mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
If output device has a contorl item, that one is used.
If a printerOutput device does not define anything, the fallback is used. CURA-4057
This commit is contained in:
parent
216b1a7a14
commit
6e55bf2d8f
3 changed files with 40 additions and 4 deletions
|
@ -144,7 +144,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
return self._control_item
|
return self._control_item
|
||||||
|
|
||||||
def _createControlViewFromQML(self):
|
def _createControlViewFromQML(self):
|
||||||
path = QUrl.fromLocalFile(self._monitor_view_qml_path)
|
path = QUrl.fromLocalFile(self._control_view_qml_path)
|
||||||
|
|
||||||
# Because of garbage collection we need to keep this referenced by python.
|
# Because of garbage collection we need to keep this referenced by python.
|
||||||
self._control_component = QQmlComponent(Application.getInstance()._engine, path)
|
self._control_component = QQmlComponent(Application.getInstance()._engine, path)
|
||||||
|
|
|
@ -179,7 +179,6 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||||
|
|
||||||
self._compressing_print = False
|
self._compressing_print = False
|
||||||
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "MonitorItem.qml")
|
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "MonitorItem.qml")
|
||||||
|
|
||||||
printer_type = self._properties.get(b"machine", b"").decode("utf-8")
|
printer_type = self._properties.get(b"machine", b"").decode("utf-8")
|
||||||
if printer_type.startswith("9511"):
|
if printer_type.startswith("9511"):
|
||||||
self._updatePrinterType("ultimaker3_extended")
|
self._updatePrinterType("ultimaker3_extended")
|
||||||
|
|
|
@ -20,6 +20,7 @@ Rectangle
|
||||||
// Is there an output device for this printer?
|
// Is there an output device for this printer?
|
||||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
||||||
|
property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
||||||
property int backendState: UM.Backend.state;
|
property int backendState: UM.Backend.state;
|
||||||
|
|
||||||
property bool monitoringPrint: false
|
property bool monitoringPrint: false
|
||||||
|
@ -344,11 +345,47 @@ Rectangle
|
||||||
|
|
||||||
Loader
|
Loader
|
||||||
{
|
{
|
||||||
|
id: controlItem
|
||||||
anchors.bottom: footerSeparator.top
|
anchors.bottom: footerSeparator.top
|
||||||
anchors.top: headerSeparator.bottom
|
anchors.top: headerSeparator.bottom
|
||||||
anchors.left: base.left
|
anchors.left: base.left
|
||||||
anchors.right: base.right
|
anchors.right: base.right
|
||||||
source: monitoringPrint ? "PrintMonitor.qml": "SidebarContents.qml"
|
sourceComponent:
|
||||||
|
{
|
||||||
|
if(monitoringPrint && connectedPrinter != null)
|
||||||
|
{
|
||||||
|
if(connectedPrinter.controlItem != null)
|
||||||
|
{
|
||||||
|
return connectedPrinter.controlItem
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader
|
||||||
|
{
|
||||||
|
anchors.bottom: footerSeparator.top
|
||||||
|
anchors.top: headerSeparator.bottom
|
||||||
|
anchors.left: base.left
|
||||||
|
anchors.right: base.right
|
||||||
|
source:
|
||||||
|
{
|
||||||
|
if(controlItem.sourceComponent == null)
|
||||||
|
{
|
||||||
|
if(monitoringPrint)
|
||||||
|
{
|
||||||
|
return "PrintMonitor.qml"
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return "SidebarContents.qml"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue