当前位置: 首页>>代码示例>>Python>>正文


Python gobject.threads_init方法代码示例

本文整理汇总了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) 
开发者ID:ukBaz,项目名称:python-bluezero,代码行数:26,代码来源:peripheral.py

示例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
# ----------------------------------------------------------------------------- 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:38,代码来源:support.py

示例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() 
开发者ID:mailpile,项目名称:gui-o-matic,代码行数:11,代码来源:gtkbase.py


注:本文中的gobject.threads_init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。