Пример #1
0
    def __init__(self, opts):
        self.logger = logging.getLogger('Skype4Py.api.posix_dbus.SkypeAPI')
        SkypeAPIBase.__init__(self)
        self.run_main_loop = opts.pop('RunMainLoop', True)
        system_bus = opts.pop('UseSystemBus', False)
        finalize_opts(opts)
        self.skype_in = self.skype_out = self.dbus_name_owner_watch = None

        # initialize glib multithreading support
        gobject.threads_init()
        dbus.glib.threads_init()

        # dbus-python calls object.__init__() with arguments passed to SessionBus(),
        # this throws a warning on newer Python versions; here we suppress it
        warnings.simplefilter('ignore')
        try:
            if system_bus:
                bus = dbus.SystemBus
            else:
                bus = dbus.SessionBus
            self.bus = bus(mainloop=DBusGMainLoop())
        finally:
            warnings.simplefilter('default')
        
        if self.run_main_loop:
            self.mainloop = gobject.MainLoop()
Пример #2
0
 def close(self):
     if self.hwnd:
         windll.user32.PostMessageA(self.hwnd, WM_QUIT, 0, 0)
         while self.hwnd:
             time.sleep(0.01)
     self.skype = None
     SkypeAPIBase.close(self)
Пример #3
0
    def __init__(self, opts):
        self.logger = logging.getLogger('Skype4Py.api.posix_x11.SkypeAPI')
        SkypeAPIBase.__init__(self)
        finalize_opts(opts)

        # initialize threads if not done already by the user
        threads_init(gtk=False)

        # init Xlib display
        self.disp = x11.XOpenDisplay(None)
        if not self.disp:
            raise SkypeAPIError('Could not open XDisplay')
        self.win_root = x11.XDefaultRootWindow(self.disp)
        self.win_self = x11.XCreateSimpleWindow(self.disp, self.win_root, 100,
                                                100, 100, 100, 1, 0, 0)
        x11.XSelectInput(self.disp, self.win_root, PropertyChangeMask)
        self.win_skype = self.get_skype()
        ctrl = 'SKYPECONTROLAPI_MESSAGE'
        self.atom_msg = x11.XInternAtom(self.disp, ctrl, False)
        self.atom_msg_begin = x11.XInternAtom(self.disp, ctrl + '_BEGIN',
                                              False)

        self.loop_event = threading.Event()
        self.loop_timeout = 0.0001
        self.loop_break = False
Пример #4
0
 def close(self):
     if self.hwnd:
         windll.user32.PostMessageA(self.hwnd, WM_QUIT, 0, 0)
         while self.hwnd:
             time.sleep(0.01)
     self.skype = None
     SkypeAPIBase.close(self)
Пример #5
0
 def __init__(self, opts):
     self.logger = logging.getLogger('Skype4Py.api.darwin.SkypeAPI')
     SkypeAPIBase.__init__(self)
     self.run_main_loop = opts.pop('RunMainLoop', True)
     finalize_opts(opts)
     self.center = CFDistributedNotificationCenter()
     self.is_available = False
     self.client_id = -1
Пример #6
0
 def close(self):
     if self.run_main_loop:
         self.mainloop.quit()
     self.skype_in = self.skype_out = None
     if self.dbus_name_owner_watch is not None:
         self.bus.remove_signal_receiver(self.dbus_name_owner_watch)
     self.dbus_name_owner_watch = None
     SkypeAPIBase.close(self)
Пример #7
0
 def close(self):
     if self.run_main_loop:
         self.mainloop.quit()
     self.skype_in = self.skype_out = None
     if self.dbus_name_owner_watch is not None:
         self.bus.remove_signal_receiver(self.dbus_name_owner_watch)
     self.dbus_name_owner_watch = None
     SkypeAPIBase.close(self)
Пример #8
0
 def __init__(self, opts):
     self.logger = logging.getLogger('Skype4Py.api.windows.SkypeAPI')
     SkypeAPIBase.__init__(self)
     finalize_opts(opts)
     self.window_class = None
     self.hwnd = None
     self.skype = None
     self.wait = False
     self.SkypeControlAPIDiscover = windll.user32.RegisterWindowMessageA('SkypeControlAPIDiscover')
     self.SkypeControlAPIAttach = windll.user32.RegisterWindowMessageA('SkypeControlAPIAttach')
     windll.user32.GetWindowLongA.restype = c_ulong
