print: fix print time not showing in subfolders fixes #1294
This commit is contained in:
parent
b23a27d296
commit
46f3f80c8a
@ -113,10 +113,11 @@ class KlippyFiles:
|
|||||||
for cb in self.callbacks:
|
for cb in self.callbacks:
|
||||||
cb(action, item)
|
cb(action, item)
|
||||||
|
|
||||||
def get_file_info(self, filename):
|
def get_file_info(self, path):
|
||||||
if filename not in self.files:
|
if path not in self.files:
|
||||||
return {"path": None, "modified": 0, "size": 0}
|
logging.info(f"Metadata not found {path}")
|
||||||
return self.files[filename]
|
return {}
|
||||||
|
return self.files[path]
|
||||||
|
|
||||||
def get_dir_info(self, directory):
|
def get_dir_info(self, directory):
|
||||||
self._screen._ws.klippy.get_dir_info(self._callback, directory=directory)
|
self._screen._ws.klippy.get_dir_info(self._callback, directory=directory)
|
||||||
|
@ -144,7 +144,7 @@ class Panel(ScreenPanel):
|
|||||||
format_label(label)
|
format_label(label)
|
||||||
info = Gtk.Label(hexpand=True, halign=Gtk.Align.START, wrap=True, wrap_mode=Pango.WrapMode.WORD_CHAR)
|
info = Gtk.Label(hexpand=True, halign=Gtk.Align.START, wrap=True, wrap_mode=Pango.WrapMode.WORD_CHAR)
|
||||||
info.get_style_context().add_class("print-info")
|
info.get_style_context().add_class("print-info")
|
||||||
info.set_markup(self.get_info_str(item))
|
info.set_markup(self.get_info_str(item, path))
|
||||||
delete = Gtk.Button(hexpand=False, vexpand=False, can_focus=False, always_show_image=True)
|
delete = Gtk.Button(hexpand=False, vexpand=False, can_focus=False, always_show_image=True)
|
||||||
delete.get_style_context().add_class("color1")
|
delete.get_style_context().add_class("color1")
|
||||||
delete.set_image(self._gtk.Image("delete", self.list_button_size, self.list_button_size))
|
delete.set_image(self._gtk.Image("delete", self.list_button_size, self.list_button_size))
|
||||||
@ -331,7 +331,7 @@ class Panel(ScreenPanel):
|
|||||||
logging.info(f"Starting print: {filename}")
|
logging.info(f"Starting print: {filename}")
|
||||||
self._screen._ws.klippy.print_start(filename)
|
self._screen._ws.klippy.print_start(filename)
|
||||||
|
|
||||||
def get_info_str(self, item):
|
def get_info_str(self, item, path):
|
||||||
info = ""
|
info = ""
|
||||||
if "modified" in item:
|
if "modified" in item:
|
||||||
info += _("Modified") if 'dirname' in item else _("Uploaded")
|
info += _("Modified") if 'dirname' in item else _("Uploaded")
|
||||||
@ -342,7 +342,7 @@ class Panel(ScreenPanel):
|
|||||||
if "size" in item:
|
if "size" in item:
|
||||||
info += _("Size") + f': <b>{self.format_size(item["size"])}</b>\n'
|
info += _("Size") + f': <b>{self.format_size(item["size"])}</b>\n'
|
||||||
if 'filename' in item:
|
if 'filename' in item:
|
||||||
fileinfo = self._screen.files.get_file_info(item['filename'])
|
fileinfo = self._screen.files.get_file_info(path)
|
||||||
if "estimated_time" in fileinfo:
|
if "estimated_time" in fileinfo:
|
||||||
info += _("Print Time") + f': <b>{self.format_time(fileinfo["estimated_time"])}</b>'
|
info += _("Print Time") + f': <b>{self.format_time(fileinfo["estimated_time"])}</b>'
|
||||||
return info
|
return info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user