Edit UI raies 'Designer cannot be opened because of a problem'

Hi,

I am following this tutorial; https://github.com/PerkLab/PerkLabBootcamp/blob/master/Doc/day3_2_SlicerProgramming.pptx?raw=true

‘Edit UI’ button was not working in my Slicer (page 36) and my understanding is that the button shows the qt designer window (page 39).

Clicking ‘Edit UI’ shows a popup saying Designer cannot be opened because of a problem but after that, I couldn’t reproduce the popup window and nothing happens in clicking.

My slicer version is 4.11.0-2020-08-24.
Any thoughts and comments are appreciated!

What operating system this is?
Have you built Slicer yourself?

I’m using macOS Mojave (10.14.6).
I’ve noticed that there is error log which says ‘dyld: Library not loaded: /Volumes/D/Support/qt-everywhere-build-5.15.0/lib/QtDesignerComponents.framework/Versions/5/QtDesignerComponents
Referenced from: /Applications/Slicer.app/Contents/bin/Designer.app/Contents/MacOS/Designer
Reason: image not found
error: [/Applications/Slicer.app/Contents/bin/Designer.app/Contents/MacOS/Designer] exit abnormally - Report the problem.’

In my mac, there is no /Volumes/D/ directly.
I just downloaded Slicer and I don’t think I built it myself.

You can start the designer on MacOS directly see:

1 Like

Thank you for the link.
I run $ /usr/local/opt/qt5/libexec/Designer.app/Contents/MacOS/Designer and it shows the following windows.

Is this what I’m supposed to see? I’m wondering if this is correct because I cannot see ‘MyFirstModule.ui’ window which the tutorial shows (page 39).

How can I proceed the tutorial after page 39 and 42?

Yes, this is what you need to see. You need to load the .ui file.

The “Edit UI” button would load it for you automatically, but we need to fix that button on Mac.

1 Like

I realized I have to open .ui file and yes, I could see other windows that the tutorial shows.
I followed the further instruction but the apply button is not active. (also clicking input Markups button not show anything)

Could you give me some advice about why it’s not enabled?
I changed all scripts based upon the tutorial but I couldn’t find “selectNodeUponCreation” in the property editor.(page 39)

UI looks different so I’m wondering if I am doing.

Everything looks good. You need to select valid inputs if you want th Apply button to become active. This behavior (disable Apply button until valid inputs are selected) is implemented in your Python script and you can change it if you want.

I’m supposed to be able to select value for Input Markups, correct?

Clicking this button happen nothing. Could you tell me how and where I can select inputs?

In Python script, I believe onSelect func defines that.

def onSelect(self):
  self.ui.applyButton.enabled = self.ui.inputSelector.currentNode()

changing self.ui.applyButton.enabled = True didn’t help.

You need to create a markups node and then you can select it. You can use Markups module or the toolbar.

OnSelect is called when selection changes. If you want the Apply button to be enabled by default then set it so in Qt Designer.

Do I have to create multiple markups?
I put some markups but the apply button is still inactive. I tried to place various markups (like circle and plane) but the results are the same.

and I was not sure how to place multiple same label markups. Seems like there was ‘Persistent’ checkbox in the old versions but I cannot see that in the current version.
https://slicer.readthedocs.io/en/latest/user_guide/modules/markups.html

Markups look good now. As you can see, you have successfully selected them in the node selector.

Is the ‘apply’ button supposed to be become active when I select the markup?
Can you tell me how to activate the apply button? The scripts are all changed based upon the tutorial.
Tanks!

Even though I selected Input Markup, the Apply button didn’t become active.
I also added print() in onSelect method in MyFirstModuleWidget class but nothing is printed in selecting markup.

I’m assuming that the onSelect method is not called when I change the markup.

I also tried to check enable box for apply button in qt designer but the apply button is still inactive.

Executing your script line-by-line in a debugger would let you see what exactly your script is doing. See setup instructions here: https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#How_can_I_use_a_visual_debugger_for_step-by-step_debugging

Thank you for the link! I setup debugger in pycharm and slicer. I set egg files and it apparently worked correctly but once I set breakpoints and open the ‘MyFirstModule’ module, it didn’t stop at breakpoint…

In this screenshot, I set a breakpoint in init of MyFirstModuleWidget class and also put print() before and after it.
As you can see the output, both of the print is exected and I assume the debugger is not working correctly…

I already confirmed that the print() put at the first row in the onSelect() was not printed so can you please tell me how onSelect() works?

I could not find any documentation for ScriptedLoadableModuleWidget.onSelect(). Do you have any documentation for it?

I was able to get PyCharm remote debug worked. It’s still unstable and they are often disconnected though.

I tried to use console in PyCharm and tried self.onApplyButton() but got the error.

Seems like self.ui doesn’t have enableScreenshotsFlagCheckBox.

Is there any documentation that explains how the codes work step-by-step? Even though I would finish this tutorial I feel I would not be able to develop something I want.

If you have something that I can refer, that would be great and very helpful.

Thanks