Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def send_access_state(self, read_access, write_access, *args, **kws):
if is_read_only():
self.write_access_signal.emit(False)
return
if write_access is not None:
self.write_access_signal.emit(write_access)
def send_access_state(self, read_access, write_access, *args, **kws):
if is_read_only():
self.write_access_signal.emit(False)
return
if write_access is not None:
self.write_access_signal.emit(write_access)
def is_read_only(self):
warnings.warn("'PyDMApplication.is_read_only' is deprecated, "
"use 'pydm.data_plugins.is_read_only' instead.")
return data_plugins.is_read_only()
def put_value(self, new_val):
if is_read_only():
return
if self.pv.write_access:
try:
self.pv.put(new_val)
except Exception as e:
logger.exception("Unable to put %s to %s. Exception: %s",
new_val, self.pv.pvname, str(e))
def check_enable_state(self):
"""
Checks whether or not the widget should be disable.
This method also disables the widget and add a Tool Tip
with the reason why it is disabled.
"""
status = self._write_access and self._connected and self._has_enums
tooltip = ""
if not self._connected:
tooltip += "Channel is disconnected."
elif not self._write_access:
if data_plugins.is_read_only():
tooltip += "Running PyDM on Read-Only mode."
else:
tooltip += "Access denied by Channel Access Security."
elif not self._has_enums:
tooltip += "Enums not available."
self.setToolTip(tooltip)
self.setEnabled(status)
def check_enable_state(self):
"""
Checks whether or not the widget should be disable.
This method also disables the widget and add a Tool Tip
with the reason why it is disabled.
"""
status = self._write_access and self._connected
tooltip = self.restore_original_tooltip()
if not self._connected:
if tooltip != '':
tooltip += '\n'
tooltip += "PV is disconnected."
elif not self._write_access:
if tooltip != '':
tooltip += '\n'
if data_plugins.is_read_only():
tooltip += "Running PyDM on Read-Only mode."
else:
tooltip += "Access denied by Channel Access Security."
self.setToolTip(tooltip)
self.setEnabled(status)