mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Lots of import fixes. Eliminated the import hacks such as those used inside UM/Settings/__init__.py.
CURA-2917
This commit is contained in:
parent
5884509af1
commit
74e5798509
20 changed files with 134 additions and 128 deletions
|
@ -2,6 +2,7 @@
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
from cura.Settings.ExtruderManager import ExtruderManager
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
from UM.Scene.Platform import Platform
|
from UM.Scene.Platform import Platform
|
||||||
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
||||||
|
@ -23,9 +24,6 @@ catalog = i18nCatalog("cura")
|
||||||
import numpy
|
import numpy
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
import UM.Settings.ContainerRegistry
|
|
||||||
|
|
||||||
|
|
||||||
# Setting for clearance around the prime
|
# Setting for clearance around the prime
|
||||||
PRIME_CLEARANCE = 6.5
|
PRIME_CLEARANCE = 6.5
|
||||||
|
|
||||||
|
@ -663,7 +661,7 @@ class BuildVolume(SceneNode):
|
||||||
return self._global_container_stack.getProperty(setting_key, property)
|
return self._global_container_stack.getProperty(setting_key, property)
|
||||||
|
|
||||||
extruder_stack_id = ExtruderManager.getInstance().extruderIds[str(extruder_index)]
|
extruder_stack_id = ExtruderManager.getInstance().extruderIds[str(extruder_index)]
|
||||||
stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0]
|
stack = ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0]
|
||||||
return stack.getProperty(setting_key, property)
|
return stack.getProperty(setting_key, property)
|
||||||
|
|
||||||
## Convenience function to calculate the disallowed radius around the edge.
|
## Convenience function to calculate the disallowed radius around the edge.
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
# Copyright (c) 2016 Ultimaker B.V.
|
# Copyright (c) 2016 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
from cura.Settings.ExtruderManager import ExtruderManager
|
|
||||||
from UM.Math.Polygon import Polygon
|
from UM.Math.Polygon import Polygon
|
||||||
from . import ConvexHullNode
|
from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
|
||||||
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
|
|
||||||
import UM.Settings.ContainerRegistry
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
|
from . import ConvexHullNode
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
|
@ -308,11 +308,11 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
extruder_stack_id = self._node.callDecoration("getActiveExtruder")
|
extruder_stack_id = self._node.callDecoration("getActiveExtruder")
|
||||||
if not extruder_stack_id: #Decoration doesn't exist.
|
if not extruder_stack_id: #Decoration doesn't exist.
|
||||||
extruder_stack_id = ExtruderManager.getInstance().extruderIds["0"]
|
extruder_stack_id = ExtruderManager.getInstance().extruderIds["0"]
|
||||||
extruder_stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0]
|
extruder_stack = ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0]
|
||||||
return extruder_stack.getProperty(setting_key, property)
|
return extruder_stack.getProperty(setting_key, property)
|
||||||
else: #Limit_to_extruder is set. Use that one.
|
else: #Limit_to_extruder is set. Use that one.
|
||||||
extruder_stack_id = ExtruderManager.getInstance().extruderIds[str(extruder_index)]
|
extruder_stack_id = ExtruderManager.getInstance().extruderIds[str(extruder_index)]
|
||||||
stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0]
|
stack = ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0]
|
||||||
return stack.getProperty(setting_key, property)
|
return stack.getProperty(setting_key, property)
|
||||||
|
|
||||||
## Returns true if node is a descendant or the same as the root node.
|
## Returns true if node is a descendant or the same as the root node.
|
||||||
|
|
|
@ -124,7 +124,6 @@ class CuraApplication(QtApplication):
|
||||||
Q_ENUMS(ResourceTypes)
|
Q_ENUMS(ResourceTypes)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType)
|
|
||||||
|
|
||||||
Resources.addSearchPath(os.path.join(QtApplication.getInstallPrefix(), "share", "cura", "resources"))
|
Resources.addSearchPath(os.path.join(QtApplication.getInstallPrefix(), "share", "cura", "resources"))
|
||||||
if not hasattr(sys, "frozen"):
|
if not hasattr(sys, "frozen"):
|
||||||
|
@ -187,6 +186,7 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
self._additional_components = {} # Components to add to certain areas in the interface
|
self._additional_components = {} # Components to add to certain areas in the interface
|
||||||
|
|
||||||
|
super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType)
|
||||||
|
|
||||||
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
|
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@ from UM.i18n import i18nCatalog
|
||||||
from UM.OutputDevice.OutputDevice import OutputDevice
|
from UM.OutputDevice.OutputDevice import OutputDevice
|
||||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
|
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
|
||||||
from PyQt5.QtWidgets import QMessageBox
|
from PyQt5.QtWidgets import QMessageBox
|
||||||
import UM.Settings.ContainerRegistry
|
|
||||||
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
|
|
||||||
from enum import IntEnum # For the connection state tracking.
|
from enum import IntEnum # For the connection state tracking.
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Application import Application
|
|
||||||
from UM.Signal import signalemitter
|
from UM.Signal import signalemitter
|
||||||
|
|
||||||
i18n_catalog = i18nCatalog("cura")
|
i18n_catalog = i18nCatalog("cura")
|
||||||
|
@ -25,7 +25,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
def __init__(self, device_id, parent = None):
|
def __init__(self, device_id, parent = None):
|
||||||
super().__init__(device_id = device_id, parent = parent)
|
super().__init__(device_id = device_id, parent = parent)
|
||||||
|
|
||||||
self._container_registry = UM.Settings.ContainerRegistry.getInstance()
|
self._container_registry = ContainerRegistry.getInstance()
|
||||||
self._target_bed_temperature = 0
|
self._target_bed_temperature = 0
|
||||||
self._bed_temperature = 0
|
self._bed_temperature = 0
|
||||||
self._num_extruders = 1
|
self._num_extruders = 1
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
# Copyright (c) 2016 Ultimaker B.V.
|
# Copyright (c) 2016 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
import UM.Application
|
|
||||||
import cura.Settings.ExtruderManager
|
|
||||||
import UM.Settings.ContainerRegistry
|
|
||||||
|
|
||||||
# This collects a lot of quality and quality changes related code which was split between ContainerManager
|
# This collects a lot of quality and quality changes related code which was split between ContainerManager
|
||||||
# and the MachineManager and really needs to usable from both.
|
# and the MachineManager and really needs to usable from both.
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
from UM.Application import Application
|
||||||
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
|
from UM.Settings.DefinitionContainer import DefinitionContainer
|
||||||
|
from UM.Settings.InstanceContainer import InstanceContainer
|
||||||
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
|
|
||||||
|
|
||||||
class QualityManager:
|
class QualityManager:
|
||||||
|
|
||||||
|
@ -121,14 +125,14 @@ class QualityManager:
|
||||||
#
|
#
|
||||||
# \param machine_definition \type{DefinitionContainer} the machine definition.
|
# \param machine_definition \type{DefinitionContainer} the machine definition.
|
||||||
# \return \type{List[InstanceContainer]} the list of quality changes
|
# \return \type{List[InstanceContainer]} the list of quality changes
|
||||||
def findAllQualityChangesForMachine(self, machine_definition):
|
def findAllQualityChangesForMachine(self, machine_definition: DefinitionContainer) -> List[InstanceContainer]:
|
||||||
if machine_definition.getMetaDataEntry("has_machine_quality"):
|
if machine_definition.getMetaDataEntry("has_machine_quality"):
|
||||||
definition_id = machine_definition.getId()
|
definition_id = machine_definition.getId()
|
||||||
else:
|
else:
|
||||||
definition_id = "fdmprinter"
|
definition_id = "fdmprinter"
|
||||||
|
|
||||||
filter_dict = { "type": "quality_changes", "extruder": None, "definition": definition_id }
|
filter_dict = { "type": "quality_changes", "extruder": None, "definition": definition_id }
|
||||||
quality_changes_list = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**filter_dict)
|
quality_changes_list = ContainerRegistry.getInstance().findInstanceContainers(**filter_dict)
|
||||||
return quality_changes_list
|
return quality_changes_list
|
||||||
|
|
||||||
## Find all usable qualities for a machine and extruders.
|
## Find all usable qualities for a machine and extruders.
|
||||||
|
@ -177,7 +181,7 @@ class QualityManager:
|
||||||
if base_material:
|
if base_material:
|
||||||
# There is a basic material specified
|
# There is a basic material specified
|
||||||
criteria = { "type": "material", "name": base_material, "definition": definition_id }
|
criteria = { "type": "material", "name": base_material, "definition": definition_id }
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria)
|
containers = ContainerRegistry.getInstance().findInstanceContainers(**criteria)
|
||||||
containers = [basic_material for basic_material in containers if
|
containers = [basic_material for basic_material in containers if
|
||||||
basic_material.getMetaDataEntry("variant") == material_container.getMetaDataEntry(
|
basic_material.getMetaDataEntry("variant") == material_container.getMetaDataEntry(
|
||||||
"variant")]
|
"variant")]
|
||||||
|
@ -191,13 +195,13 @@ class QualityManager:
|
||||||
def _getFilteredContainersForStack(self, machine_definition=None, material_containers=None, **kwargs):
|
def _getFilteredContainersForStack(self, machine_definition=None, material_containers=None, **kwargs):
|
||||||
# Fill in any default values.
|
# Fill in any default values.
|
||||||
if machine_definition is None:
|
if machine_definition is None:
|
||||||
machine_definition = UM.Application.getInstance().getGlobalContainerStack().getBottom()
|
machine_definition = Application.getInstance().getGlobalContainerStack().getBottom()
|
||||||
quality_definition_id = machine_definition.getMetaDataEntry("quality_definition")
|
quality_definition_id = machine_definition.getMetaDataEntry("quality_definition")
|
||||||
if quality_definition_id is not None:
|
if quality_definition_id is not None:
|
||||||
machine_definition = UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id=quality_definition_id)[0]
|
machine_definition = ContainerRegistry.getInstance().findDefinitionContainers(id=quality_definition_id)[0]
|
||||||
|
|
||||||
if material_containers is None:
|
if material_containers is None:
|
||||||
active_stacks = cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks()
|
active_stacks = ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks()
|
||||||
material_containers = [stack.findContainer(type="material") for stack in active_stacks]
|
material_containers = [stack.findContainer(type="material") for stack in active_stacks]
|
||||||
|
|
||||||
criteria = kwargs
|
criteria = kwargs
|
||||||
|
@ -222,7 +226,7 @@ class QualityManager:
|
||||||
if material_instance is not None:
|
if material_instance is not None:
|
||||||
material_ids.add(material_instance.getId())
|
material_ids.add(material_instance.getId())
|
||||||
|
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria)
|
containers = ContainerRegistry.getInstance().findInstanceContainers(**criteria)
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
for container in containers:
|
for container in containers:
|
||||||
|
@ -238,8 +242,8 @@ class QualityManager:
|
||||||
# an extruder definition.
|
# an extruder definition.
|
||||||
# \return \type{DefinitionContainer} the parent machine definition. If the given machine
|
# \return \type{DefinitionContainer} the parent machine definition. If the given machine
|
||||||
# definition doesn't have a parent then it is simply returned.
|
# definition doesn't have a parent then it is simply returned.
|
||||||
def getParentMachineDefinition(self, machine_definition):
|
def getParentMachineDefinition(self, machine_definition: DefinitionContainer) -> DefinitionContainer:
|
||||||
container_registry = UM.Settings.ContainerRegistry.getInstance()
|
container_registry = ContainerRegistry.getInstance()
|
||||||
|
|
||||||
machine_entry = machine_definition.getMetaDataEntry("machine")
|
machine_entry = machine_definition.getMetaDataEntry("machine")
|
||||||
if machine_entry is None:
|
if machine_entry is None:
|
||||||
|
@ -274,6 +278,6 @@ class QualityManager:
|
||||||
# This already is a 'global' machine definition.
|
# This already is a 'global' machine definition.
|
||||||
return machine_definition
|
return machine_definition
|
||||||
else:
|
else:
|
||||||
container_registry = UM.Settings.ContainerRegistry.getInstance()
|
container_registry = ContainerRegistry.getInstance()
|
||||||
whole_machine = container_registry.findDefinitionContainers(id=machine_entry)[0]
|
whole_machine = container_registry.findDefinitionContainers(id=machine_entry)[0]
|
||||||
return whole_machine
|
return whole_machine
|
||||||
|
|
|
@ -7,13 +7,15 @@ import urllib
|
||||||
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal, QUrl, QVariant
|
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal, QUrl, QVariant
|
||||||
from PyQt5.QtWidgets import QMessageBox
|
from PyQt5.QtWidgets import QMessageBox
|
||||||
|
|
||||||
import UM.PluginRegistry
|
from UM.PluginRegistry import PluginRegistry
|
||||||
import UM.SaveFile
|
import UM.SaveFile
|
||||||
import UM.Platform
|
import UM.Platform
|
||||||
import UM.MimeTypeDatabase
|
import UM.MimeTypeDatabase
|
||||||
import UM.Logger
|
|
||||||
|
|
||||||
|
from UM.Logger import Logger
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
from UM.Settings.ContainerStack import ContainerStack
|
||||||
|
from UM.Settings.DefinitionContainer import DefinitionContainer
|
||||||
from UM.Settings.InstanceContainer import InstanceContainer
|
from UM.Settings.InstanceContainer import InstanceContainer
|
||||||
from cura.QualityManager import QualityManager
|
from cura.QualityManager import QualityManager
|
||||||
|
|
||||||
|
@ -35,7 +37,7 @@ class ContainerManager(QObject):
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self._registry = ContainerRegistry.getInstance()
|
self._container_registry = ContainerRegistry.getInstance()
|
||||||
self._machine_manager = Application.getInstance().getMachineManager()
|
self._machine_manager = Application.getInstance().getMachineManager()
|
||||||
self._container_name_filters = {}
|
self._container_name_filters = {}
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@ class ContainerManager(QObject):
|
||||||
def duplicateContainer(self, container_id):
|
def duplicateContainer(self, container_id):
|
||||||
containers = self._container_registry.findContainers(None, id = container_id)
|
containers = self._container_registry.findContainers(None, id = container_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
UM.Logger.log("w", "Could duplicate container %s because it was not found.", container_id)
|
Logger.log("w", "Could duplicate container %s because it was not found.", container_id)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
container = containers[0]
|
container = containers[0]
|
||||||
|
@ -83,7 +85,7 @@ class ContainerManager(QObject):
|
||||||
def renameContainer(self, container_id, new_id, new_name):
|
def renameContainer(self, container_id, new_id, new_name):
|
||||||
containers = self._container_registry.findContainers(None, id = container_id)
|
containers = self._container_registry.findContainers(None, id = container_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
UM.Logger.log("w", "Could rename container %s because it was not found.", container_id)
|
Logger.log("w", "Could rename container %s because it was not found.", container_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
container = containers[0]
|
container = containers[0]
|
||||||
|
@ -111,7 +113,7 @@ class ContainerManager(QObject):
|
||||||
def removeContainer(self, container_id):
|
def removeContainer(self, container_id):
|
||||||
containers = self._container_registry.findContainers(None, id = container_id)
|
containers = self._container_registry.findContainers(None, id = container_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
UM.Logger.log("w", "Could remove container %s because it was not found.", container_id)
|
Logger.log("w", "Could remove container %s because it was not found.", container_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self._container_registry.removeContainer(containers[0].getId())
|
self._container_registry.removeContainer(containers[0].getId())
|
||||||
|
@ -131,20 +133,20 @@ class ContainerManager(QObject):
|
||||||
def mergeContainers(self, merge_into_id, merge_id):
|
def mergeContainers(self, merge_into_id, merge_id):
|
||||||
containers = self._container_registry.findContainers(None, id = merge_into_id)
|
containers = self._container_registry.findContainers(None, id = merge_into_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
UM.Logger.log("w", "Could merge into container %s because it was not found.", merge_into_id)
|
Logger.log("w", "Could merge into container %s because it was not found.", merge_into_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
merge_into = containers[0]
|
merge_into = containers[0]
|
||||||
|
|
||||||
containers = self._container_registry.findContainers(None, id = merge_id)
|
containers = self._container_registry.findContainers(None, id = merge_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
UM.Logger.log("w", "Could not merge container %s because it was not found", merge_id)
|
Logger.log("w", "Could not merge container %s because it was not found", merge_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
merge = containers[0]
|
merge = containers[0]
|
||||||
|
|
||||||
if not isinstance(merge, type(merge_into)):
|
if not isinstance(merge, type(merge_into)):
|
||||||
UM.Logger.log("w", "Cannot merge two containers of different types")
|
Logger.log("w", "Cannot merge two containers of different types")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self._performMerge(merge_into, merge)
|
self._performMerge(merge_into, merge)
|
||||||
|
@ -160,11 +162,11 @@ class ContainerManager(QObject):
|
||||||
def clearContainer(self, container_id):
|
def clearContainer(self, container_id):
|
||||||
containers = self._container_registry.findContainers(None, id = container_id)
|
containers = self._container_registry.findContainers(None, id = container_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
UM.Logger.log("w", "Could clear container %s because it was not found.", container_id)
|
Logger.log("w", "Could clear container %s because it was not found.", container_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if containers[0].isReadOnly():
|
if containers[0].isReadOnly():
|
||||||
UM.Logger.log("w", "Cannot clear read-only container %s", container_id)
|
Logger.log("w", "Cannot clear read-only container %s", container_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
containers[0].clear()
|
containers[0].clear()
|
||||||
|
@ -175,7 +177,7 @@ class ContainerManager(QObject):
|
||||||
def getContainerMetaDataEntry(self, container_id, entry_name):
|
def getContainerMetaDataEntry(self, container_id, entry_name):
|
||||||
containers = self._container_registry.findContainers(None, id=container_id)
|
containers = self._container_registry.findContainers(None, id=container_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
UM.Logger.log("w", "Could not get metadata of container %s because it was not found.", container_id)
|
Logger.log("w", "Could not get metadata of container %s because it was not found.", container_id)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
result = containers[0].getMetaDataEntry(entry_name)
|
result = containers[0].getMetaDataEntry(entry_name)
|
||||||
|
@ -200,13 +202,13 @@ class ContainerManager(QObject):
|
||||||
def setContainerMetaDataEntry(self, container_id, entry_name, entry_value):
|
def setContainerMetaDataEntry(self, container_id, entry_name, entry_value):
|
||||||
containers = self._container_registry.findContainers(None, id = container_id)
|
containers = self._container_registry.findContainers(None, id = container_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
UM.Logger.log("w", "Could not set metadata of container %s because it was not found.", container_id)
|
Logger.log("w", "Could not set metadata of container %s because it was not found.", container_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
container = containers[0]
|
container = containers[0]
|
||||||
|
|
||||||
if container.isReadOnly():
|
if container.isReadOnly():
|
||||||
UM.Logger.log("w", "Cannot set metadata of read-only container %s.", container_id)
|
Logger.log("w", "Cannot set metadata of read-only container %s.", container_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
entries = entry_name.split("/")
|
entries = entry_name.split("/")
|
||||||
|
@ -234,13 +236,13 @@ class ContainerManager(QObject):
|
||||||
def setContainerName(self, container_id, new_name):
|
def setContainerName(self, container_id, new_name):
|
||||||
containers = self._container_registry.findContainers(None, id = container_id)
|
containers = self._container_registry.findContainers(None, id = container_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
UM.Logger.log("w", "Could not set name of container %s because it was not found.", container_id)
|
Logger.log("w", "Could not set name of container %s because it was not found.", container_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
container = containers[0]
|
container = containers[0]
|
||||||
|
|
||||||
if container.isReadOnly():
|
if container.isReadOnly():
|
||||||
UM.Logger.log("w", "Cannot set name of read-only container %s.", container_id)
|
Logger.log("w", "Cannot set name of read-only container %s.", container_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
container.setName(new_name)
|
container.setName(new_name)
|
||||||
|
@ -264,11 +266,11 @@ class ContainerManager(QObject):
|
||||||
|
|
||||||
@pyqtSlot(str, result = bool)
|
@pyqtSlot(str, result = bool)
|
||||||
def isContainerUsed(self, container_id):
|
def isContainerUsed(self, container_id):
|
||||||
UM.Logger.log("d", "Checking if container %s is currently used", container_id)
|
Logger.log("d", "Checking if container %s is currently used", container_id)
|
||||||
containers = self._container_registry.findContainerStacks()
|
containers = self._container_registry.findContainerStacks()
|
||||||
for stack in containers:
|
for stack in containers:
|
||||||
if container_id in [child.getId() for child in stack.getContainers()]:
|
if container_id in [child.getId() for child in stack.getContainers()]:
|
||||||
UM.Logger.log("d", "The container is in use by %s", stack.getId())
|
Logger.log("d", "The container is in use by %s", stack.getId())
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -423,7 +425,7 @@ class ContainerManager(QObject):
|
||||||
# Find the quality_changes container for this stack and merge the contents of the top container into it.
|
# Find the quality_changes container for this stack and merge the contents of the top container into it.
|
||||||
quality_changes = stack.findContainer(type = "quality_changes")
|
quality_changes = stack.findContainer(type = "quality_changes")
|
||||||
if not quality_changes or quality_changes.isReadOnly():
|
if not quality_changes or quality_changes.isReadOnly():
|
||||||
UM.Logger.log("e", "Could not update quality of a nonexistant or read only quality profile in stack %s", stack.getId())
|
Logger.log("e", "Could not update quality of a nonexistant or read only quality profile in stack %s", stack.getId())
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self._performMerge(quality_changes, stack.getTop())
|
self._performMerge(quality_changes, stack.getTop())
|
||||||
|
@ -457,13 +459,13 @@ class ContainerManager(QObject):
|
||||||
# \return \type{bool} True if the operation was successfully, False if not.
|
# \return \type{bool} True if the operation was successfully, False if not.
|
||||||
@pyqtSlot(str, result = bool)
|
@pyqtSlot(str, result = bool)
|
||||||
def createQualityChanges(self, base_name):
|
def createQualityChanges(self, base_name):
|
||||||
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
if not global_stack:
|
if not global_stack:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
active_quality_name = self._machine_manager.activeQualityName
|
active_quality_name = self._machine_manager.activeQualityName
|
||||||
if active_quality_name == "":
|
if active_quality_name == "":
|
||||||
UM.Logger.log("w", "No quality container found in stack %s, cannot create profile", global_stack.getId())
|
Logger.log("w", "No quality container found in stack %s, cannot create profile", global_stack.getId())
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self._machine_manager.blurSettings.emit()
|
self._machine_manager.blurSettings.emit()
|
||||||
|
@ -477,12 +479,12 @@ class ContainerManager(QObject):
|
||||||
quality_container = stack.findContainer(type = "quality")
|
quality_container = stack.findContainer(type = "quality")
|
||||||
quality_changes_container = stack.findContainer(type = "quality_changes")
|
quality_changes_container = stack.findContainer(type = "quality_changes")
|
||||||
if not quality_container or not quality_changes_container:
|
if not quality_container or not quality_changes_container:
|
||||||
UM.Logger.log("w", "No quality or quality changes container found in stack %s, ignoring it", stack.getId())
|
Logger.log("w", "No quality or quality changes container found in stack %s, ignoring it", stack.getId())
|
||||||
continue
|
continue
|
||||||
|
|
||||||
extruder_id = None if stack is global_stack else QualityManager.getInstance().getParentMachineDefinition(stack.getBottom()).getId()
|
extruder_id = None if stack is global_stack else QualityManager.getInstance().getParentMachineDefinition(stack.getBottom()).getId()
|
||||||
new_changes = self._createQualityChanges(quality_container, unique_name,
|
new_changes = self._createQualityChanges(quality_container, unique_name,
|
||||||
UM.Application.getInstance().getGlobalContainerStack().getBottom(),
|
Application.getInstance().getGlobalContainerStack().getBottom(),
|
||||||
extruder_id)
|
extruder_id)
|
||||||
self._performMerge(new_changes, quality_changes_container, clear_settings = False)
|
self._performMerge(new_changes, quality_changes_container, clear_settings = False)
|
||||||
self._performMerge(new_changes, user_container)
|
self._performMerge(new_changes, user_container)
|
||||||
|
@ -504,7 +506,7 @@ class ContainerManager(QObject):
|
||||||
# \return \type{bool} True if successful, False if not.
|
# \return \type{bool} True if successful, False if not.
|
||||||
@pyqtSlot(str, result = bool)
|
@pyqtSlot(str, result = bool)
|
||||||
def removeQualityChanges(self, quality_name):
|
def removeQualityChanges(self, quality_name):
|
||||||
UM.Logger.log("d", "Attempting to remove the quality change containers with name %s", quality_name)
|
Logger.log("d", "Attempting to remove the quality change containers with name %s", quality_name)
|
||||||
containers_found = False
|
containers_found = False
|
||||||
|
|
||||||
if not quality_name:
|
if not quality_name:
|
||||||
|
@ -514,7 +516,7 @@ class ContainerManager(QObject):
|
||||||
activate_quality = quality_name == self._machine_manager.activeQualityName
|
activate_quality = quality_name == self._machine_manager.activeQualityName
|
||||||
activate_quality_type = None
|
activate_quality_type = None
|
||||||
|
|
||||||
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
if not global_stack or not quality_name:
|
if not global_stack or not quality_name:
|
||||||
return ""
|
return ""
|
||||||
machine_definition = global_stack.getBottom()
|
machine_definition = global_stack.getBottom()
|
||||||
|
@ -526,7 +528,7 @@ class ContainerManager(QObject):
|
||||||
self._container_registry.removeContainer(container.getId())
|
self._container_registry.removeContainer(container.getId())
|
||||||
|
|
||||||
if not containers_found:
|
if not containers_found:
|
||||||
UM.Logger.log("d", "Unable to remove quality containers, as we did not find any by the name of %s", quality_name)
|
Logger.log("d", "Unable to remove quality containers, as we did not find any by the name of %s", quality_name)
|
||||||
|
|
||||||
elif activate_quality:
|
elif activate_quality:
|
||||||
definition_id = "fdmprinter" if not self._machine_manager.filterQualityByMachine else self._machine_manager.activeDefinitionId
|
definition_id = "fdmprinter" if not self._machine_manager.filterQualityByMachine else self._machine_manager.activeDefinitionId
|
||||||
|
@ -549,15 +551,15 @@ class ContainerManager(QObject):
|
||||||
# \return True if successful, False if not.
|
# \return True if successful, False if not.
|
||||||
@pyqtSlot(str, str, result = bool)
|
@pyqtSlot(str, str, result = bool)
|
||||||
def renameQualityChanges(self, quality_name, new_name):
|
def renameQualityChanges(self, quality_name, new_name):
|
||||||
UM.Logger.log("d", "User requested QualityChanges container rename of %s to %s", quality_name, new_name)
|
Logger.log("d", "User requested QualityChanges container rename of %s to %s", quality_name, new_name)
|
||||||
if not quality_name or not new_name:
|
if not quality_name or not new_name:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if quality_name == new_name:
|
if quality_name == new_name:
|
||||||
UM.Logger.log("w", "Unable to rename %s to %s, because they are the same.", quality_name, new_name)
|
Logger.log("w", "Unable to rename %s to %s, because they are the same.", quality_name, new_name)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
if not global_stack:
|
if not global_stack:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -574,7 +576,7 @@ class ContainerManager(QObject):
|
||||||
container_registry.renameContainer(container.getId(), new_name, self._createUniqueId(stack_id, new_name))
|
container_registry.renameContainer(container.getId(), new_name, self._createUniqueId(stack_id, new_name))
|
||||||
|
|
||||||
if not containers_to_rename:
|
if not containers_to_rename:
|
||||||
UM.Logger.log("e", "Unable to rename %s, because we could not find the profile", quality_name)
|
Logger.log("e", "Unable to rename %s, because we could not find the profile", quality_name)
|
||||||
|
|
||||||
self._machine_manager.activeQualityChanged.emit()
|
self._machine_manager.activeQualityChanged.emit()
|
||||||
return True
|
return True
|
||||||
|
@ -590,7 +592,7 @@ class ContainerManager(QObject):
|
||||||
# \return A string containing the name of the duplicated containers, or an empty string if it failed.
|
# \return A string containing the name of the duplicated containers, or an empty string if it failed.
|
||||||
@pyqtSlot(str, str, result = str)
|
@pyqtSlot(str, str, result = str)
|
||||||
def duplicateQualityOrQualityChanges(self, quality_name, base_name):
|
def duplicateQualityOrQualityChanges(self, quality_name, base_name):
|
||||||
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
if not global_stack or not quality_name:
|
if not global_stack or not quality_name:
|
||||||
return ""
|
return ""
|
||||||
machine_definition = global_stack.getBottom()
|
machine_definition = global_stack.getBottom()
|
||||||
|
@ -611,16 +613,16 @@ class ContainerManager(QObject):
|
||||||
# \param material_instances \type{List[InstanceContainer]}
|
# \param material_instances \type{List[InstanceContainer]}
|
||||||
# \return \type{str} the name of the newly created container.
|
# \return \type{str} the name of the newly created container.
|
||||||
def _duplicateQualityOrQualityChangesForMachineType(self, quality_name, base_name, machine_definition, material_instances):
|
def _duplicateQualityOrQualityChangesForMachineType(self, quality_name, base_name, machine_definition, material_instances):
|
||||||
UM.Logger.log("d", "Attempting to duplicate the quality %s", quality_name)
|
Logger.log("d", "Attempting to duplicate the quality %s", quality_name)
|
||||||
|
|
||||||
if base_name is None:
|
if base_name is None:
|
||||||
base_name = quality_name
|
base_name = quality_name
|
||||||
# Try to find a Quality with the name.
|
# Try to find a Quality with the name.
|
||||||
container = QualityManager.getInstance().findQualityByName(quality_name, machine_definition, material_instances)
|
container = QualityManager.getInstance().findQualityByName(quality_name, machine_definition, material_instances)
|
||||||
if container:
|
if container:
|
||||||
UM.Logger.log("d", "We found a quality to duplicate.")
|
Logger.log("d", "We found a quality to duplicate.")
|
||||||
return self._duplicateQualityForMachineType(container, base_name, machine_definition)
|
return self._duplicateQualityForMachineType(container, base_name, machine_definition)
|
||||||
UM.Logger.log("d", "We found a quality_changes to duplicate.")
|
Logger.log("d", "We found a quality_changes to duplicate.")
|
||||||
# Assume it is a quality changes.
|
# Assume it is a quality changes.
|
||||||
return self._duplicateQualityChangesForMachineType(quality_name, base_name, machine_definition)
|
return self._duplicateQualityChangesForMachineType(quality_name, base_name, machine_definition)
|
||||||
|
|
||||||
|
@ -667,11 +669,11 @@ class ContainerManager(QObject):
|
||||||
def duplicateMaterial(self, material_id):
|
def duplicateMaterial(self, material_id):
|
||||||
containers = self._container_registry.findInstanceContainers(id=material_id)
|
containers = self._container_registry.findInstanceContainers(id=material_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
UM.Logger.log("d", "Unable to duplicate the material with id %s, because it doesn't exist.", material_id)
|
Logger.log("d", "Unable to duplicate the material with id %s, because it doesn't exist.", material_id)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
# Ensure all settings are saved.
|
# Ensure all settings are saved.
|
||||||
UM.Application.getInstance().saveSettings()
|
Application.getInstance().saveSettings()
|
||||||
|
|
||||||
# Create a new ID & container to hold the data.
|
# Create a new ID & container to hold the data.
|
||||||
new_id = self._container_registry.uniqueName(material_id)
|
new_id = self._container_registry.uniqueName(material_id)
|
||||||
|
@ -717,12 +719,12 @@ class ContainerManager(QObject):
|
||||||
self._container_name_filters = {}
|
self._container_name_filters = {}
|
||||||
for plugin_id, container_type in self._container_registry.getContainerTypes():
|
for plugin_id, container_type in self._container_registry.getContainerTypes():
|
||||||
# Ignore default container types since those are not plugins
|
# Ignore default container types since those are not plugins
|
||||||
if container_type in (UM.Settings.InstanceContainer, UM.Settings.ContainerStack, UM.Settings.DefinitionContainer):
|
if container_type in (InstanceContainer, ContainerStack, DefinitionContainer):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
serialize_type = ""
|
serialize_type = ""
|
||||||
try:
|
try:
|
||||||
plugin_metadata = UM.PluginRegistry.getInstance().getMetaData(plugin_id)
|
plugin_metadata = PluginRegistry.getInstance().getMetaData(plugin_id)
|
||||||
if plugin_metadata:
|
if plugin_metadata:
|
||||||
serialize_type = plugin_metadata["settings_container"]["type"]
|
serialize_type = plugin_metadata["settings_container"]["type"]
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -7,8 +7,8 @@ import os #For statvfs.
|
||||||
import urllib #To escape machine names for how they're saved to file.
|
import urllib #To escape machine names for how they're saved to file.
|
||||||
|
|
||||||
import UM.Resources
|
import UM.Resources
|
||||||
import UM.Settings.ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
import UM.Settings.InstanceContainer
|
from UM.Settings.InstanceContainer import InstanceContainer
|
||||||
|
|
||||||
## Are machine names valid?
|
## Are machine names valid?
|
||||||
#
|
#
|
||||||
|
@ -22,7 +22,7 @@ class MachineNameValidator(QObject):
|
||||||
filename_max_length = os.statvfs(UM.Resources.getDataStoragePath()).f_namemax
|
filename_max_length = os.statvfs(UM.Resources.getDataStoragePath()).f_namemax
|
||||||
except AttributeError: #Doesn't support statvfs. Probably because it's not a Unix system.
|
except AttributeError: #Doesn't support statvfs. Probably because it's not a Unix system.
|
||||||
filename_max_length = 255 #Assume it's Windows on NTFS.
|
filename_max_length = 255 #Assume it's Windows on NTFS.
|
||||||
machine_name_max_length = filename_max_length - len("_current_settings.") - len(UM.Settings.ContainerRegistry.getMimeTypeForContainer(UM.Settings.InstanceContainer).preferredSuffix)
|
machine_name_max_length = filename_max_length - len("_current_settings.") - len(ContainerRegistry.getMimeTypeForContainer(InstanceContainer).preferredSuffix)
|
||||||
# Characters that urllib.parse.quote_plus escapes count for 12! So now
|
# Characters that urllib.parse.quote_plus escapes count for 12! So now
|
||||||
# we must devise a regex that allows only 12 normal characters or 1
|
# we must devise a regex that allows only 12 normal characters or 1
|
||||||
# special character, and that up to [machine_name_max_length / 12] times.
|
# special character, and that up to [machine_name_max_length / 12] times.
|
||||||
|
@ -45,7 +45,7 @@ class MachineNameValidator(QObject):
|
||||||
except AttributeError: #Doesn't support statvfs. Probably because it's not a Unix system.
|
except AttributeError: #Doesn't support statvfs. Probably because it's not a Unix system.
|
||||||
filename_max_length = 255 #Assume it's Windows on NTFS.
|
filename_max_length = 255 #Assume it's Windows on NTFS.
|
||||||
escaped_name = urllib.parse.quote_plus(name)
|
escaped_name = urllib.parse.quote_plus(name)
|
||||||
current_settings_filename = escaped_name + "_current_settings." + UM.Settings.ContainerRegistry.getMimeTypeForContainer(UM.Settings.InstanceContainer).preferredSuffix
|
current_settings_filename = escaped_name + "_current_settings." + ContainerRegistry.getMimeTypeForContainer(InstanceContainer).preferredSuffix
|
||||||
if len(current_settings_filename) > filename_max_length:
|
if len(current_settings_filename) > filename_max_length:
|
||||||
return QValidator.Invalid
|
return QValidator.Invalid
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
||||||
items = []
|
items = []
|
||||||
|
|
||||||
settings = collections.OrderedDict()
|
settings = collections.OrderedDict()
|
||||||
definition_container = UM.Application.getInstance().getGlobalContainerStack().getBottom()
|
definition_container = Application.getInstance().getGlobalContainerStack().getBottom()
|
||||||
|
|
||||||
containers = self._container_registry.findInstanceContainers(id = self._quality_id)
|
containers = self._container_registry.findInstanceContainers(id = self._quality_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
|
@ -116,7 +116,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
||||||
quality_container = quality_container[0]
|
quality_container = quality_container[0]
|
||||||
|
|
||||||
quality_type = quality_container.getMetaDataEntry("quality_type")
|
quality_type = quality_container.getMetaDataEntry("quality_type")
|
||||||
definition_id = UM.Application.getInstance().getMachineManager().getQualityDefinitionId(quality_container.getDefinition())
|
definition_id = Application.getInstance().getMachineManager().getQualityDefinitionId(quality_container.getDefinition())
|
||||||
|
|
||||||
criteria = {"type": "quality", "quality_type": quality_type, "definition": definition_id}
|
criteria = {"type": "quality", "quality_type": quality_type, "definition": definition_id}
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
|
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
|
||||||
import UM.Settings
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
import cura.Settings
|
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +11,12 @@ from UM.Logger import Logger
|
||||||
# because some profiles tend to have 'hardcoded' values that break our inheritance. A good example of that are the
|
# because some profiles tend to have 'hardcoded' values that break our inheritance. A good example of that are the
|
||||||
# speed settings. If all the children of print_speed have a single value override, changing the speed won't
|
# speed settings. If all the children of print_speed have a single value override, changing the speed won't
|
||||||
# actually do anything, as only the 'leaf' settings are used by the engine.
|
# actually do anything, as only the 'leaf' settings are used by the engine.
|
||||||
|
from UM.Settings.ContainerStack import ContainerStack
|
||||||
|
from UM.Settings.SettingFunction import SettingFunction
|
||||||
|
from UM.Settings.SettingInstance import InstanceState
|
||||||
|
|
||||||
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
|
|
||||||
class SettingInheritanceManager(QObject):
|
class SettingInheritanceManager(QObject):
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
@ -22,7 +26,7 @@ class SettingInheritanceManager(QObject):
|
||||||
self._active_container_stack = None
|
self._active_container_stack = None
|
||||||
self._onGlobalContainerChanged()
|
self._onGlobalContainerChanged()
|
||||||
|
|
||||||
cura.Settings.ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged)
|
ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged)
|
||||||
self._onActiveExtruderChanged()
|
self._onActiveExtruderChanged()
|
||||||
|
|
||||||
settingsWithIntheritanceChanged = pyqtSignal()
|
settingsWithIntheritanceChanged = pyqtSignal()
|
||||||
|
@ -44,7 +48,7 @@ class SettingInheritanceManager(QObject):
|
||||||
multi_extrusion = self._global_container_stack.getProperty("machine_extruder_count", "value") > 1
|
multi_extrusion = self._global_container_stack.getProperty("machine_extruder_count", "value") > 1
|
||||||
if not multi_extrusion:
|
if not multi_extrusion:
|
||||||
return self._settings_with_inheritance_warning
|
return self._settings_with_inheritance_warning
|
||||||
extruder = cura.Settings.ExtruderManager.getInstance().getExtruderStack(extruder_index)
|
extruder = ExtruderManager.getInstance().getExtruderStack(extruder_index)
|
||||||
if not extruder:
|
if not extruder:
|
||||||
Logger.log("w", "Unable to find extruder for current machine with index %s", extruder_index)
|
Logger.log("w", "Unable to find extruder for current machine with index %s", extruder_index)
|
||||||
return []
|
return []
|
||||||
|
@ -70,7 +74,7 @@ class SettingInheritanceManager(QObject):
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
def _onActiveExtruderChanged(self):
|
def _onActiveExtruderChanged(self):
|
||||||
new_active_stack = cura.Settings.ExtruderManager.getInstance().getActiveExtruderStack()
|
new_active_stack = ExtruderManager.getInstance().getActiveExtruderStack()
|
||||||
if not new_active_stack:
|
if not new_active_stack:
|
||||||
new_active_stack = self._global_container_stack
|
new_active_stack = self._global_container_stack
|
||||||
|
|
||||||
|
@ -136,14 +140,14 @@ class SettingInheritanceManager(QObject):
|
||||||
return self._settings_with_inheritance_warning
|
return self._settings_with_inheritance_warning
|
||||||
|
|
||||||
## Check if a setting has an inheritance function that is overwritten
|
## Check if a setting has an inheritance function that is overwritten
|
||||||
def _settingIsOverwritingInheritance(self, key, stack = None):
|
def _settingIsOverwritingInheritance(self, key: str, stack: ContainerStack = None) -> bool:
|
||||||
has_setting_function = False
|
has_setting_function = False
|
||||||
if not stack:
|
if not stack:
|
||||||
stack = self._active_container_stack
|
stack = self._active_container_stack
|
||||||
containers = []
|
containers = []
|
||||||
|
|
||||||
## Check if the setting has a user state. If not, it is never overwritten.
|
## Check if the setting has a user state. If not, it is never overwritten.
|
||||||
has_user_state = stack.getProperty(key, "state") == UM.Settings.InstanceState.User
|
has_user_state = stack.getProperty(key, "state") == InstanceState.User
|
||||||
if not has_user_state:
|
if not has_user_state:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -152,7 +156,7 @@ class SettingInheritanceManager(QObject):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
## Also check if the top container is not a setting function (this happens if the inheritance is restored).
|
## Also check if the top container is not a setting function (this happens if the inheritance is restored).
|
||||||
if isinstance(stack.getTop().getProperty(key, "value"), UM.Settings.SettingFunction):
|
if isinstance(stack.getTop().getProperty(key, "value"), SettingFunction):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
## Mash all containers for all the stacks together.
|
## Mash all containers for all the stacks together.
|
||||||
|
@ -167,7 +171,7 @@ class SettingInheritanceManager(QObject):
|
||||||
continue
|
continue
|
||||||
if value is not None:
|
if value is not None:
|
||||||
# If a setting doesn't use any keys, it won't change it's value, so treat it as if it's a fixed value
|
# If a setting doesn't use any keys, it won't change it's value, so treat it as if it's a fixed value
|
||||||
has_setting_function = isinstance(value, UM.Settings.SettingFunction) and len(value.getUsedSettingKeys()) > 0
|
has_setting_function = isinstance(value, SettingFunction) and len(value.getUsedSettingKeys()) > 0
|
||||||
if has_setting_function is False:
|
if has_setting_function is False:
|
||||||
has_non_function_value = True
|
has_non_function_value = True
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -10,10 +10,10 @@ from UM.Settings.InstanceContainer import InstanceContainer
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
import UM.Logger
|
import UM.Logger
|
||||||
|
|
||||||
import cura.Settings
|
|
||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
|
||||||
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
|
|
||||||
## A decorator that adds a container stack to a Node. This stack should be queried for all settings regarding
|
## A decorator that adds a container stack to a Node. This stack should be queried for all settings regarding
|
||||||
# the linked node. The Stack in question will refer to the global stack (so that settings that are not defined by
|
# the linked node. The Stack in question will refer to the global stack (so that settings that are not defined by
|
||||||
# this stack still resolve.
|
# this stack still resolve.
|
||||||
|
@ -29,8 +29,8 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
||||||
self._instance = InstanceContainer(container_id = "SettingOverrideInstanceContainer")
|
self._instance = InstanceContainer(container_id = "SettingOverrideInstanceContainer")
|
||||||
self._stack.addContainer(self._instance)
|
self._stack.addContainer(self._instance)
|
||||||
|
|
||||||
if cura.Settings.ExtruderManager.getInstance().extruderCount > 1:
|
if ExtruderManager.getInstance().extruderCount > 1:
|
||||||
self._extruder_stack = cura.Settings.ExtruderManager.getInstance().getExtruderStack(0).getId()
|
self._extruder_stack = ExtruderManager.getInstance().getExtruderStack(0).getId()
|
||||||
else:
|
else:
|
||||||
self._extruder_stack = None
|
self._extruder_stack = None
|
||||||
|
|
||||||
|
|
|
@ -55,5 +55,8 @@ if Platform.isWindows() and hasattr(sys, "frozen"):
|
||||||
sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w")
|
sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w")
|
||||||
sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w")
|
sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w")
|
||||||
|
|
||||||
|
# Force an instance of CuraContainerRegistry to be created and reused later.
|
||||||
|
cura.Settings.CuraContainerRegistry.CuraContainerRegistry.getInstance()
|
||||||
|
|
||||||
app = cura.CuraApplication.CuraApplication.getInstance()
|
app = cura.CuraApplication.CuraApplication.getInstance()
|
||||||
app.run()
|
app.run()
|
||||||
|
|
|
@ -8,7 +8,6 @@ from UM.Math.Matrix import Matrix
|
||||||
from UM.Math.Vector import Vector
|
from UM.Math.Vector import Vector
|
||||||
from UM.Scene.SceneNode import SceneNode
|
from UM.Scene.SceneNode import SceneNode
|
||||||
from UM.Scene.GroupDecorator import GroupDecorator
|
from UM.Scene.GroupDecorator import GroupDecorator
|
||||||
import UM.Application
|
|
||||||
from UM.Job import Job
|
from UM.Job import Job
|
||||||
from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator
|
from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
@ -188,7 +187,7 @@ class ThreeMFReader(MeshReader):
|
||||||
transform = build_item.get("transform")
|
transform = build_item.get("transform")
|
||||||
if transform is not None:
|
if transform is not None:
|
||||||
build_item_node.setTransformation(self._createMatrixFromTransformationString(transform))
|
build_item_node.setTransformation(self._createMatrixFromTransformationString(transform))
|
||||||
global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
|
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
|
|
||||||
# Create a transformation Matrix to convert from 3mf worldspace into ours.
|
# Create a transformation Matrix to convert from 3mf worldspace into ours.
|
||||||
# First step: flip the y and z axis.
|
# First step: flip the y and z axis.
|
||||||
|
|
|
@ -13,12 +13,8 @@ from UM.Resources import Resources
|
||||||
from UM.Settings.Validator import ValidatorState #To find if a setting is in an error state. We can't slice then.
|
from UM.Settings.Validator import ValidatorState #To find if a setting is in an error state. We can't slice then.
|
||||||
from UM.Platform import Platform
|
from UM.Platform import Platform
|
||||||
|
|
||||||
import cura.Settings
|
|
||||||
|
|
||||||
from cura.OneAtATimeIterator import OneAtATimeIterator
|
|
||||||
from cura.Settings.ExtruderManager import ExtruderManager
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
from . import ProcessSlicedLayersJob
|
from . import ProcessSlicedLayersJob
|
||||||
from . import ProcessGCodeJob
|
|
||||||
from . import StartSliceJob
|
from . import StartSliceJob
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -82,7 +78,7 @@ class CuraEngineBackend(Backend):
|
||||||
self._onGlobalStackChanged()
|
self._onGlobalStackChanged()
|
||||||
|
|
||||||
self._active_extruder_stack = None
|
self._active_extruder_stack = None
|
||||||
cura.Settings.ExtruderManager.ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged)
|
ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged)
|
||||||
self._onActiveExtruderChanged()
|
self._onActiveExtruderChanged()
|
||||||
|
|
||||||
# When you update a setting and other settings get changed through inheritance, many propertyChanged signals are fired.
|
# When you update a setting and other settings get changed through inheritance, many propertyChanged signals are fired.
|
||||||
|
@ -484,7 +480,7 @@ class CuraEngineBackend(Backend):
|
||||||
if self._active_extruder_stack:
|
if self._active_extruder_stack:
|
||||||
self._active_extruder_stack.containersChanged.disconnect(self._onChanged)
|
self._active_extruder_stack.containersChanged.disconnect(self._onChanged)
|
||||||
|
|
||||||
self._active_extruder_stack = cura.Settings.ExtruderManager.ExtruderManager.getInstance().getActiveExtruderStack()
|
self._active_extruder_stack = ExtruderManager.getInstance().getActiveExtruderStack()
|
||||||
if self._active_extruder_stack:
|
if self._active_extruder_stack:
|
||||||
self._active_extruder_stack.containersChanged.connect(self._onChanged)
|
self._active_extruder_stack.containersChanged.connect(self._onChanged)
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,7 @@ from UM.Settings.Validator import ValidatorState
|
||||||
from UM.Settings.SettingRelation import RelationType
|
from UM.Settings.SettingRelation import RelationType
|
||||||
|
|
||||||
from cura.OneAtATimeIterator import OneAtATimeIterator
|
from cura.OneAtATimeIterator import OneAtATimeIterator
|
||||||
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
import cura.Settings
|
|
||||||
|
|
||||||
class StartJobResult(IntEnum):
|
class StartJobResult(IntEnum):
|
||||||
Finished = 1
|
Finished = 1
|
||||||
|
@ -84,7 +83,7 @@ class StartSliceJob(Job):
|
||||||
self.setResult(StartJobResult.BuildPlateError)
|
self.setResult(StartJobResult.BuildPlateError)
|
||||||
return
|
return
|
||||||
|
|
||||||
for extruder_stack in cura.Settings.ExtruderManager.getInstance().getMachineExtruders(stack.getId()):
|
for extruder_stack in ExtruderManager.getInstance().getMachineExtruders(stack.getId()):
|
||||||
material = extruder_stack.findContainer({"type": "material"})
|
material = extruder_stack.findContainer({"type": "material"})
|
||||||
if material:
|
if material:
|
||||||
if material.getMetaDataEntry("compatible") == False:
|
if material.getMetaDataEntry("compatible") == False:
|
||||||
|
@ -149,7 +148,7 @@ class StartSliceJob(Job):
|
||||||
self._buildGlobalSettingsMessage(stack)
|
self._buildGlobalSettingsMessage(stack)
|
||||||
self._buildGlobalInheritsStackMessage(stack)
|
self._buildGlobalInheritsStackMessage(stack)
|
||||||
|
|
||||||
for extruder_stack in cura.Settings.ExtruderManager.getInstance().getMachineExtruders(stack.getId()):
|
for extruder_stack in ExtruderManager.getInstance().getMachineExtruders(stack.getId()):
|
||||||
self._buildExtruderMessage(extruder_stack)
|
self._buildExtruderMessage(extruder_stack)
|
||||||
|
|
||||||
for group in object_groups:
|
for group in object_groups:
|
||||||
|
|
|
@ -4,13 +4,10 @@
|
||||||
from UM.Mesh.MeshWriter import MeshWriter
|
from UM.Mesh.MeshWriter import MeshWriter
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
import UM.Settings.ContainerRegistry
|
|
||||||
|
|
||||||
from cura.CuraApplication import CuraApplication
|
|
||||||
from cura.Settings.ExtruderManager import ExtruderManager
|
|
||||||
|
|
||||||
from UM.Settings.InstanceContainer import InstanceContainer
|
from UM.Settings.InstanceContainer import InstanceContainer
|
||||||
|
|
||||||
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
|
|
||||||
import re #For escaping characters in the settings.
|
import re #For escaping characters in the settings.
|
||||||
import json
|
import json
|
||||||
import copy
|
import copy
|
||||||
|
|
|
@ -4,13 +4,15 @@
|
||||||
from PyQt5.QtCore import pyqtSlot
|
from PyQt5.QtCore import pyqtSlot
|
||||||
|
|
||||||
from cura.MachineAction import MachineAction
|
from cura.MachineAction import MachineAction
|
||||||
import cura.Settings.CuraContainerRegistry
|
|
||||||
|
|
||||||
import UM.Application
|
from UM.Application import Application
|
||||||
import UM.Settings.InstanceContainer
|
from UM.Settings.InstanceContainer import InstanceContainer
|
||||||
import UM.Settings.DefinitionContainer
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
|
from UM.Settings.DefinitionContainer import DefinitionContainer
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
|
|
||||||
|
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
||||||
|
|
||||||
import UM.i18n
|
import UM.i18n
|
||||||
catalog = UM.i18n.i18nCatalog("cura")
|
catalog = UM.i18n.i18nCatalog("cura")
|
||||||
|
|
||||||
|
@ -19,10 +21,10 @@ class MachineSettingsAction(MachineAction):
|
||||||
super().__init__("MachineSettingsAction", catalog.i18nc("@action", "Machine Settings"))
|
super().__init__("MachineSettingsAction", catalog.i18nc("@action", "Machine Settings"))
|
||||||
self._qml_url = "MachineSettingsAction.qml"
|
self._qml_url = "MachineSettingsAction.qml"
|
||||||
|
|
||||||
cura.Settings.CuraContainerRegistry.CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
|
CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
|
||||||
|
|
||||||
def _reset(self):
|
def _reset(self):
|
||||||
global_container_stack = UM.Application.Application.getInstance().getGlobalContainerStack()
|
global_container_stack = Application.Application.getInstance().getGlobalContainerStack()
|
||||||
if global_container_stack:
|
if global_container_stack:
|
||||||
variant = global_container_stack.findContainer({"type": "variant"})
|
variant = global_container_stack.findContainer({"type": "variant"})
|
||||||
if variant and variant.getId() == "empty_variant":
|
if variant and variant.getId() == "empty_variant":
|
||||||
|
@ -31,10 +33,10 @@ class MachineSettingsAction(MachineAction):
|
||||||
|
|
||||||
def _createVariant(self, global_container_stack, variant_index):
|
def _createVariant(self, global_container_stack, variant_index):
|
||||||
# Create and switch to a variant to store the settings in
|
# Create and switch to a variant to store the settings in
|
||||||
new_variant = UM.Settings.InstanceContainer(global_container_stack.getName() + "_variant")
|
new_variant = InstanceContainer(global_container_stack.getName() + "_variant")
|
||||||
new_variant.addMetaDataEntry("type", "variant")
|
new_variant.addMetaDataEntry("type", "variant")
|
||||||
new_variant.setDefinition(global_container_stack.getBottom())
|
new_variant.setDefinition(global_container_stack.getBottom())
|
||||||
UM.Settings.ContainerRegistry.getInstance().addContainer(new_variant)
|
ContainerRegistry.getInstance().addContainer(new_variant)
|
||||||
global_container_stack.replaceContainer(variant_index, new_variant)
|
global_container_stack.replaceContainer(variant_index, new_variant)
|
||||||
|
|
||||||
def _onContainerAdded(self, container):
|
def _onContainerAdded(self, container):
|
||||||
|
@ -49,13 +51,13 @@ class MachineSettingsAction(MachineAction):
|
||||||
Logger.log("d", "Not attaching MachineSettingsAction to %s; Machines that use variants are not supported", container.getId())
|
Logger.log("d", "Not attaching MachineSettingsAction to %s; Machines that use variants are not supported", container.getId())
|
||||||
return
|
return
|
||||||
|
|
||||||
UM.Application.Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey())
|
Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey())
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def forceUpdate(self):
|
def forceUpdate(self):
|
||||||
# Force rebuilding the build volume by reloading the global container stack.
|
# Force rebuilding the build volume by reloading the global container stack.
|
||||||
# This is a bit of a hack, but it seems quick enough.
|
# This is a bit of a hack, but it seems quick enough.
|
||||||
UM.Application.Application.getInstance().globalContainerStackChanged.emit()
|
Application.getInstance().globalContainerStackChanged.emit()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def updateHasMaterialsMetadata(self):
|
def updateHasMaterialsMetadata(self):
|
||||||
|
@ -78,7 +80,7 @@ class MachineSettingsAction(MachineAction):
|
||||||
# Set the material container to a sane default
|
# Set the material container to a sane default
|
||||||
if material_container.getId() == "empty_material":
|
if material_container.getId() == "empty_material":
|
||||||
search_criteria = { "type": "material", "definition": "fdmprinter", "id": "*pla*" }
|
search_criteria = { "type": "material", "definition": "fdmprinter", "id": "*pla*" }
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
|
containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
|
||||||
if containers:
|
if containers:
|
||||||
global_container_stack.replaceContainer(material_index, containers[0])
|
global_container_stack.replaceContainer(material_index, containers[0])
|
||||||
else:
|
else:
|
||||||
|
@ -87,7 +89,7 @@ class MachineSettingsAction(MachineAction):
|
||||||
if "has_materials" in global_container_stack.getMetaData():
|
if "has_materials" in global_container_stack.getMetaData():
|
||||||
global_container_stack.removeMetaDataEntry("has_materials")
|
global_container_stack.removeMetaDataEntry("has_materials")
|
||||||
|
|
||||||
empty_material = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = "empty_material")[0]
|
empty_material = ContainerRegistry.getInstance().findInstanceContainers(id = "empty_material")[0]
|
||||||
global_container_stack.replaceContainer(material_index, empty_material)
|
global_container_stack.replaceContainer(material_index, empty_material)
|
||||||
|
|
||||||
UM.Application.getInstance().globalContainerStackChanged.emit()
|
Application.getInstance().globalContainerStackChanged.emit()
|
|
@ -4,6 +4,7 @@
|
||||||
from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal
|
from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal
|
||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
from UM.Settings.SettingInstance import SettingInstance
|
from UM.Settings.SettingInstance import SettingInstance
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
import UM.Settings.Models.SettingVisibilityHandler
|
import UM.Settings.Models.SettingVisibilityHandler
|
||||||
|
@ -72,7 +73,7 @@ class PerObjectSettingVisibilityHandler(UM.Settings.Models.SettingVisibilityHand
|
||||||
|
|
||||||
# Use the found stack number to get the right stack to copy the value from.
|
# Use the found stack number to get the right stack to copy the value from.
|
||||||
if stack_nr in ExtruderManager.getInstance().extruderIds:
|
if stack_nr in ExtruderManager.getInstance().extruderIds:
|
||||||
stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = ExtruderManager.getInstance().extruderIds[stack_nr])[0]
|
stack = ContainerRegistry.getInstance().findContainerStacks(id = ExtruderManager.getInstance().extruderIds[stack_nr])[0]
|
||||||
|
|
||||||
# Use the raw property to set the value (so the inheritance doesn't break)
|
# Use the raw property to set the value (so the inheritance doesn't break)
|
||||||
if stack is not None:
|
if stack is not None:
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
|
from UM.Settings.InstanceContainer import InstanceContainer
|
||||||
from cura.MachineAction import MachineAction
|
from cura.MachineAction import MachineAction
|
||||||
from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty
|
from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty
|
||||||
|
|
||||||
|
@ -5,8 +7,6 @@ from UM.i18n import i18nCatalog
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
import UM.Settings.InstanceContainer
|
|
||||||
|
|
||||||
class UMOUpgradeSelection(MachineAction):
|
class UMOUpgradeSelection(MachineAction):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("UMOUpgradeSelection", catalog.i18nc("@action", "Select upgrades"))
|
super().__init__("UMOUpgradeSelection", catalog.i18nc("@action", "Select upgrades"))
|
||||||
|
@ -37,9 +37,9 @@ class UMOUpgradeSelection(MachineAction):
|
||||||
|
|
||||||
def _createVariant(self, global_container_stack, variant_index):
|
def _createVariant(self, global_container_stack, variant_index):
|
||||||
# Create and switch to a variant to store the settings in
|
# Create and switch to a variant to store the settings in
|
||||||
new_variant = UM.Settings.InstanceContainer(global_container_stack.getName() + "_variant")
|
new_variant = InstanceContainer(global_container_stack.getName() + "_variant")
|
||||||
new_variant.addMetaDataEntry("type", "variant")
|
new_variant.addMetaDataEntry("type", "variant")
|
||||||
new_variant.setDefinition(global_container_stack.getBottom())
|
new_variant.setDefinition(global_container_stack.getBottom())
|
||||||
UM.Settings.ContainerRegistry.getInstance().addContainer(new_variant)
|
ContainerRegistry.getInstance().addContainer(new_variant)
|
||||||
global_container_stack.replaceContainer(variant_index, new_variant)
|
global_container_stack.replaceContainer(variant_index, new_variant)
|
||||||
return new_variant
|
return new_variant
|
|
@ -1,17 +1,18 @@
|
||||||
|
from UM.Application import Application
|
||||||
|
from UM.Settings.DefinitionContainer import DefinitionContainer
|
||||||
from cura.MachineAction import MachineAction
|
from cura.MachineAction import MachineAction
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
import cura.Settings.CuraContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
import UM.Settings.DefinitionContainer
|
|
||||||
catalog = i18nCatalog("cura")
|
|
||||||
|
|
||||||
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
class UpgradeFirmwareMachineAction(MachineAction):
|
class UpgradeFirmwareMachineAction(MachineAction):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("UpgradeFirmware", catalog.i18nc("@action", "Upgrade Firmware"))
|
super().__init__("UpgradeFirmware", catalog.i18nc("@action", "Upgrade Firmware"))
|
||||||
self._qml_url = "UpgradeFirmwareMachineAction.qml"
|
self._qml_url = "UpgradeFirmwareMachineAction.qml"
|
||||||
cura.Settings.CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
|
ContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
|
||||||
|
|
||||||
def _onContainerAdded(self, container):
|
def _onContainerAdded(self, container):
|
||||||
# Add this action as a supported action to all machine definitions
|
# Add this action as a supported action to all machine definitions
|
||||||
if isinstance(container, UM.Settings.DefinitionContainer) and container.getMetaDataEntry("type") == "machine" and container.getMetaDataEntry("supports_usb_connection"):
|
if isinstance(container, DefinitionContainer) and container.getMetaDataEntry("type") == "machine" and container.getMetaDataEntry("supports_usb_connection"):
|
||||||
UM.Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey())
|
Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey())
|
||||||
|
|
|
@ -28,7 +28,7 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
super().setReadOnly(read_only)
|
super().setReadOnly(read_only)
|
||||||
|
|
||||||
basefile = self.getMetaDataEntry("base_file", self._id) # if basefile is self.id, this is a basefile.
|
basefile = self.getMetaDataEntry("base_file", self._id) # if basefile is self.id, this is a basefile.
|
||||||
for container in UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile):
|
for container in ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile):
|
||||||
container._read_only = read_only # prevent loop instead of calling setReadOnly
|
container._read_only = read_only # prevent loop instead of calling setReadOnly
|
||||||
|
|
||||||
## Overridden from InstanceContainer
|
## Overridden from InstanceContainer
|
||||||
|
@ -44,7 +44,7 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
|
|
||||||
basefile = self.getMetaDataEntry("base_file", self._id) #if basefile is self.id, this is a basefile.
|
basefile = self.getMetaDataEntry("base_file", self._id) #if basefile is self.id, this is a basefile.
|
||||||
# Update all containers that share GUID and basefile
|
# Update all containers that share GUID and basefile
|
||||||
for container in UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile):
|
for container in ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile):
|
||||||
container.setMetaDataEntry(key, value)
|
container.setMetaDataEntry(key, value)
|
||||||
|
|
||||||
## Overridden from InstanceContainer, similar to setMetaDataEntry.
|
## Overridden from InstanceContainer, similar to setMetaDataEntry.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue