View Issue Details

IDProjectCategoryView StatusLast Update
0004698Slicer4Core: Scripting (Wrapping, Python)public2019-06-20 15:48
ReporterjcfrAssigned Tojcfr 
Status assignedResolutionopen 
Product Version 
Target VersionSlicer 4.11.0Fixed in Version 
Summary0004698: Module without catergory can not be selected programatically if developer mode is disabled

Try to select a module without category using slicer.util.selectModule("NameOfModule") does not work

Steps To Reproduce

First, in a directory like /tmp/ModuleForTest, create a file with the following content:

import slicer.util

from slicer.ScriptedLoadableModule import *

class ModuleForTest(ScriptedLoadableModule):
  def __init__(self, parent):
    ScriptedLoadableModule.__init__(self, parent)
    self.parent.title = "ModuleForTest"

class ModuleForTestWidget(ScriptedLoadableModuleWidget):
  def __init__(self, parent=None):
    ScriptedLoadableModuleWidget.__init__(self, parent)

  def setup(self):
    print("ModuleForTestWidget setup")

then, run the following command:

./Slicer --disable-builtin-modules --additional-module-path /tmp/ModuleForTest/ --python-code "slicer.util.selectModule('ModuleForTest');"

The string "ModuleForTestWidget setup" is expected to be displayed.

Updating the module script adding self.parent.categories = ["Example"] and re-running the command display the expected string.

Additional Information

Code to improve can be found here:

TagsNo tags attached.


There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2019-06-20 15:48 jcfr New Issue
2019-06-20 15:48 jcfr Status new => assigned
2019-06-20 15:48 jcfr Assigned To => jcfr