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

Method rebuild_gui

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

Source from the content-addressed store, hash-verified

193 self.rebuild_gui()
194
195 def rebuild_gui(self):
196 for i in reversed(range(self.custom_widget_layout.count())):
197 widget = self.custom_widget_layout.itemAt(i).widget()
198 if widget:
199 widget.setParent(None)
200 self.gui_widgets.clear()
201 if self.gui_code:
202 try:
203 from PySide6 import QtWidgets
204
205 scope = {"parent": self.custom_widget_host, "layout": self.custom_widget_layout, "widgets": self.gui_widgets, "node": self, "QtWidgets": QtWidgets}
206 exec(self.gui_code, scope)
207 except Exception as e:
208 from PySide6.QtWidgets import QLabel
209
210 error_label = QLabel(f"GUI Error:\n{e}")
211 error_label.setStyleSheet("color: red;")
212 self.custom_widget_layout.addWidget(error_label)
213 self.fit_size_to_content()
214
215 def _calculate_minimum_height(self):
216 title_height, pin_spacing, pin_margin_top = 32, 25, 15

Callers 2

set_gui_codeMethod · 0.95

Calls 2

fit_size_to_contentMethod · 0.95
clearMethod · 0.80

Tested by

no test coverage detected