Skip to content

Commit

Permalink
removed redef?
Browse files Browse the repository at this point in the history
  • Loading branch information
JTvD committed Jan 17, 2025
1 parent 0a7aaef commit 81e3d2f
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions ibridgesgui/gui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,36 +59,6 @@ def load_ui(ui_file, base_instance=None):
return widget


class UiLoader(PySide6.QtUiTools.QUiLoader):
"""UILoader to allow custom widgets."""

def __init__(self, base_instance):
"""Initialise the UiLoader."""
PySide6.QtUiTools.QUiLoader.__init__(self, base_instance)
self.base_instance = base_instance

def createWidget(self, class_name, parent=None, name=''):
"""Create a widget for the UI loader."""
if parent is None and self.base_instance:
return self.base_instance
else:
# create a new widget for child widgets
widget = PySide6.QtUiTools.QUiLoader.createWidget(self, class_name, parent, name)
if self.base_instance:
setattr(self.base_instance, name, widget)
return widget


def load_ui(ui_file, base_instance=None):
"""Load ui, as available in pyqt."""
ui_dir = os.path.dirname(ui_file)
os.chdir(ui_dir)
loader = UiLoader(base_instance)
widget = loader.load(ui_file)
PySide6.QtCore.QMetaObject.connectSlotsByName(widget)
return widget


# Widget utils
def populate_table(table_widget, rows: int, data_by_row: list):
"""Populate a table-like pyqt widget with data."""
Expand Down

0 comments on commit 81e3d2f

Please sign in to comment.