diff --git a/plugins/PreviewStage/PreviewStage.py b/plugins/PreviewStage/PreviewStage.py index 4c449e55f2..e41d4a592f 100644 --- a/plugins/PreviewStage/PreviewStage.py +++ b/plugins/PreviewStage/PreviewStage.py @@ -2,16 +2,17 @@ # Cura is released under the terms of the LGPLv3 or higher. import os.path -from UM.Application import Application +from UM.Qt.QtApplication import QtApplication from cura.Stages.CuraStage import CuraStage from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: - from UM.View import View + from UM.View.View import View + class PreviewStage(CuraStage): - def __init__(self, application: Application, parent = None) -> None: + def __init__(self, application: QtApplication, parent = None) -> None: super().__init__(parent) self._application = application self._application.engineCreatedSignal.connect(self._engineCreated) @@ -26,6 +27,7 @@ class PreviewStage(CuraStage): self._previously_active_view = None def _engineCreated(self) -> None: - menu_component_path = os.path.join(self._application.getPluginRegistry().getPluginPath(self.getPluginId()), - "PreviewMenu.qml") - self.addDisplayComponent("menu", menu_component_path) + plugin_path = self._application.getPluginRegistry().getPluginPath(self.getPluginId()) + if plugin_path is not None: + menu_component_path = os.path.join(plugin_path, "PreviewMenu.qml") + self.addDisplayComponent("menu", menu_component_path)