job_status: Update confirm dialog. Fix variable name

This commit is contained in:
Jordan Ruthe
2020-12-02 16:33:04 -05:00
parent 3a4c556f25
commit 16f7d4543a
2 changed files with 23 additions and 25 deletions

View File

@@ -94,33 +94,32 @@ class JobStatusPanel(ScreenPanel):
self._screen.add_subscription(panel_name) self._screen.add_subscription(panel_name)
def resume(self, widget): def resume(self, widget):
self.disable_button("pause","cancel") self.disable_button("resume","cancel")
self._screen._ws.klippy.print_resume(self._response_callback, "enable_button", "pause", "cancel") self._screen._ws.klippy.print_resume(self._response_callback, "enable_button", "pause", "cancel")
self._screen.show_all() self._screen.show_all()
def pause(self, widget): def pause(self, widget):
self.disable_button("resume","cancel") self.disable_button("pause","cancel")
self._screen._ws.klippy.print_pause(self._response_callback, "enable_button", "resume", "cancel") self._screen._ws.klippy.print_pause(self._response_callback, "enable_button", "resume", "cancel")
self._screen.show_all() self._screen.show_all()
def cancel(self, widget): def cancel(self, widget):
_ = self.lang.gettext _ = self.lang.gettext
dialog = KlippyGtk.ConfirmDialog( buttons = [
self._screen, {"name": _("Cancel Print"), "response": Gtk.ResponseType.OK},
_("Are you sure you wish to cancel this print?"), {"name": _("Go Back"), "response": Gtk.ResponseType.CANCEL}
[ ]
{
"name": _("Cancel Print"), label = Gtk.Label()
"response": Gtk.ResponseType.OK label.set_markup(_("Are you sure you wish to cancel this print?"))
}, label.set_hexpand(True)
{ label.set_halign(Gtk.Align.CENTER)
"name": _("Go Back"), label.set_line_wrap(True)
"response": Gtk.ResponseType.CANCEL label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
} label.get_style_context().add_class("text")
],
self.cancel_confirm dialog = KlippyGtk.Dialog(self._screen, buttons, label, self.cancel_confirm)
)
self.disable_button("pause","cancel") self.disable_button("pause","cancel")
def cancel_confirm(self, widget, response_id): def cancel_confirm(self, widget, response_id):
@@ -182,16 +181,14 @@ class JobStatusPanel(ScreenPanel):
if "pause_resume" in data: if "pause_resume" in data:
if self.is_paused == True and data['pause_resume']['is_paused'] == False: if self.is_paused == True and data['pause_resume']['is_paused'] == False:
self.is_paused = False self.is_paused = False
self.panel.attach(self.labels['pause'], 0, 2, 1, 1) self.layout.attach(self.labels['pause'], 0, 2, 1, 1)
self.panel.remove(self.labels['resume']) self.layout.remove(self.labels['resume'])
self.panel.show_all() self.layout.show_all()
if self.is_paused == False and data['pause_resume']['is_paused'] == True: if self.is_paused == False and data['pause_resume']['is_paused'] == True:
self.is_paused = True self.is_paused = True
self.panel.attach(self.labels['resume'], 0, 2, 1, 1) self.layout.attach(self.labels['resume'], 0, 2, 1, 1)
self.panel.remove(self.labels['pause']) self.layout.remove(self.labels['pause'])
self.panel.show_all() self.layout.show_all()
def update_image_text(self, label, text): def update_image_text(self, label, text):
if label in self.labels and 'l' in self.labels[label]: if label in self.labels and 'l' in self.labels[label]:

View File

@@ -119,6 +119,7 @@ class KlipperScreen(Gtk.Window):
"fan": ["speed"], "fan": ["speed"],
"gcode_move": ["homing_origin","extrude_factor","speed_factor"], "gcode_move": ["homing_origin","extrude_factor","speed_factor"],
"heater_bed": ["target","temperature"], "heater_bed": ["target","temperature"],
"pause_resume": ["is_paused"],
"print_stats": ["print_duration","total_duration","filament_used","filename","state","message"], "print_stats": ["print_duration","total_duration","filament_used","filename","state","message"],
"toolhead": ["homed_axes","estimated_print_time","print_time","position","extruder"], "toolhead": ["homed_axes","estimated_print_time","print_time","position","extruder"],
"virtual_sdcard": ["file_position","is_active","progress"], "virtual_sdcard": ["file_position","is_active","progress"],