Fixed typing

CURA-5829
This commit is contained in:
Jaime van Kessel 2018-10-29 13:54:20 +01:00
parent fc6ad4f623
commit cfa962311b

View file

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