gui: green progress marker + background red current-temp line in forecast
Progress line switches from red to green; a new horizontal red line tracks the live measured temperature, drawn at a lower zorder than the forecast/progress lines so it never visually covers them.
This commit is contained in:
+19
-2
@@ -118,8 +118,11 @@ class SudForecastPlot(FigureCanvasQTAgg):
|
|||||||
FigureCanvasQTAgg.__init__(self, figure)
|
FigureCanvasQTAgg.__init__(self, figure)
|
||||||
|
|
||||||
self.ax = figure.subplots(1, 1)
|
self.ax = figure.subplots(1, 1)
|
||||||
self.line, = self.ax.plot([], [], '-b', linewidth=1.5)
|
self.line, = self.ax.plot([], [], '-b', linewidth=1.5, zorder=2)
|
||||||
self.progress_line = self.ax.axvline(0, color='r', linewidth=1.5, visible=False)
|
self.progress_line = self.ax.axvline(0, color='g', linewidth=1.5, visible=False, zorder=2)
|
||||||
|
# Current temperature - drawn behind (lower zorder than) the
|
||||||
|
# forecast/progress lines so it never covers them.
|
||||||
|
self.current_temp_line = self.ax.axhline(0, color='r', linewidth=1.5, visible=False, zorder=1)
|
||||||
self.ax.set_xlabel("t [min]")
|
self.ax.set_xlabel("t [min]")
|
||||||
self.ax.set_ylabel("Temp [°C]")
|
self.ax.set_ylabel("Temp [°C]")
|
||||||
_style_axis(self.ax)
|
_style_axis(self.ax)
|
||||||
@@ -177,6 +180,15 @@ class SudForecastPlot(FigureCanvasQTAgg):
|
|||||||
self.progress_line.set_visible(False)
|
self.progress_line.set_visible(False)
|
||||||
self.draw_idle()
|
self.draw_idle()
|
||||||
|
|
||||||
|
def set_current_temp(self, theta):
|
||||||
|
self.current_temp_line.set_ydata([theta, theta])
|
||||||
|
self.current_temp_line.set_visible(True)
|
||||||
|
self.draw_idle()
|
||||||
|
|
||||||
|
def clear_current_temp(self):
|
||||||
|
self.current_temp_line.set_visible(False)
|
||||||
|
self.draw_idle()
|
||||||
|
|
||||||
|
|
||||||
class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
# on_sud_changed() runs on the websocket recv thread, but a modal dialog
|
# on_sud_changed() runs on the websocket recv thread, but a modal dialog
|
||||||
@@ -335,6 +347,11 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
else:
|
else:
|
||||||
self.forecast_plot.clear_progress()
|
self.forecast_plot.clear_progress()
|
||||||
|
|
||||||
|
if self.plot_temp_ist:
|
||||||
|
self.forecast_plot.set_current_temp(self.plot_temp_ist)
|
||||||
|
else:
|
||||||
|
self.forecast_plot.clear_current_temp()
|
||||||
|
|
||||||
def disconnect(self):
|
def disconnect(self):
|
||||||
# ws_client.disconnect() blocks until the websocket's close handshake
|
# ws_client.disconnect() blocks until the websocket's close handshake
|
||||||
# completes (or times out, ~10s if the server doesn't ack promptly),
|
# completes (or times out, ~10s if the server doesn't ack promptly),
|
||||||
|
|||||||
Reference in New Issue
Block a user