Skip to content

Commit

Permalink
Merge pull request #1426 from DivingDuck/upd_translation
Browse files Browse the repository at this point in the history
 * Fix type error quirk in status when printing via SD
 * p/pronterface: Update copyright year
 * Switch from appdirs to platformdirs

Fixes #1420
  • Loading branch information
rockstorm101 authored May 26, 2024
2 parents fef3945 + a65c72c commit dbe3bc3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions printrun/pronsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import traceback
import re

from appdirs import user_cache_dir, user_config_dir, user_data_dir
from platformdirs import user_cache_dir, user_config_dir, user_data_dir
from serial import SerialException

from . import printcore
Expand Down Expand Up @@ -323,7 +323,7 @@ def promptf(self):
progress = 0.0
specials["progress"] = str(progress)
if self.p.printing or self.sdprinting:
specials["progress_fancy"] = " " + str(progress) + "%"
specials["progress_fancy"] = " " + str(round(progress, 2)) + "%"
else:
specials["progress_fancy"] = ""
specials["red"] = "\033[31m"
Expand Down
18 changes: 11 additions & 7 deletions printrun/pronterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ def about(self, event):
% self.settings.total_filament_used

info.SetDescription(description)
info.SetCopyright('(C) 2011 - 2020')
info.SetCopyright('(C) 2011 - 2024')
info.SetWebSite('https://github.com/kliment/Printrun')

licence = """\
Expand Down 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
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ numpy (>= 1.8.2)
pyglet >= 1.1, < 2.0
psutil (>= 2.1)
lxml (>= 2.9.1)
appdirs (>= 1.4.0)
platformdirs
dbus-python >= 1.2.0 ; sys_platform == 'linux'
pyobjc-framework-Cocoa ; sys_platform == 'darwin'
pyreadline3 ; sys_platform == 'win32'

0 comments on commit dbe3bc3

Please sign in to comment.