def keyReleaseEvent(self, evt: QtGui.QKeyEvent) -> None: if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_Period): self.setPreviousTool() evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_F): self.setPreviousTool() evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_S): self.setPreviousTool() evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_N): self.setPreviousTool() evt.accept() return super().keyReleaseEvent(evt)
def keyReleaseEvent(self, event: QKeyEvent): if event.isAutoRepeat(): event.ignore() return key = event.key() if key in self.keys: self.keys[key] = False
def advance(_: QObject, event: QKeyEvent) -> bool: if event.type( ) == QKeyEvent.KeyPress and not event.isAutoRepeat(): if should_quit or not slide_spec.get( 'disable-advance', False): self.advance_slide(should_quit) return True return False
def space_callback(self, _: QObject, event: QKeyEvent) -> bool: event_type = event.type() if event_type == QKeyEvent.KeyPress and not event.isAutoRepeat(): self.start_recording() return True if event_type == QKeyEvent.KeyRelease: self.stop_recording() return True return False
def __makeKeyEvent(self, measure_editor: BaseMeasureEditor, evt: QtGui.QKeyEvent) -> QtGui.QKeyEvent: measure_evt = QtGui.QKeyEvent(evt.type(), evt.key(), evt.modifiers(), evt.nativeScanCode(), evt.nativeVirtualKey(), evt.nativeModifiers(), evt.text(), evt.isAutoRepeat(), evt.count()) measure_evt.setAccepted(False) return measure_evt
def space_callback(self, _: QObject, event: QKeyEvent) -> bool: event_type = event.type() if event_type == QKeyEvent.KeyPress and not event.isAutoRepeat(): self.recording_consumer.start_recording() return True if event_type == QKeyEvent.KeyRelease: self.recording_consumer.stop_recording() self.update_signal_widgets() return True return False
def keyReleaseEvent(self, event: QtGui.QKeyEvent) -> None: if event.isAutoRepeat(): super().keyReleaseEvent(event) return try: note = self._key2note[event.nativeScanCode()] key = self._keys[note] except KeyError: super().keyReleaseEvent(event) else: key.release()
def keyPressEvent(self, event: QtGui.QKeyEvent): """Bugfix, disables SHIFT+RETURN misbehaviour.""" if (event.key() == QtCore.Qt.Key_Enter or event.key() == 16777220) and \ ((event.modifiers() & QtCore.Qt.ShiftModifier) == QtCore.Qt.ShiftModifier): # clone object but without shift # current modifiers & all possible modifiers, but SHIFT,ALT,CTRL event = QtGui.QKeyEvent( event.type(), event.key(), event.modifiers() & QtCore.Qt.MetaModifier & QtCore.Qt.KeypadModifier, event.text(), event.isAutoRepeat(), event.count()) super().keyPressEvent(event)
def keyPressEvent(self, evt: QtGui.QKeyEvent) -> None: if self.__current_tool is not None: if (not evt.isAutoRepeat() and evt.modifiers() == Qt.KeypadModifier and evt.key() == Qt.Key_Plus): group_idx = self.__groups.index(self.__current_tool.group) group_idx = (group_idx + 1) % len(self.__groups) group = self.__groups[group_idx] tool = self.__current_tool_in_group[group] self.setCurrentToolType(tool) evt.accept() return self.__current_tool.keyPressEvent(evt)
def keyPressEvent(self, event:QKeyEvent): if event.isAutoRepeat(): return key = event.key() if key == Qt.Key_G: img = ObstacleMap(self.obstacles, GRAPH_TABLE_RATIO, self.robot.radius) print("dumping") img.dump_obstacle_grid_to_file("graph.txt") elif key == Qt.Key_Ampersand: self.ivy.send_action(1) elif key == Qt.Key_Eacute: self.ivy.send_action(2) elif key == Qt.Key_QuoteDbl: self.ivy.send_action(3) elif key == Qt.Key_Apostrophe: self.ivy.send_action(4) elif key == Qt.Key_ParenLeft: self.ivy.send_action(5) elif key == Qt.Key_Minus: self.ivy.send_action(6) elif key == Qt.Key_Egrave: self.ivy.send_action(7) elif key == Qt.Key_Underscore: self.ivy.send_action(8) elif key == Qt.Key_Ccedilla: self.ivy.send_action(9) elif key == Qt.Key_Agrave: self.ivy.send_action(10) elif key == Qt.Key_ParenRight: self.ivy.send_action(11) elif key == Qt.Key_Equal: self.ivy.send_action(12) elif key == Qt.Key_Z: self.robot_speed_command[1] = -1 self.ivy.send_speed_direction(self.robot_speed_command) elif key == Qt.Key_Q: self.robot_speed_command[0] = 1 self.ivy.send_speed_direction(self.robot_speed_command) elif key == Qt.Key_S: self.robot_speed_command[1] = 1 self.ivy.send_speed_direction(self.robot_speed_command) elif key == Qt.Key_D: self.robot_speed_command[0] = -1 self.ivy.send_speed_direction(self.robot_speed_command) elif key == Qt.Key_A: self.robot_speed_command[2] = 1 self.ivy.send_speed_direction(self.robot_speed_command) elif key == Qt.Key_E: self.robot_speed_command[2] = -1 self.ivy.send_speed_direction(self.robot_speed_command)
def replay_movie(self, _, event: QEvent): key_event = QKeyEvent(event) if key_event.type( ) == QKeyEvent.KeyPress and not key_event.isAutoRepeat(): self.movie.stop() self.movie.start() effect = QGraphicsDropShadowEffect() effect.setBlurRadius(20) effect.setXOffset(0) effect.setYOffset(0) effect.setColor(Qt.red) self.gif_progress_bar.setGraphicsEffect(effect) if key_event.type() == QKeyEvent.KeyRelease: self.gif_progress_bar.setGraphicsEffect(None)
def keyReleaseEvent(self, event: QKeyEvent): if event.isAutoRepeat(): return key = event.key() if key == Qt.Key_Z: self.robot_speed_command[0] = 0 self.send_speed_direction(self.robot_speed_command) elif key == Qt.Key_S: self.robot_speed_command[0] = 0 self.send_speed_direction(self.robot_speed_command) elif key == Qt.Key_Q: self.robot_speed_command[2] = 0 self.send_speed_direction(self.robot_speed_command) elif key == Qt.Key_D: self.robot_speed_command[2] = 0 self.send_speed_direction(self.robot_speed_command) elif key == Qt.Key_Shift: self.running = False self.send_speed_direction(self.robot_speed_command)
def keyPressEvent(self, evt: QtGui.QKeyEvent) -> None: if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_Period): self.setCurrentToolType(tools.ToolType.DURATION_DOT) evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_F): self.setCurrentToolType(tools.ToolType.ACCIDENTAL_FLAT) evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_S): self.setCurrentToolType(tools.ToolType.ACCIDENTAL_SHARP) evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_N): self.setCurrentToolType(tools.ToolType.ACCIDENTAL_NATURAL) evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_R): self.setCurrentToolType({ tools.ToolType.NOTE_WHOLE: tools.ToolType.REST_WHOLE, tools.ToolType.NOTE_HALF: tools.ToolType.REST_HALF, tools.ToolType.NOTE_QUARTER: tools.ToolType.REST_QUARTER, tools.ToolType.NOTE_8TH: tools.ToolType.REST_8TH, tools.ToolType.NOTE_16TH: tools.ToolType.REST_16TH, tools.ToolType.NOTE_32TH: tools.ToolType.REST_32TH, tools.ToolType.REST_WHOLE: tools.ToolType.NOTE_WHOLE, tools.ToolType.REST_HALF: tools.ToolType.NOTE_HALF, tools.ToolType.REST_QUARTER: tools.ToolType.NOTE_QUARTER, tools.ToolType.REST_8TH: tools.ToolType.NOTE_8TH, tools.ToolType.REST_16TH: tools.ToolType.NOTE_16TH, tools.ToolType.REST_32TH: tools.ToolType.NOTE_32TH, }.get(self.currentToolType(), tools.ToolType.REST_QUARTER)) evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_1): self.setCurrentToolType( tools.ToolType.NOTE_WHOLE if not self.currentToolType().is_rest else tools.ToolType.REST_WHOLE) evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_2): self.setCurrentToolType( tools.ToolType.NOTE_HALF if not self.currentToolType().is_rest else tools.ToolType.REST_HALF) evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_3): self.setCurrentToolType( tools.ToolType.NOTE_QUARTER if not self.currentToolType( ).is_rest else tools.ToolType.REST_QUARTER) evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_4): self.setCurrentToolType( tools.ToolType.NOTE_8TH if not self.currentToolType().is_rest else tools.ToolType.REST_8TH) evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_5): self.setCurrentToolType( tools.ToolType.NOTE_16TH if not self.currentToolType().is_rest else tools.ToolType.REST_16TH) evt.accept() return if (not evt.isAutoRepeat() and evt.modifiers() == Qt.NoModifier and evt.key() == Qt.Key_6): self.setCurrentToolType( tools.ToolType.NOTE_32TH if not self.currentToolType().is_rest else tools.ToolType.REST_32TH) evt.accept() return super().keyPressEvent(evt)
def keyPressEvent(self, e: QtGui.QKeyEvent) -> None: if e.key() == Qt.Key_Space and not e.isAutoRepeat(): self.setDragMode(QGraphicsView.ScrollHandDrag)
def keyReleaseEvent(self, e: QtGui.QKeyEvent) -> None: if e.key() == Qt.Key_Space and not e.isAutoRepeat(): self.setDragMode(QGraphicsView.NoDrag)
def keyReleaseEvent(self, event: QKeyEvent): key = event.key() if key == Qt.Key_Right or key == Qt.Key_Left and not event.isAutoRepeat( ): self.halt()