# Can you put a module listing under two different categories?

**URL:** <https://discourse.slicer.org/t/can-you-put-a-module-listing-under-two-different-categories/9535>\
**Category:** Support\
**Created:** [December 17, 2019, 9:01pm UTC](https://discourse.slicer.org/t/can-you-put-a-module-listing-under-two-different-categories/9535 "2019-12-17T21:01:55Z")\
**Posts on this page:** 7\
**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:** [December 17, 2019, 9:01pm UTC](https://discourse.slicer.org/t/can-you-put-a-module-listing-under-two-different-categories/9535/1 "2019-12-17T21:01:55Z")

</div>

As part of the SlicerMorph, we want to bundle bunch of extensions that are likely to be use to our users but may get overlooked. A particular example is Fiducial Registration tools within IGT. I would like to make them aware of it, by somehow cross-referencing through the SlicerMorph module list?

Is that possible?

---

<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:** [December 17, 2019, 9:47pm UTC](https://discourse.slicer.org/t/can-you-put-a-module-listing-under-two-different-categories/9535/2 "2019-12-17T21:47:21Z")

</div>

A module can declare itself to be in more than one menu category, e.g. with ` self.parent.categories = ["Wizards", "SlicerMorph"]` in the module class ` __init__ ` method, but I’m not sure you can easily change another modules categories.

One way to do something effectively the same would be to put stub modules in the SlicerMorph category that are programmed to redirect to the desired module (e.g. call `selectModule("otherModule")` in their module’s `enter` method.). Or you can make another module selector organized they way you want it and add it as a toolbar.

---

<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:** [December 17, 2019, 9:48pm UTC](https://discourse.slicer.org/t/can-you-put-a-module-listing-under-two-different-categories/9535/3 "2019-12-17T21:48:35Z")

</div>

Thanks Steve. What you suggested is what I was looking for…

---

<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:** [December 17, 2019, 10:02pm UTC](https://discourse.slicer.org/t/can-you-put-a-module-listing-under-two-different-categories/9535/4 "2019-12-17T22:02:06Z")

</div>

Sounds good Murat - do you need an example of how to do it?

---

<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:** [December 17, 2019, 10:50pm UTC](https://discourse.slicer.org/t/can-you-put-a-module-listing-under-two-different-categories/9535/5 "2019-12-17T22:50:18Z")

</div>

That will be great!!!

---

<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:** [December 19, 2019, 8:38pm UTC](https://discourse.slicer.org/t/can-you-put-a-module-listing-under-two-different-categories/9535/6 "2019-12-19T20:38:19Z")

</div>

Here’s an easy working example for adding some shortcuts to an existing module category.

This might be considered a hack, so I’m going to just put it here as a workaround for now and not in the script repository. If we like the idea we should probably make something like this part of the module selector API.

```auto

def addMenuShortcuts(targetCategory, modulesToMap):
    menu = mainWindow().moduleSelector().modulesMenuComboBox().menu()
    for action in menu.actions():
        if action.text == targetCategory:
            submenu = action.menu()
    for module in modulesToMap:
      action = qt.QAction(module, submenu)
      action.connect("triggered()", lambda module=module : slicer.util.selectModule(module))
      submenu.addAction(action)

addMenuShortcuts("SlicerMorph", ["Animator",])

```

---

<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:** [December 19, 2019, 8:42pm UTC](https://discourse.slicer.org/t/can-you-put-a-module-listing-under-two-different-categories/9535/7 "2019-12-19T20:42:04Z")

</div>

You may also create a “Welcome” module for SlicerMorph, which shows a list of modules (maybe illustrated with nice thumbnails), maybe shortcuts to data loading, sample data download, and documentation. You can set it as “home” module in application settings (or from Python script) so that when Slicer starts then it shows this module by default.
