当前位置: 首页>>代码示例>>Python>>正文


Python Atspi.event_main方法代码示例

本文整理汇总了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
开发者ID:GNOME,项目名称:pyatspi2,代码行数:42,代码来源:registry.py

示例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 ()
开发者ID:thnguyn2,项目名称:ECE_527_MP,代码行数:33,代码来源:registry.py


注:本文中的gi.repository.Atspi.event_main方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。