11import logging
22import typing
3- import os
43import events
54from helper_methods import calculate_current_layer , estimate_print_time
65from lib .panels .widgets import dialogPage
1413
1514
1615class JobStatusWidget (QtWidgets .QWidget ):
16+ """Job status widget page, page shown when there is a active print job.
17+
18+ Enables mid print printer tuning and inspection of print progress.
19+
20+
21+ Args:
22+ QtWidgets (QtWidgets.QWidget): Parent widget
23+ """
24+
1725 print_start : typing .ClassVar [QtCore .pyqtSignal ] = QtCore .pyqtSignal (
1826 str , name = "print_start"
1927 )
@@ -279,24 +287,19 @@ def on_print_stats_update(self, field: str, value: dict | float | str) -> None:
279287 @QtCore .pyqtSlot (str , list , name = "on_gcode_move_update" )
280288 def on_gcode_move_update (self , field : str , value : list ) -> None :
281289 """Handle gcode move"""
282- if isinstance (value , list ):
283- if "gcode_position" in field : # Without offsets
284- if self ._internal_print_status == "printing" :
285- _current_layer = calculate_current_layer (
286- z_position = value [2 ],
287- object_height = float (
288- self .file_metadata .get ("object_height" , - 1.0 )
289- ),
290- layer_height = float (
291- self .file_metadata .get ("layer_height" , - 1.0 )
292- ),
293- first_layer_height = float (
294- self .file_metadata .get ("first_layer_height" , - 1.0 )
295- ),
296- )
297- self .layer_display_button .setText (
298- f"{ int (_current_layer )} " if _current_layer != - 1 else "?"
299- )
290+ if "gcode_position" in field : # Without offsets
291+ if self ._internal_print_status == "printing" :
292+ _current_layer = calculate_current_layer (
293+ z_position = value [2 ],
294+ object_height = float (self .file_metadata .get ("object_height" , - 1.0 )),
295+ layer_height = float (self .file_metadata .get ("layer_height" , - 1.0 )),
296+ first_layer_height = float (
297+ self .file_metadata .get ("first_layer_height" , - 1.0 )
298+ ),
299+ )
300+ self .layer_display_button .setText (
301+ f"{ int (_current_layer )} " if _current_layer != - 1 else "?"
302+ )
300303
301304 @QtCore .pyqtSlot (str , float , name = "virtual_sdcard_update" )
302305 @QtCore .pyqtSlot (str , bool , name = "virtual_sdcard_update" )
@@ -308,11 +311,11 @@ def virtual_sdcard_update(self, field: str, value: float | bool) -> None:
308311 value (float | bool): The updated information for the corresponding field
309312 """
310313 if isinstance (value , bool ):
311- self . sdcard_read = value
312- elif isinstance ( value , float ) :
313- if "progress" == field :
314- self . print_progress = value
315- self . printing_progress_bar . setValue ( self . print_progress )
314+ ...
315+ if "progress" == field :
316+ self . printing_progress_bar . setValue ( value )
317+ if "file_position" == field :
318+ ...
316319
317320 def _setupUI (self ) -> None :
318321 """Setup widget ui"""
0 commit comments