Commit 9bb68b8b authored by Guillaume Seguin's avatar Guillaume Seguin

Attempt at cleaning up resuming/restarting behavior

parent 51e26180
...@@ -343,7 +343,7 @@ class printcore(): ...@@ -343,7 +343,7 @@ class printcore():
self.paused = False self.paused = False
self.printing = True self.printing = True
self.print_thread = Thread(target = self._print) self.print_thread = Thread(target = self._print, kwargs = {"resuming": True})
self.print_thread.start() self.print_thread.start()
def send(self, command, wait = 0): def send(self, command, wait = 0):
...@@ -388,10 +388,10 @@ class printcore(): ...@@ -388,10 +388,10 @@ class printcore():
else: else:
print "Not connected to printer." print "Not connected to printer."
def _print(self): def _print(self, resuming = False):
if self.startcb: if self.startcb:
#callback for printing started #callback for printing started
try: self.startcb() try: self.startcb(resuming)
except: pass except: pass
while self.printing and self.printer and self.online: while self.printing and self.printer and self.online:
self._sendnext() self._sendnext()
......
...@@ -317,10 +317,13 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -317,10 +317,13 @@ class PronterWindow(MainWindow, pronsole.pronsole):
pronsole.pronsole.process_cmdline_arguments(self, args) pronsole.pronsole.process_cmdline_arguments(self, args)
self.autoconnect = args.autoconnect self.autoconnect = args.autoconnect
def startcb(self): def startcb(self, resuming = False):
self.starttime = time.time() self.starttime = time.time()
self.compute_eta = RemainingTimeEstimator(self.p.mainqueue) if resuming:
print _("Print Started at: %s") % format_time(self.starttime) print _("Print resumed at: %s") % format_time(self.starttime)
else:
print _("Print started at: %s") % format_time(self.starttime)
self.compute_eta = RemainingTimeEstimator(self.fgcode)
def endcb(self): def endcb(self):
if self.p.queueindex == 0: if self.p.queueindex == 0:
...@@ -1434,8 +1437,8 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1434,8 +1437,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if self.paused: if self.paused:
self.p.paused = 0 self.p.paused = 0
self.paused = 0 self.paused = 0
self.on_startprint()
if self.sdprinting: if self.sdprinting:
self.on_startprint()
self.p.send_now("M26 S0") self.p.send_now("M26 S0")
self.p.send_now("M24") self.p.send_now("M24")
return return
...@@ -1483,8 +1486,8 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1483,8 +1486,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
dlg.Destroy() dlg.Destroy()
def pause(self, event): def pause(self, event):
print _("Paused.")
if not self.paused: if not self.paused:
print _("Print paused at: %s") % format_time(time.time())
if self.sdprinting: if self.sdprinting:
self.p.send_now("M25") self.p.send_now("M25")
else: else:
...@@ -1498,6 +1501,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1498,6 +1501,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.extra_print_time += int(time.time() - self.starttime) self.extra_print_time += int(time.time() - self.starttime)
wx.CallAfter(self.pausebtn.SetLabel, _("Resume")) wx.CallAfter(self.pausebtn.SetLabel, _("Resume"))
else: else:
print _("Resuming.")
self.paused = False self.paused = False
if self.sdprinting: if self.sdprinting:
self.p.send_now("M24") self.p.send_now("M24")
......
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