Add Qt connection handler for date/time widgets #37
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.
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 theState
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 theState
-side time zones in UTC, since "local time" (the defaultQt.TimeSpec
) is not a very stable concept. There's thus a little bit of manipulation to manage time spec of theQDateTime
that we put into the widget. (In practice I would think most widgets should use UTC - that's what I'm doing in the proposedglue-wwt
update - but better to support ones that don't).