Compare commits
15 Commits
pre_v1.3.0
...
v1.9.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 20b6749ed4 | |||
| fa33a4479d | |||
| 54b332f69d | |||
| 0ff5ca7b49 | |||
| 76a6f28136 | |||
| 3c408ebcbd | |||
| 420f82563f | |||
| b2ad43abb0 | |||
| 75dc1e5e51 | |||
| d9167d044f | |||
| 4c151a8cd0 | |||
| 7f1981aac7 | |||
| d9f098582f | |||
| d865b9eba7 | |||
| 9b53c2d618 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,5 +1,7 @@
|
||||
# Temporary editor files #
|
||||
##########################
|
||||
*~
|
||||
|
||||
*.-*
|
||||
*.*:*
|
||||
*.*-
|
||||
*.*-*
|
||||
*.-*
|
||||
__pycache__
|
||||
__pycache__/*.*
|
||||
|
||||
Binary file not shown.
Binary file not shown.
75
pvgateway.py
75
pvgateway.py
@@ -96,6 +96,7 @@ class PVGateway(QWidget):
|
||||
notify_unison: bool = False, precision: int = 0,
|
||||
monitor_dbr_time: bool = False):
|
||||
|
||||
|
||||
super().__init__()
|
||||
|
||||
if parent is None:
|
||||
@@ -112,7 +113,7 @@ class PVGateway(QWidget):
|
||||
1000 / self.notify_freq_hz
|
||||
|
||||
self.notify_unison = bool(notify_unison) and bool(self.notify_freq_hz)
|
||||
|
||||
|
||||
self.parent = parent
|
||||
self.settings = self.parent.settings
|
||||
|
||||
@@ -120,6 +121,8 @@ class PVGateway(QWidget):
|
||||
|
||||
self.color_mode = None
|
||||
|
||||
self.check_rtyp = False
|
||||
|
||||
if color_mode is not None:
|
||||
if color_mode in (self.ACT_ON_BEAM,
|
||||
self.NOT_ACT_ON_BEAM,
|
||||
@@ -129,6 +132,10 @@ class PVGateway(QWidget):
|
||||
|
||||
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:
|
||||
self.monitor_callback = monitor_callback
|
||||
else:
|
||||
@@ -143,9 +150,13 @@ class PVGateway(QWidget):
|
||||
self.cafe = self.parent.cafe
|
||||
self.cyca = self.parent.cyca
|
||||
|
||||
self.url_archiver = None
|
||||
self.url_databuffer = None
|
||||
|
||||
if self.parent.settings is not None:
|
||||
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"][
|
||||
"bgReadback"]
|
||||
self.fg_alarm_major = self.parent.settings.data["StyleGuide"][
|
||||
@@ -158,10 +169,10 @@ class PVGateway(QWidget):
|
||||
"fgAlarmNoAlarm"]
|
||||
else:
|
||||
#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/")
|
||||
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.desc = None
|
||||
@@ -176,6 +187,7 @@ class PVGateway(QWidget):
|
||||
self.monitor_id = None
|
||||
self.monitor_dbr_time = monitor_dbr_time
|
||||
self.mutex_post_display = QMutex()
|
||||
self.mutex = QMutex()
|
||||
|
||||
self.precision_user = precision
|
||||
self.has_precision_user = bool(precision)
|
||||
@@ -266,23 +278,20 @@ class PVGateway(QWidget):
|
||||
|
||||
action1 = QAction("Text Info", self)
|
||||
action1.triggered.connect(self.pv_status_text)
|
||||
|
||||
self.context_menu.addAction(action1)
|
||||
action2 = QAction("Lookup in Archiver", self)
|
||||
action2.triggered.connect(self.lookup_archiver)
|
||||
|
||||
action3 = QAction("Lookup in Databuffer", self)
|
||||
action3.triggered.connect(self.lookup_databuffer)
|
||||
|
||||
self.context_menu.addAction(action2)
|
||||
if self.url_databuffer is not None:
|
||||
action3 = QAction("Lookup in Databuffer", self)
|
||||
action3.triggered.connect(self.lookup_databuffer)
|
||||
self.context_menu.addAction(action3)
|
||||
action4 = QAction("Strip Chart (PShell)", self)
|
||||
action4.triggered.connect(self.strip_chart)
|
||||
|
||||
self.context_menu.addAction(action4)
|
||||
action6 = QAction("Configure Display Parameters", self)
|
||||
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.triggered.connect(self.reconnect_channel)
|
||||
@@ -307,8 +316,11 @@ class PVGateway(QWidget):
|
||||
self.pv_message_in_a_box.setDefaultButton(QMessageBox.Close)
|
||||
|
||||
self.initialize()
|
||||
|
||||
#return self - previously used by pvgateway
|
||||
#The __init__ method of a class is used to initialize new objects,
|
||||
#not create them. As such, it should not return any value.
|
||||
|
||||
|
||||
return #self # used by pvgateway in CAQStripChart
|
||||
|
||||
|
||||
def initialize(self):
|
||||
@@ -376,7 +388,7 @@ class PVGateway(QWidget):
|
||||
|
||||
if self.pv_info is None:
|
||||
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")
|
||||
self.record_type = _rtype if _rtype is not None else \
|
||||
self.pv_info.className
|
||||
@@ -409,8 +421,9 @@ class PVGateway(QWidget):
|
||||
_max_control_abs = 0
|
||||
|
||||
if self.pv_ctrl is not None:
|
||||
_lower_control_abs = abs(int(self.pv_ctrl.lowerControlLimit))
|
||||
_upper_control_abs = abs(int(self.pv_ctrl.upperControlLimit))
|
||||
#DisplayLimit preferred over ControlLimit as latter n/a for ao
|
||||
_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)
|
||||
if _max_control_abs is None:
|
||||
_max_control_abs = 0
|
||||
@@ -485,7 +498,7 @@ class PVGateway(QWidget):
|
||||
time.sleep(0.01)
|
||||
self.initialize_meta_data()
|
||||
icount += 1
|
||||
if icount > 50:
|
||||
if icount > 5: #50
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -574,7 +587,7 @@ class PVGateway(QWidget):
|
||||
self.pv_ctrl = self.cafe.getCtrlCache(self.handle)
|
||||
self.pv_info = self.cafe.getChannelInfo(self.handle)
|
||||
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")
|
||||
self.record_type = _rtype if _rtype is not None else \
|
||||
self.pv_info.className
|
||||
@@ -621,7 +634,7 @@ class PVGateway(QWidget):
|
||||
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
|
||||
'''
|
||||
|
||||
|
||||
_current_qt_dynamic_property = self.qt_dynamic_property_get()
|
||||
|
||||
alarm_severity = daq_pvd.alarmSeverity
|
||||
@@ -695,12 +708,13 @@ class PVGateway(QWidget):
|
||||
|
||||
|
||||
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()
|
||||
|
||||
def receive_monitor_update(self, value, status, alarm_severity):
|
||||
'''Triggered by monitor signal. For Widget to overload.'''
|
||||
|
||||
|
||||
self.mutex_post_display.lock()
|
||||
_current_qt_dynamic_property = self.qt_dynamic_property_get()
|
||||
|
||||
@@ -752,6 +766,8 @@ class PVGateway(QWidget):
|
||||
'''Callback function to be invoked on change of pv value.
|
||||
cafe.getCache and cafe.set operations permitted within callback.
|
||||
'''
|
||||
|
||||
self.mutex.lock()
|
||||
|
||||
pv_name = pvname
|
||||
pvd = pvdata
|
||||
@@ -783,8 +799,8 @@ class PVGateway(QWidget):
|
||||
else:
|
||||
self.trigger_monitor_float.emit(float(pvd.value[0]), pvd.status,
|
||||
_alarm_severity)
|
||||
|
||||
|
||||
self.mutex.unlock()
|
||||
|
||||
def monitor_start(self):
|
||||
'''Initiate monitor on pv.'''
|
||||
if self.handle > 0:
|
||||
@@ -940,6 +956,8 @@ class PVGateway(QWidget):
|
||||
elif self.qt_object_name == self.PV_DAQ_BS:
|
||||
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)
|
||||
|
||||
else:
|
||||
@@ -1330,7 +1348,7 @@ class PVGateway(QWidget):
|
||||
if self.pv_info is None:
|
||||
self.pv_info = self.cafe.getChannelInfo(self.handle)
|
||||
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")
|
||||
self.record_type = _rtype if _rtype is not None else \
|
||||
self.pv_info.className
|
||||
@@ -1374,7 +1392,7 @@ class PVGateway(QWidget):
|
||||
if self.pv_info is None:
|
||||
self.pv_info = self.cafe.getChannelInfo(self.handle)
|
||||
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")
|
||||
self.record_type = _rtype if _rtype is not None else \
|
||||
self.pv_info.className
|
||||
@@ -1479,8 +1497,7 @@ class PVGateway(QWidget):
|
||||
self.pv_status_text_display_limits())
|
||||
|
||||
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()
|
||||
self.pv_message_in_a_box.exec()
|
||||
|
||||
|
||||
955
pvwidgets.py
955
pvwidgets.py
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user