View Issue Details

IDProjectCategoryView StatusLast Update
0004698Slicer4Core: Scripting (Wrapping, Python)public2019-06-20 15:48
ReporterjcfrAssigned Tojcfr 
PrioritynormalSeverityminorReproducibilityalways
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
Description

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 ModuleForTest.py 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):
    ScriptedLoadableModuleWidget.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');slicer.app.quit()"

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: https://github.com/Slicer/Slicer/commit/7b52c115bff72ae19a74871da56ebca22eb61922#r34018863

TagsNo tags attached.

Activities

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