From dd92d8d5e093c225f4ccf86b8519551ff8fb548a Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Thu, 7 Dec 2017 09:22:02 +0100 Subject: [PATCH] Re-implement monitor view overlay when there is no monitor component --- plugins/MonitorStage/MonitorMainView.qml | 33 ++++++++++++++++++++---- plugins/MonitorStage/MonitorStage.py | 2 +- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/plugins/MonitorStage/MonitorMainView.qml b/plugins/MonitorStage/MonitorMainView.qml index b5008ba795..038403e6d3 100644 --- a/plugins/MonitorStage/MonitorMainView.qml +++ b/plugins/MonitorStage/MonitorMainView.qml @@ -6,11 +6,34 @@ import QtQuick.Controls 1.1 import UM 1.3 as UM import Cura 1.0 as Cura -Loader +Item { - property real maximumWidth: parent.width - property real maximumHeight: parent.height + // We show a nice overlay on the 3D viewer when the current output device has no monitor view + Rectangle + { + id: viewportOverlay - sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null - visible: sourceComponent != null + color: UM.Theme.getColor("viewport_overlay") + width: parent.width + height: parent.height + visible: monitorViewComponent.sourceComponent == null ? 1 : 0 + + MouseArea + { + anchors.fill: parent + acceptedButtons: Qt.AllButtons + onWheel: wheel.accepted = true + } + } + + Loader + { + id: monitorViewComponent + + property real maximumWidth: parent.width + property real maximumHeight: parent.height + + sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null + visible: sourceComponent != null + } } diff --git a/plugins/MonitorStage/MonitorStage.py b/plugins/MonitorStage/MonitorStage.py index f577016b2e..f19d1f895e 100644 --- a/plugins/MonitorStage/MonitorStage.py +++ b/plugins/MonitorStage/MonitorStage.py @@ -28,7 +28,7 @@ class MonitorStage(CuraStage): self.addDisplayComponent("main", main_component_path) def _setSidebar(self): - # Note: currently the sidebar component for prepare and monitor stages is the same, this will change with the printer output device refactor! + # TODO: currently the sidebar component for prepare and monitor stages is the same, this will change with the printer output device refactor! sidebar_component_path = os.path.join(Resources.getPath(Application.getInstance().ResourceTypes.QmlFiles), "Sidebar.qml") self.addDisplayComponent("sidebar", sidebar_component_path)