diff options
author | Ian Paschal <ian.paschal@gmail.com> | 2018-07-05 16:54:21 +0300 |
---|---|---|
committer | Ian Paschal <ian.paschal@gmail.com> | 2018-07-05 16:54:21 +0300 |
commit | cfae634061fbfedb6b75355fcf122e9c5ec04b25 (patch) | |
tree | 8835139106ad39c4f74b1c2ec89e91f59abfd92c /plugins/SliceInfoPlugin | |
parent | d0c68f8e947da1858331a2094c361afa89fa8dc6 (diff) |
Fixes for SliceInfo
Diffstat (limited to 'plugins/SliceInfoPlugin')
-rwxr-xr-x | plugins/SliceInfoPlugin/SliceInfo.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index fe17af89eb..aad1b5005d 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 .SliceInfoJob import SliceInfoJob @@ -81,9 +81,10 @@ class SliceInfo(QObject, Extension): @pyqtSlot(result = str) def getExampleData(self) -> str: if self._example_data_content is None: - file_path = os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), "example_data.json") - with open(file_path, "r", encoding = "utf-8") as f: - self._example_data_content = f.read() + file_path = os.path.join(cast(str, PluginRegistry.getInstance().getPluginPath(self.getPluginId())), "example_data.json") + if file_path: + with open(file_path, "r", encoding = "utf-8") as f: + self._example_data_content = f.read() return self._example_data_content @pyqtSlot(bool) |