From 2d300ab39539149398716b74a4d2052482215eae Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 20 Sep 2018 18:34:08 +0200 Subject: [PATCH 1/2] Revert "Fix plugins import in CuraApplication" This reverts commit e87f3d7ca9cf135142bee488f188b9639c8b38fd. --- cura/CuraApplication.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index cdb640c3e2..c7d7fff518 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -82,6 +82,7 @@ from cura.Settings.SettingInheritanceManager import SettingInheritanceManager from cura.Settings.SimpleModeSettingsManager import SimpleModeSettingsManager from cura.Machines.VariantManager import VariantManager +from plugins.SliceInfoPlugin.SliceInfo import SliceInfo from .SingleInstance import SingleInstance from .AutoSave import AutoSave @@ -112,10 +113,6 @@ from cura.ObjectsModel import ObjectsModel from UM.FlameProfiler import pyqtSlot -if TYPE_CHECKING: - from plugins.SliceInfoPlugin.SliceInfo import SliceInfo - - numpy.seterr(all = "ignore") try: From 4bd5d29970f19aa2e038fb7f6e49860ce5a0d725 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 20 Sep 2018 18:41:30 +0200 Subject: [PATCH 2/2] Don't crash if the plugin is not found (maybe some error while loading). In that case it's better not to show the dialog than crashing. --- cura/CuraApplication.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index c7d7fff518..74c8e805af 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -13,6 +13,7 @@ from PyQt5.QtGui import QColor, QIcon from PyQt5.QtWidgets import QMessageBox from PyQt5.QtQml import qmlRegisterUncreatableType, qmlRegisterSingletonType, qmlRegisterType +from UM.PluginError import PluginNotFoundError from UM.Scene.SceneNode import SceneNode from UM.Scene.Camera import Camera from UM.Math.Vector import Vector @@ -1704,7 +1705,11 @@ class CuraApplication(QtApplication): @pyqtSlot() def showMoreInformationDialogForAnonymousDataCollection(self): - cast(SliceInfo, self._plugin_registry.getPluginObject("SliceInfoPlugin")).showMoreInfoDialog() + try: + slice_info = cast(SliceInfo, self._plugin_registry.getPluginObject("SliceInfoPlugin")) + slice_info.showMoreInfoDialog() + except PluginNotFoundError: + Logger.log("w", "Plugin SliceInfo was not found, so not able to show the info dialog.") def addSidebarCustomMenuItem(self, menu_item: dict) -> None: self._sidebar_custom_menu_items.append(menu_item)