echo icon indicating copy to clipboard operation
echo copied to clipboard

Add Qt connection handler for date/time widgets

Open Carifio24 opened this issue 1 year ago • 1 comments

This PR adds an additional Qt connection handler to be used with QDateTimeEdit instances. The immediate use case for this is https://github.com/glue-viz/glue-wwt/pull/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).

Carifio24 avatar Jan 12 '24 08:01 Carifio24

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 :warning:
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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 12 '24 08:01 codecov[bot]