mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-16 03:16:04 +08:00
Fix a possible division by zero error
This commit is contained in:
parent
94f31378a6
commit
57efca1376
@ -132,9 +132,9 @@ class PrintJobOutputModel(QObject):
|
||||
|
||||
@pyqtProperty(float, notify = timeElapsedChanged)
|
||||
def progress(self) -> float:
|
||||
result = self.timeElapsed / self.timeTotal
|
||||
# Never get a progress past 1.0
|
||||
return min(result, 1.0)
|
||||
time_elapsed = max(float(self.timeElapsed), 1.0) # Prevent a division by zero exception
|
||||
result = time_elapsed / self.timeTotal
|
||||
return min(result, 1.0) # Never get a progress past 1.0
|
||||
|
||||
@pyqtProperty(str, notify=stateChanged)
|
||||
def state(self) -> str:
|
||||
|
Loading…
x
Reference in New Issue
Block a user