How to add additional buttons to scriptedsegmenteditoreffect?

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?

I still haven’t figured out an answer to this question.
I have tried reading up on the scriptedsegmenteditoreffect, but I can’t really find much in terms of documentation in Developer Guide — 3D Slicer documentation and when searching for it on the github page I also do not really gain much in terms of code to look at.

I would appreciate if anyone could point me in the right direction

So the button is there but the clicked() connection is not working? Maybe this isn’t it but your code says onDummy but in your message you say on_dummy which would not work. One thing we don’t typically do but should is check the return value of the call to connect(). It returns a boolean you can test to see if the connection worked.

1 Like

This is embarrassing to admit, but that was indeed the problem… Thank you so much.
And sorry for asking such a dumb question…