signature
stringlengths
8
3.44k
body
stringlengths
0
1.41M
docstring
stringlengths
1
122k
id
stringlengths
5
17
@property<EOL><INDENT>def i2c_slave_response(self):<DEDENT>
return self._i2c_slave_response<EOL>
Response to next read command. An array of bytes that will be transmitted to the I2C master with the next read operation. Warning: Due to the fact that the Aardvark API does not provide a means to read out this value, it is buffered when setting the property. Reading the property therefore might not return what is actually stored in the device.
f12759:c0:m26
@property<EOL><INDENT>def i2c_slave_last_transmit_size(self):<DEDENT>
ret = api.py_aa_i2c_slave_write_stats(self.handle)<EOL>_raise_error_if_negative(ret)<EOL>return ret<EOL>
Returns the number of bytes transmitted by the slave.
f12759:c0:m28
def enable_i2c_monitor(self):
ret = api.py_aa_i2c_monitor_enable(self.handle)<EOL>_raise_error_if_negative(ret)<EOL>
Activate the I2C monitor. Enabling the monitor will disable all other functions of the adapter. Raises an :exc:`IOError` if the hardware adapter does not support monitor mode.
f12759:c0:m29
def disable_i2c_monitor(self):
ret = api.py_aa_i2c_monitor_disable(self.handle)<EOL>_raise_error_if_negative(ret)<EOL>
Disable the I2C monitor. Raises an :exc:`IOError` if the hardware adapter does not support monitor mode.
f12759:c0:m30
def i2c_monitor_read(self):
data = array.array('<STR_LIT:H>', (<NUM_LIT:0>,) * self.BUFFER_SIZE)<EOL>ret = api.py_aa_i2c_monitor_read(self.handle, self.BUFFER_SIZE,<EOL>data)<EOL>_raise_error_if_negative(ret)<EOL>del data[ret:]<EOL>return data.tolist()<EOL>
Retrieved any data fetched by the monitor. This function has an integrated timeout mechanism. You should use :func:`poll` to determine if there is any data available. Returns a list of data bytes and special symbols. There are three special symbols: `I2C_MONITOR_NACK`, I2C_MONITOR_START and I2C_MONITOR_STOP.
f12759:c0:m31
@property<EOL><INDENT>def spi_bitrate(self):<DEDENT>
ret = api.py_aa_spi_bitrate(self.handle, <NUM_LIT:0>)<EOL>_raise_error_if_negative(ret)<EOL>return ret<EOL>
SPI bitrate in kHz. Not every bitrate is supported by the host adapter. Therefore, the actual bitrate may be less than the value which is set. The slowest bitrate supported is 125kHz. Any smaller value will be rounded up to 125kHz. The power-on default value is 1000 kHz.
f12759:c0:m32
def spi_configure(self, polarity, phase, bitorder):
ret = api.py_aa_spi_configure(self.handle, polarity, phase, bitorder)<EOL>_raise_error_if_negative(ret)<EOL>
Configure the SPI interface.
f12759:c0:m34
def spi_configure_mode(self, spi_mode):
if spi_mode == SPI_MODE_0:<EOL><INDENT>self.spi_configure(SPI_POL_RISING_FALLING,<EOL>SPI_PHASE_SAMPLE_SETUP, SPI_BITORDER_MSB)<EOL><DEDENT>elif spi_mode == SPI_MODE_3:<EOL><INDENT>self.spi_configure(SPI_POL_FALLING_RISING,<EOL>SPI_PHASE_SETUP_SAMPLE, SPI_BITORDER_MSB)<EOL><DEDENT>else:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>
Configure the SPI interface by the well known SPI modes.
f12759:c0:m35
def spi_write(self, data):
data_out = array.array('<STR_LIT:B>', data)<EOL>data_in = array.array('<STR_LIT:B>', (<NUM_LIT:0>,) * len(data_out))<EOL>ret = api.py_aa_spi_write(self.handle, len(data_out), data_out,<EOL>len(data_in), data_in)<EOL>_raise_error_if_negative(ret)<EOL>return bytes(data_in)<EOL>
Write a stream of bytes to a SPI device.
f12759:c0:m36
def spi_ss_polarity(self, polarity):
ret = api.py_aa_spi_master_ss_polarity(self.handle, polarity)<EOL>_raise_error_if_negative(ret)<EOL>
Change the ouput polarity on the SS line. Please note, that this only affects the master functions.
f12759:c0:m37
def StreamRead(stream):
try:<EOL><INDENT>return pickle.loads(base64.decodestring(stream.Read()))<EOL><DEDENT>except EOFError:<EOL><INDENT>return None<EOL><DEDENT>
Reads Python object from Skype application stream.
f12769:m0
def StreamWrite(stream, *obj):
stream.Write(base64.encodestring(pickle.dumps(obj)))<EOL>
Writes Python object to Skype application stream.
f12769:m1
def __init__(self, sock, stream, n=None):
threading.Thread.__init__(self)<EOL>self.setDaemon(True)<EOL>self.sock = sock<EOL>self.stream = stream<EOL>self.master = (n==None)<EOL>if self.master:<EOL><INDENT>n = <NUM_LIT:0><EOL>while n in TCPTunnel.threads:<EOL><INDENT>n += <NUM_LIT:1><EOL><DEDENT><DEDENT>self.n = n<EOL>assert n not in TCPTunnel.threads<EOL>TCPTunnel.threads[n] = self<EOL>
Initializes the tunelling thread. sock - socket bound to this tunnel (either from incoming or outgoing connection) stream - stream object connected to the appropriate user n - stream ID, if None a new ID is created which is then sent to the other end of the tunnel
f12769:c0:m0
def send(self, data):
try:<EOL><INDENT>self.sock.send(data)<EOL><DEDENT>except socket.error:<EOL><INDENT>pass<EOL><DEDENT>
Sends data to the socket bound to the tunnel.
f12769:c0:m2
def close(self):
try:<EOL><INDENT>self.sock.shutdown(socket.SHUT_RDWR)<EOL>self.sock.close()<EOL><DEDENT>except socket.error:<EOL><INDENT>pass<EOL><DEDENT>
Closes the tunnel.
f12769:c0:m3
def ApplicationReceiving(self, app, streams):
<EOL>if stype != socket.SOCK_STREAM:<EOL><INDENT>return<EOL><DEDENT>for stream in streams:<EOL><INDENT>obj = StreamRead(stream)<EOL>if obj:<EOL><INDENT>if obj[<NUM_LIT:0>] == cmdData:<EOL><INDENT>try:<EOL><INDENT>TCPTunnel.threads[obj[<NUM_LIT:1>]].send(obj[<NUM_LIT:2>])<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>elif obj[<NUM_LIT:0>] == cmdConnect:<EOL><INDENT>n = obj[<NUM_LIT:1>]<EOL>sock = socket.socket(type=stype)<EOL>try:<EOL><INDENT>sock.connect(addr)<EOL>TCPTunnel(sock, stream, n).start()<EOL><DEDENT>except socket.error as e:<EOL><INDENT>print('<STR_LIT>' % (n, e))<EOL>StreamWrite(stream, cmdError, n, tuple(e))<EOL>StreamWrite(stream, cmdDisconnect, n)<EOL><DEDENT><DEDENT>elif obj[<NUM_LIT:0>] == cmdDisconnect:<EOL><INDENT>try:<EOL><INDENT>TCPTunnel.threads[obj[<NUM_LIT:1>]].close()<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>elif obj[<NUM_LIT:0>] == cmdError:<EOL><INDENT>print('<STR_LIT>' % obj[<NUM_LIT:1>:<NUM_LIT:2>])<EOL><DEDENT><DEDENT><DEDENT>
Called when the list of streams with data ready to be read changes.
f12769:c1:m0
def ApplicationDatagram(self, app, stream, text):
<EOL>if stype != socket.SOCK_DGRAM:<EOL><INDENT>return<EOL><DEDENT>data = base64.decodestring(text)<EOL>sock = socket.socket(type=stype)<EOL>try:<EOL><INDENT>sock.sendto(data, addr)<EOL><DEDENT>except socket.error as e:<EOL><INDENT>print('<STR_LIT>' % e)<EOL><DEDENT>
Called when a datagram is received over a stream.
f12769:c1:m1
def __init__(self, errstr):
Exception.__init__(self, str(errstr))<EOL>
__init__. :Parameters: errstr : unicode Error description.
f12775:c0:m0
def __init__(self, errno, errstr):
Exception.__init__(self, int(errno), str(errstr))<EOL>
__init__. :Parameters: errno : int Error code. errstr : unicode Error description.
f12775:c1:m0
def __init__(self, Events=None, Skype=None):
EventHandlingBase.__init__(self)<EOL>if Events:<EOL><INDENT>self._SetEventHandlerObj(Events)<EOL><DEDENT>self._App = None<EOL>self._Name = u'<STR_LIT>'<EOL>self._ChannelType = cctReliable<EOL>self._Channels = []<EOL>self.Connect(Skype)<EOL>
Initializes the object. :Parameters: Events An optional object with event handlers. See `EventHandlingBase` for more information on events.
f12776:c0:m1
def Connect(self, Skype):
self._Skype = Skype<EOL>self._Skype.RegisterEventHandler('<STR_LIT>', self._CallStatus)<EOL>del self._Channels[:]<EOL>
Connects this call channel manager instance to Skype. This is the first thing you should do after creating this object. :Parameters: Skype : `Skype` The Skype object. :see: `Disconnect`
f12776:c0:m6
def CreateApplication(self, ApplicationName=None):
if ApplicationName is not None:<EOL><INDENT>self.Name = tounicode(ApplicationName)<EOL><DEDENT>self._App = self._Skype.Application(self.Name)<EOL>self._Skype.RegisterEventHandler('<STR_LIT>', self._ApplicationStreams)<EOL>self._Skype.RegisterEventHandler('<STR_LIT>', self._ApplicationReceiving)<EOL>self._Skype.RegisterEventHandler('<STR_LIT>', self._ApplicationDatagram)<EOL>self._App.Create()<EOL>self._CallEventHandler('<STR_LIT>', self)<EOL>
Creates an APP2APP application context. The application is automatically created using `application.Application.Create` method. :Parameters: ApplicationName : unicode Application name. Initial name, when the manager is created, is ``u'CallChannelManager'``.
f12776:c0:m7
def Disconnect(self):
self._Skype.UnregisterEventHandler('<STR_LIT>', self._CallStatus)<EOL>self._Skype = None<EOL>
Disconnects from the Skype instance. :see: `Connect`
f12776:c0:m8
def Channels(self, Manager, Channels):
This event is triggered when list of call channels changes. :Parameters: Manager : `CallChannelManager` The call channel manager object. Channels : tuple of `CallChannel` Updated list of call channels.
f12776:c1:m0
def Created(self, Manager):
This event is triggered when the application context has successfully been created. :Parameters: Manager : `CallChannelManager` The call channel manager object.
f12776:c1:m1
def Message(self, Manager, Channel, Message):
This event is triggered when a call channel message has been received. :Parameters: Manager : `CallChannelManager` The call channel manager object. Channel : `CallChannel` The call channel object receiving the message. Message : `CallChannelMessage` The received message.
f12776:c1:m2
def SendTextMessage(self, Text):
if self.Type == cctReliable:<EOL><INDENT>self.Stream.Write(Text)<EOL><DEDENT>elif self.Type == cctDatagram:<EOL><INDENT>self.Stream.SendDatagram(Text)<EOL><DEDENT>else:<EOL><INDENT>raise SkypeError(<NUM_LIT:0>, '<STR_LIT>' & repr(self.Type))<EOL><DEDENT>
Sends a text message over channel. :Parameters: Text : unicode Text to send.
f12776:c2:m1
def __init__(self, Text):
self._Text = tounicode(Text)<EOL>
Initializes the object. :Parameters: Text : unicode The message text.
f12776:c3:m0
def __init__(self, Skype):
self._SkypeRef = weakref.ref(Skype)<EOL>
__init__. :Parameters: Skype : `Skype` Skype
f12805:c0:m0
def ButtonPressed(self, Key):
self._Skype._DoCommand('<STR_LIT>' % Key)<EOL>
This command sends a button pressed notification event. :Parameters: Key : str Button key [0-9, A-Z, #, \*, UP, DOWN, YES, NO, SKYPE, PAGEUP, PAGEDOWN].
f12805:c0:m1
def ButtonReleased(self, Key):
self._Skype._DoCommand('<STR_LIT>' % Key)<EOL>
This command sends a button released notification event. :Parameters: Key : str Button key [0-9, A-Z, #, \*, UP, DOWN, YES, NO, SKYPE, PAGEUP, PAGEDOWN].
f12805:c0:m2
def CreateEvent(self, EventId, Caption, Hint):
self._Skype._DoCommand('<STR_LIT>' % (tounicode(EventId),<EOL>quote(tounicode(Caption)), quote(tounicode(Hint))))<EOL>return PluginEvent(self._Skype, EventId)<EOL>
Creates a custom event displayed in Skype client's events pane. :Parameters: EventId : unicode Unique identifier for the event. Caption : unicode Caption text. Hint : unicode Hint text. Shown when mouse hoovers over the event. :return: Event object. :rtype: `PluginEvent`
f12805:c0:m3
def CreateMenuItem(self, MenuItemId, PluginContext, CaptionText, HintText=u'<STR_LIT>', IconPath='<STR_LIT>', Enabled=True,<EOL>ContactType=pluginContactTypeAll, MultipleContacts=False):
cmd = '<STR_LIT>' % (tounicode(MenuItemId), PluginContext,<EOL>quote(tounicode(CaptionText)), cndexp(Enabled, '<STR_LIT:true>', '<STR_LIT:false>'))<EOL>if HintText:<EOL><INDENT>cmd += '<STR_LIT>' % quote(tounicode(HintText))<EOL><DEDENT>if IconPath:<EOL><INDENT>cmd += '<STR_LIT>' % quote(path2unicode(IconPath))<EOL><DEDENT>if MultipleContacts:<EOL><INDENT>cmd += '<STR_LIT>'<EOL><DEDENT>if PluginContext == pluginContextContact:<EOL><INDENT>cmd += '<STR_LIT>' % ContactType<EOL><DEDENT>self._Skype._DoCommand(cmd)<EOL>return PluginMenuItem(self._Skype, MenuItemId, CaptionText, HintText, Enabled)<EOL>
Creates custom menu item in Skype client's "Do More" menus. :Parameters: MenuItemId : unicode Unique identifier for the menu item. PluginContext : `enums`.pluginContext* Menu item context. Allows to choose in which client windows will the menu item appear. CaptionText : unicode Caption text. HintText : unicode Hint text (optional). Shown when mouse hoovers over the menu item. IconPath : unicode Path to the icon (optional). Enabled : bool Initial state of the menu item. True by default. ContactType : `enums`.pluginContactType* In case of `enums.pluginContextContact` tells which contacts the menu item should appear for. Defaults to `enums.pluginContactTypeAll`. MultipleContacts : bool Set to True if multiple contacts should be allowed (defaults to False). :return: Menu item object. :rtype: `PluginMenuItem`
f12805:c0:m4
def Focus(self):
self._Skype._Api.allow_focus(self._Skype.Timeout)<EOL>self._Skype._DoCommand('<STR_LIT>')<EOL>
Brings the client window into focus.
f12805:c0:m5
def Minimize(self):
self._Skype._DoCommand('<STR_LIT>')<EOL>
Hides Skype application window.
f12805:c0:m6
def OpenAddContactDialog(self, Username='<STR_LIT>'):
self.OpenDialog('<STR_LIT>', Username)<EOL>
Opens "Add a Contact" dialog. :Parameters: Username : str Optional Skypename of the contact.
f12805:c0:m7
def OpenAuthorizationDialog(self, Username):
self.OpenDialog('<STR_LIT>', Username)<EOL>
Opens authorization dialog. :Parameters: Username : str Skypename of the user to authenticate.
f12805:c0:m8
def OpenBlockedUsersDialog(self):
self.OpenDialog('<STR_LIT>')<EOL>
Opens blocked users dialog.
f12805:c0:m9
def OpenCallHistoryTab(self):
self.OpenDialog('<STR_LIT>')<EOL>
Opens call history tab.
f12805:c0:m10
def OpenConferenceDialog(self):
self.OpenDialog('<STR_LIT>')<EOL>
Opens create conference dialog.
f12805:c0:m11
def OpenContactsTab(self):
self.OpenDialog('<STR_LIT>')<EOL>
Opens contacts tab.
f12805:c0:m12
def OpenDialog(self, Name, *Params):
self._Skype._Api.allow_focus(self._Skype.Timeout)<EOL>params = filter(None, (str(Name),) + Params)<EOL>self._Skype._DoCommand('<STR_LIT>' % tounicode('<STR_LIT:U+0020>'.join(params)))<EOL>
Open dialog. Use this method to open dialogs added in newer Skype versions if there is no dedicated method in Skype4Py. :Parameters: Name : str Dialog name. Params : unicode One or more optional parameters.
f12805:c0:m13
def OpenDialpadTab(self):
self.OpenDialog('<STR_LIT>')<EOL>
Opens dial pad tab.
f12805:c0:m14
def OpenFileTransferDialog(self, Username, Folder):
self.OpenDialog('<STR_LIT>', Username, '<STR_LIT>', path2unicode(Folder))<EOL>
Opens file transfer dialog. :Parameters: Username : str Skypename of the user. Folder : str Path to initial directory.
f12805:c0:m15
def OpenGettingStartedWizard(self):
self.OpenDialog('<STR_LIT>')<EOL>
Opens getting started wizard.
f12805:c0:m16
def OpenImportContactsWizard(self):
self.OpenDialog('<STR_LIT>')<EOL>
Opens import contacts wizard.
f12805:c0:m17
def OpenLiveTab(self):
self.OpenDialog('<STR_LIT>')<EOL>
OpenLiveTab.
f12805:c0:m18
def OpenMessageDialog(self, Username, Text=u'<STR_LIT>'):
self.OpenDialog('<STR_LIT>', Username, tounicode(Text))<EOL>
Opens "Send an IM Message" dialog. :Parameters: Username : str Message target. Text : unicode Message text.
f12805:c0:m19
def OpenOptionsDialog(self, Page='<STR_LIT>'):
self.OpenDialog('<STR_LIT>', Page)<EOL>
Opens options dialog. :Parameters: Page : str Page name to open. :see: See https://developer.skype.com/Docs/ApiDoc/OPEN_OPTIONS for known Page values.
f12805:c0:m20
def OpenProfileDialog(self):
self.OpenDialog('<STR_LIT>')<EOL>
Opens current user profile dialog.
f12805:c0:m21
def OpenSearchDialog(self):
self.OpenDialog('<STR_LIT>')<EOL>
Opens search dialog.
f12805:c0:m22
def OpenSendContactsDialog(self, Username='<STR_LIT>'):
self.OpenDialog('<STR_LIT>', Username)<EOL>
Opens send contacts dialog. :Parameters: Username : str Optional Skypename of the user.
f12805:c0:m23
def OpenSmsDialog(self, SmsId):
self.OpenDialog('<STR_LIT>', str(SmsId))<EOL>
Opens SMS window :Parameters: SmsId : int SMS message Id.
f12805:c0:m24
def OpenUserInfoDialog(self, Username):
self.OpenDialog('<STR_LIT>', Username)<EOL>
Opens user information dialog. :Parameters: Username : str Skypename of the user.
f12805:c0:m25
def OpenVideoTestDialog(self):
self.OpenDialog('<STR_LIT>')<EOL>
Opens video test dialog.
f12805:c0:m26
def Shutdown(self):
self._Skype._Api.shutdown()<EOL>
Closes Skype application.
f12805:c0:m27
def Start(self, Minimized=False, Nosplash=False):
self._Skype._Api.startup(Minimized, Nosplash)<EOL>
Starts Skype application. :Parameters: Minimized : bool If True, Skype is started minimized in system tray. Nosplash : bool If True, no splash screen is displayed upon startup.
f12805:c0:m28
def Delete(self):
self._Skype._DoCommand('<STR_LIT>' % self.Id)<EOL>
Deletes the event from the events pane in the Skype client.
f12805:c1:m2
def Delete(self):
self._Skype._DoCommand('<STR_LIT>' % self.Id)<EOL>
Removes the menu item from the "Do More" menus.
f12805:c2:m3
def Delete(self):
self._Alter('<STR_LIT>')<EOL>
Deletes this voicemail.
f12806:c0:m3
def Download(self):
self._Alter('<STR_LIT>')<EOL>
Downloads this voicemail object from the voicemail server to a local computer.
f12806:c0:m4
def Open(self):
self._Owner._DoCommand('<STR_LIT>' % self.Id)<EOL>
Opens and plays this voicemail.
f12806:c0:m5
def SetUnplayed(self):
<EOL>self._Owner._DoCommand('<STR_LIT>' % self.Id,<EOL>'<STR_LIT>' % self.Id)<EOL>
Changes the status of a voicemail from played to unplayed.
f12806:c0:m6
def StartPlayback(self):
self._Alter('<STR_LIT>')<EOL>
Starts playing downloaded voicemail.
f12806:c0:m7
def StartPlaybackInCall(self):
self._Alter('<STR_LIT>')<EOL>
Starts playing downloaded voicemail during a call.
f12806:c0:m8
def StartRecording(self):
self._Alter('<STR_LIT>')<EOL>
Stops playing a voicemail greeting and starts recording a voicemail message.
f12806:c0:m9
def StopPlayback(self):
self._Alter('<STR_LIT>')<EOL>
Stops playing downloaded voicemail.
f12806:c0:m10
def StopRecording(self):
self._Alter('<STR_LIT>')<EOL>
Ends the recording of a voicemail message.
f12806:c0:m11
def Upload(self):
self._Alter('<STR_LIT>')<EOL>
Uploads recorded voicemail from a local computer to the voicemail server.
f12806:c0:m12
def Connect(self, Username, WaitConnected=False):
if WaitConnected:<EOL><INDENT>self._Connect_Event = threading.Event()<EOL>self._Connect_Stream = [None]<EOL>self._Connect_Username = Username<EOL>self._Connect_ApplicationStreams(self, self.Streams)<EOL>self._Owner.RegisterEventHandler('<STR_LIT>', self._Connect_ApplicationStreams)<EOL>self._Alter('<STR_LIT>', Username)<EOL>self._Connect_Event.wait()<EOL>self._Owner.UnregisterEventHandler('<STR_LIT>', self._Connect_ApplicationStreams)<EOL>try:<EOL><INDENT>return self._Connect_Stream[<NUM_LIT:0>]<EOL><DEDENT>finally:<EOL><INDENT>del self._Connect_Stream, self._Connect_Event, self._Connect_Username<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self._Alter('<STR_LIT>', Username)<EOL><DEDENT>
Connects application to user. :Parameters: Username : str Name of the user to connect to. WaitConnected : bool If True, causes the method to wait until the connection is established. :return: If ``WaitConnected`` is True, returns the stream which can be used to send the data. Otherwise returns None. :rtype: `ApplicationStream` or None
f12807:c0:m5
def Create(self):
self._Owner._DoCommand('<STR_LIT>' % self.Name)<EOL>
Creates the APP2APP application in Skype client.
f12807:c0:m6
def Delete(self):
self._Owner._DoCommand('<STR_LIT>' % self.Name)<EOL>
Deletes the APP2APP application in Skype client.
f12807:c0:m7
def SendDatagram(self, Text, Streams=None):
if Streams is None:<EOL><INDENT>Streams = self.Streams<EOL><DEDENT>for s in Streams:<EOL><INDENT>s.SendDatagram(Text)<EOL><DEDENT>
Sends datagram to application streams. :Parameters: Text : unicode Text to send. Streams : sequence of `ApplicationStream` Streams to send the datagram to or None if all currently connected streams should be used.
f12807:c0:m8
def Disconnect(self):
self.Application._Alter('<STR_LIT>', self.Handle)<EOL>
Disconnects the stream.
f12807:c1:m2
def Read(self):
return self.Application._Alter('<STR_LIT>', self.Handle)<EOL>
Reads data from stream. :return: Read data or an empty string if none were available. :rtype: unicode
f12807:c1:m3
def SendDatagram(self, Text):
self.Application._Alter('<STR_LIT>', '<STR_LIT>' % (self.Handle, tounicode(Text)))<EOL>
Sends datagram to stream. :Parameters: Text : unicode Datagram to send.
f12807:c1:m4
def Write(self, Text):
self.Application._Alter('<STR_LIT>', '<STR_LIT>' % (self.Handle, tounicode(Text)))<EOL>
Writes data to stream. :Parameters: Text : unicode Data to send.
f12807:c1:m5
def __init__(self, Skype):
self._SkypeRef = weakref.ref(Skype)<EOL>
__init__. :Parameters: Skype : `Skype` Skype object.
f12808:c0:m0
def threads_init(gtk=True):
<EOL>x11.XInitThreads()<EOL>if gtk:<EOL><INDENT>from gtk.gdk import threads_init<EOL>threads_init()<EOL><DEDENT>
Enables multithreading support in Xlib and PyGTK. See the module docstring for more info. :Parameters: gtk : bool May be set to False to skip the PyGTK module.
f12811:m0
def get_skype(self):
skype_inst = x11.XInternAtom(self.disp, '<STR_LIT>', True)<EOL>if not skype_inst:<EOL><INDENT>return<EOL><DEDENT>type_ret = Atom()<EOL>format_ret = c_int()<EOL>nitems_ret = c_ulong()<EOL>bytes_after_ret = c_ulong()<EOL>winp = pointer(Window())<EOL>fail = x11.XGetWindowProperty(self.disp, self.win_root, skype_inst,<EOL><NUM_LIT:0>, <NUM_LIT:1>, False, <NUM_LIT>, byref(type_ret), byref(format_ret),<EOL>byref(nitems_ret), byref(bytes_after_ret), byref(winp))<EOL>if not fail and format_ret.value == <NUM_LIT:32> and nitems_ret.value == <NUM_LIT:1>:<EOL><INDENT>return winp.contents.value<EOL><DEDENT>
Returns Skype window ID or None if Skype not running.
f12811:c4:m3
def start(self):
if not self.thread_started:<EOL><INDENT>super(SkypeAPI, self).start()<EOL>self.thread_started = True<EOL><DEDENT>
Start the thread associated with this API object. Ensure that the call is made no more than once, to avoid raising a RuntimeError.
f12812:c6:m1
def timeout2float(timeout):
if isinstance(timeout, float):<EOL><INDENT>return timeout<EOL><DEDENT>return timeout / <NUM_LIT><EOL>
Converts a timeout expressed in milliseconds or seconds into a timeout expressed in seconds using a floating point number. :Parameters: timeout : int, long or float The input timeout. Assumed to be expressed in number of milliseconds if the type is int or long. For float, assumed to be a number of seconds (or fractions thereof). :return: The timeout expressed in number of seconds (or fractions thereof). :rtype: float
f12814:m0
def finalize_opts(opts):
if opts:<EOL><INDENT>raise TypeError('<STR_LIT>' % '<STR_LIT:U+002CU+0020>'.join(opts.keys()))<EOL><DEDENT>
Convinient function called after popping all options from a dictionary. If there are any items left, a TypeError exception is raised listing all unexpected keys in the error message.
f12814:m1
def __init__(self, Command, Expected=u'<STR_LIT>', Blocking=False, Timeout=DEFAULT_TIMEOUT, Id=-<NUM_LIT:1>):
self.Blocking = Blocking<EOL>"""<STR_LIT>"""<EOL>self.Command = tounicode(Command)<EOL>"""<STR_LIT>"""<EOL>self.Expected = tounicode(Expected)<EOL>"""<STR_LIT>"""<EOL>self.Id = Id<EOL>"""<STR_LIT>"""<EOL>self.Reply = u'<STR_LIT>'<EOL>"""<STR_LIT>"""<EOL>self.Timeout = Timeout<EOL>"""<STR_LIT>"""<EOL>
Use `Skype.Command` to instantiate the object instead of doing it directly.
f12814:c0:m0
def timeout2float(self):
return timeout2float(self.Timeout)<EOL>
A wrapper for `api.timeout2float` function. Returns the converted `Timeout` property.
f12814:c0:m2
def __init__(self, Events=None, **Options):
self._Logger = logging.getLogger('<STR_LIT>')<EOL>self._Logger.info('<STR_LIT>')<EOL>EventHandlingBase.__init__(self)<EOL>if Events:<EOL><INDENT>self._SetEventHandlerObject(Events)<EOL><DEDENT>try:<EOL><INDENT>self._Api = Options.pop('<STR_LIT>')<EOL>if Options:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>self._Api = SkypeAPI(Options)<EOL><DEDENT>self._Api.set_notifier(APINotifier(self))<EOL>Cached._CreateOwner(self)<EOL>self._Cache = True<EOL>self.ResetCache()<EOL>from api import DEFAULT_TIMEOUT<EOL>self._Timeout = DEFAULT_TIMEOUT<EOL>self._Convert = Conversion(self)<EOL>self._Client = Client(self)<EOL>self._Settings = Settings(self)<EOL>self._Profile = Profile(self)<EOL>
Initializes the object. :Parameters: Events An optional object with event handlers. See `Skype4Py.utils.EventHandlingBase` for more information on events. Options Additional options for low-level API handler. See the `Skype4Py.api` subpackage for supported options. Available options may depend on the current platform. Note that the current platform can be queried using `Skype4Py.platform` variable.
f12817:c1:m0
def __del__(self):
if hasattr(self, '<STR_LIT>'):<EOL><INDENT>self._Api.close()<EOL><DEDENT>self._Logger.info('<STR_LIT>')<EOL>
Frees all resources.
f12817:c1:m1
def ApiSecurityContextEnabled(self, Context):
self._Api.security_context_enabled(Context)<EOL>
Queries if an API security context for Internet Explorer is enabled. :Parameters: Context : unicode API security context to check. :return: True if the API security for the given context is enabled, False otherwise. :rtype: bool :warning: This functionality isn't supported by Skype4Py.
f12817:c1:m6
def Application(self, Name):
return Application(self, Name)<EOL>
Queries an application object. :Parameters: Name : unicode Application name. :return: The application object. :rtype: `application.Application`
f12817:c1:m7
def AsyncSearchUsers(self, Target):
if not hasattr(self, '<STR_LIT>'):<EOL><INDENT>self._AsyncSearchUsersCommands = []<EOL>self.RegisterEventHandler('<STR_LIT>', self._AsyncSearchUsersReplyHandler)<EOL><DEDENT>command = Command('<STR_LIT>' % tounicode(Target), '<STR_LIT>', False, self.Timeout)<EOL>self._AsyncSearchUsersCommands.append(command)<EOL>self.SendCommand(command)<EOL>return command.Id<EOL>
Asynchronously searches for Skype users. :Parameters: Target : unicode Search target (name or email address). :return: A search identifier. It will be passed along with the results to the `SkypeEvents.AsyncSearchUsersFinished` event after the search is completed. :rtype: int
f12817:c1:m9
def Attach(self, Protocol=<NUM_LIT:5>, Wait=True):
try:<EOL><INDENT>self._Api.protocol = Protocol<EOL>self._Api.attach(self.Timeout, Wait)<EOL><DEDENT>except SkypeAPIError:<EOL><INDENT>self.ResetCache()<EOL>raise<EOL><DEDENT>
Establishes a connection to Skype. :Parameters: Protocol : int Minimal Skype protocol version. Wait : bool If set to False, blocks forever until the connection is established. Otherwise, timeouts after the `Timeout`.
f12817:c1:m10
def Call(self, Id=<NUM_LIT:0>):
o = Call(self, Id)<EOL>o.Status <EOL>return o<EOL>
Queries a call object. :Parameters: Id : int Call identifier. :return: Call object. :rtype: `call.Call`
f12817:c1:m11
def Calls(self, Target='<STR_LIT>'):
return CallCollection(self, self._Search('<STR_LIT>', Target))<EOL>
Queries calls in call history. :Parameters: Target : str Call target. :return: Call objects. :rtype: `CallCollection`
f12817:c1:m12
def ChangeUserStatus(self, Status):
if self.CurrentUserStatus.upper() == Status.upper():<EOL><INDENT>return<EOL><DEDENT>self._ChangeUserStatus_Event = threading.Event()<EOL>self._ChangeUserStatus_Status = Status.upper()<EOL>self.RegisterEventHandler('<STR_LIT>', self._ChangeUserStatus_UserStatus)<EOL>self.CurrentUserStatus = Status<EOL>self._ChangeUserStatus_Event.wait()<EOL>self.UnregisterEventHandler('<STR_LIT>', self._ChangeUserStatus_UserStatus)<EOL>del self._ChangeUserStatus_Event, self._ChangeUserStatus_Status<EOL>
Changes the online status for the current user. :Parameters: Status : `enums`.cus* New online status for the user. :note: This function waits until the online status changes. Alternatively, use the `CurrentUserStatus` property to perform an immediate change of status.
f12817:c1:m14
def Chat(self, Name='<STR_LIT>'):
o = Chat(self, Name)<EOL>o.Status <EOL>return o<EOL>
Queries a chat object. :Parameters: Name : str Chat name. :return: A chat object. :rtype: `chat.Chat`
f12817:c1:m15
def ClearCallHistory(self, Username='<STR_LIT>', Type=chsAllCalls):
cmd = '<STR_LIT>' % (str(Type), Username)<EOL>self._DoCommand(cmd, cmd)<EOL>
Clears the call history. :Parameters: Username : str Skypename of the user. A special value of 'ALL' means that entries of all users should be removed. Type : `enums`.clt* Call type.
f12817:c1:m16
def ClearChatHistory(self):
cmd = '<STR_LIT>'<EOL>self._DoCommand(cmd, cmd)<EOL>
Clears the chat history.
f12817:c1:m17
def ClearVoicemailHistory(self):
self._DoCommand('<STR_LIT>')<EOL>
Clears the voicemail history.
f12817:c1:m18
def Command(self, Command, Reply=u'<STR_LIT>', Block=False, Timeout=<NUM_LIT>, Id=-<NUM_LIT:1>):
from api import Command as CommandClass<EOL>return CommandClass(Command, Reply, Block, Timeout, Id)<EOL>
Creates an API command object. :Parameters: Command : unicode Command string. Reply : unicode Expected reply. By default any reply is accepted (except errors which raise an `SkypeError` exception). Block : bool If set to True, `SendCommand` method waits for a response from Skype API before returning. Timeout : float, int or long Timeout. Used if Block == True. Timeout may be expressed in milliseconds if the type is int or long or in seconds (or fractions thereof) if the type is float. Id : int Command Id. The default (-1) means it will be assigned automatically as soon as the command is sent. :return: A command object. :rtype: `Command` :see: `SendCommand`
f12817:c1:m19
def Conference(self, Id=<NUM_LIT:0>):
o = Conference(self, Id)<EOL>if Id <= <NUM_LIT:0> or not o.Calls:<EOL><INDENT>raise SkypeError(<NUM_LIT:0>, '<STR_LIT>')<EOL><DEDENT>return o<EOL>
Queries a call conference object. :Parameters: Id : int Conference Id. :return: A conference object. :rtype: `Conference`
f12817:c1:m20