Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoeydelarago <joeydelarago@gmail.com>2022-08-24 11:06:51 +0300
committerjoeydelarago <joeydelarago@gmail.com>2022-08-24 11:06:51 +0300
commit52b2a8322c6cc676625cd905d2ed219250449c9a (patch)
tree948f504898225368ae97858421266ced394e6f36 /cura/Settings
parent721f63b0d1b920b0363bf694d708de8fc0ae053d (diff)
Include LAN printers in abstract printers list
Make filtering clearer by splitting it up into multiple lines. CURA-9514
Diffstat (limited to 'cura/Settings')
-rw-r--r--cura/Settings/AbstractMachine.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/cura/Settings/AbstractMachine.py b/cura/Settings/AbstractMachine.py
index 2f4a50da4f..86909b6e29 100644
--- a/cura/Settings/AbstractMachine.py
+++ b/cura/Settings/AbstractMachine.py
@@ -29,14 +29,16 @@ class AbstractMachine(GlobalStack):
application = CuraApplication.getInstance()
registry = application.getContainerRegistry()
- printer_type = abstract_machine.definition.getId()
-
- machines = [machine for machine in registry.findContainerStacks(type="machine") if machine.definition.id == printer_type and ConnectionType.CloudConnection in machine.configuredConnectionTypes]
-
+ machines = registry.findContainerStacks(type="machine")
+ # Filter machines that match definition
+ machines = filter(lambda machine: machine.definition.id == abstract_machine.definition.getId(), machines)
+ # Filter only LAN and Cloud printers
+ machines = filter(lambda machine: ConnectionType.CloudConnection in machine.configuredConnectionTypes or ConnectionType.NetworkConnection in machine.configuredConnectionTypes, machines)
if online_only:
- machines = [machine for machine in machines if parseBool(machine.getMetaDataEntry("is_online", False))]
+ # LAN printers have is_online = False but should still be included
+ machines = filter(lambda machine: parseBool(machine.getMetaDataEntry("is_online", False) or ConnectionType.NetworkConnection in machine.configuredConnectionTypes), machines)
- return machines
+ return list(machines)
## private: