diff options
author | Jaime van Kessel <nallath@gmail.com> | 2018-11-30 15:53:53 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2018-11-30 15:53:53 +0300 |
commit | 6d4a460e58d81c66e849bcf17b444c3b164272ef (patch) | |
tree | fcd566cb5704b4ad41cdd42af73f57b9dbfdcdab /plugins/MonitorStage | |
parent | 6db52dde4641cba6539c2b469dbd483eefa46326 (diff) |
Move USB sidebar into the main view of the monitorstage
CURA-5943
Diffstat (limited to 'plugins/MonitorStage')
-rw-r--r-- | plugins/MonitorStage/MonitorMain.qml | 40 | ||||
-rw-r--r-- | plugins/MonitorStage/MonitorMainView.qml | 64 | ||||
-rw-r--r-- | plugins/MonitorStage/MonitorMenu.qml | 14 | ||||
-rw-r--r-- | plugins/MonitorStage/MonitorStage.py | 17 |
4 files changed, 60 insertions, 75 deletions
diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml new file mode 100644 index 0000000000..1f287fc0fa --- /dev/null +++ b/plugins/MonitorStage/MonitorMain.qml @@ -0,0 +1,40 @@ +// Copyright (c) 2017 Ultimaker B.V. + +import QtQuick 2.10 +import QtQuick.Controls 1.4 + +import UM 1.3 as UM +import Cura 1.0 as Cura + + +Item +{ + // We show a nice overlay on the 3D viewer when the current output device has no monitor view + Rectangle + { + id: viewportOverlay + + color: UM.Theme.getColor("viewport_overlay") + anchors.fill: parent + MouseArea + { + anchors.fill: parent + acceptedButtons: Qt.AllButtons + onWheel: wheel.accepted = true + } + } + + Loader + { + id: monitorViewComponent + + anchors.fill: parent + + height: parent.height + + property real maximumWidth: parent.width + property real maximumHeight: parent.height + + sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null + } +} diff --git a/plugins/MonitorStage/MonitorMainView.qml b/plugins/MonitorStage/MonitorMainView.qml deleted file mode 100644 index f5696bbf54..0000000000 --- a/plugins/MonitorStage/MonitorMainView.qml +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2017 Ultimaker B.V. - -import QtQuick 2.10 -import QtQuick.Controls 1.4 - -import UM 1.3 as UM -import Cura 1.0 as Cura - - -Item -{ - // parent could be undefined as this component is not visible at all times - width: parent ? parent.width : 0 - height: parent ? parent.height : 0 - - // We show a nice overlay on the 3D viewer when the current output device has no monitor view - Rectangle - { - id: viewportOverlay - - color: UM.Theme.getColor("viewport_overlay") - width: parent.width - height: parent.height - - MouseArea - { - anchors.fill: parent - acceptedButtons: Qt.AllButtons - onWheel: wheel.accepted = true - } - } - - Loader - { - id: monitorViewComponent - - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left - - // If the sidebar is not set, the view should take the complete space. - property var widthFactor: monitorSidebarComponent.source == "" ? 1.0 : 0.7 - - width: Math.round(parent.width * widthFactor) - height: parent.height - - property real maximumWidth: parent.width - property real maximumHeight: parent.height - - sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null - } - - Loader - { - id: monitorSidebarComponent - - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: monitorViewComponent.right - anchors.right: parent.right - - source: UM.Controller.activeStage.sidebarComponent != null ? UM.Controller.activeStage.sidebarComponent : "" - } -} diff --git a/plugins/MonitorStage/MonitorMenu.qml b/plugins/MonitorStage/MonitorMenu.qml new file mode 100644 index 0000000000..4dec719313 --- /dev/null +++ b/plugins/MonitorStage/MonitorMenu.qml @@ -0,0 +1,14 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 2.3 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +Item +{ + signal showTooltip(Item item, point location, string text) + signal hideTooltip() +}
\ No newline at end of file diff --git a/plugins/MonitorStage/MonitorStage.py b/plugins/MonitorStage/MonitorStage.py index ace201e994..69b7f20f4e 100644 --- a/plugins/MonitorStage/MonitorStage.py +++ b/plugins/MonitorStage/MonitorStage.py @@ -65,15 +65,10 @@ class MonitorStage(CuraStage): # We can only connect now, as we need to be sure that everything is loaded (plugins get created quite early)
Application.getInstance().getMachineManager().outputDevicesChanged.connect(self._onOutputDevicesChanged)
self._onOutputDevicesChanged()
- self._updateMainOverlay()
- self._updateSidebar()
- def _updateMainOverlay(self):
- main_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("MonitorStage"),
- "MonitorMainView.qml")
- self.addDisplayComponent("main", main_component_path)
-
- def _updateSidebar(self):
- sidebar_component_path = os.path.join(Resources.getPath(Application.getInstance().ResourceTypes.QmlFiles),
- "MonitorSidebar.qml")
- self.addDisplayComponent("sidebar", sidebar_component_path)
+ plugin_path = Application.getInstance().getPluginRegistry().getPluginPath(self.getPluginId())
+ if plugin_path is not None:
+ menu_component_path = os.path.join(plugin_path, "MonitorMenu.qml")
+ main_component_path = os.path.join(plugin_path, "MonitorMain.qml")
+ self.addDisplayComponent("menu", menu_component_path)
+ self.addDisplayComponent("main", main_component_path)
|