diff --git a/client/brewpi_gui.py b/client/brewpi_gui.py index 3f3e1d9..ba173cd 100755 --- a/client/brewpi_gui.py +++ b/client/brewpi_gui.py @@ -118,8 +118,11 @@ class SudForecastPlot(FigureCanvasQTAgg): FigureCanvasQTAgg.__init__(self, figure) self.ax = figure.subplots(1, 1) - self.line, = self.ax.plot([], [], '-b', linewidth=1.5) - self.progress_line = self.ax.axvline(0, color='r', linewidth=1.5, visible=False) + self.line, = self.ax.plot([], [], '-b', linewidth=1.5, zorder=2) + 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_ylabel("Temp [°C]") _style_axis(self.ax) @@ -177,6 +180,15 @@ class SudForecastPlot(FigureCanvasQTAgg): self.progress_line.set_visible(False) 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): # on_sud_changed() runs on the websocket recv thread, but a modal dialog @@ -335,6 +347,11 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow): else: 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): # ws_client.disconnect() blocks until the websocket's close handshake # completes (or times out, ~10s if the server doesn't ack promptly),