diff --git a/cura/PrinterOutput/NetworkCamera.py b/cura/PrinterOutput/NetworkCamera.py index bffd318f41..b81914ca7d 100644 --- a/cura/PrinterOutput/NetworkCamera.py +++ b/cura/PrinterOutput/NetworkCamera.py @@ -59,7 +59,6 @@ class NetworkCamera(QObject): @pyqtSlot() def stop(self): - self._stream_buffer = b"" self._stream_buffer_start_index = -1 diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 91b981f3b6..fdf9a77145 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -97,7 +97,6 @@ class PrinterOutputDevice(QObject, OutputDevice): # create the item (and fail) every time. if not self._monitor_component: self._createMonitorViewFromQML() - return self._monitor_item @pyqtProperty(QObject, constant=True) diff --git a/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py index 268debbf7c..c7fdf9bdc6 100644 --- a/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py @@ -74,7 +74,6 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice): self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "MonitorItem.qml") - self._output_controller = LegacyUM3PrinterOutputController(self) def _onAuthenticationStateChanged(self): diff --git a/plugins/UM3NetworkPrinting/MonitorItem.qml b/plugins/UM3NetworkPrinting/MonitorItem.qml index 09e427ff6f..bbbc3feee6 100644 --- a/plugins/UM3NetworkPrinting/MonitorItem.qml +++ b/plugins/UM3NetworkPrinting/MonitorItem.qml @@ -6,37 +6,49 @@ import Cura 1.0 as Cura Component { - Image + Item { - id: cameraImage - width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth) - height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width) - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - z: 1 - onVisibleChanged: + width: maximumWidth + height: maximumHeight + Image { - if(visible) + id: cameraImage + width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth) + height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width) + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + z: 1 + Component.onCompleted: { if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) { OutputDevice.activePrinter.camera.start() } - } else + } + onVisibleChanged: { - if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) + if(visible) { - OutputDevice.activePrinter.camera.stop() + if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) + { + OutputDevice.activePrinter.camera.start() + } + } else + { + if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) + { + OutputDevice.activePrinter.camera.stop() + } } } - } - source: - { - if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage) + source: { - return OutputDevice.activePrinter.camera.latestImage; + if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage) + { + return OutputDevice.activePrinter.camera.latestImage; + } + return ""; } - return ""; } } } \ No newline at end of file