mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 19:58:59 +08:00
Sort new_devices on online status first, name second
Since the first device might be activated in case there is no active printer yet, it would be nice to prioritize online devices CURA-7493
This commit is contained in:
parent
c6af6565a3
commit
b734830fcf
@ -163,7 +163,11 @@ class CloudOutputDeviceManager:
|
|||||||
self._connectToActiveMachine()
|
self._connectToActiveMachine()
|
||||||
return
|
return
|
||||||
|
|
||||||
new_devices.sort(key = lambda x: x.name.lower())
|
# Sort new_devices on online status first, alphabetical (case-sensitive) second.
|
||||||
|
# Since the first device might be activated in case there is no active printer yet,
|
||||||
|
# it would be nice to prioritize online devices
|
||||||
|
online_cluster_names = {c.friendly_name for c in clusters if c.is_online}
|
||||||
|
new_devices.sort(key = lambda x: "a{}".format(x.name) if x.name in online_cluster_names else "b{}".format(x.name))
|
||||||
|
|
||||||
image_path = os.path.join(
|
image_path = os.path.join(
|
||||||
CuraApplication.getInstance().getPluginRegistry().getPluginPath("UM3NetworkPrinting") or "",
|
CuraApplication.getInstance().getPluginRegistry().getPluginPath("UM3NetworkPrinting") or "",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user