Repository navigation
Pass the date value to the DateItem display callback - #128
Merged
Merged
Conversation
DateWidget forwarded the raw argument of the dateTimeChanged signal to the display callback: a QDateTime object, whose type depends on the Qt binding, instead of the value of the item. Pass the Python value of the widget (datetime.date), like DateTimeWidget and the other widgets. Callbacks relying on the previous QDateTime argument must be updated. Refs #126 Assisted-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #126.
Problem
DateWidget.date_changed()forwarded the raw argument of thedateTimeChangedsignal to thedisplaycallback of aDateItem. The callback therefore received aQDateTimeobject instead of the value of the item, and its type depends on the Qt binding (PyQt5, PyQt6 or PySide6).Since #127, the callback of
DateTimeItemreceives adatetime.datetime, soDateItemwas the only date item still receiving a Qt object.Fix
DateWidget.date_changed()now passes the Python value of the widget (self.value(), adatetime.date) to the callback, exactly likeDateTimeWidgetand the other widgets.Behavior change: callbacks relying on the previous
QDateTimeargument must be updated. The release notes mention it. NoDateItemwith adisplaycallback was found in PlotPy, Sigima, DataLab, DataLab-Web or the DataLab plugins. Callbacks reading the value from the dataset instance are not affected, because the dataset is updated before the callback is called. Shipping this in 3.17.0, a minor release, keeps the date items consistent in this version.Tests
test_date_display_callbackinguidata/tests/unit/test_datetime_display_callback.py: changing the date calls the callback once with adatetime.date, and the dataset is already updated. Without the fix, it fails because the callback receives aQDateTime.Local validation (Windows):
ruff check/ruff format --check: clean.Release notes
Entry added to
doc/release_notes/release_3.17.md(bug fixes).