# Custom application does not open module at startup

**URL:** <https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913>\
**Category:** Development\
**Created:** [November 29, 2018, 11:40pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913 "2018-11-29T23:40:58Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [November 29, 2018, 11:40pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/1 "2018-11-29T23:40:58Z")

</div>

I’ve compiled a custom application using the most recent Slicer commit on MacOS. In my superbuild CMakeList.txt file, I specify a default home module, currently set to Welcome:

> set(Slicer\_DEFAULT\_HOME\_MODULE “Welcome”)

When I run the application, both from the command line and after packaging, no module is opened at startup. Is this the expected behaviour? Is there somewhere else I need to set the module that should be opened at startup?

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [November 30, 2018, 12:03am UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/2 "2018-11-30T00:03:51Z")

</div>

Based on what I know it should work as you expect it to work. However, usually we don’t specify this in a CMakeLists.txt file, but we use this at the time of CMake configuration. So this would be a cmake argument like this

```
-DSlicer_DEFAULT_HOME_MODULE:STRING="Welcome"
```

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 30, 2018, 12:30am UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/3 "2018-11-30T00:30:10Z")

</div>

I can confirm, too, that `set(Slicer_DEFAULT_HOME_MODULE “Welcome”)` works. You would include it in the top-level CMakeLists.txt file if you use the [custom application template](https://github.com/KitwareMedical/SlicerCustomAppTemplate). Note that the in the custom application template, “Welcome” module is disabled, so you either need to remove it from the disabled list or choose another home module.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [November 30, 2018, 4:36pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/4 "2018-11-30T16:36:13Z")

</div>

> [@cpinter](#):
>
> Based on what I know it should work as you expect it to work. However, usually we don’t specify this in a CMakeLists.txt file, but we use this at the time of CMake configuration. So this would be a cmake argument like this
> 
> ```auto
> -DSlicer_DEFAULT_HOME_MODULE:STRING="Welcome"
> 
> ```

Thanks, I tested setting it in the GUI instead. Though I guess that won’t do much good if my CMakeLists sets the module to be disabled!

> [@lassoan](#):
>
> I can confirm, too, that `set(Slicer_DEFAULT_HOME_MODULE “Welcome”)` works. You would include it in the top-level CMakeLists.txt file if you use the [custom application template](https://github.com/KitwareMedical/SlicerCustomAppTemplate). Note that the in the custom application template, “Welcome” module is disabled, so you either need to remove it from the disabled list or choose another home module.

Thank you. I’m trying a clean build now, with Data as the default module.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [November 30, 2018, 5:09pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/5 "2018-11-30T17:09:29Z")

</div>

Another thing to note is that I’m hiding all of the toolbars in my custom application qAppMainWindow.cxx setupUi method:

> // Hide the toolbars  
> this-\>MainToolBar-\>setVisible(false);  
> this-\>ModuleSelectorToolBar-\>setVisible(false);  
> this-\>ModuleToolBar-\>setVisible(false);  
> this-\>ViewToolBar-\>setVisible(false);  
> this-\>MouseModeToolBar-\>setVisible(false);  
> this-\>CaptureToolBar-\>setVisible(false);  
> this-\>ViewersToolBar-\>setVisible(false);  
> this-\>DialogToolBar-\>setVisible(false);

Does this interfere with the creation of the qSlicerModuleManager?

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [November 30, 2018, 5:11pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/6 "2018-11-30T17:11:51Z")

</div>

> [@mschumaker](#):
>
> Though I guess that won’t do much good if my CMakeLists sets the module to be disabled!

Right, I missed the part that this is for a custom application. My bad…

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [November 30, 2018, 5:14pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/7 "2018-11-30T17:14:04Z")

</div>

No problem! I’ll see how this build goes once it’s done.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 30, 2018, 6:22pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/8 "2018-11-30T18:22:16Z")

</div>

> [@mschumaker](#):
>
> Does this interfere with the creation of the qSlicerModuleManager?

No

> [@mschumaker](#):
>
> specify a default home module, currently set to Welcome

The default for custom application is expected to be “Home”. See [SlicerCustomAppTemplate/{{cookiecutter.project\_name}}/CMakeLists.txt at e8afb986dd07f47e6dfea2437723ec2b3b8ded43 · KitwareMedical/SlicerCustomAppTemplate · GitHub](https://github.com/KitwareMedical/SlicerCustomAppTemplate/blob/e8afb986dd07f47e6dfea2437723ec2b3b8ded43/%7B%7Bcookiecutter.project_name%7D%7D/CMakeLists.txt#L42)

Changing the value in the `CMakeLists.txt` and re-configuring and re-building the project from the top-level will have the expected effect.  
Configuring the project passing `Slicer_DEFAULT_HOME_MODULE` option is also expected to change the value.

Ultimately the value is configured into the header `Slicer/CMake/vtkSlicerConfigure.h.in`

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [November 30, 2018, 6:58pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/9 "2018-11-30T18:58:24Z")

</div>

Thank you - I can see where it should be set on line 14 of vtkSlicerConfigure.h.in, and the correct value appears in Slicer-build/vtkSlicerConfigure.h:

> #define Slicer\_DEFAULT\_HOME\_MODULE “Data”

However, I’ve tried building the full Superbuild again, and when I run the executable, it starts with a blank module panel.

The error log doesn’t have much in it:

> Debug, Python  
> Scripted subject hierarchy plugin registered: Annotations  
> Scripted subject hierarchy plugin registered: SegmentEditor  
> Scripted subject hierarchy plugin registered: SegmentStatistics

> Warning, Qt  
> libpng warning: iCCP: known incorrect sRGB profile

> Debug, Qt  
> Session start time …: 2018-11-30 13:49:09  
> Slicer version …: 4.11.0-2018-11-14 (revision 60adeea) macosx-amd64 - not installed release  
> PADPlanner2 version …: 1.2.0-2018-11-29 (revision 25c786a)  
> Operating system …: Mac OS X / 10.12.6 / 16G1618 - 64-bit  
> Memory …: 16384 MB physical, 1024 MB virtual  
> CPU …: GenuineIntel Intel(R) Core™ i7-6567U CPU @ 3.30GHz, 2 cores, 4 logical processors  
> VTK configuration …: OpenGL2 rendering, Sequential threading  
> Developer mode enabled …: no  
> Prefer executable CLI …: yes  
> Additional module paths …: (none)

What could be causing this?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 30, 2018, 7:25pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/10 "2018-11-30T19:25:56Z")

</div>

> [@mschumaker](#):
>
> What could be causing this

In CMakeLists.txt files you only modify the default .ini file content. Delete the current .ini file if you want the application to start from default settings.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [November 30, 2018, 7:32pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/11 "2018-11-30T19:32:38Z")

</div>

Ok. Which .ini file?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 30, 2018, 7:43pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/12 "2018-11-30T19:43:27Z")

</div>

_customapplicationname_.ini

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 30, 2018, 8:14pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/15 "2018-11-30T20:14:02Z")

</div>

Rebuilding anything will not have any effect. Application setting .ini is stored in the user’s profile:  
[https://www.slicer.org/wiki/Documentation/Nightly/SlicerApplication/ApplicationSettings#Settings\_file\_location](https://www.slicer.org/wiki/Documentation/Nightly/SlicerApplication/ApplicationSettings#Settings_file_location)

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [November 30, 2018, 8:36pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/16 "2018-11-30T20:36:18Z")

</div>

Ok, sorry, I didn’t know. I’ll delete those and try again.  
Thanks!

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [November 30, 2018, 9:16pm UTC](https://discourse.slicer.org/t/custom-application-does-not-open-module-at-startup/4913/17 "2018-11-30T21:16:00Z")

</div>

Excellent! Thank you. That solved it.
