mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 13:35:58 +08:00
Added function to save a single stack to file.
CURA-2279
This commit is contained in:
parent
edb1a143ea
commit
03c28537f2
@ -327,16 +327,18 @@ class CuraApplication(QtApplication):
|
||||
f.write(data)
|
||||
|
||||
for stack in ContainerRegistry.getInstance().findContainerStacks():
|
||||
if not stack.isDirty():
|
||||
continue
|
||||
self.saveStack(stack)
|
||||
|
||||
def saveStack(self, stack):
|
||||
if not stack.isDirty():
|
||||
return
|
||||
try:
|
||||
data = stack.serialize()
|
||||
except NotImplementedError:
|
||||
continue
|
||||
return
|
||||
except Exception:
|
||||
Logger.logException("e", "An exception occurred when serializing container %s", instance.getId())
|
||||
continue
|
||||
Logger.logException("e", "An exception occurred when serializing container %s", stack.getId())
|
||||
return
|
||||
|
||||
mime_type = ContainerRegistry.getMimeTypeForContainer(type(stack))
|
||||
file_name = urllib.parse.quote_plus(stack.getId()) + "." + mime_type.preferredSuffix
|
||||
|
Loading…
x
Reference in New Issue
Block a user