Fix setpoint line label to not display old values

Setpoint line still displays 0 °C sometimes!
This commit is contained in:
atse 2023-11-27 11:52:15 +08:00 committed by Tse Kwok Yan
parent 5306de35d1
commit 1d06b6b042
1 changed files with 5 additions and 5 deletions

View File

@ -216,11 +216,11 @@ class ChannelGraphs:
self._t_line.setVisible(visible)
if temp is not None:
self._t_line.setValue(temp)
if visible is False:
# PyQtGraph does not update this text when the line
# is not visible, but we need it so that the temperature
# label doesn't display 0 °C despite not being at 0 °C.
self._t_line.label.setText(f"{temp} °C")
# PyQtGraph normally does not update this text when the line
# is not visible, so make sure that the temperature label
# gets updated always, and doesn't stay at an old value.
self._t_line.label.setText(f"{temp} °C")
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):