job_status: add extra info to print list and dialog

This commit is contained in:
Alfredo Monclus 2024-05-27 22:32:12 -03:00
parent e39c286f00
commit bb8031ce89

View File

@ -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"<b>{filename}</b>\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': <b>{self.format_size(item["size"])}</b>\n'
if 'filename' in item:
fileinfo = self._screen.files.get_file_info(path)
if "layer_height" in fileinfo:
info += _("Layer Height") + f': <b>{fileinfo["layer_height"]}</b>' + _("mm") + '\n'
if "filament_type" in fileinfo:
info += _("Filament") + f': <b>{fileinfo["filament_type"]}</b>\n'
if "filament_name" in fileinfo:
info += f'<b>{fileinfo["filament_name"]}</b>\n'
if "estimated_time" in fileinfo:
info += _("Print Time") + f': <b>{self.format_time(fileinfo["estimated_time"])}</b>'
return info