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

Class GroupConnectionRouter

src/core/group_connection_router.py:16–588  ·  view source on GitHub ↗

Manages connection routing between group interface pins and internal node pins. Handles data flow preservation and connection updates during group operations.

Source from the content-addressed store, hash-verified

14
15
16class GroupConnectionRouter(QObject):
17 """
18 Manages connection routing between group interface pins and internal node pins.
19 Handles data flow preservation and connection updates during group operations.
20 """
21
22 # Signals for data flow events
23 dataFlowUpdated = Signal(str) # Emitted when data flow is updated
24 routingError = Signal(str, str) # Emitted when routing error occurs (pin_id, error_msg)
25
26 def __init__(self, node_graph, parent=None):
27 """
28 Initialize the connection router.
29
30 Args:
31 node_graph: The NodeGraph instance
32 parent: Qt parent object
33 """
34 super().__init__(parent)
35 self.node_graph = node_graph
36 self.routing_tables = {} # Maps group UUIDs to routing information
37 self.active_data_flows = {} # Tracks active data flows through groups
38
39 def create_routing_for_group(self, group, interface_pins: Dict[str, List]) -> Dict[str, Any]:
40 """
41 Create routing table for a group's interface pins.
42
43 Args:
44 group: The Group instance
45 interface_pins: Dict with 'input_pins' and 'output_pins' lists
46
47 Returns:
48 Dict containing routing information
49 """
50 group_uuid = group.uuid
51 routing_table = {
52 'group_uuid': group_uuid,
53 'input_routes': {},
54 'output_routes': {},
55 'internal_connections': {},
56 'data_flow_map': {}
57 }
58
59 # Create routing for input interface pins
60 for input_pin in interface_pins.get('input_pins', []):
61 route_info = self._create_input_route(input_pin)
62 routing_table['input_routes'][input_pin.uuid] = route_info
63
64 # Create routing for output interface pins
65 for output_pin in interface_pins.get('output_pins', []):
66 route_info = self._create_output_route(output_pin)
67 routing_table['output_routes'][output_pin.uuid] = route_info
68
69 # Map internal connections for data flow tracking
70 routing_table['internal_connections'] = self._map_internal_connections(group)
71
72 # Store routing table
73 self.routing_tables[group_uuid] = routing_table

Callers 3

setUpMethod · 0.90
setUpMethod · 0.90
setUpMethod · 0.90

Calls

no outgoing calls

Tested by 3

setUpMethod · 0.72
setUpMethod · 0.72
setUpMethod · 0.72