mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Added function to save a single stack to file.
CURA-2279
This commit is contained in:
parent
edb1a143ea
commit
03c28537f2
1 changed files with 23 additions and 21 deletions
|
@ -327,16 +327,18 @@ class CuraApplication(QtApplication):
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
|
||||||
for stack in ContainerRegistry.getInstance().findContainerStacks():
|
for stack in ContainerRegistry.getInstance().findContainerStacks():
|
||||||
if not stack.isDirty():
|
self.saveStack(stack)
|
||||||
continue
|
|
||||||
|
|
||||||
|
def saveStack(self, stack):
|
||||||
|
if not stack.isDirty():
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
data = stack.serialize()
|
data = stack.serialize()
|
||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
continue
|
return
|
||||||
except Exception:
|
except Exception:
|
||||||
Logger.logException("e", "An exception occurred when serializing container %s", instance.getId())
|
Logger.logException("e", "An exception occurred when serializing container %s", stack.getId())
|
||||||
continue
|
return
|
||||||
|
|
||||||
mime_type = ContainerRegistry.getMimeTypeForContainer(type(stack))
|
mime_type = ContainerRegistry.getMimeTypeForContainer(type(stack))
|
||||||
file_name = urllib.parse.quote_plus(stack.getId()) + "." + mime_type.preferredSuffix
|
file_name = urllib.parse.quote_plus(stack.getId()) + "." + mime_type.preferredSuffix
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue