當前位置: 首頁>>代碼示例>>Python>>正文


Python GObject.threads_init方法代碼示例

本文整理匯總了Python中gi.repository.GObject.threads_init方法的典型用法代碼示例。如果您正苦於以下問題:Python GObject.threads_init方法的具體用法?Python GObject.threads_init怎麽用?Python GObject.threads_init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gi.repository.GObject的用法示例。


在下文中一共展示了GObject.threads_init方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def main():

    global args
    args = argparser.parse_args()

    bluez = Bluez()

    adapt = bluez.getAdapter(args.adapter)

    if not adapt:
        print("Adapter " + args.adapter + " not found")
        return

    adapt.powerSet(True)
    adapt.discoverableSet(True)
    adapt.mediaEndpointRegisterSBC()
    if args.aac_enabled:
        adapt.mediaEndpointRegisterAAC()


    Gst.init(None)
    GObject.threads_init()
    mainloop = GObject.MainLoop()
    mainloop.run()
    return 
開發者ID:gmsoft-tuxicoman,項目名稱:bt-audio,代碼行數:27,代碼來源:bt-audio.py

示例2: __init__

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.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

示例3: init

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def init(lets_connect):  # type: (bool) -> EduVpnApp
    (level, secure_internet_uri, institute_access_uri, verify_key, lets_connect_arg) = parse_args()
    lets_connect = lets_connect or lets_connect_arg
    if geteuid() == 0:
        logger.error(u"Running eduVPN client as root is not supported (yet)")
        exit(1)
    GObject.threads_init()

    if have_dbus():
        import dbus.mainloop.glib
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

    # import this later so the logging is properly configured
    from eduvpn.ui import EduVpnApp

    edu_vpn_app = EduVpnApp(secure_internet_uri=secure_internet_uri,
                            institute_access_uri=institute_access_uri,
                            verify_key=verify_key, lets_connect=lets_connect)
    edu_vpn_app.run()
    return edu_vpn_app 
開發者ID:eduvpn,項目名稱:python-eduvpn-client,代碼行數:22,代碼來源:main.py

示例4: __init__

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def __init__(self):
            super().__init__()
            self._browser = None
            self._win32_handle = None
            self._initial_html = ""

            sys.excepthook = cef.ExceptHook  # To shutdown CEF processes on error.
            cef.Initialize(settings={"context_menu": {"enabled": False}})

            GObject.threads_init()
            GObject.timeout_add(10, self.on_timer)

            self.connect("configure-event", self.on_configure)
            self.connect("size-allocate", self.on_size_allocate)
            self.connect("focus-in-event", self.on_focus_in)
            self.connect("realize", self.on_realize) 
開發者ID:jendrikseipp,項目名稱:rednotebook,代碼行數:18,代碼來源:browser_cef.py

示例5: __init__

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def __init__(self):
        # logging.basicConfig(level=logging.INFO)

        # voxforge/tri2b_mmi_b0.05 model:
        decoder_conf = {
            "model": ENGLISH_MODEL_PATH + "final.mdl",
            "lda-mat": ENGLISH_MODEL_PATH + "final.mat",
            "word-syms": ENGLISH_MODEL_PATH + "words.txt",
            "fst": ENGLISH_MODEL_PATH + "HCLG.fst",
            "silence-phones": "6"
        }
        self.decoder_pipeline = DecoderPipeline({"decoder": decoder_conf})
        self.__class__.words = []
        self.__class__.finished = False

        self.decoder_pipeline.set_word_handler(self.word_getter)
        self.decoder_pipeline.set_eos_handler(self.set_finished, self.finished)

        GObject.threads_init()
        self.loop = GObject.MainLoop()
        self.gi_thread = Thread(target=self.loop.run, args=())
        self.gi_thread.start() 
開發者ID:DragonComputer,項目名稱:Dragonfire,代碼行數:24,代碼來源:kaldi.py

示例6: launch_wifi_gui

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def launch_wifi_gui(socket_id=None, no_confirm_ether=False):
    from gi.repository import GObject
    from kano_wifi_gui.wifi_window import create_wifi_gui

    GObject.threads_init()

    is_plug = socket_id is not None
    create_wifi_gui(is_plug, socket_id, no_confirm_ether)

    return 0 
