gui: Add text for LD & Thermostat status

This commit is contained in:
linuswck 2024-08-07 12:48:09 +08:00
parent c214e4182d
commit af73ac8127
2 changed files with 22 additions and 10 deletions

View File

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

View File

@ -105,7 +105,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>55</height>
<height>57</height>
</size>
</property>
</widget>
@ -193,7 +193,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>55</height>
<height>57</height>
</size>
</property>
</widget>