job_status: remove the status message and use the titlebar for that
This commit is contained in:
parent
c0477be5cb
commit
4060d6ef18
@ -14,7 +14,7 @@ from ks_includes.KlippyGtk import find_widget
|
||||
|
||||
class Panel(ScreenPanel):
|
||||
def __init__(self, screen, title):
|
||||
title = title or (_("Printing") if self._printer.extrudercount > 0 else _("Job Status"))
|
||||
title = title or _("Job Status")
|
||||
super().__init__(screen, title)
|
||||
self.grid = Gtk.Grid(column_homogeneous=True)
|
||||
self.pos_z = 0.0
|
||||
@ -82,8 +82,6 @@ class Panel(ScreenPanel):
|
||||
|
||||
self.labels['file'] = Gtk.Label(label="Filename", hexpand=True)
|
||||
self.labels['file'].get_style_context().add_class("printing-filename")
|
||||
self.labels['status'] = Gtk.Label(label="Status")
|
||||
self.labels['status'].get_style_context().add_class("printing-status")
|
||||
self.labels['lcdmessage'] = Gtk.Label()
|
||||
self.labels['lcdmessage'].get_style_context().add_class("printing-status")
|
||||
|
||||
@ -91,9 +89,8 @@ class Panel(ScreenPanel):
|
||||
self.labels[label].set_halign(Gtk.Align.START)
|
||||
self.labels[label].set_ellipsize(Pango.EllipsizeMode.END)
|
||||
|
||||
fi_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
fi_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, valign=Gtk.Align.CENTER)
|
||||
fi_box.add(self.labels['file'])
|
||||
fi_box.add(self.labels['status'])
|
||||
fi_box.add(self.labels['lcdmessage'])
|
||||
self.grid.attach(fi_box, 1, 0, 3, 1)
|
||||
|
||||
@ -106,6 +103,7 @@ class Panel(ScreenPanel):
|
||||
box.add(self.labels['progress_text'])
|
||||
|
||||
overlay = Gtk.Overlay(hexpand=True)
|
||||
overlay.set_size_request(*(self._gtk.font_size * 5,) * 2)
|
||||
overlay.add(self.labels['darea'])
|
||||
overlay.add_overlay(box)
|
||||
self.grid.attach(overlay, 0, 0, 1, 1)
|
||||
@ -663,25 +661,27 @@ class Panel(ScreenPanel):
|
||||
|
||||
def set_state(self, state, msg=""):
|
||||
if state == "printing":
|
||||
self.labels["status"].set_label(_("Printing"))
|
||||
self._screen.set_panel_title(
|
||||
_("Printing") if self._printer.extrudercount > 0 else _("Working")
|
||||
)
|
||||
elif state == "complete":
|
||||
self.update_progress(1)
|
||||
self.labels["status"].set_label(_("Complete"))
|
||||
self._screen.set_panel_title(_("Complete"))
|
||||
self.buttons['left'].set_label("-")
|
||||
self._add_timeout(self._config.get_main_config().getint("job_complete_timeout", 0))
|
||||
elif state == "error":
|
||||
self.labels['status'].set_label(_("Error"))
|
||||
self._screen.set_panel_title(_("Error"))
|
||||
self._screen.show_popup_message(msg)
|
||||
self._add_timeout(self._config.get_main_config().getint("job_error_timeout", 0))
|
||||
elif state == "cancelling":
|
||||
self.labels["status"].set_label(_("Cancelling"))
|
||||
self._screen.set_panel_title(_("Cancelling"))
|
||||
elif state == "cancelled" or (state == "standby" and self.state == "cancelled"):
|
||||
self.labels["status"].set_label(_("Cancelled"))
|
||||
self._screen.set_panel_title(_("Cancelled"))
|
||||
self._add_timeout(self._config.get_main_config().getint("job_cancelled_timeout", 0))
|
||||
elif state == "paused":
|
||||
self.labels["status"].set_label(_("Paused"))
|
||||
self._screen.set_panel_title(_("Paused"))
|
||||
elif state == "standby":
|
||||
self.labels["status"].set_label(_("Standby"))
|
||||
self._screen.set_panel_title(_("Standby"))
|
||||
if self.state != state:
|
||||
logging.debug(f"Changing job_status state from '{self.state}' to '{state}'")
|
||||
self.state = state
|
||||
|
@ -333,6 +333,9 @@ class KlipperScreen(Gtk.Window):
|
||||
except Exception as e:
|
||||
logging.exception(f"Error attaching panel:\n{e}\n\n{traceback.format_exc()}")
|
||||
|
||||
def set_panel_title(self, title):
|
||||
self.base_panel.set_title(title)
|
||||
|
||||
def attach_panel(self, panel):
|
||||
if panel in self.panels_reinit:
|
||||
# this happens when the first panel needs a reinit
|
||||
|
Loading…
x
Reference in New Issue
Block a user