Commit 87b8b124 authored by Guillaume Seguin's avatar Guillaume Seguin

Fix variable name collision between ponsole.status and GUI statusbar

parent 9bb68b8b
...@@ -415,8 +415,8 @@ class MainWindow(wx.Frame): ...@@ -415,8 +415,8 @@ class MainWindow(wx.Frame):
self.notebook.AddPage(page1panel, _("Commands")) self.notebook.AddPage(page1panel, _("Commands"))
self.notebook.AddPage(page2panel, _("Status")) self.notebook.AddPage(page2panel, _("Status"))
self.panel.SetSizer(self.notesizer) self.panel.SetSizer(self.notesizer)
self.status = self.CreateStatusBar() self.statusbar = self.CreateStatusBar()
self.status.SetStatusText(_("Not connected to printer.")) self.statusbar.SetStatusText(_("Not connected to printer."))
self.panel.Bind(wx.EVT_MOUSE_EVENTS, self.editbutton) self.panel.Bind(wx.EVT_MOUSE_EVENTS, self.editbutton)
self.Bind(wx.EVT_CLOSE, self.kill) self.Bind(wx.EVT_CLOSE, self.kill)
...@@ -460,8 +460,8 @@ class MainWindow(wx.Frame): ...@@ -460,8 +460,8 @@ class MainWindow(wx.Frame):
self.mainsizer.Add(upperpanel, 0) self.mainsizer.Add(upperpanel, 0)
self.mainsizer.Add(lowerpanel, 1, wx.EXPAND) self.mainsizer.Add(lowerpanel, 1, wx.EXPAND)
self.panel.SetSizer(self.mainsizer) self.panel.SetSizer(self.mainsizer)
self.status = self.CreateStatusBar() self.statusbar = self.CreateStatusBar()
self.status.SetStatusText(_("Not connected to printer.")) self.statusbar.SetStatusText(_("Not connected to printer."))
self.panel.Bind(wx.EVT_MOUSE_EVENTS, self.editbutton) self.panel.Bind(wx.EVT_MOUSE_EVENTS, self.editbutton)
self.Bind(wx.EVT_CLOSE, self.kill) self.Bind(wx.EVT_CLOSE, self.kill)
......
...@@ -1192,7 +1192,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1192,7 +1192,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
string += _(" Est: %s of %s remaining | ") % (format_duration(secondsremain), string += _(" Est: %s of %s remaining | ") % (format_duration(secondsremain),
format_duration(secondsestimate)) format_duration(secondsestimate))
string += _(" Z: %.3f mm") % self.curlayer string += _(" Z: %.3f mm") % self.curlayer
wx.CallAfter(self.status.SetStatusText, string) wx.CallAfter(self.statusbar.SetStatusText, string)
wx.CallAfter(self.gviz.Refresh) wx.CallAfter(self.gviz.Refresh)
if self.monitor and self.p.online: if self.monitor and self.p.online:
if self.sdprinting: if self.sdprinting:
...@@ -1209,7 +1209,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1209,7 +1209,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
while not self.sentlines.empty(): while not self.sentlines.empty():
gc = self.sentlines.get_nowait() gc = self.sentlines.get_nowait()
wx.CallAfter(self.gviz.addgcode, gc, 1) wx.CallAfter(self.gviz.addgcode, gc, 1)
wx.CallAfter(self.status.SetStatusText, _("Not connected to printer.")) wx.CallAfter(self.statusbar.SetStatusText, _("Not connected to printer."))
def capture(self, func, *args, **kwargs): def capture(self, func, *args, **kwargs):
stdout = sys.stdout stdout = sys.stdout
...@@ -1265,19 +1265,19 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1265,19 +1265,19 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def waitforsdresponse(self, l): def waitforsdresponse(self, l):
if "file.open failed" in l: if "file.open failed" in l:
wx.CallAfter(self.status.SetStatusText, _("Opening file failed.")) wx.CallAfter(self.statusbar.SetStatusText, _("Opening file failed."))
self.recvlisteners.remove(self.waitforsdresponse) self.recvlisteners.remove(self.waitforsdresponse)
return return
if "File opened" in l: if "File opened" in l:
wx.CallAfter(self.status.SetStatusText, l) wx.CallAfter(self.statusbar.SetStatusText, l)
if "File selected" in l: if "File selected" in l:
wx.CallAfter(self.status.SetStatusText, _("Starting print")) wx.CallAfter(self.statusbar.SetStatusText, _("Starting print"))
self.sdprinting = 1 self.sdprinting = 1
self.p.send_now("M24") self.p.send_now("M24")
self.startcb() self.startcb()
return return
if "Done printing file" in l: if "Done printing file" in l:
wx.CallAfter(self.status.SetStatusText, l) wx.CallAfter(self.statusbar.SetStatusText, l)
self.sdprinting = 0 self.sdprinting = 0
self.recvlisteners.remove(self.waitforsdresponse) self.recvlisteners.remove(self.waitforsdresponse)
self.endcb() self.endcb()
...@@ -1332,7 +1332,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1332,7 +1332,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def skein_monitor(self): def skein_monitor(self):
while(not self.stopsf): while(not self.stopsf):
try: try:
wx.CallAfter(self.status.SetStatusText, _("Slicing..."))#+self.cout.getvalue().split("\n")[-1]) wx.CallAfter(self.statusbar.SetStatusText, _("Slicing..."))#+self.cout.getvalue().split("\n")[-1])
except: except:
pass pass
time.sleep(0.1) time.sleep(0.1)
...@@ -1343,7 +1343,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1343,7 +1343,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if self.p.online: if self.p.online:
wx.CallAfter(self.printbtn.Enable) wx.CallAfter(self.printbtn.Enable)
wx.CallAfter(self.status.SetStatusText, _("Loaded %s, %d lines") % (self.filename, len(self.fgcode),)) wx.CallAfter(self.statusbar.SetStatusText, _("Loaded %s, %d lines") % (self.filename, len(self.fgcode),))
print _("Loaded %s, %d lines") % (self.filename, len(self.fgcode),) print _("Loaded %s, %d lines") % (self.filename, len(self.fgcode),)
wx.CallAfter(self.pausebtn.Disable) wx.CallAfter(self.pausebtn.Disable)
wx.CallAfter(self.printbtn.SetLabel, _("Print")) wx.CallAfter(self.printbtn.SetLabel, _("Print"))
...@@ -1393,7 +1393,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1393,7 +1393,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
name = dlg.GetPath() name = dlg.GetPath()
dlg.Destroy() dlg.Destroy()
if not os.path.exists(name): if not os.path.exists(name):
self.status.SetStatusText(_("File not found!")) self.statusbar.SetStatusText(_("File not found!"))
return return
path = os.path.split(name)[0] path = os.path.split(name)[0]
if path != self.settings.last_file_path: if path != self.settings.last_file_path:
...@@ -1405,7 +1405,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1405,7 +1405,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
else: else:
self.filename = name self.filename = name
self.fgcode = gcoder.GCode(open(self.filename)) self.fgcode = gcoder.GCode(open(self.filename))
self.status.SetStatusText(_("Loaded %s, %d lines") % (name, len(self.fgcode))) self.statusbar.SetStatusText(_("Loaded %s, %d lines") % (name, len(self.fgcode)))
print _("Loaded %s, %d lines") % (name, len(self.fgcode)) print _("Loaded %s, %d lines") % (name, len(self.fgcode))
wx.CallAfter(self.printbtn.SetLabel, _("Print")) wx.CallAfter(self.printbtn.SetLabel, _("Print"))
wx.CallAfter(self.pausebtn.SetLabel, _("Pause")) wx.CallAfter(self.pausebtn.SetLabel, _("Pause"))
...@@ -1444,10 +1444,10 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1444,10 +1444,10 @@ class PronterWindow(MainWindow, pronsole.pronsole):
return return
if not self.fgcode: if not self.fgcode:
wx.CallAfter(self.status.SetStatusText, _("No file loaded. Please use load first.")) wx.CallAfter(self.statusbar.SetStatusText, _("No file loaded. Please use load first."))
return return
if not self.p.online: if not self.p.online:
wx.CallAfter(self.status.SetStatusText, _("Not connected to printer.")) wx.CallAfter(self.statusbar.SetStatusText, _("Not connected to printer."))
return return
self.on_startprint() self.on_startprint()
self.p.startprint(self.fgcode) self.p.startprint(self.fgcode)
...@@ -1459,7 +1459,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1459,7 +1459,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def endupload(self): def endupload(self):
self.p.send_now("M29 ") self.p.send_now("M29 ")
wx.CallAfter(self.status.SetStatusText, _("File upload complete")) wx.CallAfter(self.statusbar.SetStatusText, _("File upload complete"))
time.sleep(0.5) time.sleep(0.5)
self.p.clear = True self.p.clear = True
self.uploading = False self.uploading = False
...@@ -1561,7 +1561,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1561,7 +1561,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def recover(self, event): def recover(self, event):
self.extra_print_time = 0 self.extra_print_time = 0
if not self.p.online: if not self.p.online:
wx.CallAfter(self.status.SetStatusText, _("Not connected to printer.")) wx.CallAfter(self.statusbar.SetStatusText, _("Not connected to printer."))
return return
# Reset Z # Reset Z
self.p.send_now("G92 Z%f" % self.predisconnect_layer) self.p.send_now("G92 Z%f" % self.predisconnect_layer)
......
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