Exemplo n.º 1
0
    def __init__(self):
        self._log = _logger(self.__class__)
        self._modifiers_lock = threading.RLock()
        self._modifiers = set()
        self._caps_lock = False
        self._dead_key = None

        kc = self._Key

        # pylint: disable=C0103; this is treated as a class scope constant, but
        # we cannot set it in the class scope, as _Key is overridden by
        # platform implementations
        # pylint: disable=C0326; it is easier to read column aligned keys
        #: The keys used as modifiers; the first value in each tuple is the
        #: base modifier to use for subsequent modifiers.
        self._MODIFIER_KEYS = (
            (kc.alt_gr, (kc.alt_gr.value, )),
            (kc.alt, (kc.alt.value, kc.alt_l.value, kc.alt_r.value)),
            (kc.cmd, (kc.cmd.value, kc.cmd_l.value, kc.cmd_r.value)),
            (kc.ctrl, (kc.ctrl.value, kc.ctrl_l.value, kc.ctrl_r.value)),
            (kc.shift, (kc.shift.value, kc.shift_l.value, kc.shift_r.value)),
        )

        #: Control codes to transform into key codes when typing
        self._CONTROL_CODES = {"\n": kc.enter, "\r": kc.enter, "\t": kc.tab}
Exemplo n.º 2
0
 def __init__(self, on_press=None, on_release=None, suppress=False,
              **kwargs):
     self._log = _logger(self.__class__)
     prefix = self.__class__.__module__.rsplit('.', 1)[-1][1:] + '_'
     self._options = {
         key[len(prefix):]: value
         for key, value in kwargs.items()
         if key.startswith(prefix)}
     super(Listener, self).__init__(
         on_press=on_press, on_release=on_release, suppress=suppress)
Exemplo n.º 3
0
 def __init__(
     self, on_move=None, on_click=None, on_scroll=None, suppress=False, **kwargs
 ):
     self._log = _logger(self.__class__)
     prefix = self.__class__.__module__.rsplit(".", 1)[-1][1:] + "_"
     self._options = {
         key[len(prefix) :]: value
         for key, value in kwargs.items()
         if key.startswith(prefix)
     }
     super(Listener, self).__init__(
         on_move=on_move, on_click=on_click, on_scroll=on_scroll, suppress=suppress
     )
Exemplo n.º 4
0
 def __init__(self,
              on_press=None,
              on_release=None,
              suppress=False,
              **kwargs):
     self._log = _logger(self.__class__)
     option_prefix = prefix(Listener, self.__class__)
     self._options = {
         key[len(option_prefix):]: value
         for key, value in kwargs.items() if key.startswith(option_prefix)
     }
     super(Listener, self).__init__(on_press=on_press,
                                    on_release=on_release,
                                    suppress=suppress)
Exemplo n.º 5
0
 def __init__(self):
     self._log = _logger(self.__class__)
Exemplo n.º 6
0
 def __init__(self):
     self._log = _logger(self.__class__)
     self._modifiers_lock = threading.RLock()
     self._modifiers = set()
     self._caps_lock = False
     self._dead_key = None