def _create_key_event(self, vtk_event, event_type): focus_owner = self.focus_owner if focus_owner is None: focus_owner = self.component if focus_owner is None: return self._pass_event_to_vtk(vtk_obj, eventname) if event_type == 'character': key = unicode(self.control.key_sym) else: key = KEY_MAP.get(self.control.key_sym, None) if key is None: key = unicode(self.control.key_sym) if not key: return x, y = self.control.event_position return KeyEvent(event_type = event_type, character=key, x=x, y=y, alt_down=bool(self.control.alt_key), shift_down=bool(self.control.shift_key), control_down=bool(self.control.control_key), event=eventname, window=self.control)
def _create_key_event(self, event_type, event): focus_owner = self.focus_owner if focus_owner is None: focus_owner = self.component if focus_owner is None: event.ignore() return None if event_type == 'character': key = unicode(event.text()) else: # Convert the keypress to a standard enable key if possible, otherwise # to text. key_code = event.key() key = KEY_MAP.get(key_code) if key is None: key = unichr(key_code).lower() if not key: return None # Use the last-seen mouse position as the coordinates of this event. x, y = self.control.handler.last_mouse_pos modifiers = event.modifiers() return KeyEvent(event_type=event_type, character=key, x=x, y=self._flip_y(y), alt_down=bool(modifiers & QtCore.Qt.AltModifier), shift_down=bool(modifiers & QtCore.Qt.ShiftModifier), control_down=bool(modifiers & QtCore.Qt.ControlModifier), event=event, window=self)
def _create_key_event(self, event_type, event): if self.enable_window.focus_owner is None: focus_owner = self.enable_window.component else: focus_owner = self.enable_window.focus_owner if focus_owner is None: return if event_type == 'character': key = event if not key: return None else: key_code = event[0] if key_code in KEY_MAP: key = KEY_MAP.get(key_code) else: key = key_code return KeyEvent( event_type = event_type, character = key, alt_down = keys[key.LALT] | keys[key.RALT], control_down = keys[key.LCTRL] | keys[key.RCTRL], shift_down = keys[key.LSHIFT] | keys[key.RSHIFT], x = self._mouse_x, y = self._mouse_y, window = self.enable_window)