mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-07 06:01:48 +08:00
Fix type checking for DiscoverUM3Action
This commit is contained in:
parent
80d2a78463
commit
d2746d03c1
@ -124,14 +124,20 @@ class DiscoverUM3Action(MachineAction):
|
|||||||
@pyqtSlot(QObject)
|
@pyqtSlot(QObject)
|
||||||
def associateActiveMachineWithPrinterDevice(self, printer_device: Optional["PrinterOutputDevice"]) -> None:
|
def associateActiveMachineWithPrinterDevice(self, printer_device: Optional["PrinterOutputDevice"]) -> None:
|
||||||
Logger.log("d", "Attempting to set the network key of the active machine to %s", printer_device.key)
|
Logger.log("d", "Attempting to set the network key of the active machine to %s", printer_device.key)
|
||||||
|
if not printer_device:
|
||||||
|
return
|
||||||
|
|
||||||
global_container_stack = CuraApplication.getInstance().getGlobalContainerStack()
|
global_container_stack = CuraApplication.getInstance().getGlobalContainerStack()
|
||||||
if global_container_stack:
|
if not global_container_stack:
|
||||||
|
return
|
||||||
|
|
||||||
meta_data = global_container_stack.getMetaData()
|
meta_data = global_container_stack.getMetaData()
|
||||||
if "um_network_key" in meta_data:
|
if "um_network_key" in meta_data:
|
||||||
previous_network_key = meta_data["um_network_key"]
|
previous_network_key = meta_data["um_network_key"]
|
||||||
global_container_stack.setMetaDataEntry("um_network_key", printer_device.key)
|
global_container_stack.setMetaDataEntry("um_network_key", printer_device.key)
|
||||||
# Delete old authentication data.
|
# Delete old authentication data.
|
||||||
Logger.log("d", "Removing old authentication id %s for device %s", global_container_stack.getMetaDataEntry("network_authentication_id", None), printer_device.key)
|
Logger.log("d", "Removing old authentication id %s for device %s",
|
||||||
|
global_container_stack.getMetaDataEntry("network_authentication_id", None), printer_device.key)
|
||||||
global_container_stack.removeMetaDataEntry("network_authentication_id")
|
global_container_stack.removeMetaDataEntry("network_authentication_id")
|
||||||
global_container_stack.removeMetaDataEntry("network_authentication_key")
|
global_container_stack.removeMetaDataEntry("network_authentication_key")
|
||||||
CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "um_network_key", value = previous_network_key, new_value = printer_device.key)
|
CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "um_network_key", value = previous_network_key, new_value = printer_device.key)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user