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


Python Atspi.deregister_keystroke_listener方法代码示例

本文整理汇总了Python中gi.repository.Atspi.deregister_keystroke_listener方法的典型用法代码示例。如果您正苦于以下问题:Python Atspi.deregister_keystroke_listener方法的具体用法?Python Atspi.deregister_keystroke_listener怎么用?Python Atspi.deregister_keystroke_listener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Atspi的用法示例。


在下文中一共展示了Atspi.deregister_keystroke_listener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: deregisterKeystrokeListener

# 需要导入模块: from gi.repository import Atspi [as 别名]
# 或者: from gi.repository.Atspi import deregister_keystroke_listener [as 别名]
        def deregisterKeystrokeListener(self,
                                        client,
                                        key_set=[],
                                        mask=0,
                                        kind=(_KEY_PRESSED_EVENT, _KEY_RELEASED_EVENT)):
                """
                Deregisters a listener for key stroke events.

                @@param client: Callable to be invoked when the event occurs
                @@type client: callable
                @@param key_set: Set of hardware key codes to stop monitoring. Leave empty
                        to indicate all keys.
                @@type key_set: list of integer
                @@param mask: When the mask is None, the codes in the key_set will be 
                        monitored only when no modifier is held. When the mask is an 
                        integer, keys in the key_set will be monitored only when the modifiers in
                        the mask are held. When the mask is an iterable over more than one 
                        integer, keys in the key_set will be monitored when any of the modifier
                        combinations in the set are held.
                @@type mask: integer, iterable, None
                @@param kind: Kind of events to stop watching, KEY_PRESSED_EVENT or 
                        KEY_RELEASED_EVENT.
                @@type kind: list
                @@raise KeyError: When the client isn't already registered for events
                """
                if not self.has_implementations:
                        self._set_default_registry ()
                try:
                        listener = self.event_listeners[client]
                except:
                        return
                Atspi.deregister_keystroke_listener (listener, key_set, mask, kind)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:34,代码来源:registry.py

示例2: _register_atspi_keystroke_listeners

# 需要导入模块: from gi.repository import Atspi [as 别名]
# 或者: from gi.repository.Atspi import deregister_keystroke_listener [as 别名]
    def _register_atspi_keystroke_listeners(self, register):
        if self._keystroke_listeners_registered != register:
            modifier_masks = range(16)

            if register:
                if not self._keystroke_listener:
                    self._keystroke_listener = \
                       Atspi.DeviceListener.new(self._on_atspi_keystroke, None)

                for modifier_mask in modifier_masks:
                    Atspi.register_keystroke_listener( \
                                        self._keystroke_listener,
                                        None,        # key set, None=all
                                        modifier_mask,
                                        Atspi.KeyEventType.PRESSED,
                                        Atspi.KeyListenerSyncType.SYNCHRONOUS)
            else:
                # Apparently any single deregister call will turn off
                # all the other registered modifier_masks too. Since
                # deregistering takes extremely long (~2.5s for 16 calls)
                # seize the opportunity and just pick a single arbitrary
                # mask (Quantal).
                modifier_masks = [2]

                for modifier_mask in modifier_masks:
                    Atspi.deregister_keystroke_listener(
                                        self._keystroke_listener,
                                        None, # key set, None=all
                                        modifier_mask,
                                        Atspi.KeyEventType.PRESSED)

        self._keystroke_listeners_registered = register
开发者ID:Dhiru,项目名称:Inputability-1,代码行数:34,代码来源:AtspiStateTracker.py


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