mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Include LAN printers in abstract printers list
Make filtering clearer by splitting it up into multiple lines. CURA-9514
This commit is contained in:
parent
721f63b0d1
commit
52b2a8322c
1 changed files with 8 additions and 6 deletions
|
|
@ -29,14 +29,16 @@ class AbstractMachine(GlobalStack):
|
||||||
application = CuraApplication.getInstance()
|
application = CuraApplication.getInstance()
|
||||||
registry = application.getContainerRegistry()
|
registry = application.getContainerRegistry()
|
||||||
|
|
||||||
printer_type = abstract_machine.definition.getId()
|
machines = registry.findContainerStacks(type="machine")
|
||||||
|
# Filter machines that match definition
|
||||||
machines = [machine for machine in registry.findContainerStacks(type="machine") if machine.definition.id == printer_type and ConnectionType.CloudConnection in machine.configuredConnectionTypes]
|
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:
|
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:
|
## private:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue