mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 01:39:03 +08:00
Back to QUrl, fix monitor view overlay
This commit is contained in:
parent
9e3c681d66
commit
f6b570e299
16
plugins/MonitorStage/MonitorMainView.qml
Normal file
16
plugins/MonitorStage/MonitorMainView.qml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Copyright (c) 2017 Ultimaker B.V.
|
||||||
|
|
||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
|
||||||
|
import UM 1.3 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
|
Loader
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
# 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.Application import Application
|
||||||
|
from UM.PluginRegistry import PluginRegistry
|
||||||
from UM.Resources import Resources
|
from UM.Resources import Resources
|
||||||
from cura.Stages.CuraStage import CuraStage
|
from cura.Stages.CuraStage import CuraStage
|
||||||
|
|
||||||
@ -11,14 +12,29 @@ class MonitorStage(CuraStage):
|
|||||||
|
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
Application.getInstance().engineCreatedSignal.connect(self._engineCreated)
|
|
||||||
|
# Wait until QML engine is created, otherwise creating the new QML components will fail
|
||||||
|
Application.getInstance().engineCreatedSignal.connect(self._setComponents)
|
||||||
|
|
||||||
# TODO: connect output device state to icon source
|
# TODO: connect output device state to icon source
|
||||||
|
|
||||||
def _engineCreated(self):
|
def _setComponents(self):
|
||||||
|
self._setMainOverlay()
|
||||||
|
self._setSidebar()
|
||||||
|
self._setIconSource()
|
||||||
|
|
||||||
|
def _setMainOverlay(self):
|
||||||
|
main_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("MonitorStage"), "MonitorMainView.qml")
|
||||||
|
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!
|
# Note: 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")
|
sidebar_component_path = os.path.join(Resources.getPath(Application.getInstance().ResourceTypes.QmlFiles), "Sidebar.qml")
|
||||||
self.addDisplayComponent("sidebar", sidebar_component_path)
|
self.addDisplayComponent("sidebar", sidebar_component_path)
|
||||||
self.setIconSource(Application.getInstance().getTheme().getIcon("tab_status_connected"))
|
|
||||||
|
def _setIconSource(self):
|
||||||
|
if Application.getInstance().getTheme() is not None:
|
||||||
|
self.setIconSource(Application.getInstance().getTheme().getIcon("tab_status_connected"))
|
||||||
|
|
||||||
# property string iconSource:
|
# property string iconSource:
|
||||||
# // {
|
# // {
|
||||||
|
@ -393,12 +393,13 @@ UM.MainWindow
|
|||||||
right: sidebar.left
|
right: sidebar.left
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseArea
|
MouseArea
|
||||||
// {
|
{
|
||||||
// anchors.fill: parent
|
visible: UM.Controller.activeStage.mainComponent != ""
|
||||||
// acceptedButtons: Qt.AllButtons
|
anchors.fill: parent
|
||||||
// onWheel: wheel.accepted = true
|
acceptedButtons: Qt.AllButtons
|
||||||
// }
|
onWheel: wheel.accepted = true
|
||||||
|
}
|
||||||
|
|
||||||
source: UM.Controller.activeStage.mainComponent
|
source: UM.Controller.activeStage.mainComponent
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user