Represents a visual grouping of nodes that can be organized, collapsed, and persisted. Inherits from QGraphicsRectItem for visual representation in the scene.
| 17 | |
| 18 | |
| 19 | class Group(QGraphicsRectItem): |
| 20 | """ |
| 21 | Represents a visual grouping of nodes that can be organized, collapsed, and persisted. |
| 22 | Inherits from QGraphicsRectItem for visual representation in the scene. |
| 23 | """ |
| 24 | |
| 25 | def __init__(self, name: str = "Group", member_node_uuids: Optional[List[str]] = None, parent=None): |
| 26 | super().__init__(parent) |
| 27 | |
| 28 | # Unique identification |
| 29 | self.uuid = str(uuid.uuid4()) |
| 30 | |
| 31 | # Group metadata |
| 32 | self.name = name |
| 33 | self.description = "" |
| 34 | self.creation_timestamp = "" |
| 35 | |
| 36 | # Member tracking - store UUIDs instead of direct references to avoid circular dependencies |
| 37 | self.member_node_uuids = member_node_uuids or [] |
| 38 | |
| 39 | # Groups no longer have interface pins - they keep original connections |
| 40 | |
| 41 | # Visual state |
| 42 | self.is_expanded = True |
| 43 | self.is_selected = False |
| 44 | |
| 45 | # Dimensions and positioning |
| 46 | self.width = 200.0 |
| 47 | self.height = 150.0 |
| 48 | self.padding = 20.0 |
| 49 | |
| 50 | # Visual styling |
| 51 | self.color_background = QColor(45, 45, 55, 120) # Semi-transparent background |
| 52 | self.color_border = QColor(100, 150, 200, 180) # Blue border |
| 53 | self.color_title_bg = QColor(60, 60, 70, 200) # Title bar background |
| 54 | self.color_title_text = QColor(220, 220, 220) # Title text |
| 55 | self.color_selection = QColor(255, 165, 0, 100) # Orange selection highlight |
| 56 | |
| 57 | # Pens and brushes |
| 58 | self.pen_border = QPen(self.color_border, 2.0) |
| 59 | self.pen_selected = QPen(self.color_selection, 3.0) |
| 60 | self.brush_background = QBrush(self.color_background) |
| 61 | self.brush_title = QBrush(self.color_title_bg) |
| 62 | |
| 63 | # Resize handle properties |
| 64 | self.handle_size = 16.0 # Large, simple handles |
| 65 | self.is_resizing = False |
| 66 | self.resize_handle = None |
| 67 | self.resize_start_pos = QPointF() |
| 68 | self.resize_start_rect = QRectF() |
| 69 | |
| 70 | # Handle types enumeration |
| 71 | self.HANDLE_NONE = 0 |
| 72 | self.HANDLE_NW = 1 # Northwest corner |
| 73 | self.HANDLE_N = 2 # North edge |
| 74 | self.HANDLE_NE = 3 # Northeast corner |
| 75 | self.HANDLE_E = 4 # East edge |
| 76 | self.HANDLE_SE = 5 # Southeast corner |
no outgoing calls