本文整理汇总了Python中gi.repository.Atspi.event_main方法的典型用法代码示例。如果您正苦于以下问题:Python Atspi.event_main方法的具体用法?Python Atspi.event_main怎么用?Python Atspi.event_main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Atspi
的用法示例。
在下文中一共展示了Atspi.event_main方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from gi.repository import Atspi [as 别名]
# 或者: from gi.repository.Atspi import event_main [as 别名]
def start(self, asynchronous=False, gil=True, **kwargs):
"""
Enter the main loop to start receiving and dispatching events.
@@param asynchronous: Should event dispatch be asynchronous
(decoupled) from event receiving from the AT-SPI registry?
@@type asynchronous: boolean
@@param gil: Add an idle callback which releases the Python GIL for a few
milliseconds to allow other threads to run? Necessary if other threads
will be used in this process.
@@type gil: boolean
"""
if 'async' in kwargs:
# support previous API
asynchronous = kwargs['async']
if not self.has_implementations:
self._set_default_registry ()
self.started = True
if gil:
def releaseGIL():
try:
time.sleep(1e-2)
except KeyboardInterrupt as e:
# store the exception for later
releaseGIL.keyboard_exception = e
self.stop()
return True
# make room for an exception if one occurs during the
releaseGIL.keyboard_exception = None
i = GLib.idle_add(releaseGIL)
Atspi.event_main()
GLib.source_remove(i)
if releaseGIL.keyboard_exception is not None:
# raise an keyboard exception we may have gotten earlier
raise releaseGIL.keyboard_exception
else:
Atspi.event_main()
self.started = False
示例2: releaseGIL
# 需要导入模块: from gi.repository import Atspi [as 别名]
# 或者: from gi.repository.Atspi import event_main [as 别名]
self._set_default_registry ()
self.started = True
if gil:
def releaseGIL():
try:
time.sleep(1e-2)
except KeyboardInterrupt, e:
# store the exception for later
releaseGIL.keyboard_exception = e
self.stop()
return True
# make room for an exception if one occurs during the
releaseGIL.keyboard_exception = None
i = GObject.idle_add(releaseGIL)
Atspi.event_main()
GObject.source_remove(i)
if releaseGIL.keyboard_exception is not None:
# raise an keyboard exception we may have gotten earlier
raise releaseGIL.keyboard_exception
else:
Atspi.event_main()
self.started = False
def stop(self, *args):
"""
Quits the main loop.
"""
if not self.has_implementations:
self._set_default_registry ()