mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Fix remaining references to NetworkCamera and OutputDevice.activeCamera
This commit is contained in:
parent
736bf040a8
commit
e0d6bac37d
7 changed files with 23 additions and 28 deletions
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue