mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Enabled monitor items for ClusterOutputDevice again
CL-541
This commit is contained in:
parent
083eee2e9d
commit
f791b53ad8
3 changed files with 15 additions and 31 deletions
|
@ -106,39 +106,15 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
def _createControlViewFromQML(self):
|
def _createControlViewFromQML(self):
|
||||||
if not self._control_view_qml_path:
|
if not self._control_view_qml_path:
|
||||||
return
|
return
|
||||||
|
|
||||||
path = QUrl.fromLocalFile(self._control_view_qml_path)
|
|
||||||
|
|
||||||
# Because of garbage collection we need to keep this referenced by python.
|
|
||||||
self._control_component = QQmlComponent(Application.getInstance()._engine, path)
|
|
||||||
|
|
||||||
# Check if the context was already requested before (Printer output device might have multiple items in the future)
|
|
||||||
if self._qml_context is None:
|
|
||||||
self._qml_context = QQmlContext(Application.getInstance()._engine.rootContext())
|
|
||||||
self._qml_context.setContextProperty("OutputDevice", self)
|
|
||||||
|
|
||||||
self._control_item = self._control_component.create(self._qml_context)
|
|
||||||
if self._control_item is None:
|
if self._control_item is None:
|
||||||
Logger.log("e", "QQmlComponent status %s", self._control_component.status())
|
self._control_item = Application.getInstance().createQmlComponent(self._control_view_qml_path, {"OutputDevice": self})
|
||||||
Logger.log("e", "QQmlComponent error string %s", self._control_component.errorString())
|
|
||||||
|
|
||||||
def _createMonitorViewFromQML(self):
|
def _createMonitorViewFromQML(self):
|
||||||
if not self._monitor_view_qml_path:
|
if not self._monitor_view_qml_path:
|
||||||
return
|
return
|
||||||
path = QUrl.fromLocalFile(self._monitor_view_qml_path)
|
|
||||||
|
|
||||||
# Because of garbage collection we need to keep this referenced by python.
|
|
||||||
self._monitor_component = QQmlComponent(Application.getInstance()._engine, path)
|
|
||||||
|
|
||||||
# Check if the context was already requested before (Printer output device might have multiple items in the future)
|
|
||||||
if self._qml_context is None:
|
|
||||||
self._qml_context = QQmlContext(Application.getInstance()._engine.rootContext())
|
|
||||||
self._qml_context.setContextProperty("OutputDevice", self)
|
|
||||||
|
|
||||||
self._monitor_item = self._monitor_component.create(self._qml_context)
|
|
||||||
if self._monitor_item is None:
|
if self._monitor_item is None:
|
||||||
Logger.log("e", "QQmlComponent status %s", self._monitor_component.status())
|
self._monitor_item = Application.getInstance().createQmlComponent(self._monitor_view_qml_path, {"OutputDevice": self})
|
||||||
Logger.log("e", "QQmlComponent error string %s", self._monitor_component.errorString())
|
|
||||||
|
|
||||||
## Attempt to establish connection
|
## Attempt to establish connection
|
||||||
def connect(self):
|
def connect(self):
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# Copyright (c) 2017 Ultimaker B.V.
|
||||||
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
|
|
||||||
from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice
|
from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice
|
||||||
|
@ -5,10 +8,12 @@ from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
|
||||||
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
|
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
|
||||||
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel
|
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply
|
from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
def __init__(self, device_id, address, properties, parent = None):
|
def __init__(self, device_id, address, properties, parent = None):
|
||||||
super().__init__(device_id = device_id, address = address, properties=properties, parent = parent)
|
super().__init__(device_id = device_id, address = address, properties=properties, parent = parent)
|
||||||
|
@ -18,6 +23,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
|
|
||||||
self._print_jobs = []
|
self._print_jobs = []
|
||||||
|
|
||||||
|
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ClusterMonitorItem.qml")
|
||||||
|
self._control_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ClusterControlItem.qml")
|
||||||
|
|
||||||
def _update(self):
|
def _update(self):
|
||||||
if not super()._update():
|
if not super()._update():
|
||||||
return
|
return
|
||||||
|
|
|
@ -108,11 +108,11 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
|
||||||
# or "Legacy" UM3 device.
|
# or "Legacy" UM3 device.
|
||||||
cluster_size = int(properties.get(b"cluster_size", -1))
|
cluster_size = int(properties.get(b"cluster_size", -1))
|
||||||
# TODO: For debug purposes; force it to be legacy printer.
|
# TODO: For debug purposes; force it to be legacy printer.
|
||||||
device = LegacyUM3OutputDevice.LegacyUM3OutputDevice(name, address, properties)
|
#device = LegacyUM3OutputDevice.LegacyUM3OutputDevice(name, address, properties)
|
||||||
'''if cluster_size > 0:
|
if cluster_size > 0:
|
||||||
device = ClusterUM3OutputDevice.ClusterUM3OutputDevice(name, address, properties)
|
device = ClusterUM3OutputDevice.ClusterUM3OutputDevice(name, address, properties)
|
||||||
else:
|
else:
|
||||||
device = LegacyUM3OutputDevice.LegacyUM3OutputDevice(name, address, properties)'''
|
device = LegacyUM3OutputDevice.LegacyUM3OutputDevice(name, address, properties)
|
||||||
|
|
||||||
self._discovered_devices[device.getId()] = device
|
self._discovered_devices[device.getId()] = device
|
||||||
self.discoveredDevicesChanged.emit()
|
self.discoveredDevicesChanged.emit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue