-
Notifications
You must be signed in to change notification settings - Fork 78
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
ENH: Monitor the DISP field of records connected to by PyDMWritableWidget #1011
Conversation
…ts so that puts are correctly disabled to them
pydm/widgets/base.py
Outdated
if value is not None and self._disp_channel != f'{value}.DISP': | ||
if self._disp_channel is not None: | ||
self._disp_channel.disconnect() | ||
self._disp_channel = f'{value}.DISP' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few thoughts:
- An EPICS record-specific thing like this seems like it should only apply to certain protocols (CA, PVA)
- PV names may already include a field name: this could end up being
PV:NAME.VAL.DISP
, couldn't it? - Similarly, PV names may include a channel filter as in e.g.
PV:NAME.[3:5]
- so stripping off the field/filter will be necessary. Fortunately both are guaranteed to be preceded by a.
, sochannel.split(".", 1)[0] if "." in channel else channel
can be sufficient - Python IOCs may not have fields at all depending on how they are configured. I assume if this doesn't connect it's just a no-op, right? So then we just waste a search for each PV of that type.
- I didn't realize disable put didn't manifest itself as showing "read-only" in
cainfo
- that's new and confusing to me. I assume that's where you started and this solution came about because of that?
Thanks for taking a look! For 1, 2, and 3, agreed with all of them, I can update with all of that.
Yes it is just a wasted search, nothing else happens. I considered putting this behind something like a
Yes, this was the very weird one to me too and why I was unsure of this solution. That is basically where I started. Then I tried with |
These cases are handled and tested for now.
After thinking on this further I figured it might be a good idea to add a checkbox for this, since it is actually many wasted name searches as it is a monitor and will keep checking to see if the PV is responding yet. It does have exponential backoff on how often it checks, but having pointless name searches continually go out that the user didn't necessarily ask for doesn't seem great. So 83060e7 adds an option for the user to ask for the DISP field or not, which ensures this new channel will only be created when it is wanted, which covers the protocol case too. If anyone has another idea they like better I could change this back, but I think all the basic functionality should work now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks good to me
This fixes #932.
I still need to add docstrings and a new test case, but just want to get a quick check that this solutions looks reasonable before proceeding.
This sets up an additional monitor on
channel_name.DISP
for any writable widget so that the widget can be disabled with an appropriate tooltip, similar to the way access security is currently handled.If
DISP
is not set, it will timeout in a thread without performance impact, I checked with several displays with write widgets and did not see adverse performance issues.