From af73ac81273f41739b304b91d9725ed2965cf417 Mon Sep 17 00:00:00 2001 From: linuswck Date: Wed, 7 Aug 2024 12:48:09 +0800 Subject: [PATCH] gui: Add text for LD & Thermostat status --- pykirdy/kirdy_qt.py | 28 ++++++++++++++++++++-------- pykirdy/ui/kirdy_qt.ui | 4 ++-- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pykirdy/kirdy_qt.py b/pykirdy/kirdy_qt.py index 8783b31..c90f453 100644 --- a/pykirdy/kirdy_qt.py +++ b/pykirdy/kirdy_qt.py @@ -340,8 +340,9 @@ class MainWindow(QtWidgets.QMainWindow): DEFAULT_PORT = 1337 LASER_DIODE_STATUS = [ - {'name': 'Power', 'type': 'color', 'value': 'w', 'readonly': True}, - {'name': 'Alarm', 'type': 'color', 'value': 'w', 'readonly': True}, + {'name': 'Status', 'title': 'Status: Power Off', 'expanded': True, 'type': 'group', 'children': [ + {'name': 'Color', 'title': '', 'type': 'color', 'value': 'w', 'readonly': True, "compactHeight": False}, + ]} ] LASER_DIODE_PARAMETERS = [ @@ -368,8 +369,9 @@ class MainWindow(QtWidgets.QMainWindow): ] THERMOSTAT_STATUS = [ - {'name': 'Power', 'type': 'color', 'value': 'w', 'readonly': True}, - {'name': 'Alarm', 'type': 'color', 'value': 'w', 'readonly': True}, + {'name': 'Status', 'title': 'Status: Power Off', 'expanded': True, 'type': 'group', 'children': [ + {'name': 'Color', 'title': '', 'type': 'color', 'value': 'w', 'readonly': True, "compactHeight": False}, + ]} ] THERMOSTAT_PARAMETERS = [ @@ -814,8 +816,12 @@ class MainWindow(QtWidgets.QMainWindow): try: report = report['laser'] with QSignalBlocker(self.params[0]): - self.params[0].child('Power').setValuewithLock('g' if report['pwr_on'] else 'w') - self.params[0].child('Alarm').setValuewithLock('r' if report['pwr_excursion'] else 'w') + if report['pwr_excursion']: + self.params[0].child('Status', 'Color').setValuewithLock('r') + self.params[0].child('Status').setOpts(title='Status: OverPower Alarm') + else: + self.params[0].child('Status', 'Color').setValuewithLock('g' if report['pwr_on'] else 'w') + self.params[0].child('Status').setOpts(title='Status: Power On' if report['pwr_on'] else 'Status: Power Off') with QSignalBlocker(self.params[1]): self.params[1].child('Readings', 'LD Current Set').setValuewithLock(report["ld_i_set"]) @@ -861,8 +867,14 @@ class MainWindow(QtWidgets.QMainWindow): try: report = report['thermostat'] with QSignalBlocker(self.params[2]): - self.params[2].child('Power').setValuewithLock('g' if report['pwr_on'] else 'w') - self.params[2].child('Alarm').setValuewithLock('r' if report['temp_mon_status']['over_temp_alarm'] else 'w') + if report['temp_mon_status']['over_temp_alarm']: + self.params[2].child('Status', 'Color').setValuewithLock('r') + self.params[2].child('Status').setOpts(title='Status: OverTemperature Alarm') + + else: + self.params[2].child('Status', 'Color').setValuewithLock('g' if report['pwr_on'] else 'w') + self.params[2].child('Status').setOpts(title='Status: Power On' if report['pwr_on'] else 'Status: Power Off') + with QSignalBlocker(self.params[3]): if report["temperature"] == None: self.params[3].child('Readings', 'Temperature').setValuewithLock(-273.15) diff --git a/pykirdy/ui/kirdy_qt.ui b/pykirdy/ui/kirdy_qt.ui index 2554f78..2fa2383 100644 --- a/pykirdy/ui/kirdy_qt.ui +++ b/pykirdy/ui/kirdy_qt.ui @@ -105,7 +105,7 @@ 16777215 - 55 + 57 @@ -193,7 +193,7 @@ 16777215 - 55 + 57