Fix duplicating a favourite material

The duplicate must also be favourite.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-27 16:45:50 +02:00
parent 1874a6453d
commit 957894b614
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276

View file

@ -86,7 +86,8 @@ class MaterialManagementModel(QObject):
root_material = root_materials[0] root_material = root_materials[0]
# Ensure that all settings are saved. # Ensure that all settings are saved.
cura.CuraApplication.CuraApplication.getInstance().saveSettings() application = cura.CuraApplication.CuraApplication.getInstance()
application.saveSettings()
# Create a new ID and container to hold the data. # Create a new ID and container to hold the data.
if new_base_id is None: if new_base_id is None:
@ -122,8 +123,9 @@ class MaterialManagementModel(QObject):
container_registry.addContainer(container_to_add) container_registry.addContainer(container_to_add)
# If the duplicated material was favorite then the new material should also be added to the favorites. # If the duplicated material was favorite then the new material should also be added to the favorites.
# TODO: Move favourites to here. favorites_set = set(application.getPreferences().getValue("cura/favorite_materials").split(";"))
#if material_node.base_file in self.getFavorites(): if material_node.base_file in favorites_set:
# self.addFavorite(new_base_id) favorites_set.add(new_base_id)
application.getPreferences().setValue("cura/favorite_materials", ";".join(favorites_set))
return new_base_id return new_base_id