# Would it be possible to have more then one module panel?

**URL:** https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880
**Category:** Feature requests
**Created:** [March 27, 2020, 8:01pm UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880 "2020-03-27T20:01:33Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [March 27, 2020, 8:01pm UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/1 "2020-03-27T20:01:33Z")

</div>

I sometimes want to have two (or even more) module tabs open to interact with multiple modules at the same time (as oppose to using the arrows to go back and forth). With the ability of undocking the modules tab, and with multiple screen setups, it think this actually kind of makes sense.

In such case I guess the Module selection drop down needs to be part of the module panel, as oppose to menu bar to enable module selection in each panel independently.

---

<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: [March 28, 2020, 1:34am UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/2 "2020-03-28T01:34:04Z")

</div>

If the module history and favorite modules on toolbar are not convenient enough (e.g., because you want to perform the same workflow multiple times) then having one more module panel would not help much. Instead, you can get more much more convenient, polished GUI by creating a custom scripted module You should be able to put together a GUI panel from the readily available high-level widgets in a few ten minutes using Qt Designer. Potentially you don’t need to write any code, just drag-and-drop the widgets and connect the signals in Qt designer. You only need to write code if you want to run specific processing functions when a button is clicked.

I would be also reluctant to enable unlimited module panels (e.g., dockable panels) because when you look at applications that take this approach, they all end up being extremely hard to use. We get lots of complaints that Slicer is hard to learn, so I would rather work on things that would take us in that direction.

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [March 28, 2020, 3:06am UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/3 "2020-03-28T03:06:39Z")

</div>

Thanks Andras. I do not know anything about QT Designer. Looking at this page it seems it is more suitable for custom build? [https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/QtDesigner](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/QtDesigner)

But somehow we can use it in a scripted module?

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [March 29, 2020, 3:31pm UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/4 "2020-03-29T15:31:06Z")

</div>

> [@muratmaga](#):
>
> But somehow we can use it in a scripted module?

It’s part of the current scripted module template. In developer mode you can start designer on the module with a single click.

> [@lassoan](#):
>
> I would be also reluctant to enable unlimited module panels (e.g., dockable panels) because when you look at applications that take this approach, they all end up being extremely hard to use.

Qt Designer itself starts out with a bunch of panels. Do you find that hard to use? I think they did it for the same reason Murat wants it, so you don’t need so many clicks to get what you need.

> [@muratmaga](#):
>
> I sometimes want to have two (or even more) module tabs open to interact with multiple modules at the same time (as oppose to using the arrows to go back and forth).

If you want to try it out, you can go to the module and then type in the following (replace `annotations` with the name of the module you want to pop out). If it basically works we could make a hot key or small button for this.

```auto
slicer.modules.annotations.widgetRepresentation().setParent(None)
slicer.modules.annotations.widgetRepresentation().show()

```

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [March 30, 2020, 3:42am UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/5 "2020-03-30T03:42:10Z")

</div>

Thanks Steve. This looks good.

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [April 1, 2020, 4:20pm UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/6 "2020-04-01T16:20:38Z")

</div>

Actually, while this popups up the module, the module itself is not functional. I am trying particularly with the Markups module, and you can’t see the control points, nor modify their color/size etc with the popup Markups module, while the docked one in the main module panel works fine.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [April 1, 2020, 4:50pm UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/7 "2020-04-01T16:50:46Z")

</div>

That’s weird - Volume Rendering works fine. Probably Markups and maybe other modules have some other logic that makes it not work in this mode. Does it work for other modules you use often and if so, do you like the mode well enough that we should take it past this prototype stage (e.g. add a button or hotkey for this).

---

<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: [April 1, 2020, 5:14pm UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/8 "2020-04-01T17:14:14Z")

</div>

If you would like to create an other widget representation for an existing module, it could be done like this:

```auto
>>> markups_module_widget = slicer.modules.annotations.createNewWidgetRepresentation()
>>> markups_module_widget.setMRMLScene(slicer.mrmlScene)
>>> markups_module_widget.show()

```

Next would be to ensure `enter()/exit()` method can be called from python and this should allow to have the module UI updated.

Doing so (instead of re-parenting) ensures the existing module panel will work as expected.

---

<div class="post-metadata">

### Author: ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)
#### Post date: [April 1, 2020, 5:52pm UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/9 "2020-04-01T17:52:58Z")

</div>

Thanks @jcfr this works perfectly!

---

<div class="post-metadata">

### Author: ![Greydon\_Gilmore](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/greydon_gilmore/32/6863_2.png) [@Greydon\_Gilmore](https://discourse.slicer.org/u/Greydon_Gilmore)
#### Post date: [January 29, 2021, 4:26am UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/10 "2021-01-29T04:26:57Z")

</div>

Found this thread really cool, never knew about this functionality before. I have been playing around with the pop out and wanted to add another point. If you want the pop-out window to stay always on top you can add:

```auto
markups_module_widget.setWindowFlag(qt.Qt.WindowStaysOnTopHint)

```

This will ensure whatever window you have floating will stay on top of the main panel.

---

<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: [January 29, 2021, 4:46am UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/11 "2021-01-29T04:46:16Z")

</div>

I would recommend to put all widgets into the window layout (you can add any number of dockable widgets), because popups can get very confusing. For example,when you switch between applications (Alt+Tab) then it is quite random what ends up being visible and where.

See for example the [NodeInfo module](https://github.com/SlicerRt/SlicerDebuggingTools/blob/master/NodeInfo/NodeInfo.py) if you want to learn how to place additional dockable widgets in the main window.

---

<div class="post-metadata">

### Author: ![Greydon\_Gilmore](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/greydon_gilmore/32/6863_2.png) [@Greydon\_Gilmore](https://discourse.slicer.org/u/Greydon_Gilmore)
#### Post date: [January 29, 2021, 4:50am UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/12 "2021-01-29T04:50:36Z")

</div>

I have always just built UI files and loaded them with `slicer.util.loadUI()`. I never thought about accessing them though the `slicer.modules` module before. I’ll check out the Nodeinfo module!

---

<div class="post-metadata">

### Author: ![Greydon\_Gilmore](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/greydon_gilmore/32/6863_2.png) [@Greydon\_Gilmore](https://discourse.slicer.org/u/Greydon_Gilmore)
#### Post date: [January 29, 2021, 4:59am UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/13 "2021-01-29T04:59:17Z")

</div>

In the NodeInfo module I notced this [signal/slot syntax](https://github.com/SlicerRt/SlicerDebuggingTools/blob/086d5b4ba78bd25f99a9bf6484a3c9452181fde8/NodeInfo/NodeInfo.py#L97). Is there a reason not to use the newer syntax `self.showInfoButton.clicked.connect(self.onShowInfoClicked)`?

---

<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: [January 29, 2021, 5:06am UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/14 "2021-01-29T05:06:35Z")

</div>

I’m not sure what you are referring to exactly, because you should not insert a completely different module’s GUI in your own module GUI. It would contain lots of irrelevant components. Instead, you can have a look at the module GUI and just add those widgets to your module that are relevant to your workflow (with all the customization you need).

> [@Greydon\_Gilmore](#):
>
> In the NodeInfo module I notced this [signal/slot syntax](https://github.com/SlicerRt/SlicerDebuggingTools/blob/086d5b4ba78bd25f99a9bf6484a3c9452181fde8/NodeInfo/NodeInfo.py#L97). Is there a reason not to use the newer syntax

I tend to prefer optimizing the code for readability (make it clear that it is a signal, make it clear what arguments it provides), so in general I would choose this syntax:

```
self.showInfoButton.connect('clicked(bool)', self.onShowInfoClicked)

```

instead of this:

```
self.showInfoButton.clicked.connect(self.onShowInfoClicked)

```

but if both work then it is up to you to choose.

---

<div class="post-metadata">

### Author: ![Greydon\_Gilmore](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/greydon_gilmore/32/6863_2.png) [@Greydon\_Gilmore](https://discourse.slicer.org/u/Greydon_Gilmore)
#### Post date: [January 29, 2021, 5:12am UTC](https://discourse.slicer.org/t/would-it-be-possible-to-have-more-then-one-module-panel/10880/15 "2021-01-29T05:12:13Z")

</div>

I only meant that I never realized I could access my own modules with `slicer.modules.myModuleWidget.mySubWidget`. I have just been using the other syntax style for signals/slots so was curious to know.
