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

Method on_add_node

src/ui/editor/node_editor_window.py:299–308  ·  view source on GitHub ↗

Add a new node to the graph.

(self, scene_pos=None)

Source from the content-addressed store, hash-verified

297 self.output_log.append("Environment requirements updated.")
298
299 def on_add_node(self, scene_pos=None):
300 """Add a new node to the graph."""
301 title, ok = QInputDialog.getText(self, "Add Node", "Enter Node Title:")
302 if ok and title:
303 if not isinstance(scene_pos, QPointF):
304 scene_pos = self.view.mapToScene(self.view.viewport().rect().center())
305 node = self.graph.create_node(title, pos=(scene_pos.x(), scene_pos.y()))
306 node.set_code("from typing import Tuple\n\n" "@node_entry\n"
307 "def node_function(input_1: str) -> Tuple[str, int]:\n"
308 " return 'hello', len(input_1)")
309
310
311 def _setup_command_system(self):

Callers 1

show_context_menuMethod · 0.80

Calls 2

create_nodeMethod · 0.80
set_codeMethod · 0.80

Tested by

no test coverage detected