diff --git a/cura/CuraView.py b/cura/CuraView.py index 978c651b43..45cd7ba61b 100644 --- a/cura/CuraView.py +++ b/cura/CuraView.py @@ -3,8 +3,11 @@ from PyQt5.QtCore import pyqtProperty, QUrl +from UM.Resources import Resources from UM.View.View import View +from cura.CuraApplication import CuraApplication + # Since Cura has a few pre-defined "space claims" for the locations of certain components, we've provided some structure # to indicate this. @@ -12,13 +15,20 @@ from UM.View.View import View # the stageMenuComponent returns an item that should be used somehwere in the stage menu. It's up to the active stage # to actually do something with this. class CuraView(View): - def __init__(self, parent = None) -> None: + def __init__(self, parent = None, use_empty_menu_placeholder: bool = False) -> None: super().__init__(parent) + self._empty_menu_placeholder_url = QUrl(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, + "EmptyViewMenuComponent.qml")) + self._use_empty_menu_placeholder = use_empty_menu_placeholder + @pyqtProperty(QUrl, constant = True) def mainComponent(self) -> QUrl: return self.getDisplayComponent("main") @pyqtProperty(QUrl, constant = True) def stageMenuComponent(self) -> QUrl: - return self.getDisplayComponent("menu") \ No newline at end of file + url = self.getDisplayComponent("menu") + if not url.toString() and self._use_empty_menu_placeholder: + url = self._empty_menu_placeholder_url + return url diff --git a/plugins/XRayView/XRayView.py b/plugins/XRayView/XRayView.py index 86533fe51c..88a5a441b8 100644 --- a/plugins/XRayView/XRayView.py +++ b/plugins/XRayView/XRayView.py @@ -10,21 +10,21 @@ from UM.Math.Color import Color from UM.PluginRegistry import PluginRegistry from UM.Platform import Platform from UM.Event import Event -from UM.View.View import View from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator from UM.View.RenderBatch import RenderBatch from UM.View.GL.OpenGL import OpenGL from cura.CuraApplication import CuraApplication +from cura.CuraView import CuraView from cura.Scene.ConvexHullNode import ConvexHullNode from . import XRayPass ## View used to display a see-through version of objects with errors highlighted. -class XRayView(View): +class XRayView(CuraView): def __init__(self): - super().__init__() + super().__init__(parent = None, use_empty_menu_placeholder = True) self._xray_shader = None self._xray_pass = None diff --git a/resources/qml/EmptyViewMenuComponent.qml b/resources/qml/EmptyViewMenuComponent.qml new file mode 100644 index 0000000000..8551d21998 --- /dev/null +++ b/resources/qml/EmptyViewMenuComponent.qml @@ -0,0 +1,9 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + + +// Empty placeholder +Item { }