48 Commits

Author SHA1 Message Date
Jan Chrin
ca195b0003 README 2026-03-09 12:26:52 +01:00
b66a8657d9 README 2025-10-01 12:10:08 +02:00
e4213dfaee added time.sleep(0.01) to avoid UnicodeDecodeError: 'ascii' codec can't decode byte 0xfa in position 0: ordinal not in range(128) in getCtrlcache in receive_connect_update 2025-05-14 09:55:11 +02:00
13fa5c0f2e added scale_factor for CAQLabel 2024-12-13 15:33:26 +01:00
c0dd0c6038 QEventLoop has int argument not flopat 2024-02-29 17:01:07 +01:00
0f62863828 expt with font size 2024-02-29 16:05:08 +01:00
ab8534c62a expt with font size 2024-02-29 16:03:29 +01:00
9852226d3b expt with font size 2024-02-29 16:01:36 +01:00
434679d9ce expt with font size 2024-02-29 15:58:28 +01:00
f229ba2059 expt with font size 2024-02-29 15:51:16 +01:00
c06bc4f58e expt with font size 2024-02-29 15:48:27 +01:00
3e5255c55e expt with font size 2024-02-29 15:39:20 +01:00
8ae83b2ea6 expt with font size 2024-02-29 15:32:45 +01:00
49be032511 expt with font size 2024-02-29 15:29:56 +01:00
4b5f911c10 expt with font size 2024-02-29 15:19:42 +01:00
727b48e1c6 expt with font size 2024-02-29 15:08:16 +01:00
d997517dc1 expt with font size 2024-02-29 15:04:38 +01:00
68e8da943e expt with font size 2024-02-29 15:01:38 +01:00
bf08fbe488 expt with font size 2024-02-29 14:35:07 +01:00
f335663b55 expt with font size 2024-02-29 14:32:56 +01:00
9829be0bcd expt with font size 2024-02-29 14:30:24 +01:00
14400488a3 Font size to 8 CAQTextEntry 2024-02-29 14:13:32 +01:00
76528ed3c0 Font size to 8 CAQTextEntry 2024-02-29 14:12:03 +01:00
9beed3ff90 Font size to 12 CAQTextEntry 2024-02-29 13:13:11 +01:00
53a0f6495d Font size to 12 CAQTextEntry 2024-02-29 13:11:41 +01:00
fee2e64bb3 Font size to 16 CAQTextEntry 2024-02-29 13:10:22 +01:00
15394066ed Font size to 8 pixels for CAQTextEntry 2024-02-29 13:03:35 +01:00
0441a79305 Font size to 8 pixels for CAQTextEntry 2024-02-29 13:01:39 +01:00
2f0e9aefee Font size to 8 pixels for CAQTextEntry 2024-02-29 12:58:23 +01:00
d148f6777f Font size to 8 pixels for CAQTextEntry 2024-02-29 12:57:20 +01:00
c95afc03b5 Font size to 10 pixels for CAQTextEntry 2024-02-29 12:55:05 +01:00
a830a1a44b Font size to 10 pixels for CAQTextEntry 2024-02-29 12:53:23 +01:00
952cff5002 Font size from 11 to 10 for CAQTextEntry as for CAQLabel 2024-02-29 12:43:19 +01:00
681761ca40 cast to Qt.AlignmentFlag when setAlignment includeds an OR 2024-02-27 15:54:14 +01:00
20b6749ed4 added scale-factot to update_widget in CAQTableWidget 2024-01-30 10:11:46 +01:00
fa33a4479d Added precision to and modified CAQTextEdit 2023-08-21 15:40:32 +02:00
54b332f69d Reconnect btn to 11px 2023-07-27 09:51:46 +02:00
0ff5ca7b49 rm unwanted backup files 2023-07-17 14:37:52 +02:00
76a6f28136 update to caqtable 2023-07-17 14:31:01 +02:00
3c408ebcbd add standby functionality to table wgt 2023-06-01 12:14:26 +02:00
420f82563f fixed widget_update in CAQTableWidget as used in Configure Table PVs 2023-04-06 14:17:43 +02:00
b2ad43abb0 fixed widget_update in CAQTableWidget as used in Configure Table PVs 2023-04-06 14:11:50 +02:00
75dc1e5e51 removed prtint statements 2022-10-28 10:58:03 +02:00
d9167d044f Merge branch 'master' of gitlab.psi.ch:cafe/caqtwidgets 2022-10-14 13:48:47 +02:00
4c151a8cd0 sync git 2022-10-14 13:48:13 +02:00
7f1981aac7 fixed alarm colors in QTableWidget 2022-10-14 13:32:15 +02:00
d9f098582f Delete pvwidgets.py- 2022-09-15 08:15:54 +00:00
d865b9eba7 Delete pvgateway.py- 2022-09-15 08:15:46 +00:00
8 changed files with 632 additions and 5021 deletions

10
.gitignore vendored
View File

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

2
README Normal file
View File

@@ -0,0 +1,2 @@
Qt widgets for PyCafe
RHEL9

Binary file not shown.

Binary file not shown.

View File

@@ -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()

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