mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 13:34:01 -06:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
ceef6a003e
7 changed files with 22 additions and 34 deletions
|
@ -274,38 +274,18 @@ class MachineManagerModel(QObject):
|
|||
return containers[0].isReadOnly()
|
||||
|
||||
@pyqtSlot(result = str)
|
||||
def convertUserContainerToQuality(self):
|
||||
if not self._global_container_stack:
|
||||
def newQualityContainerFromQualityAndUser(self):
|
||||
new_container_id = self.duplicateContainer(self.activeQualityId)
|
||||
if new_container_id == "":
|
||||
return
|
||||
self.setActiveQuality(new_container_id)
|
||||
self.updateQualityContainerFromUserContainer()
|
||||
|
||||
new_quality_container = InstanceContainer("")
|
||||
name = self._createUniqueName("quality", "", self.activeQualityName, catalog.i18nc("@label", "Custom profile"))
|
||||
user_settings = self._global_container_stack.getTop()
|
||||
|
||||
## Copy all values
|
||||
new_quality_container.deserialize(user_settings.serialize())
|
||||
|
||||
## If the currently active machine does not have quality profiles of its own,
|
||||
# make the new quality profile available for all machines that don't have
|
||||
# unique quality profiles (including the current machine)
|
||||
if not self.filterQualityByMachine:
|
||||
new_quality_container.setDefinition(UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = "fdmprinter")[0])
|
||||
|
||||
## Change type / id / name
|
||||
new_quality_container.setMetaDataEntry("type", "quality")
|
||||
new_quality_container.setReadOnly(False)
|
||||
new_quality_container.setName(name)
|
||||
new_quality_container._id = name
|
||||
|
||||
UM.Settings.ContainerRegistry.getInstance().addContainer(new_quality_container)
|
||||
self.clearUserSettings() # As all users settings are now transfered to the new quality profile, remove them.
|
||||
self.setActiveQuality(name)
|
||||
return name
|
||||
|
||||
@pyqtSlot(str, result=str)
|
||||
def duplicateContainer(self, container_id):
|
||||
if not self._global_container_stack:
|
||||
return
|
||||
return ""
|
||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=container_id)
|
||||
if containers:
|
||||
new_name = self._createUniqueName("quality", "", containers[0].getName(), catalog.i18nc("@label", "Custom profile"))
|
||||
|
@ -364,7 +344,7 @@ class MachineManagerModel(QObject):
|
|||
|
||||
|
||||
@pyqtSlot()
|
||||
def updateUserContainerToQuality(self):
|
||||
def updateQualityContainerFromUserContainer(self):
|
||||
if not self._global_container_stack:
|
||||
return
|
||||
user_settings = self._global_container_stack.getTop()
|
||||
|
|
|
@ -8,6 +8,7 @@ from UM.Signal import Signal, signalemitter
|
|||
from UM.Settings.ContainerStack import ContainerStack
|
||||
from UM.Settings.InstanceContainer import InstanceContainer
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
import UM.Logger
|
||||
|
||||
from UM.Application import Application
|
||||
|
||||
|
@ -58,7 +59,11 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
|||
# kept up to date.
|
||||
def _updateNextStack(self):
|
||||
if self._extruder_stack:
|
||||
self._stack.setNextStack(ContainerRegistry.getInstance().findContainerStack(id = self._extruder_stack))
|
||||
extruder_stack = ContainerRegistry.getInstance().findContainerStacks(id = self._extruder_stack)
|
||||
if extruder_stack:
|
||||
self._stack.setNextStack(extruder_stack)
|
||||
else:
|
||||
UM.Logger.log("e", "Extruder stack %s below per-object settings does not exist.", self._extruder_stack)
|
||||
else:
|
||||
self._stack.setNextStack(Application.getInstance().getGlobalContainerStack())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue