def initAppletDrawerUi(self): # Load the ui file (find it in our own directory) localDir = os.path.split(__file__)[0] self._drawer = uic.loadUi(localDir+"/drawer.ui") layout = QVBoxLayout() layout.setSpacing(0) self._drawer.setLayout( layout ) thresholdWidget = ThresholdingWidget(self) thresholdWidget.valueChanged.connect( self.handleThresholdGuiValuesChanged ) self._drawer.layout().addWidget( thresholdWidget ) self._drawer.layout().addSpacerItem( QSpacerItem(0,0,vPolicy=QSizePolicy.Expanding) ) def updateDrawerFromOperator(): minValue, maxValue = (0,255) if self.topLevelOperatorView.MinValue.ready(): minValue = self.topLevelOperatorView.MinValue.value if self.topLevelOperatorView.MaxValue.ready(): maxValue = self.topLevelOperatorView.MaxValue.value thresholdWidget.setValue(minValue, maxValue) self.topLevelOperatorView.MinValue.notifyDirty( bind(updateDrawerFromOperator) ) self.topLevelOperatorView.MaxValue.notifyDirty( bind(updateDrawerFromOperator) ) updateDrawerFromOperator()
def initAppletDrawerUi(self): with Tracer(traceLogger): # Load the ui file (find it in our own directory) localDir = os.path.split(__file__)[0] self._drawer = uic.loadUi(localDir+"/drawer.ui") layout = QVBoxLayout( self ) layout.setSpacing(0) self._drawer.setLayout( layout ) thresholdWidget = ThresholdingWidget(self) thresholdWidget.valueChanged.connect( self.handleThresholdGuiValuesChanged ) layout.addWidget( thresholdWidget ) def updateDrawerFromOperator(): minValue, maxValue = (0,255) if self.mainOperator.MinValue.ready(): minValue = self.mainOperator.MinValue.value if self.mainOperator.MaxValue.ready(): maxValue = self.mainOperator.MaxValue.value thresholdWidget.setValue(minValue, maxValue) self.mainOperator.MinValue.notifyDirty( bind(updateDrawerFromOperator) ) self.mainOperator.MaxValue.notifyDirty( bind(updateDrawerFromOperator) )
def initAppletDrawerUi(self): # Load the ui file (find it in our own directory) localDir = os.path.split(__file__)[0] self._drawer = uic.loadUi(localDir + "/drawer.ui") # Init threshold widget self.thresholdWidget = ThresholdingWidget(self) self.thresholdWidget.valueChanged.connect(self.apply_gui_settings_to_operator) # Add widget to a layout layout = QVBoxLayout() layout.setSpacing(0) layout.addWidget(self.thresholdWidget) layout.addSpacerItem(QSpacerItem(0, 0, vPolicy=QSizePolicy.Expanding)) # Apply layout to the drawer self._drawer.setLayout(layout) # Initialize the gui with the operator's current values self.apply_operator_settings_to_gui()
def createWidget(self, parent): return ThresholdingWidget(parent)