本文整理汇总了Python中subscription_manager.ga.GObject.idle_add方法的典型用法代码示例。如果您正苦于以下问题:Python GObject.idle_add方法的具体用法?Python GObject.idle_add怎么用?Python GObject.idle_add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subscription_manager.ga.GObject
的用法示例。
在下文中一共展示了GObject.idle_add方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: refresh
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import idle_add [as 别名]
def refresh(self, active_on, callback, data=None):
"""
Run pool stash refresh asynchronously.
"""
ga_GObject.idle_add(self._watch_thread)
threading.Thread(target=self._run_refresh,
args=(active_on, callback, data)).start()
示例2: worker
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import idle_add [as 别名]
def worker(self, widget_update, backend_method, args=None, kwargs=None, exception_msg=None, callback=None):
args = args or []
kwargs = kwargs or {}
try:
result = backend_method(*args, **kwargs)
if callback:
ga_GObject.idle_add(callback, result)
except Exception, e:
message = exception_msg or str(e)
ga_GObject.idle_add(handle_gui_exception, e, message, self.parent_window)
示例3: _run_unbind
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import idle_add [as 别名]
def _run_unbind(self, serial, selection, callback, except_callback):
"""
Selection is only passed to maintain the gui error message. This
can be removed, because it doesn't really give us any more information
"""
try:
self.cp_provider.get_consumer_auth_cp().unbindBySerial(self.identity.uuid, serial)
try:
self.certlib.update()
except Disconnected, e:
pass
if callback:
ga_GObject.idle_add(callback)
示例4: test_registration_error_returns_to_page
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import idle_add [as 别名]
def test_registration_error_returns_to_page(self):
self.rs.initialize()
self.correct_page = None
self.rs.register_notebook.connect('notify::page', self.page_notify_handler)
self.rs.connect('register-error', self.error_handler)
ga_GObject.timeout_add(3000, self.gtk_quit_on_fail)
ga_GObject.idle_add(self.emit_proceed)
ga_GObject.idle_add(self.emit_error)
# run till quit or timeout
# if we get to the state we want we can call quit
ga_Gtk.main()
# If we saw any exceptions, raise them now so we fail nosetests
for exc_info in self.exc_infos:
six.reraise(*exc_info)
self.assertTrue(self.correct_page)
示例5: _create_async_pool
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import idle_add [as 别名]
def _create_async_pool(self):
provide(inj.CP_PROVIDER, stubs.StubCPProvider())
inj.provide(inj.PROD_DIR, stubs.StubProductDirectory())
inj.provide(inj.ENT_DIR, stubs.StubEntitlementDirectory())
inj.provide(inj.CERT_SORTER, stubs.StubCertSorter())
self.pool_stash = \
managerlib.PoolStash(facts=self.stub_facts)
self.ap = async.AsyncPool(self.pool_stash)
# add a timeout and a idle handler
self.idle = ga_GObject.idle_add(self.ap.refresh, datetime.date.today(), self.idle_callback)
self.timer = ga_GObject.timeout_add(50, self.idle_callback)
self.mainloop = ga_GObject.MainLoop()
示例6: _run_bind
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import idle_add [as 别名]
def _run_bind(self, pool, quantity, bind_callback, cert_callback, except_callback):
try:
self.plugin_manager.run("pre_subscribe", consumer_uuid=self.identity.uuid,
pool_id=pool['id'], quantity=quantity)
ents = self.cp_provider.get_consumer_auth_cp().bindByEntitlementPool(self.identity.uuid, pool['id'], quantity)
self.plugin_manager.run("post_subscribe", consumer_uuid=self.identity.uuid, entitlement_data=ents)
if bind_callback:
ga_GObject.idle_add(bind_callback)
fetch_certificates(self.certlib)
if cert_callback:
ga_GObject.idle_add(cert_callback)
except Exception, e:
ga_GObject.idle_add(except_callback, e)
示例7: watchdog
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import idle_add [as 别名]
def watchdog(self):
if not self.keep_alive:
ga_GObject.idle_add(check_if_ran_once, self, self.loop)
示例8: test_connection_wrapper
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import idle_add [as 别名]
def test_connection_wrapper(self, proxy_host, proxy_port, proxy_user, proxy_password):
connection_status = self.test_connection(proxy_host, proxy_port, proxy_user, proxy_password)
ga_GObject.idle_add(self.on_test_connection_finish, connection_status)
示例9: set_sensitive
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import idle_add [as 别名]
def set_sensitive(self, is_sensitive):
for widget in self.widgets_to_disable:
widget.set_sensitive(is_sensitive)
def finished(self):
self.set_sensitive(True)
class AsyncWidgetUpdater(object):
def __init__(self, parent):
self.parent_window = parent
def worker(self, widget_update, backend_method, args=None, kwargs=None, exception_msg=None, callback=None):
args = args or []
kwargs = kwargs or {}
try:
result = backend_method(*args, **kwargs)
if callback:
ga_GObject.idle_add(callback, result)
except Exception, e:
message = exception_msg or str(e)
ga_GObject.idle_add(handle_gui_exception, e, message, self.parent_window)
finally:
ga_GObject.idle_add(widget_update.finished)
def update(self, widget_update, backend_method, args=None, kwargs=None, exception_msg=None, callback=None):
threading.Thread(target=self.worker, name="AsyncWidgetUpdaterThread",
args=(widget_update, backend_method, args,
kwargs, exception_msg, callback)).start()
示例10: _process_callback
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import idle_add [as 别名]
def _process_callback(self, callback, *args):
ga_GObject.idle_add(callback, *args)