Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2021-06-28 15:32:12 +0300
committerGhostkeeper <rubend@tutanota.com>2021-06-28 15:32:12 +0300
commit7ff86547efb8e68830d9d84f86a7546bf55d238a (patch)
tree0c8f2c0474b93b2609a11bc80297576a53d74b27 /plugins/SliceInfoPlugin
parent1ccff0e3eb417498fc5383af81febf06d62be5d1 (diff)
Add fallback for if the example file can't be read
Fixes Sentry issue CURA-2KM.
Diffstat (limited to 'plugins/SliceInfoPlugin')
-rwxr-xr-xplugins/SliceInfoPlugin/SliceInfo.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py
index 5ead422d0a..02e71207e0 100755
--- a/plugins/SliceInfoPlugin/SliceInfo.py
+++ b/plugins/SliceInfoPlugin/SliceInfo.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Ultimaker B.V.
+# Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import json
@@ -87,8 +87,12 @@ class SliceInfo(QObject, Extension):
return None
file_path = os.path.join(plugin_path, "example_data.html")
if file_path:
- with open(file_path, "r", encoding = "utf-8") as f:
- self._example_data_content = f.read()
+ try:
+ with open(file_path, "r", encoding = "utf-8") as f:
+ self._example_data_content = f.read()
+ except EnvironmentError as e:
+ Logger.error(f"Unable to read example slice info data to show to the user: {e}")
+ self._example_data_content = "<i>" + catalog.i18nc("@text", "Unable to read example data file.") + "</i>"
return self._example_data_content
@pyqtSlot(bool)