Add tool tip support to action and group parameters
This commit is contained in:
parent
2260030845
commit
6a8f7779dc
|
@ -65,7 +65,7 @@ params = [
|
|||
{'name': 'Basic parameter data types', 'type': 'group', 'children': [
|
||||
{'name': 'Integer', 'type': 'int', 'value': 10},
|
||||
{'name': 'Float', 'type': 'float', 'value': 10.5, 'step': 0.1, 'finite': False},
|
||||
{'name': 'String', 'type': 'str', 'value': "hi"},
|
||||
{'name': 'String', 'type': 'str', 'value': "hi", 'tip': 'Well hello'},
|
||||
{'name': 'List', 'type': 'list', 'values': [1,2,3], 'value': 2},
|
||||
{'name': 'Named List', 'type': 'list', 'values': {"one": 1, "two": "twosies", "three": [3,3,3]}, 'value': 2},
|
||||
{'name': 'Boolean', 'type': 'bool', 'value': True, 'tip': "This is a checkbox"},
|
||||
|
@ -76,7 +76,7 @@ params = [
|
|||
{'name': 'Sub-param 2', 'type': 'float', 'value': 1.2e6},
|
||||
]},
|
||||
{'name': 'Text Parameter', 'type': 'text', 'value': 'Some text...'},
|
||||
{'name': 'Action Parameter', 'type': 'action'},
|
||||
{'name': 'Action Parameter', 'type': 'action', 'tip': 'Click me'},
|
||||
]},
|
||||
{'name': 'Numerical Parameter Options', 'type': 'group', 'children': [
|
||||
{'name': 'Units + SI prefix', 'type': 'float', 'value': 1.2e-6, 'step': 1e-6, 'siPrefix': True, 'suffix': 'V'},
|
||||
|
@ -107,7 +107,7 @@ params = [
|
|||
}},
|
||||
]},
|
||||
ComplexParameter(name='Custom parameter group (reciprocal values)'),
|
||||
ScalableGroup(name="Expandable Parameter Group", children=[
|
||||
ScalableGroup(name="Expandable Parameter Group", tip='Click to add children', children=[
|
||||
{'name': 'ScalableParam 1', 'type': 'str', 'value': "default param 1"},
|
||||
{'name': 'ScalableParam 2', 'type': 'str', 'value': "default param 2"},
|
||||
]),
|
||||
|
|
|
@ -482,8 +482,12 @@ class GroupParameterItem(ParameterItem):
|
|||
if 'addList' in opts:
|
||||
self.updateAddList()
|
||||
|
||||
if 'enabled' in opts and hasattr(self, 'addWidget'):
|
||||
self.addWidget.setEnabled(opts['enabled'])
|
||||
if hasattr(self, 'addWidget'):
|
||||
if 'enabled' in opts:
|
||||
self.addWidget.setEnabled(opts['enabled'])
|
||||
|
||||
if 'tip' in opts:
|
||||
self.addWidget.setToolTip(opts['tip'])
|
||||
|
||||
def updateAddList(self):
|
||||
self.addWidget.blockSignals(True)
|
||||
|
@ -663,6 +667,9 @@ class ActionParameterItem(ParameterItem):
|
|||
if 'enabled' in opts:
|
||||
self.button.setEnabled(opts['enabled'])
|
||||
|
||||
if 'tip' in opts:
|
||||
self.button.setToolTip(opts['tip'])
|
||||
|
||||
def buttonClicked(self):
|
||||
self.param.activate()
|
||||
|
||||
|
|
Loading…
Reference in New Issue