mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 05:53:59 -06:00
Exporting a profile now exports all profiles in a zipped container
CURA-2099
This commit is contained in:
parent
e7f2acfeab
commit
ced6cd7320
5 changed files with 42 additions and 22 deletions
|
@ -58,12 +58,10 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
|
||||
## Exports an profile to a file
|
||||
#
|
||||
# \param instance_id \type{str} the ID of the profile to export.
|
||||
# \param instance_ids \type{list} the IDs of the profiles to export.
|
||||
# \param file_name \type{str} the full path and filename to export to.
|
||||
# \param file_type \type{str} the file type with the format "<description> (*.<extension>)"
|
||||
def exportProfile(self, instance_id, file_name, file_type):
|
||||
Logger.log('d', 'exportProfile instance_id: '+str(instance_id))
|
||||
|
||||
def exportProfile(self, instance_ids, file_name, file_type):
|
||||
# Parse the fileType to deduce what plugin can save the file format.
|
||||
# fileType has the format "<description> (*.<extension>)"
|
||||
split = file_type.rfind(" (*.") # Find where the description ends and the extension starts.
|
||||
|
@ -82,16 +80,16 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
catalog.i18nc("@label", "The file <filename>{0}</filename> already exists. Are you sure you want to overwrite it?").format(file_name))
|
||||
if result == QMessageBox.No:
|
||||
return
|
||||
|
||||
containers = ContainerRegistry.getInstance().findInstanceContainers(id=instance_id)
|
||||
if not containers:
|
||||
return
|
||||
container = containers[0]
|
||||
found_containers = []
|
||||
for instance_id in instance_ids:
|
||||
containers = ContainerRegistry.getInstance().findInstanceContainers(id=instance_id)
|
||||
if containers:
|
||||
found_containers.append(containers[0])
|
||||
|
||||
profile_writer = self._findProfileWriter(extension, description)
|
||||
|
||||
try:
|
||||
success = profile_writer.write(file_name, container)
|
||||
success = profile_writer.write(file_name, found_containers)
|
||||
except Exception as e:
|
||||
Logger.log("e", "Failed to export profile to %s: %s", file_name, str(e))
|
||||
m = Message(catalog.i18nc("@info:status", "Failed to export profile to <filename>{0}</filename>: <message>{1}</message>", file_name, str(e)), lifetime = 0)
|
||||
|
|
|
@ -55,6 +55,13 @@ class ExtruderManager(QObject):
|
|||
map[position] = self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()][position].getId()
|
||||
return map
|
||||
|
||||
@pyqtSlot(str, result = str)
|
||||
def getQualityChangesIdByExtruderStackId(self, id):
|
||||
for position in self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()]:
|
||||
extruder = self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()][position]
|
||||
if extruder.getId() == id:
|
||||
return extruder.findContainer(type = "quality_changes").getId()
|
||||
|
||||
## The instance of the singleton pattern.
|
||||
#
|
||||
# It's None if the extruder manager hasn't been created yet.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue