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:
authorIan Paschal <ian.paschal@gmail.com>2018-07-09 12:29:25 +0300
committerIan Paschal <ian.paschal@gmail.com>2018-07-09 12:29:25 +0300
commitac0192f01f72c859effe05ae7ce9dc7a536d9220 (patch)
tree6cfd45c68718ec813454236524529d374ddea50e /plugins/SliceInfoPlugin
parentc3cd6f8052d53e8f0ef6acf944784707633140e8 (diff)
Improve fixes
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 aad1b5005d..2e9e557c4a 100755
--- a/plugins/SliceInfoPlugin/SliceInfo.py
+++ b/plugins/SliceInfoPlugin/SliceInfo.py
@@ -16,7 +16,7 @@ from UM.i18n import i18nCatalog
from UM.Logger import Logger
from UM.PluginRegistry import PluginRegistry
from UM.Qt.Duration import DurationFormat
-from typing import cast
+from typing import cast, Optional
from .SliceInfoJob import SliceInfoJob
@@ -79,9 +79,13 @@ class SliceInfo(QObject, Extension):
return dialog
@pyqtSlot(result = str)
- def getExampleData(self) -> str:
+ def getExampleData(self) -> Optional[str]:
if self._example_data_content is None:
- file_path = os.path.join(cast(str, PluginRegistry.getInstance().getPluginPath(self.getPluginId())), "example_data.json")
+ plugin_path = PluginRegistry.getInstance().getPluginPath(self.getPluginId())
+ if not plugin_path:
+ Logger.log("e", "Could not get plugin path!", self.getPluginId())
+ return None
+ file_path = os.path.join(plugin_path, "example_data.json")
if file_path:
with open(file_path, "r", encoding = "utf-8") as f:
self._example_data_content = f.read()