mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 11:47:50 -06:00
Fix some codestyle, make connectionType a property as it's needed in QML
This commit is contained in:
parent
d3419f2e07
commit
5e9fe3fe50
3 changed files with 18 additions and 21 deletions
|
@ -97,7 +97,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
self._update_timer.timeout.connect(self._update)
|
self._update_timer.timeout.connect(self._update)
|
||||||
|
|
||||||
self._connection_state = ConnectionState.Closed # type: ConnectionState
|
self._connection_state = ConnectionState.Closed # type: ConnectionState
|
||||||
self._connection_type = connection_type
|
self._connection_type = connection_type # type: ConnectionType
|
||||||
|
|
||||||
self._firmware_updater = None # type: Optional[FirmwareUpdater]
|
self._firmware_updater = None # type: Optional[FirmwareUpdater]
|
||||||
self._firmware_name = None # type: Optional[str]
|
self._firmware_name = None # type: Optional[str]
|
||||||
|
@ -131,9 +131,6 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
self._connection_state = connection_state
|
self._connection_state = connection_state
|
||||||
self.connectionStateChanged.emit(self._id)
|
self.connectionStateChanged.emit(self._id)
|
||||||
|
|
||||||
def getConnectionType(self) -> "ConnectionType":
|
|
||||||
return self._connection_type
|
|
||||||
|
|
||||||
@pyqtProperty(int, constant = True)
|
@pyqtProperty(int, constant = True)
|
||||||
def connectionType(self) -> "ConnectionType":
|
def connectionType(self) -> "ConnectionType":
|
||||||
return self._connection_type
|
return self._connection_type
|
||||||
|
|
|
@ -138,11 +138,11 @@ class DiscoverUM3Action(MachineAction):
|
||||||
|
|
||||||
if "connection_type" in meta_data:
|
if "connection_type" in meta_data:
|
||||||
previous_connection_type = meta_data["connection_type"]
|
previous_connection_type = meta_data["connection_type"]
|
||||||
global_container_stack.setMetaDataEntry("connection_type", printer_device.getConnectionType().value)
|
global_container_stack.setMetaDataEntry("connection_type", printer_device.connectionType.value)
|
||||||
CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "connection_type", value = previous_connection_type, new_value = printer_device.getConnectionType().value)
|
CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "connection_type", value = previous_connection_type, new_value = printer_device.connectionType.value)
|
||||||
else:
|
else:
|
||||||
global_container_stack.setMetaDataEntry("um_network_key", printer_device.key)
|
global_container_stack.setMetaDataEntry("um_network_key", printer_device.key)
|
||||||
global_container_stack.setMetaDataEntry("connection_type", printer_device.getConnectionType().value)
|
global_container_stack.setMetaDataEntry("connection_type", printer_device.connectionType.value)
|
||||||
|
|
||||||
if self._network_plugin:
|
if self._network_plugin:
|
||||||
# Ensure that the connection states are refreshed.
|
# Ensure that the connection states are refreshed.
|
||||||
|
|
|
@ -288,7 +288,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
|
||||||
|
|
||||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
if global_container_stack and device.getId() == global_container_stack.getMetaDataEntry("um_network_key"):
|
if global_container_stack and device.getId() == global_container_stack.getMetaDataEntry("um_network_key"):
|
||||||
global_container_stack.setMetaDataEntry("connection_type", device.getConnectionType().value)
|
global_container_stack.setMetaDataEntry("connection_type", device.connectionType.value)
|
||||||
device.connect()
|
device.connect()
|
||||||
device.connectionStateChanged.connect(self._onDeviceConnectionStateChanged)
|
device.connectionStateChanged.connect(self._onDeviceConnectionStateChanged)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue