11 Commits

7 changed files with 526 additions and 4971 deletions

10
.gitignore vendored
View File

@@ -1,5 +1,7 @@
# Temporary editor files #
##########################
*~
*.-*
*.*:*
*.*-
*.*-*
*.-*
__pycache__
__pycache__/*.*

Binary file not shown.

Binary file not shown.

View File

@@ -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:
@@ -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)
@@ -310,6 +319,7 @@ class PVGateway(QWidget):
#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
@@ -378,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
@@ -411,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
@@ -487,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
@@ -576,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
@@ -754,6 +765,7 @@ 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
@@ -785,8 +797,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:
@@ -942,6 +954,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:
@@ -1332,7 +1346,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
@@ -1376,7 +1390,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
@@ -1481,8 +1495,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()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff