pyqtgraph/examples/parametertree.py

193 lines
8.1 KiB
Python
Raw Normal View History

2012-07-09 21:14:41 +00:00
# -*- coding: utf-8 -*-
"""
This example demonstrates the use of pyqtgraph's parametertree system. This provides
a simple way to generate user interfaces that control sets of parameters. The example
demonstrates a variety of different parameter types (int, float, list, etc.)
as well as some customized parameter types
"""
feature More parameter item types (#1844) * feature More parameter item types Pen: Pops up a dialouge that allows the user to customize a pen. Setting pen value is not working yet. Progress bar: For indication things. Slider: Easier way to set values that dont require precision. Fonts: Picking font types. Next thing could be a Font dialog. Calendar: For picking dates or intervals Open/save file/files/directory: Pops up an open/save file/directory dialog to select a file/directory. Filter string and caption can be defined too. A PenSelectorDialog widget was created for the pen parameter item too. Also added these parameter items to the example. * PyQt/Side6 compatibility fixup * Revisions from intial PR Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialog.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/parametertree/parameterTypes.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/parametertree/parameterTypes.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialog.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Apply suggestions from code review Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> * Bugfix: module instead of class import on param tree example * Enrich the slider parameter * Address pijyoi comments on pen style parameter * Different file picker for easier porting * Better organization and formatting, minor refactoring * PyQt6/PySide6 fixup for file dialog * Minor adjustment to file picker * Bugfix: for 'None' sigChanged 'None' is explicitly allowed for a WidgetParameterItem's `sigChanged` value. However, this raises an error on a changed value unless the commit's fix is applied * Calendar works better as sub item * Fixes bugs in pen parameter's dialog + makes it resizable * more bugfixes and recommended changes, lets pen serialize its options * better pen save state * Fixes file parameter qualms * Fixes font parameter qualms * Fixes calendar parameter qualms * Fixes multiply-defined slider optsChanged * Fixes pen parameter qualms * ptree example minor bugfix * Pen dialog bugfixes * File dialog bugfixes / mild improvements * unto ptree save state regression * file fixup * Adds parameter descriptions to docstrings * Improved parameter documentation * adds 'relativeTo' option for file parameter * Less abuse of Qt enums during or-operations * More uniform handling of relative paths * More cleanup of enum setting * better name for window title (matches qt name) * Favor os.path over pathlib * Exposes 'directory', 'windowTitle' to file parameter * Fixup and add comparison to parameter tree state restoration * Exposes "cosmetic" in pen parameter * Indicate defaults in parameter documentation * QtEnumParameter works for enums outside QtCore.Qt * see if altering pytest report fixes ci bug * Cleanup unused import and redundant `self.widget` assignments Co-authored-by: Fekete Imre <feketeimre87@gmail.com> Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>
2021-07-23 21:40:49 +00:00
import os
2012-07-09 21:14:41 +00:00
import initExample ## Add path to library (just for examples; you do not need this)
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
app = pg.mkQApp("Parameter Tree Example")
2012-07-09 21:14:41 +00:00
import pyqtgraph.parametertree.parameterTypes as pTypes
from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType
## test subclassing parameters
## This parameter automatically generates two child parameters which are always reciprocals of each other
class ComplexParameter(pTypes.GroupParameter):
def __init__(self, **opts):
opts['type'] = 'bool'
opts['value'] = True
pTypes.GroupParameter.__init__(self, **opts)
self.addChild({'name': 'A = 1/B', 'type': 'float', 'value': 7, 'suffix': 'Hz', 'siPrefix': True})
self.addChild({'name': 'B = 1/A', 'type': 'float', 'value': 1/7., 'suffix': 's', 'siPrefix': True})
self.a = self.param('A = 1/B')
self.b = self.param('B = 1/A')
self.a.sigValueChanged.connect(self.aChanged)
self.b.sigValueChanged.connect(self.bChanged)
def aChanged(self):
self.b.setValue(1.0 / self.a.value(), blockSignal=self.bChanged)
def bChanged(self):
self.a.setValue(1.0 / self.b.value(), blockSignal=self.aChanged)
## test add/remove
## this group includes a menu allowing the user to add new parameters into its child list
class ScalableGroup(pTypes.GroupParameter):
def __init__(self, **opts):
opts['type'] = 'group'
opts['addText'] = "Add"
opts['addList'] = ['str', 'float', 'int']
pTypes.GroupParameter.__init__(self, **opts)
def addNew(self, typ):
val = {
'str': '',
'float': 0.0,
'int': 0
}[typ]
self.addChild(dict(name="ScalableParam %d" % (len(self.childs)+1), type=typ, value=val, removable=True, renamable=True))
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", 'tip': 'Well hello'},
{'name': 'List', 'type': 'list', 'limits': [1,2,3], 'value': 2},
{'name': 'Named List', 'type': 'list', 'limits': {"one": 1, "two": "twosies", "three": [3,3,3]}, 'value': 2},
2012-07-09 21:14:41 +00:00
{'name': 'Boolean', 'type': 'bool', 'value': True, 'tip': "This is a checkbox"},
{'name': 'Color', 'type': 'color', 'value': "#FF0", 'tip': "This is a color button"},
2013-02-10 19:10:30 +00:00
{'name': 'Gradient', 'type': 'colormap'},
2012-07-09 21:14:41 +00:00
{'name': 'Subgroup', 'type': 'group', 'children': [
{'name': 'Sub-param 1', 'type': 'int', 'value': 10},
{'name': 'Sub-param 2', 'type': 'float', 'value': 1.2e6},
]},
{'name': 'Text Parameter', 'type': 'text', 'value': 'Some text...'},
{'name': 'Action Parameter', 'type': 'action', 'tip': 'Click me'},
2012-07-09 21:14:41 +00:00
]},
feature More parameter item types (#1844) * feature More parameter item types Pen: Pops up a dialouge that allows the user to customize a pen. Setting pen value is not working yet. Progress bar: For indication things. Slider: Easier way to set values that dont require precision. Fonts: Picking font types. Next thing could be a Font dialog. Calendar: For picking dates or intervals Open/save file/files/directory: Pops up an open/save file/directory dialog to select a file/directory. Filter string and caption can be defined too. A PenSelectorDialog widget was created for the pen parameter item too. Also added these parameter items to the example. * PyQt/Side6 compatibility fixup * Revisions from intial PR Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialog.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/parametertree/parameterTypes.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/parametertree/parameterTypes.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialog.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Apply suggestions from code review Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> * Bugfix: module instead of class import on param tree example * Enrich the slider parameter * Address pijyoi comments on pen style parameter * Different file picker for easier porting * Better organization and formatting, minor refactoring * PyQt6/PySide6 fixup for file dialog * Minor adjustment to file picker * Bugfix: for 'None' sigChanged 'None' is explicitly allowed for a WidgetParameterItem's `sigChanged` value. However, this raises an error on a changed value unless the commit's fix is applied * Calendar works better as sub item * Fixes bugs in pen parameter's dialog + makes it resizable * more bugfixes and recommended changes, lets pen serialize its options * better pen save state * Fixes file parameter qualms * Fixes font parameter qualms * Fixes calendar parameter qualms * Fixes multiply-defined slider optsChanged * Fixes pen parameter qualms * ptree example minor bugfix * Pen dialog bugfixes * File dialog bugfixes / mild improvements * unto ptree save state regression * file fixup * Adds parameter descriptions to docstrings * Improved parameter documentation * adds 'relativeTo' option for file parameter * Less abuse of Qt enums during or-operations * More uniform handling of relative paths * More cleanup of enum setting * better name for window title (matches qt name) * Favor os.path over pathlib * Exposes 'directory', 'windowTitle' to file parameter * Fixup and add comparison to parameter tree state restoration * Exposes "cosmetic" in pen parameter * Indicate defaults in parameter documentation * QtEnumParameter works for enums outside QtCore.Qt * see if altering pytest report fixes ci bug * Cleanup unused import and redundant `self.widget` assignments Co-authored-by: Fekete Imre <feketeimre87@gmail.com> Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>
2021-07-23 21:40:49 +00:00
{'name': 'Custom Parameter Options', 'type': 'group', 'children': [
{'name': 'Pen', 'type': 'pen', 'value': pg.mkPen(color=(255,0,0), width=2)},
{'name': 'Progress bar', 'type': 'progress', 'value':50, 'limits':(0,100)},
{'name': 'Slider', 'type': 'slider', 'value':50, 'limits':(0,100)},
{'name': 'Font', 'type': 'font', 'value':QtGui.QFont("Inter")},
{'name': 'Calendar', 'type': 'calendar', 'value':QtCore.QDate.currentDate().addMonths(1)},
{'name': 'Open python file', 'type': 'file', 'fileMode': 'ExistingFile', 'nameFilter': 'Python file (*.py);;',
'value': 'parametertree.py', 'relativeTo': os.getcwd(), 'options': ['DontResolveSymlinks']}
]},
2012-07-09 21:14:41 +00:00
{'name': 'Numerical Parameter Options', 'type': 'group', 'children': [
{'name': 'Units + SI prefix', 'type': 'float', 'value': 1.2e-6, 'step': 1e-6, 'siPrefix': True, 'suffix': 'V'},
{'name': 'Limits (min=7;max=15)', 'type': 'int', 'value': 11, 'limits': (7, 15), 'default': -6},
{'name': 'Int suffix', 'type': 'int', 'value': 9, 'suffix': 'V'},
{'name': 'DEC stepping', 'type': 'float', 'value': 1.2e6, 'dec': True, 'step': 1, 'minStep': 1.0e-12, 'siPrefix': True, 'suffix': 'Hz'},
2012-07-09 21:14:41 +00:00
]},
{'name': 'Save/Restore functionality', 'type': 'group', 'children': [
{'name': 'Save State', 'type': 'action'},
{'name': 'Restore State', 'type': 'action', 'children': [
{'name': 'Add missing items', 'type': 'bool', 'value': True},
{'name': 'Remove extra items', 'type': 'bool', 'value': True},
]},
]},
2012-07-09 21:14:41 +00:00
{'name': 'Extra Parameter Options', 'type': 'group', 'children': [
{'name': 'Read-only', 'type': 'float', 'value': 1.2e6, 'siPrefix': True, 'suffix': 'Hz', 'readonly': True},
2020-12-22 07:10:44 +00:00
{'name': 'Disabled', 'type': 'float', 'value': 1.2e6, 'siPrefix': True, 'suffix': 'Hz', 'enabled': False},
2012-07-09 21:14:41 +00:00
{'name': 'Renamable', 'type': 'float', 'value': 1.2e6, 'siPrefix': True, 'suffix': 'Hz', 'renamable': True},
{'name': 'Removable', 'type': 'float', 'value': 1.2e6, 'siPrefix': True, 'suffix': 'Hz', 'removable': True},
]},
2020-05-22 13:17:33 +00:00
{'name': 'Custom context menu', 'type': 'group', 'children': [
{'name': 'List contextMenu', 'type': 'float', 'value': 0, 'context': [
'menu1',
'menu2'
]},
{'name': 'Dict contextMenu', 'type': 'float', 'value': 0, 'context': {
'changeName': 'Title',
'internal': 'What the user sees',
}},
]},
2012-07-09 21:14:41 +00:00
ComplexParameter(name='Custom parameter group (reciprocal values)'),
ScalableGroup(name="Expandable Parameter Group", tip='Click to add children', children=[
2012-07-09 21:14:41 +00:00
{'name': 'ScalableParam 1', 'type': 'str', 'value': "default param 1"},
{'name': 'ScalableParam 2', 'type': 'str', 'value': "default param 2"},
]),
]
## Create tree of Parameter objects
p = Parameter.create(name='params', type='group', children=params)
2012-07-09 21:14:41 +00:00
## If anything changes in the tree, print a message
def change(param, changes):
print("tree changes:")
for param, change, data in changes:
path = p.childPath(param)
if path is not None:
childName = '.'.join(path)
else:
childName = param.name()
print(' parameter: %s'% childName)
print(' change: %s'% change)
print(' data: %s'% str(data))
print(' ----------')
p.sigTreeStateChanged.connect(change)
2014-03-25 17:15:29 +00:00
def valueChanging(param, value):
2015-02-28 16:05:57 +00:00
print("Value changing (not finalized): %s %s" % (param, value))
2014-03-25 17:15:29 +00:00
# Too lazy for recursion:
for child in p.children():
child.sigValueChanging.connect(valueChanging)
for ch2 in child.children():
ch2.sigValueChanging.connect(valueChanging)
def save():
global state
state = p.saveState()
feature More parameter item types (#1844) * feature More parameter item types Pen: Pops up a dialouge that allows the user to customize a pen. Setting pen value is not working yet. Progress bar: For indication things. Slider: Easier way to set values that dont require precision. Fonts: Picking font types. Next thing could be a Font dialog. Calendar: For picking dates or intervals Open/save file/files/directory: Pops up an open/save file/directory dialog to select a file/directory. Filter string and caption can be defined too. A PenSelectorDialog widget was created for the pen parameter item too. Also added these parameter items to the example. * PyQt/Side6 compatibility fixup * Revisions from intial PR Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialog.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/parametertree/parameterTypes.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/parametertree/parameterTypes.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialog.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Apply suggestions from code review Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> * Bugfix: module instead of class import on param tree example * Enrich the slider parameter * Address pijyoi comments on pen style parameter * Different file picker for easier porting * Better organization and formatting, minor refactoring * PyQt6/PySide6 fixup for file dialog * Minor adjustment to file picker * Bugfix: for 'None' sigChanged 'None' is explicitly allowed for a WidgetParameterItem's `sigChanged` value. However, this raises an error on a changed value unless the commit's fix is applied * Calendar works better as sub item * Fixes bugs in pen parameter's dialog + makes it resizable * more bugfixes and recommended changes, lets pen serialize its options * better pen save state * Fixes file parameter qualms * Fixes font parameter qualms * Fixes calendar parameter qualms * Fixes multiply-defined slider optsChanged * Fixes pen parameter qualms * ptree example minor bugfix * Pen dialog bugfixes * File dialog bugfixes / mild improvements * unto ptree save state regression * file fixup * Adds parameter descriptions to docstrings * Improved parameter documentation * adds 'relativeTo' option for file parameter * Less abuse of Qt enums during or-operations * More uniform handling of relative paths * More cleanup of enum setting * better name for window title (matches qt name) * Favor os.path over pathlib * Exposes 'directory', 'windowTitle' to file parameter * Fixup and add comparison to parameter tree state restoration * Exposes "cosmetic" in pen parameter * Indicate defaults in parameter documentation * QtEnumParameter works for enums outside QtCore.Qt * see if altering pytest report fixes ci bug * Cleanup unused import and redundant `self.widget` assignments Co-authored-by: Fekete Imre <feketeimre87@gmail.com> Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>
2021-07-23 21:40:49 +00:00
def restore():
global state
add = p['Save/Restore functionality', 'Restore State', 'Add missing items']
rem = p['Save/Restore functionality', 'Restore State', 'Remove extra items']
p.restoreState(state, addChildren=add, removeChildren=rem)
p.param('Save/Restore functionality', 'Save State').sigActivated.connect(save)
p.param('Save/Restore functionality', 'Restore State').sigActivated.connect(restore)
2012-07-09 21:14:41 +00:00
## Create two ParameterTree widgets, both accessing the same data
t = ParameterTree()
t.setParameters(p, showTop=False)
2013-02-25 04:09:03 +00:00
t.setWindowTitle('pyqtgraph example: Parameter Tree')
2012-07-09 21:14:41 +00:00
t2 = ParameterTree()
t2.setParameters(p, showTop=False)
win = QtGui.QWidget()
layout = QtGui.QGridLayout()
win.setLayout(layout)
layout.addWidget(QtGui.QLabel("These are two views of the same data. They should always display the same values."), 0, 0, 1, 2)
layout.addWidget(t, 1, 0, 1, 1)
layout.addWidget(t2, 1, 1, 1, 1)
win.show()
## test save/restore
feature More parameter item types (#1844) * feature More parameter item types Pen: Pops up a dialouge that allows the user to customize a pen. Setting pen value is not working yet. Progress bar: For indication things. Slider: Easier way to set values that dont require precision. Fonts: Picking font types. Next thing could be a Font dialog. Calendar: For picking dates or intervals Open/save file/files/directory: Pops up an open/save file/directory dialog to select a file/directory. Filter string and caption can be defined too. A PenSelectorDialog widget was created for the pen parameter item too. Also added these parameter items to the example. * PyQt/Side6 compatibility fixup * Revisions from intial PR Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialog.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/parametertree/parameterTypes.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/parametertree/parameterTypes.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialog.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Update pyqtgraph/widgets/PenSelectorDialogbox.py Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> Apply suggestions from code review Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com> * Bugfix: module instead of class import on param tree example * Enrich the slider parameter * Address pijyoi comments on pen style parameter * Different file picker for easier porting * Better organization and formatting, minor refactoring * PyQt6/PySide6 fixup for file dialog * Minor adjustment to file picker * Bugfix: for 'None' sigChanged 'None' is explicitly allowed for a WidgetParameterItem's `sigChanged` value. However, this raises an error on a changed value unless the commit's fix is applied * Calendar works better as sub item * Fixes bugs in pen parameter's dialog + makes it resizable * more bugfixes and recommended changes, lets pen serialize its options * better pen save state * Fixes file parameter qualms * Fixes font parameter qualms * Fixes calendar parameter qualms * Fixes multiply-defined slider optsChanged * Fixes pen parameter qualms * ptree example minor bugfix * Pen dialog bugfixes * File dialog bugfixes / mild improvements * unto ptree save state regression * file fixup * Adds parameter descriptions to docstrings * Improved parameter documentation * adds 'relativeTo' option for file parameter * Less abuse of Qt enums during or-operations * More uniform handling of relative paths * More cleanup of enum setting * better name for window title (matches qt name) * Favor os.path over pathlib * Exposes 'directory', 'windowTitle' to file parameter * Fixup and add comparison to parameter tree state restoration * Exposes "cosmetic" in pen parameter * Indicate defaults in parameter documentation * QtEnumParameter works for enums outside QtCore.Qt * see if altering pytest report fixes ci bug * Cleanup unused import and redundant `self.widget` assignments Co-authored-by: Fekete Imre <feketeimre87@gmail.com> Co-authored-by: ChristophRose <42769515+ChristophRose@users.noreply.github.com>
2021-07-23 21:40:49 +00:00
state = p.saveState()
p.restoreState(state)
compareState = p.saveState()
assert pg.eq(compareState, state)
2012-07-09 21:14:41 +00:00
if __name__ == '__main__':
2021-05-13 21:28:22 +00:00
pg.exec()