diff options
author | joeydelarago <joeydelarago@gmail.com> | 2022-08-24 11:06:51 +0300 |
---|---|---|
committer | joeydelarago <joeydelarago@gmail.com> | 2022-08-24 11:06:51 +0300 |
commit | 52b2a8322c6cc676625cd905d2ed219250449c9a (patch) | |
tree | 948f504898225368ae97858421266ced394e6f36 | |
parent | 721f63b0d1b920b0363bf694d708de8fc0ae053d (diff) |
Include LAN printers in abstract printers list
Make filtering clearer by splitting it up into multiple lines.
CURA-9514
-rw-r--r-- | cura/Settings/AbstractMachine.py | 14 |
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: |