1# Copyright (c) 2018 Ultimaker B.V. 2# Cura is released under the terms of the LGPLv3 or higher. 3 4from PyQt5.QtCore import pyqtProperty, QUrl 5 6from UM.Resources import Resources 7from UM.View.View import View 8 9from cura.CuraApplication import CuraApplication 10 11 12# Since Cura has a few pre-defined "space claims" for the locations of certain components, we've provided some structure 13# to indicate this. 14# MainComponent works in the same way the MainComponent of a stage. 15# the stageMenuComponent returns an item that should be used somehwere in the stage menu. It's up to the active stage 16# to actually do something with this. 17class CuraView(View): 18 def __init__(self, parent = None, use_empty_menu_placeholder: bool = False) -> None: 19 super().__init__(parent) 20 21 self._empty_menu_placeholder_url = QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, 22 "EmptyViewMenuComponent.qml")) 23 self._use_empty_menu_placeholder = use_empty_menu_placeholder 24 25 @pyqtProperty(QUrl, constant = True) 26 def mainComponent(self) -> QUrl: 27 return self.getDisplayComponent("main") 28 29 30 @pyqtProperty(QUrl, constant = True) 31 def stageMenuComponent(self) -> QUrl: 32 url = self.getDisplayComponent("menu") 33 if not url.toString() and self._use_empty_menu_placeholder: 34 url = self._empty_menu_placeholder_url 35 return url 36