Skip to content

Instantly share code, notes, and snippets.

@jbvimort
Created February 29, 2016 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbvimort/e1e3c21f2d0a37590b5b to your computer and use it in GitHub Desktop.
Save jbvimort/e1e3c21f2d0a37590b5b to your computer and use it in GitHub Desktop.
import os
import unittest
from __main__ import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import json
#
# dumyExtenction
#
class dumyExtenction(ScriptedLoadableModule):
"""Uses ScriptedLoadableModule base class, available at:
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "dumyExtenction" # TODO make this more human readable by adding spaces
self.parent.categories = ["Examples"]
self.parent.dependencies = []
self.parent.contributors = ["John Doe (AnyWare Corp.)"] # replace with "Firstname Lastname (Organization)"
self.parent.helpText = """
This is an example of scripted loadable module bundled in an extension.
"""
self.parent.acknowledgementText = """
This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
and Steve Pieper, Isomics, Inc. and was partially funded by NIH grant 3P41RR013218-12S1.
""" # replace with organization, grant and thanks.
#
# dumyExtenctionWidget
#
class dumyExtenctionWidget(ScriptedLoadableModuleWidget):
"""Uses ScriptedLoadableModuleWidget base class, available at:
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
def setup(self):
self.logic = dumyExtenctionLogic()
ScriptedLoadableModuleWidget.setup(self)
# Instantiate and connect widgets ...
#
# Parameters Area
#
parametersCollapsibleButton = ctk.ctkCollapsibleButton()
parametersCollapsibleButton.text = "Parameters"
self.layout.addWidget(parametersCollapsibleButton)
# Layout within the dummy collapsible button
parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton)
self.createMarkup = qt.QPushButton("Button 1")
self.createMarkup.enabled = True
parametersFormLayout.addRow(self.createMarkup)
self.createMarkup.connect('clicked(bool)', self.onButton1)
self.displayAtribute = qt.QPushButton("Button 2")
self.displayAtribute.enabled = True
parametersFormLayout.addRow(self.displayAtribute)
self.displayAtribute.connect('clicked(bool)', self.onButton2)
# Add vertical spacer
self.layout.addStretch(1)
def onButton1(self, signal):
print "Button 1:"
print signal
print self
print self.sender()
def onButton2(self, signal):
print "Button 2:"
print signal
print self
print self.sender()
#
# dumyExtenctionLogic
#
class dumyExtenctionLogic(ScriptedLoadableModuleLogic):
pass
class dumyExtenctionTest(ScriptedLoadableModuleTest):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment