pydm
pydm copied to clipboard
Add DataKeys.TIMESTAMP in pydm 2.0
It should be possible to propagate timestamp information to widgets.
Consideration for timestamp metadata (like pulse ID) may be advisable as well.
I have heard repeated requests in the past to somehow display the timestamp related to the data shown on a widget (via hover tooltip or right click or something like that). The demand is out there!
Reopening as we still plan to implement that.
I would like to see this, and was wondering if it could simply be a special type of PYDMLabel widget (PYDMTimeLabel?)
@slactasha as an alternative you can use a PyDMDateTimeLabel
along with the PV but selecting the .TIME
field.
That should technically work.
Thanks @hhslepicka! I'll try that today, I admit I've never used that widget before and its purpose is kind of obvious from the name :)
I'm not entirely sure how EPICS records output the timestamp, nor how the timestamp gets updated in PyDM. For context, I'm working on a ui that dynamically changes channels based on the text field of a QLineEdit. Some channels write to my PyDMDateTimeLabel just fine, and it shows the timestamp as expected. Others crash my page and spit out the following error:
File "/afs/slac/g/lcls/package/python/python2.7.13/linux-x86_64/lib/python2.7/site-packages/pydm/widgets/base.py", line 793, in channelValueChanged
self.value_changed(new_val)
File "/afs/slac/g/lcls/package/python/python2.7.13/linux-x86_64/lib/python2.7/site-packages/pydm/widgets/datetime.py", line 175, in value_changed
val = val.addMSecs(new_val)
TypeError: addMSecs(self, int): argument 1 has unexpected type 'unicode'
I'm not sure that .TIME
is universally available, I think only certain well-behaved IOCs support it. However, all monitor events in EPICS come with a timestamp (if you use the right monitor flags). We could (should?) implement the capability for handling timestamps (and passing them along to widgets) at the data plugin level. My only reservation is that we need to be a bit careful to make this stuff optional, because non-EPICS data sources might handle timestamps in a very different way.
This feature was included in PR #911