當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。