diff --git a/cura/PrinterOutput/PrintJobOutputModel.py b/cura/PrinterOutput/PrintJobOutputModel.py index b417e0aab3..25b168e6fd 100644 --- a/cura/PrinterOutput/PrintJobOutputModel.py +++ b/cura/PrinterOutput/PrintJobOutputModel.py @@ -54,7 +54,7 @@ class PrintJobOutputModel(QObject): @pyqtProperty(QUrl, notify=previewImageChanged) def previewImageUrl(self): self._preview_image_id += 1 - # There is an image provider that is called "camera". In order to ensure that the image qml object, that + # There is an image provider that is called "print_job_preview". In order to ensure that the image qml object, that # requires a QUrl to function, updates correctly we add an increasing number. This causes to see the QUrl # as new (instead of relying on cached version and thus forces an update. temp = "image://print_job_preview/" + str(self._preview_image_id) + "/" + self._key diff --git a/cura/PrinterOutput/PrinterOutputModel.py b/cura/PrinterOutput/PrinterOutputModel.py index b40b07e16b..f82d568e63 100644 --- a/cura/PrinterOutput/PrinterOutputModel.py +++ b/cura/PrinterOutput/PrinterOutputModel.py @@ -11,7 +11,6 @@ MYPY = False if MYPY: from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.PrinterOutputController import PrinterOutputController - from cura.PrinterOutput.NetworkCamera import NetworkCamera class PrinterOutputModel(QObject): diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml index f8dd3bc467..7ec0cb880a 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml @@ -31,10 +31,10 @@ Rectangle { anchors.fill: parent; hoverEnabled: true; onClicked: { - if (OutputDevice.activeCamera !== null) { - OutputDevice.setActiveCamera(null) + if (OutputDevice.activeCameraUrl !== null) { + OutputDevice.setActiveCameraUrl(null) } else { - OutputDevice.setActiveCamera(modelData.camera); + OutputDevice.setActiveCameraUrl(modelData.cameraUrl); } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml index c79092863e..a9166432ae 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml @@ -16,7 +16,7 @@ Component { height: maximumHeight; onVisibleChanged: { if (monitorFrame != null && !monitorFrame.visible) { - OutputDevice.setActiveCamera(null); + OutputDevice.setActiveCameraUrl(null); } } width: maximumWidth; @@ -125,8 +125,8 @@ Component { PrinterVideoStream { anchors.fill: parent; - camera: OutputDevice.activeCamera; - visible: OutputDevice.activeCamera != null; + cameraUrl: OutputDevice.activeCameraUrl; + visible: OutputDevice.activeCameraUrl != null; } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml index b247034c70..9b79a8d008 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml @@ -8,7 +8,7 @@ import UM 1.3 as UM import Cura 1.0 as Cura Item { - property var camera: null; + property var cameraUrl: null; Rectangle { anchors.fill:parent; @@ -18,7 +18,7 @@ Item { MouseArea { anchors.fill: parent; - onClicked: OutputDevice.setActiveCamera(null); + onClicked: OutputDevice.setActiveCameraUrl(null); z: 0; } @@ -58,7 +58,7 @@ Item { MouseArea { anchors.fill: cameraImage; onClicked: { - OutputDevice.setActiveCamera(null); + OutputDevice.setActiveCameraUrl(null); } z: 1; } diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 5089b61a2a..368273102b 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -22,7 +22,6 @@ from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationM from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel -from cura.PrinterOutput.NetworkCamera import NetworkCamera from .ClusterUM3PrinterOutputController import ClusterUM3PrinterOutputController from .SendMaterialJob import SendMaterialJob @@ -47,7 +46,7 @@ i18n_catalog = i18nCatalog("cura") class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): printJobsChanged = pyqtSignal() activePrinterChanged = pyqtSignal() - activeCameraChanged = pyqtSignal() + activeCameraUrlChanged = pyqtSignal() receivedPrintJobsChanged = pyqtSignal() # This is a bit of a hack, as the notify can only use signals that are defined by the class that they are in. @@ -100,7 +99,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): self._latest_reply_handler = None # type: Optional[QNetworkReply] self._sending_job = None - self._active_camera = None # type: Optional[NetworkCamera] + self._active_camera_url = None # type: Optional[QUrl] def requestWrite(self, nodes: List[SceneNode], file_name: Optional[str] = None, limit_mimetypes: bool = False, file_handler: Optional[FileHandler] = None, **kwargs: str) -> None: self.writeStarted.emit(self) @@ -264,30 +263,28 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): def activePrinter(self) -> Optional[PrinterOutputModel]: return self._active_printer - @pyqtProperty(QObject, notify=activeCameraChanged) - def activeCamera(self) -> Optional[NetworkCamera]: - return self._active_camera + @pyqtProperty(QUrl, notify=activeCameraUrlChanged) + def activeCameraUrl(self) -> Optional[QUrl]: + return self._active_camera_url @pyqtSlot(QObject) def setActivePrinter(self, printer: Optional[PrinterOutputModel]) -> None: if self._active_printer != printer: - if self._active_printer and self._active_printer.camera: - self._active_printer.camera.stop() self._active_printer = printer self.activePrinterChanged.emit() @pyqtSlot(QObject) - def setActiveCamera(self, camera: Optional[NetworkCamera]) -> None: - if self._active_camera != camera: - if self._active_camera: - self._active_camera.stop() + def setActiveCameraUrl(self, camera_url: Optional[QUrl]) -> None: + if self._active_camera_url != camera_url: + if self._active_camera_url: + self._active_camera_url.stop() - self._active_camera = camera + self._active_camera_url = camera_url - if self._active_camera: - self._active_camera.start() + if self._active_camera_url: + self._active_camera_url.start() - self.activeCameraChanged.emit() + self.activeCameraUrlChanged.emit() def _onPostPrintJobFinished(self, reply: QNetworkReply) -> None: if self._progress_message: diff --git a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py index a49ec1f6a9..e45de2dbb0 100644 --- a/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py @@ -7,7 +7,6 @@ from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutp from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel -from cura.PrinterOutput.NetworkCamera import NetworkCamera from cura.Settings.ContainerManager import ContainerManager from cura.Settings.ExtruderManager import ExtruderManager