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

Method _create_content_widget

src/core/node.py:162–193  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

160 # --- GUI & Layout ---
161
162 def _create_content_widget(self):
163 # --- Definitive Fix for Initialization Order ---
164 # 1. Create all objects first.
165 self.content_container = ResizableWidgetContainer()
166 # Set background to match node body color instead of transparent
167 self.content_container.setAttribute(Qt.WA_TranslucentBackground)
168
169 main_layout = QVBoxLayout(self.content_container)
170 main_layout.setContentsMargins(5, 5, 5, 15)
171 main_layout.setSpacing(5)
172
173 self.custom_widget_host = QWidget()
174 self.custom_widget_host.setAttribute(Qt.WA_TranslucentBackground)
175 self.custom_widget_host._node = self # Add node reference for GUI callbacks
176 self.custom_widget_layout = QVBoxLayout(self.custom_widget_host)
177 self.custom_widget_layout.setContentsMargins(0, 0, 0, 0)
178 main_layout.addWidget(self.custom_widget_host)
179
180 self.proxy_widget = QGraphicsProxyWidget(self)
181
182 self.edit_button = QPushButton("</>")
183 self.edit_button.setFixedSize(30, 22)
184 self.edit_button_proxy = QGraphicsProxyWidget(self)
185
186 # 2. Now that all objects exist, set widgets and connect signals.
187 self.proxy_widget.setWidget(self.content_container)
188 self.edit_button_proxy.setWidget(self.edit_button)
189 self.edit_button.clicked.connect(self.open_unified_editor)
190 self.content_container.resized.connect(self._update_layout)
191
192 # 3. Finally, build the initial GUI, which will trigger the first layout update.
193 self.rebuild_gui()
194
195 def rebuild_gui(self):
196 for i in reversed(range(self.custom_widget_layout.count())):

Callers 1

__init__Method · 0.95

Calls 2

rebuild_guiMethod · 0.95

Tested by

no test coverage detected