Can you put a module listing under two different categories?

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?

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.

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

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

That will be great!!!

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.

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

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

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.