mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Searching container registry returns ContainerStacks.
Made typing more generic to work with an ContainerStack to compensate. Made AbstractMachine getMachines a classmethod so it can be called with ContainerStacks. CURA-9514
This commit is contained in:
parent
d1ae3136aa
commit
7ffa770fb4
4 changed files with 22 additions and 6 deletions
|
@ -5,10 +5,12 @@ from PyQt6.QtCore import Qt, QTimer
|
|||
from typing import Optional, Dict
|
||||
|
||||
from UM.Qt.ListModel import ListModel
|
||||
from UM.Settings.ContainerStack import ContainerStack
|
||||
from UM.i18n import i18nCatalog
|
||||
from UM.Util import parseBool
|
||||
|
||||
from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
|
||||
from cura.Settings.AbstractMachine import AbstractMachine
|
||||
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
||||
from cura.Settings.GlobalStack import GlobalStack
|
||||
|
||||
|
@ -62,8 +64,11 @@ class AbstractStacksModel(ListModel):
|
|||
|
||||
abstract_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type="abstract_machine")
|
||||
|
||||
abstract_machine_stacks.sort(key=lambda machine: machine.getName(), reverse=True)
|
||||
|
||||
for abstract_machine in abstract_machine_stacks:
|
||||
machine_stacks = container_stacks # FIXME: This should point to abstract_machine.getPrinters()
|
||||
machine_stacks = AbstractMachine.getMachines(abstract_machine)
|
||||
|
||||
|
||||
# Create item for abstract printer
|
||||
items.append(self.createItem(abstract_machine))
|
||||
|
@ -76,7 +81,7 @@ class AbstractStacksModel(ListModel):
|
|||
|
||||
self.setItems(items)
|
||||
|
||||
def createItem(self, container_stack: GlobalStack) -> Optional[Dict]:
|
||||
def createItem(self, container_stack: ContainerStack) -> Optional[Dict]:
|
||||
if parseBool(container_stack.getMetaDataEntry("hidden", False)):
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue