Change camera URL to non-optional QUrl

Otherwise pyqt property will complain when it tries to convert a None to
a QUrl.
This commit is contained in:
Lipu Fei 2018-10-29 13:23:10 +01:00
parent 0c1b3931db
commit 02681a5700
5 changed files with 23 additions and 30 deletions

View file

@ -49,17 +49,21 @@ class PrinterOutputModel(QObject):
self._printer_configuration.extruderConfigurations = [extruder.extruderConfiguration for extruder in
self._extruders]
self._camera_url = None # type: Optional[QUrl]
self._camera_url = QUrl() # type: QUrl
@pyqtProperty(str, constant = True)
def firmwareVersion(self) -> str:
return self._firmware_version
def setCameraUrl(self, camera_url: Optional["QUrl"]) -> None:
if self._camera_url is not camera_url:
def setCameraUrl(self, camera_url: "QUrl") -> None:
if self._camera_url != camera_url:
self._camera_url = camera_url
self.cameraUrlChanged.emit()
@pyqtProperty(QUrl, fset = setCameraUrl, notify = cameraUrlChanged)
def cameraUrl(self) -> "QUrl":
return self._camera_url
def updateIsPreheating(self, pre_heating: bool) -> None:
if self._is_preheating != pre_heating:
self._is_preheating = pre_heating
@ -69,10 +73,6 @@ class PrinterOutputModel(QObject):
def isPreheating(self) -> bool:
return self._is_preheating
@pyqtProperty(QUrl, notify=cameraUrlChanged)
def cameraUrl(self) -> Optional["QUrl"]:
return self._camera_url
@pyqtProperty(str, notify = printerTypeChanged)
def type(self) -> str:
return self._printer_type