Skip to content

PyDMLineEdit can get saved as read-only if marked explicitly as not read-only #1247

Open
@ZLLentz

Description

@ZLLentz

Describe the bug

There is a series of actions which will result in a user's PyDMLineEdit getting stuck as read-only.

The resulting widget will not be greyed out (it will be enabled and will look writeable), but the user will be unable to get a cursor or type anything when they click on the widget.

The source of this is a discrepancy between how the widgets load in designer and how the widgets load in pydm proper, plus some nuances with how designer saves files.

I am so far unable to figure out exactly why this happens, but:

  • In PyDM, a wigdet with readOnly -> False results in readOnly -> False after all the ui loads, access callbacks, etc.
  • In Designer, a widget with readOnly -> False results in readOnly -> True after all the loading

This isn't a problem except for a quirk in designer: if a parameter is explicitly set, its value will be included in the ui file on save. So, if you explicitly set the value to False (unchecked), but it becomes True (checked) automatically the next time you open the ui file, the next time you save your file in this new session it will save as True, breaking your screen.

To avoid this, one must edit the ui file to remove references to the readOnly property.

Steps to reproduce

  • Pick any PV that you have write access to
  • Open designer
  • Create a ui file with a PyDMLineEdit widget with this PV as the channel
  • Set readOnly to explicitly unchecked (not default unchecked)
  • Save the file
  • Open the file
  • Edit anything else aside from readOnly, save the file
  • Open the screen, the widget will now be stuck at readOnly

Expected behavior

A widget marked as readOnly = False should be writeable.

Operating System.

Linux

OS Version Details.

rhel7 and rocky9

Python Version

Python 3.9

Packages Version

PyDM v1.25.1
Numpy v1.26.4
PyQt v5.15.9
Qt v5.15.8
PyQtGraph v0.13.7

Additional context.

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions