Add mime type to AbstractMachine

Cura-9277

Co-authored-by: joeydelarago <joeydelarago@gmail.com>
This commit is contained in:
c.lamboo 2022-08-22 11:57:18 +02:00
parent 544ac33537
commit c4be0e298c

View File

@ -2,6 +2,8 @@ from typing import List
from UM.Settings.ContainerStack import ContainerStack from UM.Settings.ContainerStack import ContainerStack
from cura.Settings.GlobalStack import GlobalStack from cura.Settings.GlobalStack import GlobalStack
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
from UM.Settings.ContainerRegistry import ContainerRegistry
class AbstractMachine(GlobalStack): class AbstractMachine(GlobalStack):
@ -19,3 +21,14 @@ class AbstractMachine(GlobalStack):
printer_type = self.definition.getId() printer_type = self.definition.getId()
cloud_printer_type = 3 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] return [machine for machine in registry.findContainerStacks(type="machine") if machine.definition.id == printer_type and cloud_printer_type in machine.configuredConnectionTypes]
## private:
abstract_machine_mime = MimeType(
name = "application/x-cura-abstract-machine",
comment = "Cura Abstract Machine",
suffixes = ["global.cfg"]
)
MimeTypeDatabase.addMimeType(abstract_machine_mime)
ContainerRegistry.addContainerTypeByName(AbstractMachine, "abstract_machine", abstract_machine_mime.name)