Python gobject.threads_init() Examples
The following are 4
code examples of gobject.threads_init().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gobject
, or try the search function
.
Example #1
Source File: peripheral.py From python-bluezero with MIT License | 6 votes |
def __init__(self, device_id=None): """Default initialiser. 1. Initialises the program loop using ``GObject``. 2. Registers the Application on the D-Bus. 3. Initialises the list of services offered by the application. """ # Initialise the loop that the application runs in GObject.threads_init() dbus.mainloop.glib.threads_init() dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) self.mainloop = GObject.MainLoop() # Initialise the D-Bus path and register it self.bus = dbus.SystemBus() self.path = '/ukBaz/bluezero/application{}'.format(id(self)) self.bus_name = dbus.service.BusName('ukBaz.bluezero', self.bus) dbus.service.Object.__init__(self, self.bus_name, self.path) # Initialise services within the application self.services = [] self.dongle = adapter.Adapter(device_id)
Example #2
Source File: support.py From Tickeys-linux with MIT License | 5 votes |
def install_gobject_iteration(): '''Import and install gobject context iteration inside our event loop. This is used as soon as gobject is used (like gstreamer). ''' from kivy.clock import Clock try: from gi.repository import GObject as gobject except ImportError: import gobject if hasattr(gobject, '_gobject_already_installed'): # already installed, don't do it twice. return gobject._gobject_already_installed = True # get gobject mainloop / context loop = gobject.MainLoop() gobject.threads_init() context = loop.get_context() # schedule the iteration each frame def _gobject_iteration(*largs): # XXX we need to loop over context here, otherwise, we might have a lag loop = 0 while context.pending() and loop < 10: context.iteration(False) loop += 1 Clock.schedule_interval(_gobject_iteration, 0) # ----------------------------------------------------------------------------- # Android support # -----------------------------------------------------------------------------
Example #3
Source File: support.py From Tickeys-linux with MIT License | 5 votes |
def install_gobject_iteration(): '''Import and install gobject context iteration inside our event loop. This is used as soon as gobject is used (like gstreamer). ''' from kivy.clock import Clock try: from gi.repository import GObject as gobject except ImportError: import gobject if hasattr(gobject, '_gobject_already_installed'): # already installed, don't do it twice. return gobject._gobject_already_installed = True # get gobject mainloop / context loop = gobject.MainLoop() gobject.threads_init() context = loop.get_context() # schedule the iteration each frame def _gobject_iteration(*largs): # XXX we need to loop over context here, otherwise, we might have a lag loop = 0 while context.pending() and loop < 10: context.iteration(False) loop += 1 Clock.schedule_interval(_gobject_iteration, 0) # ----------------------------------------------------------------------------- # Android support # -----------------------------------------------------------------------------
Example #4
Source File: gtkbase.py From gui-o-matic with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self, config): BaseGUI.__init__(self, config) self.splash = None self.font_styles = {} self.status_display = {} self.popup = None if pynotify: pynotify.init(config.get('app_name', 'gui-o-matic')) gobject.threads_init()