Пример #9
0
 def __init__(self, opts):
     self.logger = logging.getLogger('Skype4Py.api.windows.SkypeAPI')
     SkypeAPIBase.__init__(self)
     finalize_opts(opts)
     self.window_class = None
     self.hwnd = None
     self.skype = None
     self.wait = False
     self.SkypeControlAPIDiscover = windll.user32.RegisterWindowMessageA('SkypeControlAPIDiscover')
     self.SkypeControlAPIAttach = windll.user32.RegisterWindowMessageA('SkypeControlAPIAttach')
     windll.user32.GetWindowLongA.restype = c_ulong
Пример #10
0
    def __init__(self, opts):
        self.logger = logging.getLogger("Skype4Py.api.posix_x11.SkypeAPI")
        SkypeAPIBase.__init__(self)
        finalize_opts(opts)

        # initialize threads if not done already by the user
        threads_init(gtk=False)

        # init Xlib display
        self.disp = x11.XOpenDisplay(None)
        if not self.disp:
            raise SkypeAPIError("Could not open XDisplay")
        self.win_root = x11.XDefaultRootWindow(self.disp)
        self.win_self = x11.XCreateSimpleWindow(self.disp, self.win_root, 100, 100, 100, 100, 1, 0, 0)
        x11.XSelectInput(self.disp, self.win_root, PropertyChangeMask)
        self.win_skype = self.get_skype()
        ctrl = "SKYPECONTROLAPI_MESSAGE"
        self.atom_msg = x11.XInternAtom(self.disp, ctrl, False)
        self.atom_msg_begin = x11.XInternAtom(self.disp, ctrl + "_BEGIN", False)

        self.loop_event = threading.Event()
        self.loop_timeout = 0.0001
        self.loop_break = False
Пример #11
0
 def close(self):
     self.loop_break = True
     self.loop_event.set()
     while self.isAlive():
         time.sleep(0.01)
     SkypeAPIBase.close(self)
Пример #12
0
 def set_friendly_name(self, friendly_name):
     SkypeAPIBase.set_friendly_name(self, friendly_name)
     if self.attachment_status == apiAttachSuccess:
         # reattach with the new name
         self.set_attachment_status(apiAttachUnknown)
         self.attach()
Пример #13
0
 def __init__(self):
     SkypeAPIBase.__init__(self)
     self.queue = []
Пример #14
0
 def close(self):
     if hasattr(self, 'loop'):
         self.loop.stop()
         self.client_id = -1
     SkypeAPIBase.close(self)
Пример #15
0
 def set_friendly_name(self, friendly_name):
     SkypeAPIBase.set_friendly_name(self, friendly_name)
     if self.skype_out:
         self.send_command(Command('NAME %s' % friendly_name))
Пример #16
0
 def close(self):
     self.loop_break = True
     self.loop_event.set()
     while self.isAlive():
         time.sleep(0.01)
     SkypeAPIBase.close(self)
Пример #17
0
 def set_friendly_name(self, friendly_name):
     SkypeAPIBase.set_friendly_name(self, friendly_name)
     if self.skype_out:
         self.send_command(Command('NAME %s' % friendly_name))
Пример #18
0
 def set_friendly_name(self, friendly_name):
     SkypeAPIBase.set_friendly_name(self, friendly_name)
     if self.skype:
         self.send_command(Command("NAME %s" % friendly_name))
Пример #19
0
 def close(self):
     if hasattr(self, 'loop'):
         self.loop.stop()
         self.client_id = -1
     SkypeAPIBase.close(self)
Пример #20
0
 def set_friendly_name(self, friendly_name):
     SkypeAPIBase.set_friendly_name(self, friendly_name)
     if self.attachment_status == apiAttachSuccess:
         # reattach with the new name
         self.set_attachment_status(apiAttachUnknown)
         self.attach()
Пример #21
0
 def __init__(self):
     SkypeAPIBase.__init__(self)
     self.queue = []