本文整理汇总了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
示例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)
示例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
示例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)
示例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()
示例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
示例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
示例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
示例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
示例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)
示例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()
示例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()
示例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()
示例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()
示例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')