From 80e153da2b386d192cc763d3685081c1134b59e4 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Thu, 4 Jul 2024 00:12:00 -0300 Subject: [PATCH] refactor(graph): use max_temp --- ks_includes/widgets/heatergraph.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ks_includes/widgets/heatergraph.py b/ks_includes/widgets/heatergraph.py index 0f660cf5..253dc824 100644 --- a/ks_includes/widgets/heatergraph.py +++ b/ks_includes/widgets/heatergraph.py @@ -29,6 +29,11 @@ class HeaterGraph(Gtk.DrawingArea): if fullscreen: GLib.timeout_add_seconds(1, self.update_graph) self.fs_graph = None + self.max_temp = 0 + for section in self.printer.config: + if "max_temp" in self.printer.get_config_section(section): + self.max_temp = max(float(self.printer.get_config_section(section)["max_temp"]), self.max_temp) + self.max_temp = min(self.max_temp, 999) def update_graph(self): self.queue_draw() @@ -141,7 +146,7 @@ class HeaterGraph(Gtk.DrawingArea): def graph_lines(self, ctx: cairoContext, gsize, max_num): nscale = 10 - max_num = min(max_num, 999) + max_num = min(max_num, self.max_temp) while (max_num / nscale) > 5: nscale += 10 r = int(max_num / nscale) + 1