From bb8031ce89c25ed5e6803eb699938f8a9184ae2d Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 27 May 2024 22:32:12 -0300 Subject: [PATCH] job_status: add extra info to print list and dialog --- panels/print.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/panels/print.py b/panels/print.py index a9762788..f273bc5d 100644 --- a/panels/print.py +++ b/panels/print.py @@ -71,7 +71,7 @@ class Panel(ScreenPanel): logging.info(f"Thumbsize: {self.thumbsize}") self.flowbox = Gtk.FlowBox(selection_mode=Gtk.SelectionMode.NONE, - column_spacing=0, row_spacing=0, homogeneous=True) + column_spacing=0, row_spacing=0) list_mode = self._config.get_main_config().get("print_view", 'thumbs') logging.info(list_mode) self.list_mode = list_mode == 'list' @@ -314,14 +314,21 @@ class Panel(ScreenPanel): label = Gtk.Label(hexpand=True, vexpand=True, wrap=True, wrap_mode=Pango.WrapMode.WORD_CHAR) label.set_markup(f"{filename}\n") - box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) - box.add(label) + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, vexpand=True) + box.pack_start(label, False, False, 0) - height = (self._screen.height - self._gtk.dialog_buttons_height - self._gtk.font_size) * .75 + height = (self._screen.height - self._gtk.dialog_buttons_height - self._gtk.font_size * 5) * .75 pixbuf = self.get_file_image(filename, self._screen.width * .9, height) if pixbuf is not None: image = Gtk.Image.new_from_pixbuf(pixbuf) - box.add(image) + box.pack_start(image, True, True, 0) + + fileinfo = self._screen.files.get_file_info(filename) + if "estimated_time" in fileinfo: + box.pack_start( + Gtk.Label(label=_("Print Time") + f': {self.format_time(fileinfo["estimated_time"])}'), + False, False, 2 + ) self._gtk.Dialog(_("Print") + f' {filename}', buttons, box, self.confirm_print_response, filename) @@ -343,6 +350,12 @@ class Panel(ScreenPanel): info += _("Size") + f': {self.format_size(item["size"])}\n' if 'filename' in item: fileinfo = self._screen.files.get_file_info(path) + if "layer_height" in fileinfo: + info += _("Layer Height") + f': {fileinfo["layer_height"]}' + _("mm") + '\n' + if "filament_type" in fileinfo: + info += _("Filament") + f': {fileinfo["filament_type"]}\n' + if "filament_name" in fileinfo: + info += f'{fileinfo["filament_name"]}\n' if "estimated_time" in fileinfo: info += _("Print Time") + f': {self.format_time(fileinfo["estimated_time"])}' return info