def __init__(self, parent: QtGui.QWidget, uiPyModule, className: str = "Ui_Widget"): """ 'parent' - common widget for all device types, 'uiPyModule' - generated from Widget.ui py-module. """ QtGui.QFrame.__init__(self) self.ui = uiPyModule.__dict__[className]() self.ui.setupUi(self) self.setParent(parent) if parent: parent.setMinimumHeight(parent.minimumHeight() + self.minimumHeight()) parent.resize(parent.width(), parent.minimumHeight())
def Adjust(widget: QtGui.QWidget) -> int: h = widget.minimumHeight() + addHeight assert h > 0 widget.setMinimumHeight(h) widget.setMaximumHeight(h) widget.resize(widget.width(), h)