Add updatePristineValues arg to Parameter.setDefault#2853
Add updatePristineValues arg to Parameter.setDefault#2853outofculture merged 27 commits intopyqtgraph:masterfrom
Conversation
- extensive testing - raise appropriate ValueErrors when a parameter lacks a value or default - small cleanups around area of work
| Parameter.__init__(self, *args, **kargs) | ||
| @property | ||
| def itemClass(self): | ||
| from .bool import BoolParameterItem |
Check notice
Code scanning / CodeQL
Cyclic import
| @property | ||
| def itemClass(self): | ||
| from .bool import BoolParameterItem | ||
| from .numeric import NumericParameterItem |
Check notice
Code scanning / CodeQL
Cyclic import
| def itemClass(self): | ||
| from .bool import BoolParameterItem | ||
| from .numeric import NumericParameterItem | ||
| from .str import StrParameterItem |
Check notice
Code scanning / CodeQL
Cyclic import
| # with pytest.raises(ValueError): | ||
| # p.setToDefault() |
Check notice
Code scanning / CodeQL
Commented-out code
|
@ntjess want to look over this one? 😅 |
|
Is there a reason |
Good point. I was working back from the thought that there wasn't a generic widget that would make sense for editing a typeless parameter, but I hadn't considered that Parameters are useful outside of an interactive widget. The |
| except ImportError: | ||
| try: | ||
| from PySide6 import QtCore, QtGui, QtWidgets | ||
| from PySide6 import QtCore, QtGui, QtSvg, QtTest, QtWidgets |
There was a problem hiding this comment.
Curious what the motivation here is for these extra imports? I'm not seeing them referenced elsewhere in the PR.
There was a problem hiding this comment.
I noticed while looking at a test that the pyi file was incomplete; we already import both of these in the actual Qt/__init__.py file. Though, now that I'm looking at it closer, they're both imported in blocks of
try:
from PySide6 import QtTest
except ImportError as err:
QtTest = FailedImport(err)I don't know why QtTest wouldn't be available for import, but I'm guessing that maybe there are stripped-down distributions that don't include it? I don't know what that should mean for the pyi file, though. Probably any development environment is going to include the full qt library, which is what this file is intended for. However, the type-checking is going to run everywhere, regardless, and might throw an ImportError. Maybe I should just skip this and accept the lack of type hints... Thoughts?
There was a problem hiding this comment.
Huh, QtTest is shown as being present in PySide6-essentials https://pypi.org/project/PySide6-Essentials/
That's weird it's not included, would it be under a different module or something?
There was a problem hiding this comment.
the import worked fine on my machine just now?
In [1]: from PySide6 import QtTest
In [2]: import PySide6
In [3]: PySide6.__version__
Out[3]: '6.6.2'
In [4]:
There was a problem hiding this comment.
okay then, I say we tentatively go forward with importing like this in the pyi and expecting that nothing will blow up. I'll put in an issue to clean up Qt.py to keep it isolated.
When a Parameter has its default changed, the value could change to match unless it has previously been modified by the user. The
updatePristineValuesargument will turn this behavior on, currently defaulting to False.valueModifiedSinceResetToDefaultmethod, a necessary part of the implementation, but also a nice feature for possible application logic.hasValuemethod, to be better able to distinguish when a Parameter has an explicit value set.value()anddefaultValue()while they're respectively null.'values'to specify the limits of a ListParameter.Other Tasks
Bump Dependency Versions
Files that need updates
Confirm the following files have been either updated or there has been a determination that no update is needed.
README.mdsetup.pytox.ini.github/workflows/main.ymland associatedrequirements.txtand condaenvironemt.ymlfilespyproject.tomlbinder/requirements.txtPre-Release Checklist
Pre Release Checklist
__init__.pyCHANGELOGprimarily using contents from automated changelog generation in GitHub release pagePost-Release Checklist
Steps To Complete
.dev0to__version__in__init__.py