MCPcopy Create free account
hub / github.com/bhowiebkr/PyFlowGraph / keyPressEvent

Method keyPressEvent

src/ui/editor/node_editor_view.py:48–62  ·  view source on GitHub ↗

Handle key press events for copy and paste.

(self, event: QKeyEvent)

Source from the content-addressed store, hash-verified

46 self._resize_handle = None
47
48 def keyPressEvent(self, event: QKeyEvent):
49 """Handle key press events for copy and paste."""
50 if event.key() == Qt.Key_C and event.modifiers() == Qt.ControlModifier:
51 # BUG FIX: The copy_selected method no longer takes the cursor position as an argument.
52 self.scene().copy_selected()
53 event.accept()
54 elif event.key() == Qt.Key_V and event.modifiers() == Qt.ControlModifier:
55 # Get current mouse cursor position in scene coordinates
56 global_mouse_pos = QCursor.pos()
57 local_mouse_pos = self.mapFromGlobal(global_mouse_pos)
58 scene_mouse_pos = self.mapToScene(local_mouse_pos)
59 self.scene().paste(scene_mouse_pos) # Pass actual mouse position
60 event.accept()
61 else:
62 super().keyPressEvent(event)
63
64 def show_context_menu(self, event: QContextMenuEvent):
65 scene_pos = self.mapToScene(event.pos())

Callers

nothing calls this directly

Calls 3

copy_selectedMethod · 0.80
pasteMethod · 0.80
acceptMethod · 0.45

Tested by

no test coverage detected