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)
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)
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 __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()