Cura no longer crashes when NaN is recieved for printtime from engine

CURA-3516
This commit is contained in:
Jaime van Kessel 2017-03-14 09:59:55 +01:00
parent 32d5fbe557
commit c0cdddd098

View File

@ -5,6 +5,7 @@ from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty
from UM.FlameProfiler import pyqtSlot
from UM.Application import Application
from UM.Logger import Logger
from UM.Qt.Duration import Duration
from UM.Preferences import Preferences
from UM.Settings.ContainerRegistry import ContainerRegistry
@ -109,7 +110,12 @@ class PrintInformation(QObject):
return self._material_costs
def _onPrintDurationMessage(self, total_time, material_amounts):
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._material_amounts = material_amounts