Commit 852d47d5 authored by Guillaume Seguin's avatar Guillaume Seguin

Fix monitor setting breakage created by 72dd0b4c

parent 9b303128
...@@ -119,7 +119,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -119,7 +119,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def __init__(self, app, filename = None, size = winsize): def __init__(self, app, filename = None, size = winsize):
pronsole.pronsole.__init__(self) pronsole.pronsole.__init__(self)
self.app = app self.app = app
self.settings._add(BooleanSetting("monitor", True, _("Monitor printer status"), _("Regularly monitor printer temperatures (required to have functional temperature graph or gauges)"), "Printer")) self.settings._add(BooleanSetting("monitor", True, _("Monitor printer status"), _("Regularly monitor printer temperatures (required to have functional temperature graph or gauges)"), "Printer"), self.update_monitor)
self.settings._add(StringSetting("simarrange_path", "", _("Simarrange command"), _("Path to the simarrange binary to use in the STL plater"), "External")) self.settings._add(StringSetting("simarrange_path", "", _("Simarrange command"), _("Path to the simarrange binary to use in the STL plater"), "External"))
self.settings._add(BooleanSetting("circular_bed", False, _("Circular build platform"), _("Draw a circular (or oval) build platform instead of a rectangular one"), "Printer")) self.settings._add(BooleanSetting("circular_bed", False, _("Circular build platform"), _("Draw a circular (or oval) build platform instead of a rectangular one"), "Printer"))
self.settings._add(SpinSetting("extruders", 0, 1, 5, _("Extruders count"), _("Number of extruders"), "Printer")) self.settings._add(SpinSetting("extruders", 0, 1, 5, _("Extruders count"), _("Number of extruders"), "Printer"))
...@@ -176,7 +176,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -176,7 +176,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.userm114 = 0 self.userm114 = 0
self.userm105 = 0 self.userm105 = 0
self.m105_waitcycles = 0 self.m105_waitcycles = 0
self.monitor = 0
self.fgcode = None self.fgcode = None
self.excluder = None self.excluder = None
self.skeinp = None self.skeinp = None
...@@ -269,7 +268,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -269,7 +268,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if self.filename is not None: if self.filename is not None:
self.do_load(self.filename) self.do_load(self.filename)
if self.settings.monitor: if self.settings.monitor:
self.setmonitor(None) self.update_monitor()
def on_resize(self, event): def on_resize(self, event):
maximized = self.IsMaximized() maximized = self.IsMaximized()
...@@ -1312,26 +1311,23 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1312,26 +1311,23 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
def do_monitor(self, l = ""): def do_monitor(self, l = ""):
if l.strip() == "": if l.strip() == "":
self.monitorbox.SetValue(not self.monitorbox.GetValue()) self.set("monitor", not self.settings.monitor)
elif l.strip() == "off": elif l.strip() == "off":
wx.CallAfter(self.monitorbox.SetValue, False) self.set("monitor", False)
else: else:
try: try:
self.monitor_interval = float(l) self.monitor_interval = float(l)
wx.CallAfter(self.monitorbox.SetValue, self.monitor_interval > 0) self.set("monitor", self.monitor_interval > 0)
except: except:
print _("Invalid period given.") print _("Invalid period given.")
self.setmonitor(None) if self.settings.monitor:
if self.monitor:
print _("Monitoring printer.") print _("Monitoring printer.")
else: else:
print _("Done monitoring.") print _("Done monitoring.")
def setmonitor(self, e): def update_monitor(self, *args):
self.monitor = self.monitorbox.GetValue() if hasattr(self, "display_graph") and self.display_graph:
self.set("monitor", self.monitor) if self.settings.monitor:
if self.display_graph:
if self.monitor:
wx.CallAfter(self.graph.StartPlotting, 1000) wx.CallAfter(self.graph.StartPlotting, 1000)
else: else:
wx.CallAfter(self.graph.StopPlotting) wx.CallAfter(self.graph.StopPlotting)
...@@ -1448,7 +1444,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1448,7 +1444,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self.status_thread = None self.status_thread = None
self.disconnect() self.disconnect()
return return
if self.monitor and self.p.online: if self.settings.monitor and self.p.online:
if self.sdprinting: if self.sdprinting:
self.p.send_now("M27") self.p.send_now("M27")
if self.m105_waitcycles % 10 == 0: if self.m105_waitcycles % 10 == 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment