skype4py.api.posix_dbus-pysrc.html

来自「基于python的skype的API的说明文档」· HTML 代码 · 共 292 行 · 第 1/5 页

HTML
292
字号
</table><h1 class="epydoc">Source Code for <a href="Skype4Py.API.posix_dbus-module.html">Module Skype4Py.API.posix_dbus</a></h1><pre class="py-src"><a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-docstring">'''</tt> </tt><a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-docstring">Low level Skype for Linux interface implemented</tt> </tt><a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-docstring">using python-dbus package.</tt> </tt><a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt><a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-docstring">This module handles the options that you can pass to L{ISkype.__init__&lt;skype.ISkype.__init__&gt;}</tt> </tt><a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-docstring">for Linux machines when the transport is set to DBus. See below.</tt> </tt><a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt><a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-docstring">@newfield option: Option, Options</tt> </tt><a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt><a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-docstring">@option: C{Bus} DBus bus object as returned by python-dbus package.</tt> </tt><a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-docstring">If not specified, private session bus is created and used. See also C{MainLoop}.</tt> </tt><a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-docstring">@option: C{MainLoop} DBus mainloop object. Use only without specifying the C{Bus}</tt> </tt><a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-docstring">(if you use C{Bus}, pass the mainloop to the bus constructor). If neither C{Bus} or</tt> </tt><a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-docstring">C{MainLoop} is specified, glib mainloop is used. In such case, the mainloop is</tt> </tt><a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-docstring">also run on a separate thread upon attaching to Skype. If you want to use glib</tt> </tt><a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-docstring">mainloop but you want to run the loop yourself (for example because your GUI toolkit</tt> </tt><a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">does it for you), pass C{dbus.mainloop.glib.DBusGMainLoop()} object as C{MainLoop}</tt> </tt><a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring">parameter.</tt> </tt><a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt><a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">@requires: Skype for Linux 2.0 (beta) or newer.</tt> </tt><a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">'''</tt> </tt><a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"> </tt><a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">threading</tt> </tt><a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">time</tt> </tt><a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">weakref</tt> </tt><a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Package Skype4Py=Skype4Py-module.html"><a title="Skype4Py" class="py-name" href="#" onclick="return doclink('link-0', 'Skype4Py', 'link-0');">Skype4Py</a></tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Package Skype4Py.API=Skype4Py.API-module.html"><a title="Skype4Py.API" class="py-name" href="#" onclick="return doclink('link-1', 'API', 'link-1');">API</a></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Class Skype4Py.API.ICommand=Skype4Py.API.ICommand-class.html"><a title="Skype4Py.API.ICommand" class="py-name" href="#" onclick="return doclink('link-2', 'ICommand', 'link-2');">ICommand</a></tt><tt class="py-op">,</tt> <tt class="py-name">_ISkypeAPIBase</tt> </tt><a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-3" class="py-name"><a title="Skype4Py" class="py-name" href="#" onclick="return doclink('link-3', 'Skype4Py', 'link-0');">Skype4Py</a></tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Module Skype4Py.enums=Skype4Py.enums-module.html"><a title="Skype4Py.enums" class="py-name" href="#" onclick="return doclink('link-4', 'enums', 'link-4');">enums</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt><a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-5" class="py-name"><a title="Skype4Py" class="py-name" href="#" onclick="return doclink('link-5', 'Skype4Py', 'link-0');">Skype4Py</a></tt><tt class="py-op">.</tt><tt id="link-6" class="py-name" targets="Module Skype4Py.errors=Skype4Py.errors-module.html"><a title="Skype4Py.errors" class="py-name" href="#" onclick="return doclink('link-6', 'errors', 'link-6');">errors</a></tt> <tt class="py-keyword">import</tt> <tt id="link-7" class="py-name" targets="Class Skype4Py.errors.ISkypeAPIError=Skype4Py.errors.ISkypeAPIError-class.html"><a title="Skype4Py.errors.ISkypeAPIError" class="py-name" href="#" onclick="return doclink('link-7', 'ISkypeAPIError', 'link-7');">ISkypeAPIError</a></tt> </tt><a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-8" class="py-name"><a title="Skype4Py" class="py-name" href="#" onclick="return doclink('link-8', 'Skype4Py', 'link-0');">Skype4Py</a></tt><tt class="py-op">.</tt><tt id="link-9" class="py-name" targets="Module Skype4Py.utils=Skype4Py.utils-module.html"><a title="Skype4Py.utils" class="py-name" href="#" onclick="return doclink('link-9', 'utils', 'link-9');">utils</a></tt> <tt class="py-keyword">import</tt> <tt id="link-10" class="py-name" targets="Function Skype4Py.utils.cndexp()=Skype4Py.utils-module.html#cndexp"><a title="Skype4Py.utils.cndexp" class="py-name" href="#" onclick="return doclink('link-10', 'cndexp', 'link-10');">cndexp</a></tt> </tt><a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"> </tt><a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"> </tt><a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt><a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">    <tt class="py-keyword">import</tt> <tt id="link-11" class="py-name" targets="Class Skype4Py.API.faked_dbus.dbus=Skype4Py.API.faked_dbus.dbus-class.html"><a title="Skype4Py.API.faked_dbus.dbus" class="py-name" href="#" onclick="return doclink('link-11', 'dbus', 'link-11');">dbus</a></tt><tt class="py-op">,</tt> <tt id="link-12" class="py-name"><a title="Skype4Py.API.faked_dbus.dbus" class="py-name" href="#" onclick="return doclink('link-12', 'dbus', 'link-11');">dbus</a></tt><tt class="py-op">.</tt><tt id="link-13" class="py-name" targets="Class Skype4Py.API.faked_dbus.dbus.service=Skype4Py.API.faked_dbus.dbus.service-class.html"><a title="Skype4Py.API.faked_dbus.dbus.service" class="py-name" href="#" onclick="return doclink('link-13', 'service', 'link-13');">service</a></tt> </tt><a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt><a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">    <tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt><a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt> <tt class="py-op">==</tt> <tt class="py-op">[</tt><tt class="py-string">'(imported)'</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt><a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-comment"># we get here if we're building docs on windows, to let the module</tt> </tt><a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">        <tt class="py-comment"># import without exceptions, we import our faked dbus module</tt> </tt><a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line">        <tt class="py-keyword">from</tt> <tt id="link-14" class="py-name" targets="Module Skype4Py.API.faked_dbus=Skype4Py.API.faked_dbus-module.html"><a title="Skype4Py.API.faked_dbus" class="py-name" href="#" onclick="return doclink('link-14', 'faked_dbus', 'link-14');">faked_dbus</a></tt> <tt class="py-keyword">import</tt> <tt id="link-15" class="py-name"><a title="Skype4Py.API.faked_dbus.dbus" class="py-name" href="#" onclick="return doclink('link-15', 'dbus', 'link-11');">dbus</a></tt> </tt><a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt><a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> </tt><a name="_SkypeNotifyCallback"></a><div id="_SkypeNotifyCallback-def"><a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"> </tt><a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"> </tt><a name="L44"></a><tt class="py-lineno"> 44</tt> <a class="py-toggle" href="#" id="_SkypeNotifyCallback-toggle" onclick="return toggle('_SkypeNotifyCallback');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="Skype4Py.API.posix_dbus._SkypeNotifyCallback-class.html">_SkypeNotifyCallback</a><tt class="py-op">(</tt><tt class="py-base-class">dbus</tt><tt class="py-op">.</tt><tt class="py-base-class">service</tt><tt class="py-op">.</tt><tt class="py-base-class">Object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt></div><div id="_SkypeNotifyCallback-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_SkypeNotifyCallback-expanded"><a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">    <tt class="py-docstring">'''DBus object which exports a Notify method. This will be called by Skype for all</tt> </tt><a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-docstring">    notifications with the notification string as a parameter. The Notify method of this</tt> </tt><a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-docstring">    class calls in turn the callable passed to the constructor.</tt> </tt><a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"><tt class="py-docstring">    '''</tt> </tt><a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"> </tt><a name="_SkypeNotifyCallback.__init__"></a><div id="_SkypeNotifyCallback.__init__-def"><a name="L50"></a><tt class="py-lineno"> 50</tt> <a class="py-toggle" href="#" id="_SkypeNotifyCallback.__init__-toggle" onclick="return toggle('_SkypeNotifyCallback.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="Skype4Py.API.posix_dbus._SkypeNotifyCallback-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">bus</tt><tt class="py-op">,</tt> <tt class="py-param">notify</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt></div><div id="_SkypeNotifyCallback.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_SkypeNotifyCallback.__init__-expanded"><a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">        <tt id="link-16" class="py-name"><a title="Skype4Py.API.faked_dbus.dbus" class="py-name" href="#" onclick="return doclink('link-16', 'dbus', 'link-11');">dbus</a></tt><tt class="py-op">.</tt><tt id="link-17" class="py-name"><a title="Skype4Py.API.faked_dbus.dbus.service" class="py-name" href="#" onclick="return doclink('link-17', 'service', 'link-13');">service</a></tt><tt class="py-op">.</tt><tt id="link-18" class="py-name" targets="Class Skype4Py.API.faked_dbus.dbus.service.Object=Skype4Py.API.faked_dbus.dbus.service.Object-class.html"><a title="Skype4Py.API.faked_dbus.dbus.service.Object" class="py-name" href="#" onclick="return doclink('link-18', 'Object', 'link-18');">Object</a></tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Method Skype4Py.API.ICommand.__init__()=Skype4Py.API.ICommand-class.html#__init__,Method Skype4Py.API.darwin.CFDictionary.__init__()=Skype4Py.API.darwin.CFDictionary-class.html#__init__,Method Skype4Py.API.darwin.CFDistributedNotificationCenter.__init__()=Skype4Py.API.darwin.CFDistributedNotificationCenter-class.html#__init__,Method Skype4Py.API.darwin.CFNumber.__init__()=Skype4Py.API.darwin.CFNumber-class.html#__init__,Method Skype4Py.API.darwin.CFString.__init__()=Skype4Py.API.darwin.CFString-class.html#__init__,Method Skype4Py.API.darwin.CFType.__init__()=Skype4Py.API.darwin.CFType-class.html#__init__,Method Skype4Py.API.darwin.Carbon.__init__()=Skype4Py.API.darwin.Carbon-class.html#__init__,Method Skype4Py.API.darwin.CoreFoundation.__init__()=Skype4Py.API.darwin.CoreFoundation-class.html#__init__,Method Skype4Py.API.darwin.EventLoop.__init__()=Skype4Py.API.darwin.EventLoop-class.html#__init__,Method Skype4Py.callchannel.ICallChannel.__init__()=Skype4Py.callchannel.ICallChannel-class.html#__init__,Method Skype4Py.callchannel.ICallChannelManager.__init__()=Skype4Py.callchannel.ICallChannelManager-class.html#__init__,Method Skype4Py.callchannel.ICallChannelMessage.__init__()=Skype4Py.callchannel.ICallChannelMessage-class.html#__init__,Method Skype4Py.client.IClient.__init__()=Skype4Py.client.IClient-class.html#__init__,Method Skype4Py.conversion.IConversion.__init__()=Skype4Py.conversion.IConversion-class.html#__init__,Method Skype4Py.errors.ISkypeAPIError.__init__()=Skype4Py.errors.ISkypeAPIError-class.html#__init__,Method Skype4Py.errors.ISkypeError.__init__()=Skype4Py.errors.ISkypeError-class.html#__init__,Method Skype4Py.profile.IProfile.__init__()=Skype4Py.profile.IProfile-class.html#__init__,Method Skype4Py.settings.ISettings.__init__()=Skype4Py.settings.ISettings-class.html#__init__,Method Skype4Py.skype.ISkype.__init__()=Skype4Py.skype.ISkype-class.html#__init__,Method Skype4Py.utils.EventHandlingBase.__init__()=Skype4Py.utils.EventHandlingBase-class.html#__init__"><a title="Skype4Py.API.ICommand.__init__Skype4Py.API.darwin.CFDictionary.__init__Skype4Py.API.darwin.CFDistributedNotificationCenter.__init__Skype4Py.API.darwin.CFNumber.__init__Skype4Py.API.darwin.CFString.__init__Skype4Py.API.darwin.CFType.__init__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?