Ejemplo n.º 1
0
  def setup(self):

    #
    # test list
    #

    self.testList = ctk.ctkCollapsibleButton(self.parent)
    self.testList.setLayout(qt.QVBoxLayout())
    self.testList.setText("Self Tests")
    self.layout.addWidget(self.testList)
    self.testList.collapsed = False

    self.runAll = qt.QPushButton("Run All")
    self.testList.layout().addWidget(self.runAll)
    self.runAll.connect('clicked()', self.onRunAll)

    self.testButtons = {}
    self.testMapper = qt.QSignalMapper()
    self.testMapper.connect('mapped(const QString&)', self.onRun)
    testKeys = slicer.selfTests.keys()
    testKeys.sort()
    for test in testKeys:
      self.testButtons[test] = qt.QPushButton(test)
      self.testButtons[test].setToolTip(slicer.selfTests[test].__doc__)
      self.testList.layout().addWidget(self.testButtons[test])
      self.testMapper.setMapping(self.testButtons[test],test)
      self.testButtons[test].connect('clicked()', self.testMapper, 'map()')

    # Add spacer to layout
    self.layout.addStretch(1)
Ejemplo n.º 2
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        # This module is often used in developer mode, therefore
        # collapse reload & test section by default.
        if hasattr(self, "reloadCollapsibleButton"):
            self.reloadCollapsibleButton.collapsed = True

        self.logic = SelfTestsLogic(slicer.selfTests)

        globals()['selfTests'] = self

        #
        # test list
        #

        self.testList = ctk.ctkCollapsibleButton(self.parent)
        self.testList.setLayout(qt.QVBoxLayout())
        self.testList.setText("Self Tests")
        self.layout.addWidget(self.testList)
        self.testList.collapsed = False

        self.runAll = qt.QPushButton("Run All")
        self.testList.layout().addWidget(self.runAll)
        self.runAll.connect('clicked()', self.onRunAll)

        self.testButtons = {}
        self.testMapper = qt.QSignalMapper()
        self.testMapper.connect('mapped(const QString&)', self.onRun)
        testKeys = slicer.selfTests.keys()
        testKeys.sort()
        for test in testKeys:
            self.testButtons[test] = qt.QPushButton(test)
            self.testButtons[test].setToolTip(slicer.selfTests[test].__doc__)
            self.testList.layout().addWidget(self.testButtons[test])
            self.testMapper.setMapping(self.testButtons[test], test)
            self.testButtons[test].connect('clicked()', self.testMapper,
                                           'map()')

        # Add spacer to layout
        self.layout.addStretch(1)