Beispiel #1
0
 def __init__(self, **args):
     axis = args.get('axis', None)
     args['expanded'] = args.get('expanded', False)
     SimpleParameter.__init__(self, **args)
     initialParams = [ch.name() for ch in self]
     
     newParams = [
         {'name': 'sequence', 'type': 'list', 'value': 'off', 'values': ['off', 'range', 'list']},
         {'name': 'start', 'type': 'float', 'axis': axis, 'value': 0, 'visible': False}, 
         {'name': 'stop', 'type': 'float', 'axis': axis, 'value': 0, 'visible': False}, 
         {'name': 'steps', 'type': 'int', 'value': 10, 'visible': False},
         {'name': 'log spacing', 'type': 'bool', 'value': False, 'visible': False}, 
         {'name': 'list', 'type': 'str', 'value': '', 'visible': False}, 
         {'name': 'randomize', 'type': 'bool', 'value': False, 'visible': False}, 
     ]
     for ch in newParams:
         self.addChild(ch)
     #print "Built sequence param:", id(self), args['name'], args['type']
     #self.sequence.sigTreeStateChanged.connect(self.seqChanged)
     
     self.visibleParams = {  ## list of params to display in each mode
         'off': initialParams+['sequence'],
         'range': initialParams+['sequence', 'start', 'stop', 'steps', 'log spacing', 'randomize'],
         'list': initialParams+['sequence', 'list', 'randomize'],
     }
Beispiel #2
0
 def treeStateChanged(self, param, changes):
     ## catch changes to 'sequence' so we can hide/show other params.
     ## Note: it would be easier to just catch self.sequence.sigValueChanged,
     ## but this approach allows us to block tree change events so they are all
     ## released as a single update.
     with self.treeChangeBlocker():
         ## queue up change 
         SimpleParameter.treeStateChanged(self, param, changes)
         
         ## if needed, add some more changes before releasing the signal
         for param, change, data in changes:
             ## if the sequence value changes, hide/show other parameters
             if param is self.param('sequence') and change == 'value':
                 vis = self.visibleParams[self['sequence']]
                 for ch in self:
                     if ch.name() in vis:
                         ch.show()
                     else:
                         ch.hide()
Beispiel #3
0
 def setOpts(self, **opts):
     SimpleParameter.setOpts(self, **opts)
     if 'readonly' in opts:  ## if this param is set to readonly, then disable sequencing.
         if opts['readonly'] is False:
             self['sequence'] = 'off'
         self.param('sequence').setOpts(readonly=opts['readonly'], visible=False)