Skip to content

Commit

Permalink
SD printing status bar handling, correct none type error
Browse files Browse the repository at this point in the history
  • Loading branch information
DivingDuck committed May 26, 2024
1 parent 7fe22cb commit 65ab778
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions printrun/pronterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1273,12 +1273,16 @@ def statuschecker_inner(self):
status_string += _(" Z: %.3f mm") % self.curlayer
if self.settings.display_progress_on_printer and time.time() - self.printer_progress_time >= self.settings.printer_progress_update_interval:
self.printer_progress_time = time.time()
printer_progress_string = "M117 " + str(round(100 * float(self.p.queueindex) / len(self.p.mainqueue), 2)) + "% Est " + format_duration(secondsremain)
# ":" seems to be some kind of separator for G-CODE"
self.p.send_now(printer_progress_string.replace(":", "."))
if len(printer_progress_string) > 25:
logging.info(_("Warning: The print progress message might be too long to be displayed properly"))
# 13 chars for up to 99h est.
if self.p.mainqueue is not None:
# Don't try to calculate the printer_progress_string with a None value of self.p.mainqueue.
# This happens in combination with self.p.queueindex = 0
# We pass the calculation and try it next time.
printer_progress_string = "M117 " + str(round(100 * float(self.p.queueindex) / len(self.p.mainqueue), 2)) + "% Est " + format_duration(secondsremain)
# ":" seems to be some kind of separator for G-CODE"
self.p.send_now(printer_progress_string.replace(":", "."))
if len(printer_progress_string) > 25:
logging.info(_("Warning: The print progress message might be too long to be displayed properly"))
# 13 chars for up to 99h est.
elif self.loading_gcode:
status_string = self.loading_gcode_message
wx.CallAfter(self.statusbar.SetStatusText, status_string)
Expand Down

0 comments on commit 65ab778

Please sign in to comment.