MCPcopy Index your code
hub / github.com/bhowiebkr/PyFlowGraph / _paste_with_command

Method _paste_with_command

src/core/node_graph.py:301–323  ·  view source on GitHub ↗

Helper method to paste using PasteNodesCommand.

(self, data, paste_pos)

Source from the content-addressed store, hash-verified

299 print("Clipboard does not contain valid graph data.")
300
301 def _paste_with_command(self, data, paste_pos):
302 """Helper method to paste using PasteNodesCommand."""
303 if not data or not data.get('nodes'):
304 print("No nodes to paste.")
305 return
306
307 # Convert data format to match PasteNodesCommand expectations
308 clipboard_data = self._convert_data_format(data)
309
310 # Set paste operation flag to prevent Group.itemChange from moving nodes automatically
311 self._is_pasting = True
312
313 try:
314 # Create and execute paste command
315 from commands.node_commands import PasteNodesCommand
316 paste_cmd = PasteNodesCommand(self, clipboard_data, paste_pos)
317 result = self.execute_command(paste_cmd)
318
319 if not result:
320 print("Failed to paste nodes.")
321 finally:
322 # Always clear the paste flag
323 self._is_pasting = False
324
325 def _convert_data_format(self, data):
326 """Convert deserialize format to PasteNodesCommand format."""

Callers 1

pasteMethod · 0.95

Calls 3

_convert_data_formatMethod · 0.95
execute_commandMethod · 0.95
PasteNodesCommandClass · 0.85

Tested by

no test coverage detected