開發者ID:KanoComputing,項目名稱:kano-settings,代碼行數:12,代碼來源:ctl.py

示例7: run

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def run(self):
        GObject.threads_init()
        self.file_notification.show()

        timeout_thread = threading.Thread(target=self.input_timeout, args=())
        timeout_thread.daemon = True
        timeout_thread.start()

        Gtk.main()
        return self.accepted 
開發者ID:screenfreeze,項目名稱:deskcon-desktop,代碼行數:12,代碼來源:notificationmanager.py

示例8: input_timeout

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def input_timeout(self):
        GObject.threads_init()
        timeout = FILE_TIMEOUT
        while self.waiting_for_user_input:
            time.sleep(1)
            timeout = timeout - 1
            if timeout == 0:
                self.file_notification.close()
                self.waiting_for_user_input = False
                buildNotification("File", "Filetranfser was canceled after 60 seconds")
                Gtk.main_quit()
                break 
開發者ID:screenfreeze,項目名稱:deskcon-desktop,代碼行數:14,代碼來源:notificationmanager.py

示例9: start

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def start(self):        
        self.connect("destroy", Gtk.main_quit)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.show_all()
        GObject.threads_init()
        Gtk.main()
        return self.accepted 
開發者ID:screenfreeze,項目名稱:deskcon-desktop,代碼行數:9,代碼來源:fingerprints.py

示例10: main

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def main(args):
    GObject.threads_init()
    ip = args[1]
    port = args[2]
    win = FileChooserWindow()
    win.run(ip, port) 
開發者ID:screenfreeze,項目名稱:deskcon-desktop,代碼行數:8,代碼來源:filechooser.py

示例11: main

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def main(args):
    GObject.threads_init()
    ip = args[1]
    port = args[2]
    if (len(args) == 4):       
        number = args[3]
    else:
        number = ""

    win = EntryWindow(ip, port, number)
    Gtk.main() 
開發者ID:screenfreeze,項目名稱:deskcon-desktop,代碼行數:13,代碼來源:sms.py

示例12: main

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def main(args):
    GObject.threads_init()
    win = EntryWindow()
    Gtk.main() 
開發者ID:screenfreeze,項目名稱:deskcon-desktop,代碼行數:6,代碼來源:setupdevice.py

示例13: run

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def run(self):
        DBusGMainLoop(set_as_default=True)        
        GObject.threads_init()
        dbus.mainloop.glib.threads_init()
        self.dbusservice = self.DbusService(self.connector)        
        Gtk.main() 
開發者ID:screenfreeze,項目名稱:deskcon-desktop,代碼行數:8,代碼來源:dbusservice.py

示例14: main

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def main():
    if not check_root_access():
        sys.exit("\nOnly root can run this script :(\n")

    win = AppWindow()
    win.show_all()

    Gdk.threads_enter()
    GObject.threads_init()
    Gtk.main()
    Gdk.threads_leave() 
開發者ID:Mati365,項目名稱:pyWinUSB,代碼行數:13,代碼來源:__main__.py

示例15: initialize

# 需要導入模塊: from gi.repository import GObject [as 別名]
# 或者: from gi.repository.GObject import threads_init [as 別名]
def initialize(self):
        """Initialize bluez DBus communication.  Must be called before any other
        calls are made!
        """
        # Ensure GLib's threading is initialized to support python threads, and
        # make a default mainloop that all DBus objects will inherit.  These
        # commands MUST execute before any other DBus commands!
        GObject.threads_init()
        dbus.mainloop.glib.threads_init()
        # Set the default main loop, this also MUST happen before other DBus calls.
        self._mainloop = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
        # Get the main DBus system bus and root bluez object.
        self._bus = dbus.SystemBus()
        self._bluez = dbus.Interface(self._bus.get_object('org.bluez', '/'),
                                     'org.freedesktop.DBus.ObjectManager') 
開發者ID:adafruit,項目名稱:Adafruit_Python_BluefruitLE,代碼行數:17,代碼來源:provider.py


注:本文中的gi.repository.GObject.threads_init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。