From e4213dfaee36d1ae875ed07a2f788f7442336fc6 Mon Sep 17 00:00:00 2001 From: chrin Date: Wed, 14 May 2025 09:55:11 +0200 Subject: [PATCH] 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 --- pvgateway.py | 1 + pvwidgets.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pvgateway.py b/pvgateway.py index 6b50aa2..c2ae2be 100644 --- a/pvgateway.py +++ b/pvgateway.py @@ -584,6 +584,7 @@ class PVGateway(QWidget): if status == self.cyca.ICAFE_CS_CONN: self.initialize_connect = True + time.sleep(0.01) 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: diff --git a/pvwidgets.py b/pvwidgets.py index 6d6194b..4287f8d 100644 --- a/pvwidgets.py +++ b/pvwidgets.py @@ -287,8 +287,8 @@ class CAQMenu(QComboBox, PVGateway): _width_scaling_factor = 1.1 - self.setFixedHeight(fm.lineSpacing()*1.8) - self.setFixedWidth((qrect.width()+40) * _width_scaling_factor) + self.setFixedHeight(round(fm.lineSpacing()*1.8)) + self.setFixedWidth(round((qrect.width()+40) * _width_scaling_factor)) self.qt_property_initial_values(qt_object_name=self.PV_CONTROLLER) @@ -476,8 +476,8 @@ class CAQMessageButton(QPushButton, PVGateway): _width_scaling_factor = 1.0 self.setText(self.msg_label) - self.setFixedHeight(int(fm.lineSpacing()*1.8)) - self.setFixedWidth(int(qrect.width() * _width_scaling_factor)) + self.setFixedHeight(round(fm.lineSpacing()*1.8)) + self.setFixedWidth(round(qrect.width() * _width_scaling_factor)) self.qt_property_initial_values(qt_object_name=self.PV_CONTROLLER) @@ -605,8 +605,8 @@ class CAQTextEntry(QLineEdit, PVGateway): qrect = fm.boundingRect(self.suggested_text) _width_scaling_factor = 1.2 - self.setFixedHeight(int(fm.lineSpacing()*1.8)) - self.setFixedWidth(int(qrect.width()+20 * _width_scaling_factor)) + self.setFixedHeight(round(fm.lineSpacing()*1.8)) + self.setFixedWidth(round(qrect.width()+20 * _width_scaling_factor)) self.qt_property_initial_values(qt_object_name=self.PV_CONTROLLER)