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

Method create_connection

src/core/node_graph.py:626–644  ·  view source on GitHub ↗

Create a connection, optionally using command pattern for undo/redo.

(self, start_pin, end_pin, use_command=True)

Source from the content-addressed store, hash-verified

624 return True
625
626 def create_connection(self, start_pin, end_pin, use_command=True):
627 """Create a connection, optionally using command pattern for undo/redo."""
628 if not start_pin.can_connect_to(end_pin):
629 return None
630
631 if use_command:
632 # Use command pattern
633 command = CreateConnectionCommand(self, start_pin, end_pin)
634 if self.execute_command(command):
635 return command.created_connection
636 return None
637 else:
638 # Direct creation (for internal use by commands)
639 conn = Connection(start_pin, end_pin)
640 self.addItem(conn)
641 self.connections.append(conn)
642 if isinstance(end_pin.node, RerouteNode):
643 end_pin.node.update_color()
644 return conn
645
646 def remove_connection(self, connection, use_command=True):
647 """Remove a connection, optionally using command pattern for undo/redo."""

Calls 5

execute_commandMethod · 0.95
ConnectionClass · 0.85
update_colorMethod · 0.80
can_connect_toMethod · 0.45