mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-29 15:25:02 +08:00
Use cluster_size property from zeroconf if available
This commit is contained in:
parent
998f58d3fa
commit
fcd5a563e4
@ -236,7 +236,7 @@ class LocalClusterOutputDeviceManager:
|
|||||||
machine.setName(device.name)
|
machine.setName(device.name)
|
||||||
machine.setMetaDataEntry(self.META_NETWORK_KEY, device.key)
|
machine.setMetaDataEntry(self.META_NETWORK_KEY, device.key)
|
||||||
machine.setMetaDataEntry("group_name", device.name)
|
machine.setMetaDataEntry("group_name", device.name)
|
||||||
|
|
||||||
device.connect()
|
device.connect()
|
||||||
machine.addConfiguredConnectionType(device.connectionType.value)
|
machine.addConfiguredConnectionType(device.connectionType.value)
|
||||||
CuraApplication.getInstance().getOutputDeviceManager().addOutputDevice(device)
|
CuraApplication.getInstance().getOutputDeviceManager().addOutputDevice(device)
|
||||||
|
@ -109,7 +109,10 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice):
|
|||||||
@pyqtProperty(int, notify=_clusterPrintersChanged)
|
@pyqtProperty(int, notify=_clusterPrintersChanged)
|
||||||
def clusterSize(self) -> int:
|
def clusterSize(self) -> int:
|
||||||
if not self._has_received_printers:
|
if not self._has_received_printers:
|
||||||
return 1 # prevent false positives when discovering new devices
|
discovered_size = self.getProperty("cluster_size")
|
||||||
|
if discovered_size == "":
|
||||||
|
return 1 # prevent false positives for new devices
|
||||||
|
return int(discovered_size)
|
||||||
return len(self._printers)
|
return len(self._printers)
|
||||||
|
|
||||||
# Get the amount of printer in the cluster per type.
|
# Get the amount of printer in the cluster per type.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user