當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。