mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 16:19:05 +08:00
Prevent division by 0 if total download size is 0
This can happen if the downloads are all so small that it gets rounded to 0kB. Fixes Sentry issue CURA-ZM.
This commit is contained in:
parent
f0456526b3
commit
3032221b70
@ -99,7 +99,7 @@ class ExtruderOutputModel(QObject):
|
|||||||
self._is_preheating = pre_heating
|
self._is_preheating = pre_heating
|
||||||
self.isPreheatingChanged.emit()
|
self.isPreheatingChanged.emit()
|
||||||
|
|
||||||
@pyqtProperty(bool, notify=isPreheatingChanged)
|
@pyqtProperty(bool, notify = isPreheatingChanged)
|
||||||
def isPreheating(self) -> bool:
|
def isPreheating(self) -> bool:
|
||||||
return self._is_preheating
|
return self._is_preheating
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ except ImportError:
|
|||||||
parser = argparse.ArgumentParser(prog = "cura",
|
parser = argparse.ArgumentParser(prog = "cura",
|
||||||
add_help = False)
|
add_help = False)
|
||||||
parser.add_argument("--debug",
|
parser.add_argument("--debug",
|
||||||
action="store_true",
|
action = "store_true",
|
||||||
default = False,
|
default = False,
|
||||||
help = "Turn on the debug mode by setting this option."
|
help = "Turn on the debug mode by setting this option."
|
||||||
)
|
)
|
||||||
@ -49,7 +49,7 @@ known_args = vars(parser.parse_known_args()[0])
|
|||||||
if with_sentry_sdk:
|
if with_sentry_sdk:
|
||||||
sentry_env = "unknown" # Start off with a "IDK"
|
sentry_env = "unknown" # Start off with a "IDK"
|
||||||
if hasattr(sys, "frozen"):
|
if hasattr(sys, "frozen"):
|
||||||
sentry_env = "production" # A frozen build has the posibility to be a "real" distribution.
|
sentry_env = "production" # A frozen build has the possibility to be a "real" distribution.
|
||||||
|
|
||||||
if ApplicationMetadata.CuraVersion == "master":
|
if ApplicationMetadata.CuraVersion == "master":
|
||||||
sentry_env = "development" # Master is always a development version.
|
sentry_env = "development" # Master is always a development version.
|
||||||
|
@ -120,6 +120,10 @@ class DownloadPresenter:
|
|||||||
received += item["received"]
|
received += item["received"]
|
||||||
total += item["total"]
|
total += item["total"]
|
||||||
|
|
||||||
|
if total == 0: # Total download size is 0, or unknown, or there are no progress items at all.
|
||||||
|
self._progress_message.setProgress(100.0)
|
||||||
|
return
|
||||||
|
|
||||||
self._progress_message.setProgress(100.0 * (received / total)) # [0 .. 100] %
|
self._progress_message.setProgress(100.0 * (received / total)) # [0 .. 100] %
|
||||||
|
|
||||||
def _onError(self, package_id: str) -> None:
|
def _onError(self, package_id: str) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user