mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 02:35:53 +08:00
Cura no longer crashes when NaN is recieved for printtime from engine
CURA-3516
This commit is contained in:
parent
32d5fbe557
commit
c0cdddd098
@ -5,6 +5,7 @@ from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty
|
|||||||
from UM.FlameProfiler import pyqtSlot
|
from UM.FlameProfiler import pyqtSlot
|
||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
from UM.Logger import Logger
|
||||||
from UM.Qt.Duration import Duration
|
from UM.Qt.Duration import Duration
|
||||||
from UM.Preferences import Preferences
|
from UM.Preferences import Preferences
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
@ -109,7 +110,12 @@ class PrintInformation(QObject):
|
|||||||
return self._material_costs
|
return self._material_costs
|
||||||
|
|
||||||
def _onPrintDurationMessage(self, total_time, material_amounts):
|
def _onPrintDurationMessage(self, total_time, material_amounts):
|
||||||
self._current_print_time.setDuration(total_time)
|
if total_time != total_time: # Check for NaN. Engine can sometimes give us weird values.
|
||||||
|
Logger.log("w", "Received NaN for print duration message")
|
||||||
|
self._current_print_time.setDuration(0)
|
||||||
|
else:
|
||||||
|
self._current_print_time.setDuration(total_time)
|
||||||
|
|
||||||
self.currentPrintTimeChanged.emit()
|
self.currentPrintTimeChanged.emit()
|
||||||
|
|
||||||
self._material_amounts = material_amounts
|
self._material_amounts = material_amounts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user