group all defaults into one argument
This commit is contained in:
parent
fb098e9cdc
commit
bafe1b4b74
@ -90,10 +90,7 @@ class ColorMapParameter(ptree.types.GroupParameter):
|
|||||||
values List of unique values for which the user may assign a
|
values List of unique values for which the user may assign a
|
||||||
color when mode=='enum'. Optionally may specify a dict
|
color when mode=='enum'. Optionally may specify a dict
|
||||||
instead {value: name}.
|
instead {value: name}.
|
||||||
colormap assign a colormap to the field
|
defaults Dict of ColorMapParameter children and it's default value
|
||||||
min/max assign a min/max to the field, default is 0, 1
|
|
||||||
operation assign operation for merging multiple maps from ['Overlay',
|
|
||||||
'Add', 'Multiply', 'Set'], default is 'Overlay'
|
|
||||||
============== ============================================================
|
============== ============================================================
|
||||||
"""
|
"""
|
||||||
self.fields = OrderedDict(fields)
|
self.fields = OrderedDict(fields)
|
||||||
@ -173,12 +170,12 @@ class RangeColorMapItem(ptree.types.SimpleParameter):
|
|||||||
self.fieldName = name
|
self.fieldName = name
|
||||||
units = opts.get('units', '')
|
units = opts.get('units', '')
|
||||||
ptree.types.SimpleParameter.__init__(self,
|
ptree.types.SimpleParameter.__init__(self,
|
||||||
name=name, autoIncrementName=True, type='colormap', removable=True, renamable=True, value=opts.get('colormap', None),
|
name=name, autoIncrementName=True, type='colormap', removable=True, renamable=True,
|
||||||
children=[
|
children=[
|
||||||
#dict(name="Field", type='list', value=name, values=fields),
|
#dict(name="Field", type='list', value=name, values=fields),
|
||||||
dict(name='Min', type='float', value=opts.get('min', 0.0), suffix=units, siPrefix=True),
|
dict(name='Min', type='float', value=0.0, suffix=units, siPrefix=True),
|
||||||
dict(name='Max', type='float', value=opts.get('max', 1.0), suffix=units, siPrefix=True),
|
dict(name='Max', type='float', value=1.0, suffix=units, siPrefix=True),
|
||||||
dict(name='Operation', type='list', value=opts.get('operation', 'Overlay'), values=['Overlay', 'Add', 'Multiply', 'Set']),
|
dict(name='Operation', type='list', value='Overlay', values=['Overlay', 'Add', 'Multiply', 'Set']),
|
||||||
dict(name='Channels..', type='group', expanded=False, children=[
|
dict(name='Channels..', type='group', expanded=False, children=[
|
||||||
dict(name='Red', type='bool', value=True),
|
dict(name='Red', type='bool', value=True),
|
||||||
dict(name='Green', type='bool', value=True),
|
dict(name='Green', type='bool', value=True),
|
||||||
@ -188,6 +185,13 @@ class RangeColorMapItem(ptree.types.SimpleParameter):
|
|||||||
dict(name='Enabled', type='bool', value=True),
|
dict(name='Enabled', type='bool', value=True),
|
||||||
dict(name='NaN', type='color'),
|
dict(name='NaN', type='color'),
|
||||||
])
|
])
|
||||||
|
if 'defaults' in opts:
|
||||||
|
defaults = opts['defaults']
|
||||||
|
for k, v in defaults.items():
|
||||||
|
if k == 'colormap':
|
||||||
|
self.setValue(v)
|
||||||
|
else:
|
||||||
|
self[k] = v
|
||||||
|
|
||||||
def map(self, data):
|
def map(self, data):
|
||||||
data = data[self.fieldName]
|
data = data[self.fieldName]
|
||||||
@ -223,7 +227,7 @@ class EnumColorMapItem(ptree.types.GroupParameter):
|
|||||||
name=name, autoIncrementName=True, removable=True, renamable=True,
|
name=name, autoIncrementName=True, removable=True, renamable=True,
|
||||||
children=[
|
children=[
|
||||||
dict(name='Values', type='group', children=childs),
|
dict(name='Values', type='group', children=childs),
|
||||||
dict(name='Operation', type='list', value=opts.get('operation', 'Overlay'), values=['Overlay', 'Add', 'Multiply', 'Set']),
|
dict(name='Operation', type='list', value='Overlay', values=['Overlay', 'Add', 'Multiply', 'Set']),
|
||||||
dict(name='Channels..', type='group', expanded=False, children=[
|
dict(name='Channels..', type='group', expanded=False, children=[
|
||||||
dict(name='Red', type='bool', value=True),
|
dict(name='Red', type='bool', value=True),
|
||||||
dict(name='Green', type='bool', value=True),
|
dict(name='Green', type='bool', value=True),
|
||||||
|
Loading…
Reference in New Issue
Block a user