mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Back to QUrl, fix monitor view overlay
This commit is contained in:
parent
9e3c681d66
commit
f6b570e299
3 changed files with 42 additions and 9 deletions
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.
|
||||
import os.path
|
||||
from UM.Application import Application
|
||||
from UM.PluginRegistry import PluginRegistry
|
||||
from UM.Resources import Resources
|
||||
from cura.Stages.CuraStage import CuraStage
|
||||
|
||||
|
|
@ -11,14 +12,29 @@ class MonitorStage(CuraStage):
|
|||
|
||||
def __init__(self, parent = None):
|
||||
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
|
||||
|
||||
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!
|
||||
sidebar_component_path = os.path.join(Resources.getPath(Application.getInstance().ResourceTypes.QmlFiles), "Sidebar.qml")
|
||||
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:
|
||||
# // {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue