Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Qt connection handler for date/time widgets #37

Merged
merged 4 commits into from
May 13, 2024

Conversation

Carifio24
Copy link
Member

@Carifio24 Carifio24 commented Jan 12, 2024

This PR adds an additional Qt connection handler to be used with QDateTimeEdit instances. The immediate use case for this is glue-viz/glue-wwt#103. But I know there has been interest in time manipulation in glue (e.g. time sliders on viewers) so maybe this can be used elsewhere.

The connection uses numpy.datetime64 to represent datetime on the State side. I went with this for consistency - it seems to be what we're already using throughout glue. The connection is relatively straightforward, with the possible exception of time zones. I decided that it would be simplest to store all of the State-side time zones in UTC, since "local time" (the default Qt.TimeSpec) is not a very stable concept. There's thus a little bit of manipulation to manage time spec of the QDateTime that we put into the widget. (In practice I would think most widgets should use UTC - that's what I'm doing in the proposed glue-wwt update - but better to support ones that don't).

Copy link

codecov bot commented Jan 12, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (9747254) 96.74% compared to head (c6c7caa) 96.66%.

Files Patch % Lines
echo/qt/connect.py 81.25% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #37      +/-   ##
==========================================
- Coverage   96.74%   96.66%   -0.09%     
==========================================
  Files          17       17              
  Lines        2182     2247      +65     
==========================================
+ Hits         2111     2172      +61     
- Misses         71       75       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks!

@astrofrog astrofrog merged commit e2f717d into glue-viz:main May 13, 2024
23 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants