|
10 | 10 | from .base import PyDMWritableWidget, TextFormatter, str_types, PostParentClassInitSetup |
11 | 11 | from pydm import utilities |
12 | 12 | from .display_format import DisplayFormat, parse_value_for_display |
13 | | -from pydm.utilities import ACTIVE_QT_WRAPPER, QtWrapperTypes |
| 13 | +from pydm.utilities import ACTIVE_QT_WRAPPER, QtWrapperTypes, is_qt_designer |
14 | 14 |
|
15 | 15 | logger = logging.getLogger(__name__) |
16 | 16 |
|
@@ -162,14 +162,26 @@ def send_value(self): |
162 | 162 |
|
163 | 163 | def setReadOnly(self, readOnly): |
164 | 164 | self._user_set_read_only = readOnly |
165 | | - super().setReadOnly(True if self._user_set_read_only else not self._write_access) |
| 165 | + shouldSetReadOnly = True if self._user_set_read_only else (not self._write_access) |
| 166 | + # When in designer and reading in live data (DESIGNER_ONLINE), don't set and therefore save to |
| 167 | + # the ui file readOnly=True setting. While we do want widgets to act in read-only way in designer |
| 168 | + # (so don't accidentally write data during editing), this is handled in the data_plugins themselves. |
| 169 | + if is_qt_designer() and config.DESIGNER_ONLINE: |
| 170 | + shouldSetReadOnly = False |
| 171 | + super().setReadOnly(shouldSetReadOnly) |
166 | 172 |
|
167 | 173 | def write_access_changed(self, new_write_access): |
168 | 174 | """ |
169 | 175 | Change the PyDMLineEdit to read only if write access is denied |
170 | 176 | """ |
171 | 177 | super().write_access_changed(new_write_access) |
172 | 178 | if not self._user_set_read_only: |
| 179 | + shouldSetReadOnly = not new_write_access |
| 180 | + # When in designer and reading in live data (DESIGNER_ONLINE), don't set and therefore save to |
| 181 | + # the ui file readOnly=True setting. While we do want widgets to act in read-only way in designer |
| 182 | + # (so don't accidentally write data during editing), this is handled in the data_plugins themselves. |
| 183 | + if is_qt_designer() and config.DESIGNER_ONLINE: |
| 184 | + shouldSetReadOnly = False |
173 | 185 | super().setReadOnly(not new_write_access) |
174 | 186 |
|
175 | 187 | def unit_changed(self, new_unit): |
|
0 commit comments