Enabled monitor items for ClusterOutputDevice again

CL-541
This commit is contained in:
Jaime van Kessel 2017-11-27 13:54:34 +01:00
parent 083eee2e9d
commit f791b53ad8
3 changed files with 15 additions and 31 deletions

View file

@ -106,39 +106,15 @@ class PrinterOutputDevice(QObject, OutputDevice):
def _createControlViewFromQML(self):
if not self._control_view_qml_path:
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:
Logger.log("e", "QQmlComponent status %s", self._control_component.status())
Logger.log("e", "QQmlComponent error string %s", self._control_component.errorString())
self._control_item = Application.getInstance().createQmlComponent(self._control_view_qml_path, {"OutputDevice": self})
def _createMonitorViewFromQML(self):
if not self._monitor_view_qml_path:
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:
Logger.log("e", "QQmlComponent status %s", self._monitor_component.status())
Logger.log("e", "QQmlComponent error string %s", self._monitor_component.errorString())
self._monitor_item = Application.getInstance().createQmlComponent(self._monitor_view_qml_path, {"OutputDevice": self})
## Attempt to establish connection
def connect(self):