|
@@ -143,7 +143,7 @@ class CuraEngineBackend(QObject, Backend):
|
|
|
self._last_num_objects = defaultdict(int) #type: Dict[int, int] # Count number of objects to see if there is something changed
|
|
|
self._postponed_scene_change_sources = [] #type: List[SceneNode] # scene change is postponed (by a tool)
|
|
|
|
|
|
- self._slice_start_time = None #type: Optional[float]
|
|
|
+ self._time_start_process = None #type: Optional[float]
|
|
|
self._is_disabled = False #type: bool
|
|
|
|
|
|
application.getPreferences().addPreference("general/auto_slice", False)
|
|
@@ -171,10 +171,24 @@ class CuraEngineBackend(QObject, Backend):
|
|
|
)
|
|
|
self._slicing_error_message.actionTriggered.connect(self._reportBackendError)
|
|
|
|
|
|
+ self._resetLastSliceTimeStats()
|
|
|
self._snapshot = None #type: Optional[QImage]
|
|
|
|
|
|
application.initializationFinished.connect(self.initialize)
|
|
|
|
|
|
+ def _resetLastSliceTimeStats(self) -> None:
|
|
|
+ self._time_start_process = None
|
|
|
+ self._time_send_message = None
|
|
|
+ self._time_end_slice = None
|
|
|
+
|
|
|
+ def resetAndReturnLastSliceTimeStats(self) -> Dict[str, float]:
|
|
|
+ return {
|
|
|
+ "time_start_process": self._time_start_process,
|
|
|
+ "time_send_message": self._time_send_message,
|
|
|
+ "time_end_slice": self._time_end_slice
|
|
|
+ }
|
|
|
+ self._resetLastSliceTimeStats()
|
|
|
+
|
|
|
def initialize(self) -> None:
|
|
|
application = CuraApplication.getInstance()
|
|
|
self._multi_build_plate_model = application.getMultiBuildPlateModel()
|
|
@@ -288,7 +302,7 @@ class CuraEngineBackend(QObject, Backend):
|
|
|
self._createSnapshot()
|
|
|
|
|
|
Logger.log("i", "Starting to slice...")
|
|
|
- self._slice_start_time = time()
|
|
|
+ self._time_start_process = time()
|
|
|
if not self._build_plates_to_be_sliced:
|
|
|
self.processingProgress.emit(1.0)
|
|
|
Logger.log("w", "Slice unnecessary, nothing has changed that needs reslicing.")
|
|
@@ -512,8 +526,10 @@ class CuraEngineBackend(QObject, Backend):
|
|
|
# Notify the user that it's now up to the backend to do it's job
|
|
|
self.setState(BackendState.Processing)
|
|
|
|
|
|
- if self._slice_start_time:
|
|
|
- Logger.log("d", "Sending slice message took %s seconds", time() - self._slice_start_time )
|
|
|
+ # Handle time reporting.
|
|
|
+ self._time_send_message = time()
|
|
|
+ if self._time_start_process:
|
|
|
+ Logger.log("d", "Sending slice message took %s seconds", self._time_send_message - self._time_start_process)
|
|
|
|
|
|
def determineAutoSlicing(self) -> bool:
|
|
|
"""Determine enable or disable auto slicing. Return True for enable timer and False otherwise.
|
|
@@ -750,6 +766,7 @@ class CuraEngineBackend(QObject, Backend):
|
|
|
|
|
|
self.setState(BackendState.Done)
|
|
|
self.processingProgress.emit(1.0)
|
|
|
+ self._time_end_slice = time()
|
|
|
|
|
|
try:
|
|
|
gcode_list = self._scene.gcode_dict[self._start_slice_job_build_plate] #type: ignore #Because we generate this attribute dynamically.
|
|
@@ -766,8 +783,8 @@ class CuraEngineBackend(QObject, Backend):
|
|
|
gcode_list[index] = replaced
|
|
|
|
|
|
self._slicing = False
|
|
|
- if self._slice_start_time:
|
|
|
- Logger.log("d", "Slicing took %s seconds", time() - self._slice_start_time )
|
|
|
+ if self._time_start_process:
|
|
|
+ Logger.log("d", "Slicing took %s seconds", time() - self._time_start_process)
|
|
|
Logger.log("d", "Number of models per buildplate: %s", dict(self._numObjectsPerBuildPlate()))
|
|
|
|
|
|
# See if we need to process the sliced layers job.
|