mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 07:03:56 -06:00
CURA-4870 Reuse the filter in findContainerStacks to find specific
printers. Allow to show configurations with empty material or variant.
This commit is contained in:
parent
2bf6d071d1
commit
180139090a
2 changed files with 11 additions and 15 deletions
|
@ -361,19 +361,10 @@ class MachineManager(QObject):
|
|||
# \param metadata_filter \type{dict} list of metadata keys and values used for filtering
|
||||
@staticmethod
|
||||
def getMachine(definition_id: str, metadata_filter: Dict[str, str] = None) -> Optional["GlobalStack"]:
|
||||
machines = ContainerRegistry.getInstance().findContainerStacks(type = "machine")
|
||||
machines = ContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
||||
for machine in machines:
|
||||
if machine.definition.getId() == definition_id:
|
||||
if metadata_filter:
|
||||
pass_all_filters = True
|
||||
for key in metadata_filter:
|
||||
if machine.getMetaDataEntry(key) != metadata_filter[key]:
|
||||
pass_all_filters = False
|
||||
break
|
||||
if pass_all_filters:
|
||||
return machine
|
||||
else:
|
||||
return machine
|
||||
return machine
|
||||
return None
|
||||
|
||||
@pyqtSlot(str, str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue