mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Do not try to write to read-only containers
Contributes to CURA-341
This commit is contained in:
parent
8476090ed2
commit
6e153414a4
1 changed files with 12 additions and 3 deletions
|
@ -18,6 +18,7 @@ class ContainerManager(QObject):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self._registry = UM.Settings.ContainerRegistry.getInstance()
|
self._registry = UM.Settings.ContainerRegistry.getInstance()
|
||||||
|
self._container_name_filters = {}
|
||||||
|
|
||||||
## Create a duplicate of the specified container
|
## Create a duplicate of the specified container
|
||||||
#
|
#
|
||||||
|
@ -89,7 +90,7 @@ class ContainerManager(QObject):
|
||||||
if not containers:
|
if not containers:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self._registry.removeContainer(containers[0])
|
self._registry.removeContainer(containers[0].getId())
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -135,6 +136,9 @@ class ContainerManager(QObject):
|
||||||
if not containers:
|
if not containers:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if containers[0].isReadOnly():
|
||||||
|
return False
|
||||||
|
|
||||||
containers[0].clear()
|
containers[0].clear()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -149,14 +153,19 @@ class ContainerManager(QObject):
|
||||||
# \param container_id \type{str} The ID of the container to change.
|
# \param container_id \type{str} The ID of the container to change.
|
||||||
# \param entry_name \type{str} The name of the metadata entry to change.
|
# \param entry_name \type{str} The name of the metadata entry to change.
|
||||||
# \param entry_value The new value of the entry.
|
# \param entry_value The new value of the entry.
|
||||||
@pyqtSlot(str, str, str)
|
#
|
||||||
|
# \return True if successful, False if not.
|
||||||
|
@pyqtSlot(str, str, str, result = bool)
|
||||||
def setContainerMetaDataEntry(self, container_id, entry_name, entry_value):
|
def setContainerMetaDataEntry(self, container_id, entry_name, entry_value):
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findContainers(None, id = container_id)
|
containers = UM.Settings.ContainerRegistry.getInstance().findContainers(None, id = container_id)
|
||||||
if not containers:
|
if not containers:
|
||||||
return
|
return False
|
||||||
|
|
||||||
container = containers[0]
|
container = containers[0]
|
||||||
|
|
||||||
|
if container.isReadOnly():
|
||||||
|
return False
|
||||||
|
|
||||||
entries = entry_name.split("/")
|
entries = entry_name.split("/")
|
||||||
entry_name = entries.pop()
|
entry_name = entries.pop()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue