job_status: use the new print_stats layer info

This commit is contained in:
alfrix 2022-11-06 11:51:43 -03:00
parent 8855d9b98f
commit 26d10a949b
2 changed files with 12 additions and 8 deletions

View File

@ -632,12 +632,6 @@ class JobStatusPanel(ScreenPanel):
if fan_label: if fan_label:
self.labels['fan'].set_text(fan_label[:12]) self.labels['fan'].set_text(fan_label[:12])
if "layer_height" in self.file_metadata and "object_height" in self.file_metadata:
layer_label = (
f"{1 + round((self.pos_z - self.f_layer_h) / self.layer_h)} / {self.labels['total_layers'].get_text()}"
)
self.labels['layer'].set_label(layer_label)
self.state_check() self.state_check()
if self.state not in ["printing", "paused"]: if self.state not in ["printing", "paused"]:
return return
@ -648,6 +642,15 @@ class JobStatusPanel(ScreenPanel):
self.update_filename() self.update_filename()
else: else:
self.update_percent_complete() self.update_percent_complete()
if ps.get('info').get('total_layer'):
self.labels['total_layers'].set_label(f"{ps['info']['total_layer']}")
if ps.get('info').get('current_layer'):
self.labels['layer'].set_label(f"{ps['info']['current_layer']} / {self.labels['total_layers'].get_text()}")
elif "layer_height" in self.file_metadata and "object_height" in self.file_metadata:
layer_label = (
f"{1 + round((self.pos_z - self.f_layer_h) / self.layer_h)} / {self.labels['total_layers'].get_text()}")
self.labels['layer'].set_label(layer_label)
if 'print_duration' in ps: if 'print_duration' in ps:
if int(ps['print_duration']) == 0 and self.progress > 0.001: if int(ps['print_duration']) == 0 and self.progress > 0.001:
# Print duration remains at 0 when using No-extusion tests # Print duration remains at 0 when using No-extusion tests
@ -828,7 +831,7 @@ class JobStatusPanel(ScreenPanel):
height = self._screen.height / 4 height = self._screen.height / 4
else: else:
width = self._screen.width / 3 width = self._screen.width / 3
height = self._gtk.get_content_height() * 0.48 height = self._gtk.get_content_height() * 0.47
pixbuf = self.get_file_image(self.filename, width, height) pixbuf = self.get_file_image(self.filename, width, height)
if pixbuf is not None: if pixbuf is not None:
self.labels['thumbnail'].set_from_pixbuf(pixbuf) self.labels['thumbnail'].set_from_pixbuf(pixbuf)

View File

@ -251,7 +251,8 @@ class KlipperScreen(Gtk.Window):
"gcode_move": ["extrude_factor", "gcode_position", "homing_origin", "speed_factor", "speed"], "gcode_move": ["extrude_factor", "gcode_position", "homing_origin", "speed_factor", "speed"],
"idle_timeout": ["state"], "idle_timeout": ["state"],
"pause_resume": ["is_paused"], "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",
"info"],
"toolhead": ["homed_axes", "estimated_print_time", "print_time", "position", "extruder", "toolhead": ["homed_axes", "estimated_print_time", "print_time", "position", "extruder",
"max_accel", "max_accel_to_decel", "max_velocity", "square_corner_velocity"], "max_accel", "max_accel_to_decel", "max_velocity", "square_corner_velocity"],
"virtual_sdcard": ["file_position", "is_active", "progress"], "virtual_sdcard": ["file_position", "is_active", "progress"],