コード例 #1
0
ファイル: keypress_actions.py プロジェクト: 2nty7vn/pyatom
class KeyComboAction:
    """Used for sending keyboard events to the system."""

    def __init__(self, data):
        """
        @param data: data to type
        @type data: string
        """
        self._data=data
        # Create dummy window, it has code for creating and queuing events.
        # We will send events 'globally' to the system so dummy window will
        # not receive the event.
        self._dummy_window=NativeUIElement()
        _keyOp=KeyboardOp()
        self._keyvalId=_keyOp.get_keyval_id(data)
        if not self._keyvalId:
          raise LdtpServerException("Unsupported keys passed")
        self._doCombo()

    def _doCombo(self):
        for key_val in self._keyvalId:
            if key_val.modifiers:
              self._dummy_window.sendGlobalKeyWithModifiers(key_val.value,
                                                            key_val.modVal)
            else:
              self._dummy_window.sendGlobalKey(key_val.value)
            time.sleep(0.01)
コード例 #2
0
class KeyComboAction:
    """Used for sending keyboard events to the system."""
    def __init__(self, data):
        """
        @param data: data to type
        @type data: string
        """
        self._data = data
        # Create dummy window, it has code for creating and queuing events.
        # We will send events 'globally' to the system so dummy window will
        # not receive the event.
        self._dummy_window = NativeUIElement()
        _keyOp = KeyboardOp()
        self._keyvalId = _keyOp.get_keyval_id(data)
        if not self._keyvalId:
            raise LdtpServerException("Unsupported keys passed")
        self._doCombo()

    def _doCombo(self):
        for key_val in self._keyvalId:
            if key_val.modifiers:
                self._dummy_window.sendGlobalKeyWithModifiers(
                    key_val.value, key_val.modVal)
            else:
                self._dummy_window.sendGlobalKey(key_val.value)
            time.sleep(0.01)
コード例 #3
0
 def __init__(self, data):
     """
     @param data: data to type
     @type data: string
     """
     self._data = data
     # Create dummy window, it has code for creating and queuing events.
     # We will send events 'globally' to the system so dummy window will
     # not receive the event.
     self._dummy_window = NativeUIElement()
     _keyOp = KeyboardOp()
     self._keyvalId = _keyOp.get_keyval_id(data)
     if not self._keyvalId:
         raise LdtpServerException("Unsupported keys passed")
     self._doCombo()
コード例 #4
0
ファイル: keypress_actions.py プロジェクト: 2nty7vn/pyatom
 def __init__(self, data):
     """
     @param data: data to type
     @type data: string
     """
     self._data=data
     # Create dummy window, it has code for creating and queuing events.
     # We will send events 'globally' to the system so dummy window will
     # not receive the event.
     self._dummy_window=NativeUIElement()
     _keyOp=KeyboardOp()
     self._keyvalId=_keyOp.get_keyval_id(data)
     if not self._keyvalId:
       raise LdtpServerException("Unsupported keys passed")
     self._doCombo()