Tutorial: Creating your own CIG Modules
Create a New File
Adding a Panel
- every panels requires 2 class definitions, one derived form the
ProjectEditorPage
to handle the GUI elements and one derived from the Module
to handle the project elements/items
class YourModulePage(ProjectEditorPage):
"""The description of the page - the GUI layout"""
def __init__(self, parent,values,defaults=[],onChange=None):
#Initialize the standard fields (in this case the epsilon array)
#This creates edit buttons for all arrays and text entries for the rest
ProjectEditorPage.__init__(self,parent,values,defaults,onChange)
def getPassiveItem(self,v,default,onChange):
if v=='p':
return ButtonProperty(self,'Run',onChange=self.run)
print self
def getPropertyItem(self,v,default,onChange,i):
if v=='command':
return SelectProperty(self, v, 'PCEVSolve', ['PCEVSolve','PCquadEVsolve'], onChange)
else:
return PropertyItem(self,v,default, onChange)
class YourModule(Module):
""" The module describing the binary and how to use it"""
def __init__(self):
Module.__init__(self,['command','p'],['PCEVsolve','5'])
def setProject(self,p):
Module.setProject(self,p)
self.project.setDontSave('command')
def makePage(self,item,onChange):
"""Creates an instance of the YourModulePage Class - defined above"""
self.page=YourModulePage(item,self.getNames(),defaults=self.getDefaults(),onChange=onChange,run=self.run)
return self.page
Adding the Module in the cigNavigator