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:
authorc.lamboo <casperlamboo@gmail.com>2022-08-19 17:35:13 +0300
committerc.lamboo <casperlamboo@gmail.com>2022-08-19 17:35:13 +0300
commitf22d446fa401d5a2e6e8650184826c4ccb2878df (patch)
tree232d8d988c4ee1ec471100bee729fe3b6d128e2e /cura/Settings
parentd7f119415f572c360dd3199d3acd842c8fcc6792 (diff)
Implement `getMachines` function
Cura-9277 Co-authored-by: joeydelarago <joeydelarago@gmail.com>
Diffstat (limited to 'cura/Settings')
-rw-r--r--cura/Settings/AbstractMachine.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/cura/Settings/AbstractMachine.py b/cura/Settings/AbstractMachine.py
index 837cfad4bd..7bf8454a49 100644
--- a/cura/Settings/AbstractMachine.py
+++ b/cura/Settings/AbstractMachine.py
@@ -1,16 +1,21 @@
from typing import List
+from UM.Settings.ContainerStack import ContainerStack
from cura.Settings.GlobalStack import GlobalStack
class AbstractMachine(GlobalStack):
- """ Behaves as a type of machine, represents multiple machines of the same type """
+ """ Represents a group of machines of the same type. This allows the user to select settings before selecting a printer. """
def __init__(self, container_id: str):
super().__init__(container_id)
self.setMetaDataEntry("type", "abstract_machine")
- def getMachinesOfType(self) -> List[GlobalStack]:
- pass
-
+ def getMachines(self) -> List[ContainerStack]:
+ from cura.CuraApplication import CuraApplication
+ application = CuraApplication.getInstance()
+ registry = application.getContainerRegistry()
+ printer_type = self.definition.getId()
+ cloud_printer_type = 3
+ return [machine for machine in registry.findContainerStacks(type="machine") if machine.definition.id == printer_type and cloud_printer_type in machine.configuredConnectionTypes]