Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QT Designer does not start on MacOS #4700

Open
slicerbot opened this issue Mar 13, 2020 · 17 comments
Open

QT Designer does not start on MacOS #4700

slicerbot opened this issue Mar 13, 2020 · 17 comments
Assignees
Milestone

Comments

@slicerbot
Copy link
Collaborator

@slicerbot slicerbot commented Mar 13, 2020

This issue was created automatically from an original Mantis Issue. Further discussion may take place here.

@slicerbot slicerbot added this to the Slicer 4.11.0 milestone Mar 13, 2020
@lassoan lassoan changed the title QT Designer does not start QT Designer does not start on MacOS Mar 21, 2020
@lassoan
Copy link
Contributor

@lassoan lassoan commented Mar 26, 2020

@pieper Could you test this?

@pieper
Copy link
Member

@pieper pieper commented Mar 26, 2020

On local machine ./Slicer-build/Slicer --designer just launches regular slicer with no indication that the flag did anything. Same with a nightly build download.

@jcfr
Copy link
Member

@jcfr jcfr commented Mar 26, 2020

On macOS, starting QtDesigner can be done without launcher because it is properly fixed up for either the build tree or the downloaded package.

That said, having a consistent interface is important to streamline the user/developer experience.

There are two cases:

  • (1) build tree: Slicer is a launcher .. and specifying --designer is expected to work.
  • (2) downloaded package: Slicer is not a launcher. We will have account for this. The good news is that we already have an "AppLauncherLib"' available on macOS and we could use this to parse the launcher settings and update the argument supported by the regular Slicer executable based on this.

First, we should address (1)

@jcfr
Copy link
Member

@jcfr jcfr commented Mar 26, 2020

(1) build tree: Slicer is a launcher .. and specifying --designer is expected to work.

I am not able to reproduce the problem. @pieper Could you try the following and report the output. Especially the part with Starting.

$ ./Slicer  --designer --launcher-verbose

For example, here is what I get on the factory:

[...]
info: Starting [/Volumes/Dashboards/Support/qt-everywhere-build-5.10.0/bin/designer.app/Contents/MacOS/Designer]
info: launcher-timeout (ms) [-1000]
info: DisableSplash [1]
[...]
@lassoan
Copy link
Contributor

@lassoan lassoan commented Mar 26, 2020

Please also try if these work?

  • DICOM module / Reload&Test section / Edit UI button opens Qt designer (with the module's GUI)
  • menu: Edit / Application settings / Developer / Qt Designer / launch button opens Qt designer
@pieper
Copy link
Member

@pieper pieper commented Mar 26, 2020

$ ./Slicer-build/Slicer --designer --launcher-verbose
info: AdditionalSettingsFilePath []
info: LauncherSplashImagePath [/Users/pieper/slicer/latest/Slicer/Applications/SlicerApp/Resources/Images/Slicer-SplashScreen.png]
info: LauncherSplashScreenHideDelayMs [3000]
info: ApplicationToLaunch [/s/Slicer-build/bin/Slicer.app/Contents/MacOS/./Slicer]
info: ApplicationToLaunchArguments []
info: AdditionalSettingsFilePath []
info: LauncherDir [/s/Slicer-build]
info: LauncherName [Slicer]
info: OrganizationDomain [www.na-mic.org]
info: OrganizationName [NA-MIC]
info: ApplicationName [Slicer]
info: ApplicationRevision [28881]
info: SettingsFileName [/s/Slicer-build/./SlicerLauncherSettings.ini]
info: SettingsDir [/s/Slicer-build]
info: UserAdditionalSettingsDir [/Users/pieper/.config/www.na-mic.org]
info: UserAdditionalSettingsFileName [/Users/pieper/.config/www.na-mic.org/Slicer-28881.ini]
info: UserAdditionalSettingsFileBaseName []
info: AdditionalSettingsDir []
info: AdditionalSettingsExcludeGroups []
info: LauncherNoSplashScreen [0]
info: AdditionalLauncherHelpShortArgument [-h]
info: AdditionalLauncherHelpLongArgument [--help]
info: AdditionalLauncherNoSplashArguments [--no-splash,--help,--version,--home,--program-path,--no-main-window,--settings-path,--temporary-path]
info: DetachApplicationToLaunch [0]
info: LoadEnvironment [-1]
info: LauncherSplashImagePath [/Users/pieper/slicer/latest/Slicer/Applications/SlicerApp/Resources/Images/Slicer-SplashScreen.png]
info: LauncherSplashScreenHideDelayMs [3000]
info: ApplicationToLaunch [/s/Slicer-build/bin/Slicer.app/Contents/MacOS/./Slicer]
info: ApplicationToLaunchArguments []
info: <APPLAUNCHER_DIR> -> [/s/Slicer-build]
info: <APPLAUNCHER_NAME> -> [Slicer]
info: <APPLAUNCHER_SETTINGS_DIR> (RegularSettings) -> [/s/Slicer-build]
info: <APPLAUNCHER_SETTINGS_DIR> (UserAdditionalSettings) -> [/Users/pieper/.config/www.na-mic.org]
info: <APPLAUNCHER_SETTINGS_DIR> (AdditionalSettings) -> [<APPLAUNCHER_SETTINGS_DIR-NOTFOUND>]
info: <PATHSEP> -> [:]
info: Setting env. variable [SLICER_HOME]:/s/Slicer-build
info: Setting env. variable [PIP_REQUIRE_VIRTUALENV]:0
info: Setting env. variable [ITK_AUTOLOAD_PATH]:/s/Slicer-build/lib/Slicer-4.11/ITKFactories/.
info: Setting env. variable [PYTHONNOUSERSITE]:1
info: Setting env. variable [PYTHONHOME]:/s/python-install
info: Setting env. variable [SSL_CERT_FILE]:/s/Slicer-build/share/Slicer-4.11/Slicer.crt
info: Setting env. variable [PATH]:/s/Slicer-build/bin/.:/usr/local/opt/qt5/bin:/s/Slicer-build/lib/Slicer-4.11/cli-modules/.:/s/python-install/bin:/s/teem-build/bin/.
info: Setting env. variable [QT_PLUGIN_PATH]:/s/Slicer-build/bin:/s/CTK-build/CTK-build/bin:/usr/local/opt/qt5/plugins
info: Setting env. variable [DYLD_LIBRARY_PATH]:/s/Slicer-build/bin/.:../lib/Slicer-4.11/qt-loadable-modules:/s/Slicer-build/lib/Slicer-4.11/cli-modules/.:/s/Slicer-build/lib/Slicer-4.11/qt-loadable-modules/.:/s/OpenSSL:/s/python-install/lib:/s/VTK-build/lib/.:/s/teem-build/bin/.:/s/DCMTK-build/lib/.:/s/ITK-build/lib/.:/s/CTK-build/CTK-build/bin/.:/s/CTK-build/QtTesting-build/.:/s/CTK-build/PythonQt-build/.:/s/LibArchive-install/lib:/s/SimpleITK-build/SimpleITK-build/lib/.:/s/JsonCpp-build/src/lib_json/.:/s/ParameterSerializer-build/lib/.:/s/SlicerExecutionModel-build/ModuleDescriptionParser/bin/.:/s/python-install/lib/python3.6/site-packages/numpy/core:/s/python-install/lib/python3.6/site-packages/numpy/lib
info: Setting env. variable [PYTHONPATH]:/s/Slicer-build/bin/.:/s/Slicer-build/bin/Python:/s/Slicer-build/lib/Slicer-4.11/qt-loadable-modules/.:/s/Slicer-build/lib/Slicer-4.11/qt-loadable-modules/Python:/s/Slicer-build/lib/Slicer-4.11/qt-scripted-modules:/s/python-install/lib/python3.6:/s/python-install/lib/python3.6/lib-dynload:/s/python-install/lib/python3.6/site-packages:/s/VTK-build/lib/python3.6/site-packages:/s/CTK-build/CTK-build/bin/Python:/s/CTK-build/CTK-build/bin/.
info: Starting [/s/Slicer-build/bin/Slicer.app/Contents/MacOS/./Slicer]
info: argument [--designer]
info: launcher-timeout (ms) [-1000]
info: DisableSplash [0]
2020-03-26 15:20:24.841 Slicer[39132:46699172] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead. 
toInt : value  10  for singleStep  1e-12  is out of integer bounds !
toInt : value  10  for singleStep  1e-12  is out of integer bounds !
toInt : value  10  for singleStep  1e-12  is out of integer bounds !
Switch to module:  "Welcome"

@pieper
Copy link
Member

@pieper pieper commented Mar 26, 2020

It's probably because I built with a homebrew Qt that doesn't include the designer. I'm not seeing that there's a way to install it via brew.

The path exists and it has all the other qt executables but no designer.

This prints when I click either of the buttons @lassoan suggested:

error: Application does NOT exists [/s/Slicer-build/bin/../../../usr/local/opt/qt5/bin/Designer.app/Contents/MacOS/./designer]
Usage
  SlicerDesigner [options]

Options
  --launcher-help                                 Display help
  --launcher-version                              Show launcher version information
  --launcher-verbose                              Verbose mode
  --launch                                        Specify the application to launch
  --launcher-detach                               Launcher will NOT wait for the application to finish
  --launcher-no-splash                            Hide launcher splash
  --launcher-timeout                              Specify the time in second before the launcher kills the application. -1 means no timeout (default: -1)
  --launcher-load-environment                     Specify the saved environment to load.
  --launcher-dump-environment                     Launcher will print environment variables to be set, then exit
  --launcher-show-set-environment-commands        Launcher will print commands suitable for setting the parent environment (i.e. using 'eval' in a POSIX shell), then exit
  --launcher-additional-settings                  Additional settings file to consider
  --launcher-additional-settings-exclude-groups   Comma separated list of settings groups that should NOT be overwritten by values in User and Additional settings. For example: General,Application,ExtraApplicationToLaunch
  --launcher-ignore-user-additional-settings      Ignore additional user settings
  --launcher-generate-exec-wrapper-script         Generate executable wrapper script allowing to set the environment
  --launcher-generate-template                    Generate an example of setting file
@lassoan
Copy link
Contributor

@lassoan lassoan commented Mar 26, 2020

Do the "Edit UI" and "launch" buttons work well in an installed official Slicer Preview Release?

It's probably because I built with a homebrew Qt that doesn't include the designer. I'm not seeing that there's a way to install it via brew.

You cannot develop classic desktop applications without Qt designer, so there must be an option to install it via homebrew. Maybe it comes with Qt Creator. We could make qSlicerApplication::launchDesigner method more intelligent by also searching at typical Qt Creator install locations.

@pieper
Copy link
Member

@pieper pieper commented Mar 26, 2020

Do the "Edit UI" and "launch" buttons work well in an installed official Slicer Preview Release?

Yes, but I get this error when I do Edit UI in the module.

image

so there must be an option to install it via homebrew

Yes, I can get this

image

@jcfr
Copy link
Member

@jcfr jcfr commented Mar 26, 2020

re: (1) build tree

That makes then. Since no designer was found at configuration time, the launcher settings for the build tree didn't include the --designer option ... and it was then considered as a regular Slicer option.

We could improve the build system to always add the launcher option but when designer is missing, it could instead starts Slicer with something like this :

Slicer --no-main-window --disable-modules --python-code 'qt.QMessageBox.critical(0, "Slicer", "Check your Qt install : QtDesigner executable was not found !")'
@jcfr
Copy link
Member

@jcfr jcfr commented Mar 26, 2020

@lassoan
Copy link
Contributor

@lassoan lassoan commented Mar 26, 2020

downloaded package: Slicer is not a launcher. We will have account for this. The good news is that we already have an "AppLauncherLib"' available on macOS and we could use this to parse the launcher settings and update the argument supported by the regular Slicer executable based on this.

I don't think it is necessary to have the Slicer --designer shortcut to launch Qt designer in an installed package, but if we want then we can map Slicer --designer shortcut to Slicer --testing --no-main-window --python-code slicer.app.launchDesigner() instead.

@pieper
Copy link
Member

@pieper pieper commented Mar 26, 2020

@pieper Is qtdesigner in the libexec folder in your install ?

Yes! This launches the right one:

$ /usr/local/opt/qt5/libexec/Designer.app/Contents/MacOS/Designer

@fepegar
Copy link
Contributor

@fepegar fepegar commented Jul 29, 2020

Hi all,

I came here to report this issue. I just got this after running startQtDesigner() in the console:
Screen Shot 2020-07-29 at 17 23 51

Slicer 4.11.0-2020-07-27 r29229 / 1217275.

@lassoan
Copy link
Contributor

@lassoan lassoan commented Aug 26, 2020

@pieper you've worked on Qt related issues on Mac, could you have a look at this? Maybe qSlicerApplication::launchDesigner can be updated to run the designer directly instead of via a launcher.

@pieper
Copy link
Member

@pieper pieper commented Aug 26, 2020

Since I did brew cask install qt-creator after I'd configured my slicer build, I didn't have the --designer option and startQtDesigner() does nothing, as expected from @jcfr 's comment above.

But if I start slicer with this command the designer starts with all the Slicer widgets available:

/opt/s/Slicer-build/Slicer --launch /usr/local/opt/qt5/libexec/Designer.app/Contents/MacOS/Designer

I'm rebuilding from scratch now to see if the designer from homebrew is detected.

@pieper
Copy link
Member

@pieper pieper commented Aug 26, 2020

With a fresh build and qt-creator installed --designer still starts Slicer instead of Designer. If I run startDesigner() I get the message below, so I guess the path is just not detected correctly for the homebrew case.

 ./Slicer-build/Slicer --designer
2020-08-26 13:52:53.809 Slicer[77456:41501397] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead. 
Switch to module:  "Welcome"
Loading Slicer RC file [/Users/pieper/.slicerrc.py]
Python console user input: startQtDesigner()
True
error: Application does NOT exists [/opt/sr/Slicer-build/bin/../../../../usr/local/Cellar/qt/5.15.0/bin/Designer.app/Contents/MacOS/./designer]
Usage
  SlicerDesigner [options]

Options
  --launcher-help                                 Display help
  --launcher-version                              Show launcher version information
  --launcher-verbose                              Verbose mode
  --launch                                        Specify the application to launch
  --launcher-detach                               Launcher will NOT wait for the application to finish
  --launcher-no-splash                            Hide launcher splash
  --launcher-timeout                              Specify the time in second before the launcher kills the application. -1 means no timeout (default: -1)
  --launcher-load-environment                     Specify the saved environment to load.
  --launcher-dump-environment                     Launcher will print environment variables to be set, then exit
  --launcher-show-set-environment-commands        Launcher will print commands suitable for setting the parent environment (i.e. using 'eval' in a POSIX shell), then exit
  --launcher-additional-settings                  Additional settings file to consider
  --launcher-additional-settings-exclude-groups   Comma separated list of settings groups that should NOT be overwritten by values in User and Additional settings. For example: General,Application,ExtraApplicationToLaunch
  --launcher-ignore-user-additional-settings      Ignore additional user settings
  --launcher-generate-exec-wrapper-script         Generate executable wrapper script allowing to set the environment
  --launcher-generate-template                    Generate an example of setting file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.