Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca195b0003 | ||
| b66a8657d9 | |||
| e4213dfaee | |||
| 13fa5c0f2e | |||
| c0dd0c6038 | |||
| 0f62863828 | |||
| ab8534c62a | |||
| 9852226d3b | |||
| 434679d9ce | |||
| f229ba2059 | |||
| c06bc4f58e | |||
| 3e5255c55e | |||
| 8ae83b2ea6 | |||
| 49be032511 | |||
| 4b5f911c10 | |||
| 727b48e1c6 | |||
| d997517dc1 | |||
| 68e8da943e | |||
| bf08fbe488 | |||
| f335663b55 | |||
| 9829be0bcd | |||
| 14400488a3 | |||
| 76528ed3c0 | |||
| 9beed3ff90 | |||
| 53a0f6495d | |||
| fee2e64bb3 | |||
| 15394066ed | |||
| 0441a79305 | |||
| 2f0e9aefee | |||
| d148f6777f | |||
| c95afc03b5 | |||
| a830a1a44b | |||
| 952cff5002 | |||
| 681761ca40 | |||
| 20b6749ed4 | |||
| fa33a4479d | |||
| 54b332f69d | |||
| 0ff5ca7b49 | |||
| 76a6f28136 | |||
| 3c408ebcbd | |||
| 420f82563f | |||
| b2ad43abb0 | |||
| 75dc1e5e51 | |||
| d9167d044f | |||
| 4c151a8cd0 | |||
| 7f1981aac7 | |||
| d9f098582f | |||
| d865b9eba7 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,5 +1,7 @@
|
|||||||
# Temporary editor files #
|
|
||||||
##########################
|
|
||||||
*~
|
*~
|
||||||
|
*.*:*
|
||||||
*.-*
|
*.*-
|
||||||
|
*.*-*
|
||||||
|
*.-*
|
||||||
|
__pycache__
|
||||||
|
__pycache__/*.*
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
71
pvgateway.py
71
pvgateway.py
@@ -96,6 +96,7 @@ class PVGateway(QWidget):
|
|||||||
notify_unison: bool = False, precision: int = 0,
|
notify_unison: bool = False, precision: int = 0,
|
||||||
monitor_dbr_time: bool = False):
|
monitor_dbr_time: bool = False):
|
||||||
|
|
||||||
|
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
if parent is None:
|
if parent is None:
|
||||||
@@ -112,7 +113,7 @@ class PVGateway(QWidget):
|
|||||||
1000 / self.notify_freq_hz
|
1000 / self.notify_freq_hz
|
||||||
|
|
||||||
self.notify_unison = bool(notify_unison) and bool(self.notify_freq_hz)
|
self.notify_unison = bool(notify_unison) and bool(self.notify_freq_hz)
|
||||||
|
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.settings = self.parent.settings
|
self.settings = self.parent.settings
|
||||||
|
|
||||||
@@ -120,6 +121,8 @@ class PVGateway(QWidget):
|
|||||||
|
|
||||||
self.color_mode = None
|
self.color_mode = None
|
||||||
|
|
||||||
|
self.check_rtyp = False
|
||||||
|
|
||||||
if color_mode is not None:
|
if color_mode is not None:
|
||||||
if color_mode in (self.ACT_ON_BEAM,
|
if color_mode in (self.ACT_ON_BEAM,
|
||||||
self.NOT_ACT_ON_BEAM,
|
self.NOT_ACT_ON_BEAM,
|
||||||
@@ -129,6 +132,10 @@ class PVGateway(QWidget):
|
|||||||
|
|
||||||
self.color_mode_requested = self.color_mode
|
self.color_mode_requested = self.color_mode
|
||||||
|
|
||||||
|
#if 'READ' in self.pv_name:
|
||||||
|
#print('color mode',self.pv_name, self.color_mode,
|
||||||
|
#self.color_mode_requested )
|
||||||
|
|
||||||
if monitor_callback is not None:
|
if monitor_callback is not None:
|
||||||
self.monitor_callback = monitor_callback
|
self.monitor_callback = monitor_callback
|
||||||
else:
|
else:
|
||||||
@@ -143,9 +150,13 @@ class PVGateway(QWidget):
|
|||||||
self.cafe = self.parent.cafe
|
self.cafe = self.parent.cafe
|
||||||
self.cyca = self.parent.cyca
|
self.cyca = self.parent.cyca
|
||||||
|
|
||||||
|
self.url_archiver = None
|
||||||
|
self.url_databuffer = None
|
||||||
|
|
||||||
if self.parent.settings is not None:
|
if self.parent.settings is not None:
|
||||||
self.url_archiver = self.parent.settings.data["url"]["archiver"]
|
self.url_archiver = self.parent.settings.data["url"]["archiver"]
|
||||||
self.url_databuffer = self.parent.settings.data["url"]["databuffer"]
|
if "databuffer" in self.parent.settings.data["url"]:
|
||||||
|
self.url_databuffer = self.parent.settings.data["url"]["databuffer"]
|
||||||
self.bg_readback = self.parent.settings.data["StyleGuide"][
|
self.bg_readback = self.parent.settings.data["StyleGuide"][
|
||||||
"bgReadback"]
|
"bgReadback"]
|
||||||
self.fg_alarm_major = self.parent.settings.data["StyleGuide"][
|
self.fg_alarm_major = self.parent.settings.data["StyleGuide"][
|
||||||
@@ -158,10 +169,10 @@ class PVGateway(QWidget):
|
|||||||
"fgAlarmNoAlarm"]
|
"fgAlarmNoAlarm"]
|
||||||
else:
|
else:
|
||||||
#self.settings = ReadJSON(self.parent.appname)
|
#self.settings = ReadJSON(self.parent.appname)
|
||||||
self.url_archiver = ("https://ui-data-api.psi.ch/prepare?channel=" +
|
self.url_archiver = ("https://data-ui.psi.ch/preselect?c1=" +
|
||||||
"sf-archiverappliance/")
|
"sf-archiverappliance/")
|
||||||
self.url_databuffer \
|
self.url_databuffer \
|
||||||
= "https://ui-data-api.psi.ch/prepare?channel=sf-databuffer/"
|
= "https://data-ui.psi.ch/preselect?c1=sf-databuffer/"
|
||||||
|
|
||||||
self.daq_group_name = self._DAQ_CAFE_SG_NAME
|
self.daq_group_name = self._DAQ_CAFE_SG_NAME
|
||||||
self.desc = None
|
self.desc = None
|
||||||
@@ -176,6 +187,7 @@ class PVGateway(QWidget):
|
|||||||
self.monitor_id = None
|
self.monitor_id = None
|
||||||
self.monitor_dbr_time = monitor_dbr_time
|
self.monitor_dbr_time = monitor_dbr_time
|
||||||
self.mutex_post_display = QMutex()
|
self.mutex_post_display = QMutex()
|
||||||
|
self.mutex = QMutex()
|
||||||
|
|
||||||
self.precision_user = precision
|
self.precision_user = precision
|
||||||
self.has_precision_user = bool(precision)
|
self.has_precision_user = bool(precision)
|
||||||
@@ -266,23 +278,20 @@ class PVGateway(QWidget):
|
|||||||
|
|
||||||
action1 = QAction("Text Info", self)
|
action1 = QAction("Text Info", self)
|
||||||
action1.triggered.connect(self.pv_status_text)
|
action1.triggered.connect(self.pv_status_text)
|
||||||
|
self.context_menu.addAction(action1)
|
||||||
action2 = QAction("Lookup in Archiver", self)
|
action2 = QAction("Lookup in Archiver", self)
|
||||||
action2.triggered.connect(self.lookup_archiver)
|
action2.triggered.connect(self.lookup_archiver)
|
||||||
|
self.context_menu.addAction(action2)
|
||||||
action3 = QAction("Lookup in Databuffer", self)
|
if self.url_databuffer is not None:
|
||||||
action3.triggered.connect(self.lookup_databuffer)
|
action3 = QAction("Lookup in Databuffer", self)
|
||||||
|
action3.triggered.connect(self.lookup_databuffer)
|
||||||
|
self.context_menu.addAction(action3)
|
||||||
action4 = QAction("Strip Chart (PShell)", self)
|
action4 = QAction("Strip Chart (PShell)", self)
|
||||||
action4.triggered.connect(self.strip_chart)
|
action4.triggered.connect(self.strip_chart)
|
||||||
|
self.context_menu.addAction(action4)
|
||||||
action6 = QAction("Configure Display Parameters", self)
|
action6 = QAction("Configure Display Parameters", self)
|
||||||
action6.triggered.connect(self.display_parameters)
|
action6.triggered.connect(self.display_parameters)
|
||||||
|
|
||||||
self.context_menu.addAction(action1)
|
|
||||||
self.context_menu.addAction(action2)
|
|
||||||
self.context_menu.addAction(action3)
|
|
||||||
self.context_menu.addAction(action4)
|
|
||||||
|
|
||||||
action5 = QAction("Reconnect: {0}".format(self.pv_name), self)
|
action5 = QAction("Reconnect: {0}".format(self.pv_name), self)
|
||||||
action5.triggered.connect(self.reconnect_channel)
|
action5.triggered.connect(self.reconnect_channel)
|
||||||
@@ -310,6 +319,7 @@ class PVGateway(QWidget):
|
|||||||
#The __init__ method of a class is used to initialize new objects,
|
#The __init__ method of a class is used to initialize new objects,
|
||||||
#not create them. As such, it should not return any value.
|
#not create them. As such, it should not return any value.
|
||||||
|
|
||||||
|
|
||||||
return #self # used by pvgateway in CAQStripChart
|
return #self # used by pvgateway in CAQStripChart
|
||||||
|
|
||||||
|
|
||||||
@@ -378,7 +388,7 @@ class PVGateway(QWidget):
|
|||||||
|
|
||||||
if self.pv_info is None:
|
if self.pv_info is None:
|
||||||
self.pv_info = self.cafe.getChannelInfo(self.pv_name)
|
self.pv_info = self.cafe.getChannelInfo(self.pv_name)
|
||||||
if "Not Supported" in self.pv_info.className:
|
if "Not Supported" in self.pv_info.className and self.check_rtyp:
|
||||||
_rtype = self.cafe.get(self.pv_name.split(".")[0] + ".RTYP")
|
_rtype = self.cafe.get(self.pv_name.split(".")[0] + ".RTYP")
|
||||||
self.record_type = _rtype if _rtype is not None else \
|
self.record_type = _rtype if _rtype is not None else \
|
||||||
self.pv_info.className
|
self.pv_info.className
|
||||||
@@ -411,8 +421,9 @@ class PVGateway(QWidget):
|
|||||||
_max_control_abs = 0
|
_max_control_abs = 0
|
||||||
|
|
||||||
if self.pv_ctrl is not None:
|
if self.pv_ctrl is not None:
|
||||||
_lower_control_abs = abs(int(self.pv_ctrl.lowerControlLimit))
|
#DisplayLimit preferred over ControlLimit as latter n/a for ao
|
||||||
_upper_control_abs = abs(int(self.pv_ctrl.upperControlLimit))
|
_lower_control_abs = abs(int(self.pv_ctrl.lowerDisplayLimit))
|
||||||
|
_upper_control_abs = abs(int(self.pv_ctrl.upperDisplayLimit))
|
||||||
_max_control_abs = max(_lower_control_abs, _upper_control_abs)
|
_max_control_abs = max(_lower_control_abs, _upper_control_abs)
|
||||||
if _max_control_abs is None:
|
if _max_control_abs is None:
|
||||||
_max_control_abs = 0
|
_max_control_abs = 0
|
||||||
@@ -487,7 +498,7 @@ class PVGateway(QWidget):
|
|||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
self.initialize_meta_data()
|
self.initialize_meta_data()
|
||||||
icount += 1
|
icount += 1
|
||||||
if icount > 50:
|
if icount > 5: #50
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -573,10 +584,11 @@ class PVGateway(QWidget):
|
|||||||
|
|
||||||
if status == self.cyca.ICAFE_CS_CONN:
|
if status == self.cyca.ICAFE_CS_CONN:
|
||||||
self.initialize_connect = True
|
self.initialize_connect = True
|
||||||
|
time.sleep(0.01)
|
||||||
self.pv_ctrl = self.cafe.getCtrlCache(self.handle)
|
self.pv_ctrl = self.cafe.getCtrlCache(self.handle)
|
||||||
self.pv_info = self.cafe.getChannelInfo(self.handle)
|
self.pv_info = self.cafe.getChannelInfo(self.handle)
|
||||||
if self.pv_info is not None and self.record_type is None:
|
if self.pv_info is not None and self.record_type is None:
|
||||||
if "Not Supported" in self.pv_info.className:
|
if "Not Supported" in self.pv_info.className and self.check_rtyp:
|
||||||
_rtype = self.cafe.get(self.pv_name.split(".")[0] + ".RTYP")
|
_rtype = self.cafe.get(self.pv_name.split(".")[0] + ".RTYP")
|
||||||
self.record_type = _rtype if _rtype is not None else \
|
self.record_type = _rtype if _rtype is not None else \
|
||||||
self.pv_info.className
|
self.pv_info.className
|
||||||
@@ -623,7 +635,7 @@ class PVGateway(QWidget):
|
|||||||
DAQ may be in BS mode, but channels within DAQ stream that
|
DAQ may be in BS mode, but channels within DAQ stream that
|
||||||
are not BS enabled will be flagged as CA Mode, i.e., CARead
|
are not BS enabled will be flagged as CA Mode, i.e., CARead
|
||||||
'''
|
'''
|
||||||
|
|
||||||
_current_qt_dynamic_property = self.qt_dynamic_property_get()
|
_current_qt_dynamic_property = self.qt_dynamic_property_get()
|
||||||
|
|
||||||
alarm_severity = daq_pvd.alarmSeverity
|
alarm_severity = daq_pvd.alarmSeverity
|
||||||
@@ -697,7 +709,7 @@ class PVGateway(QWidget):
|
|||||||
|
|
||||||
|
|
||||||
def receive_monitor_dbr_time(self, pvdata, alarm_severity):
|
def receive_monitor_dbr_time(self, pvdata, alarm_severity):
|
||||||
print("called from gateway", self.pv_name, alarm_severity)
|
print("called from gateway", self.pv_name, alarm_severity, flush=True)
|
||||||
pvdata.show()
|
pvdata.show()
|
||||||
|
|
||||||
def receive_monitor_update(self, value, status, alarm_severity):
|
def receive_monitor_update(self, value, status, alarm_severity):
|
||||||
@@ -754,6 +766,8 @@ class PVGateway(QWidget):
|
|||||||
'''Callback function to be invoked on change of pv value.
|
'''Callback function to be invoked on change of pv value.
|
||||||
cafe.getCache and cafe.set operations permitted within callback.
|
cafe.getCache and cafe.set operations permitted within callback.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
self.mutex.lock()
|
||||||
|
|
||||||
pv_name = pvname
|
pv_name = pvname
|
||||||
pvd = pvdata
|
pvd = pvdata
|
||||||
@@ -785,8 +799,8 @@ class PVGateway(QWidget):
|
|||||||
else:
|
else:
|
||||||
self.trigger_monitor_float.emit(float(pvd.value[0]), pvd.status,
|
self.trigger_monitor_float.emit(float(pvd.value[0]), pvd.status,
|
||||||
_alarm_severity)
|
_alarm_severity)
|
||||||
|
self.mutex.unlock()
|
||||||
|
|
||||||
def monitor_start(self):
|
def monitor_start(self):
|
||||||
'''Initiate monitor on pv.'''
|
'''Initiate monitor on pv.'''
|
||||||
if self.handle > 0:
|
if self.handle > 0:
|
||||||
@@ -942,6 +956,8 @@ class PVGateway(QWidget):
|
|||||||
elif self.qt_object_name == self.PV_DAQ_BS:
|
elif self.qt_object_name == self.PV_DAQ_BS:
|
||||||
self.color_mode = self.READBACK_STATIC
|
self.color_mode = self.READBACK_STATIC
|
||||||
|
|
||||||
|
#if 'READ' in self.pv_name:
|
||||||
|
# print('color mode',self.pv_name, self.color_mode)
|
||||||
self._qt_dynamic_property_set(self.color_mode)
|
self._qt_dynamic_property_set(self.color_mode)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -985,7 +1001,6 @@ class PVGateway(QWidget):
|
|||||||
self._qt_readback_color_mode()
|
self._qt_readback_color_mode()
|
||||||
#self.setStatusTip(self.status_tip)
|
#self.setStatusTip(self.status_tip)
|
||||||
|
|
||||||
|
|
||||||
elif self.qt_object_name == self.PV_CONTROLLER:
|
elif self.qt_object_name == self.PV_CONTROLLER:
|
||||||
if self.color_mode == self.ACT_ON_BEAM:
|
if self.color_mode == self.ACT_ON_BEAM:
|
||||||
#self.setStatusTip("PV setting acts directly on beam")
|
#self.setStatusTip("PV setting acts directly on beam")
|
||||||
@@ -994,7 +1009,6 @@ class PVGateway(QWidget):
|
|||||||
self.color_mode = self.NOT_ACT_ON_BEAM
|
self.color_mode = self.NOT_ACT_ON_BEAM
|
||||||
#self.setStatusTip("PV setting does not influence beam")
|
#self.setStatusTip("PV setting does not influence beam")
|
||||||
|
|
||||||
|
|
||||||
#self._qt_property_selected =
|
#self._qt_property_selected =
|
||||||
self._qt_dynamic_property_set(self.color_mode)
|
self._qt_dynamic_property_set(self.color_mode)
|
||||||
|
|
||||||
@@ -1332,7 +1346,7 @@ class PVGateway(QWidget):
|
|||||||
if self.pv_info is None:
|
if self.pv_info is None:
|
||||||
self.pv_info = self.cafe.getChannelInfo(self.handle)
|
self.pv_info = self.cafe.getChannelInfo(self.handle)
|
||||||
if self.pv_info is not None and self.record_type is None:
|
if self.pv_info is not None and self.record_type is None:
|
||||||
if "Not Supported" in self.pv_info.className:
|
if "Not Supported" in self.pv_info.className and self.check_rtyp:
|
||||||
_rtype = self.cafe.get(self.pv_name.split(".")[0] + ".RTYP")
|
_rtype = self.cafe.get(self.pv_name.split(".")[0] + ".RTYP")
|
||||||
self.record_type = _rtype if _rtype is not None else \
|
self.record_type = _rtype if _rtype is not None else \
|
||||||
self.pv_info.className
|
self.pv_info.className
|
||||||
@@ -1376,7 +1390,7 @@ class PVGateway(QWidget):
|
|||||||
if self.pv_info is None:
|
if self.pv_info is None:
|
||||||
self.pv_info = self.cafe.getChannelInfo(self.handle)
|
self.pv_info = self.cafe.getChannelInfo(self.handle)
|
||||||
if self.pv_info is not None and self.record_type is None:
|
if self.pv_info is not None and self.record_type is None:
|
||||||
if "Not Supported" in self.pv_info.className:
|
if "Not Supported" in self.pv_info.className and self.check_rtyp:
|
||||||
_rtype = self.cafe.get(self.pv_name.split(".")[0] + ".RTYP")
|
_rtype = self.cafe.get(self.pv_name.split(".")[0] + ".RTYP")
|
||||||
self.record_type = _rtype if _rtype is not None else \
|
self.record_type = _rtype if _rtype is not None else \
|
||||||
self.pv_info.className
|
self.pv_info.className
|
||||||
@@ -1481,8 +1495,7 @@ class PVGateway(QWidget):
|
|||||||
self.pv_status_text_display_limits())
|
self.pv_status_text_display_limits())
|
||||||
|
|
||||||
self.pv_message_in_a_box.setText(
|
self.pv_message_in_a_box.setText(
|
||||||
self.pv_status_text_header(source=_source) + _text_data
|
self.pv_status_text_header(source=_source) + _text_data)
|
||||||
)
|
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
self.pv_message_in_a_box.exec()
|
self.pv_message_in_a_box.exec()
|
||||||
|
|
||||||
|
|||||||
1690
pvgateway.py-
1690
pvgateway.py-
File diff suppressed because it is too large
Load Diff
768
pvwidgets.py
768
pvwidgets.py
File diff suppressed because it is too large
Load Diff
3112
pvwidgets.py-
3112
pvwidgets.py-
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user