mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Introduce clearUserContainers and updateQualityChanges methods in ContainerManager
They are moved from MachineManager which is really getting too large and complicated. Contributes to CURA-2006
This commit is contained in:
parent
95c3aa8251
commit
0934ae70a8
1 changed files with 32 additions and 0 deletions
|
@ -14,6 +14,8 @@ import UM.Platform
|
||||||
import UM.MimeTypeDatabase
|
import UM.MimeTypeDatabase
|
||||||
import UM.Logger
|
import UM.Logger
|
||||||
|
|
||||||
|
from .ExtruderManager import ExtruderManager
|
||||||
|
|
||||||
from UM.MimeTypeDatabase import MimeTypeNotFoundError
|
from UM.MimeTypeDatabase import MimeTypeNotFoundError
|
||||||
|
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
|
@ -349,6 +351,36 @@ class ContainerManager(QObject):
|
||||||
|
|
||||||
return { "status": "success", "message": "Successfully imported container {0}".format(container.getName()) }
|
return { "status": "success", "message": "Successfully imported container {0}".format(container.getName()) }
|
||||||
|
|
||||||
|
@pyqtSlot(result = bool)
|
||||||
|
def updateQualityChanges(self):
|
||||||
|
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||||
|
|
||||||
|
containers_to_merge = []
|
||||||
|
|
||||||
|
global_quality_changes = global_stack.findContainer(type = "quality_changes")
|
||||||
|
if not global_quality_changes or global_quality_changes.isReadOnly():
|
||||||
|
return False
|
||||||
|
|
||||||
|
containers_to_merge.append((global_quality_changes, global_stack.getTop()))
|
||||||
|
|
||||||
|
for extruder in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()):
|
||||||
|
quality_changes = extruder.findContainer(type = "quality_changes")
|
||||||
|
if not quality_changes or quality_changes.isReadOnly():
|
||||||
|
return False
|
||||||
|
|
||||||
|
containers_to_merge.append((quality_changes, extruder.getTop()))
|
||||||
|
|
||||||
|
for merge_into, merge in containers_to_merge:
|
||||||
|
self._performMerge(merge_into, merge)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def clearUserContainers(self):
|
||||||
|
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||||
|
|
||||||
|
for extruder in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()):
|
||||||
|
extruder.getTop().clear()
|
||||||
|
|
||||||
|
global_stack.getTop().clear()
|
||||||
# Factory function, used by QML
|
# Factory function, used by QML
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def createContainerManager(engine, js_engine):
|
def createContainerManager(engine, js_engine):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue