mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 17:05:10 +08:00
Fix for initial connection
This commit is contained in:
parent
8360b5b448
commit
4b71b45aa3
@ -126,15 +126,12 @@ class CloudOutputDeviceManager:
|
|||||||
Logger.log("e", "Could not find discovered device with key [%s]", key)
|
Logger.log("e", "Could not find discovered device with key [%s]", key)
|
||||||
return
|
return
|
||||||
|
|
||||||
group_name = device.clusterData.friendly_name
|
|
||||||
machine_type_id = device.printerType
|
|
||||||
|
|
||||||
Logger.log("i", "Creating machine from cloud device with key = [%s], group name = [%s], printer type = [%s]",
|
|
||||||
key, group_name, machine_type_id)
|
|
||||||
|
|
||||||
# The newly added machine is automatically activated.
|
# The newly added machine is automatically activated.
|
||||||
CuraApplication.getInstance().getMachineManager().addMachine(machine_type_id, group_name)
|
CuraApplication.getInstance().getMachineManager().addMachine(device.printerType,
|
||||||
self._connectToActiveMachine()
|
device.clusterData.friendly_name)
|
||||||
|
active_machine = CuraApplication.getInstance().getGlobalContainerStack()
|
||||||
|
if active_machine:
|
||||||
|
self._connectToOutputDevice(device, active_machine)
|
||||||
|
|
||||||
## Callback for when the active machine was changed by the user or a new remote cluster was found.
|
## Callback for when the active machine was changed by the user or a new remote cluster was found.
|
||||||
def _connectToActiveMachine(self) -> None:
|
def _connectToActiveMachine(self) -> None:
|
||||||
|
@ -231,16 +231,16 @@ class NetworkOutputDeviceManager:
|
|||||||
|
|
||||||
## Create a machine instance based on the discovered network printer.
|
## Create a machine instance based on the discovered network printer.
|
||||||
def _createMachineFromDiscoveredPrinter(self, key: str) -> None:
|
def _createMachineFromDiscoveredPrinter(self, key: str) -> None:
|
||||||
discovered_device = self._discovered_devices.get(key)
|
device = self._discovered_devices.get(key)
|
||||||
if discovered_device is None:
|
if device is None:
|
||||||
Logger.log("e", "Could not find discovered device with key [%s]", key)
|
Logger.log("e", "Could not find discovered device with key [%s]", key)
|
||||||
return
|
return
|
||||||
group_name = discovered_device.getProperty("name")
|
|
||||||
machine_type_id = discovered_device.getProperty("printer_type")
|
# The newly added machine is automatically activated.
|
||||||
Logger.log("i", "Creating machine from network device with key = [%s], group name = [%s], printer type = [%s]",
|
CuraApplication.getInstance().getMachineManager().addMachine(device.printerType, device.name)
|
||||||
key, group_name, machine_type_id)
|
active_machine = CuraApplication.getInstance().getGlobalContainerStack()
|
||||||
CuraApplication.getInstance().getMachineManager().addMachine(machine_type_id, group_name)
|
if active_machine:
|
||||||
self._connectToActiveMachine()
|
self._connectToOutputDevice(device, active_machine)
|
||||||
|
|
||||||
## Load the user-configured manual devices from Cura preferences.
|
## Load the user-configured manual devices from Cura preferences.
|
||||||
def _getStoredManualInstances(self) -> Dict[str, Optional[Callable]]:
|
def _getStoredManualInstances(self) -> Dict[str, Optional[Callable]]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user