本文整理汇总了Python中gobject.threads_init方法的典型用法代码示例。如果您正苦于以下问题:Python gobject.threads_init方法的具体用法?Python gobject.threads_init怎么用?Python gobject.threads_init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gobject
的用法示例。
在下文中一共展示了gobject.threads_init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import threads_init [as 别名]
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)
示例2: install_gobject_iteration
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import threads_init [as 别名]
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
# -----------------------------------------------------------------------------
示例3: __init__
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import threads_init [as 别名]
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()