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
parent 9797364043
commit d4bf06e242

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