Add a new node to the graph.
(self, scene_pos=None)
| 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): |
no test coverage detected