I am creating an extension for segment editor using the scriptedsegmenteditoreffect, and I would like to add another button to the widget.
I saw how the on_apply button is added in setupOptionFrame and tried to add another button in a similar fashion
def setupOptionsFrame(self):
# Object scale slider
self.objectScaleMmSlider = slicer.qMRMLSliderWidget()
self.objectScaleMmSlider.setMRMLScene(slicer.mrmlScene)
self.objectScaleMmSlider.quantity = "length" # get unit, precision, etc. from MRML unit node
self.objectScaleMmSlider.minimum = 0
self.objectScaleMmSlider.maximum = 10
self.objectScaleMmSlider.value = 2.0
self.objectScaleMmSlider.setToolTip("Increasing this value smooths the segmentation and reduces leaks. This is the sigma used for edge detection.")
self.scriptedEffect.addLabeledOptionsWidget("Object scale:", self.objectScaleMmSlider)
self.objectScaleMmSlider.connect("valueChanged(double)", self.updateMRMLFromGUI)
# Apply button
self.applyButton = qt.QPushButton("Accept")
self.applyButton.objectName = self.__class__.__name__ + "Apply"
self.applyButton.setToolTip("Accept previewed result")
self.scriptedEffect.addOptionsWidget(self.applyButton)
self.applyButton.connect("clicked()", self.onApply)
# Do Nothing button
self.dummyButton = qt.QPushButton("Dummy")
self.dummyButton.objectName = self.__class__.__name__ + "Dummy"
self.dummyButton.setToolTip("Dummy things")
self.scriptedEffect.addOptionsWidget(self.dummyButton)
self.dummyButton.connect("clicked()", self.onDummy)
This adds a new button in the widget, but unfortunately I am still missing something since the button does not activate the on_dummy function as hoped. (See the image below)
So how do I get more control over this button that I am adding, or is this not possible when using scriptedsegmenteditoreffect?
If it is possible, then where I can find more information/documentation about this problem?