mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 04:37:51 -06:00
Correctly load material favorites from preferences
Contributes to CURA-5378, CURA-5162
This commit is contained in:
parent
6d1fd8281c
commit
08b325ee04
2 changed files with 4 additions and 11 deletions
|
@ -501,7 +501,7 @@ class CuraApplication(QtApplication):
|
||||||
preferences.addPreference("view/filter_current_build_plate", False)
|
preferences.addPreference("view/filter_current_build_plate", False)
|
||||||
preferences.addPreference("cura/sidebar_collapsed", False)
|
preferences.addPreference("cura/sidebar_collapsed", False)
|
||||||
|
|
||||||
preferences.addPreference("cura/favorite_materials", [])
|
preferences.addPreference("cura/favorite_materials", ";".join([]))
|
||||||
|
|
||||||
self._need_to_show_user_agreement = not preferences.getValue("general/accepted_user_agreement")
|
self._need_to_show_user_agreement = not preferences.getValue("general/accepted_user_agreement")
|
||||||
|
|
||||||
|
|
|
@ -199,11 +199,8 @@ class MaterialManager(QObject):
|
||||||
self.materialsUpdated.emit()
|
self.materialsUpdated.emit()
|
||||||
|
|
||||||
favorites = self._application.getPreferences().getValue("cura/favorite_materials")
|
favorites = self._application.getPreferences().getValue("cura/favorite_materials")
|
||||||
print(favorites)
|
for item in favorites.split(";"):
|
||||||
for item in favorites:
|
|
||||||
print(item)
|
|
||||||
self._favorites.add(item)
|
self._favorites.add(item)
|
||||||
print("LOADED FAVES", self._favorites)
|
|
||||||
self.favoritesUpdated.emit()
|
self.favoritesUpdated.emit()
|
||||||
|
|
||||||
def __addMaterialMetadataIntoLookupTree(self, material_metadata: dict) -> None:
|
def __addMaterialMetadataIntoLookupTree(self, material_metadata: dict) -> None:
|
||||||
|
@ -623,24 +620,20 @@ class MaterialManager(QObject):
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def addFavorite(self, root_material_id: str):
|
def addFavorite(self, root_material_id: str):
|
||||||
print(root_material_id)
|
|
||||||
self._favorites.add(root_material_id)
|
self._favorites.add(root_material_id)
|
||||||
self.favoritesUpdated.emit()
|
self.favoritesUpdated.emit()
|
||||||
print(self._favorites)
|
|
||||||
print(list(self._favorites))
|
|
||||||
|
|
||||||
# Ensure all settings are saved.
|
# Ensure all settings are saved.
|
||||||
self._application.getPreferences().setValue("cura/favorite_materials", list(self._favorites))
|
self._application.getPreferences().setValue("cura/favorite_materials", ";".join(list(self._favorites)))
|
||||||
self._application.saveSettings()
|
self._application.saveSettings()
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def removeFavorite(self, root_material_id: str):
|
def removeFavorite(self, root_material_id: str):
|
||||||
self._favorites.remove(root_material_id)
|
self._favorites.remove(root_material_id)
|
||||||
self.favoritesUpdated.emit()
|
self.favoritesUpdated.emit()
|
||||||
print(self._favorites)
|
|
||||||
|
|
||||||
# Ensure all settings are saved.
|
# Ensure all settings are saved.
|
||||||
self._application.getPreferences().setValue("cura/favorite_materials", list(self._favorites))
|
self._application.getPreferences().setValue("cura/favorite_materials", ";".join(list(self._favorites)))
|
||||||
self._application.saveSettings()
|
self._application.saveSettings()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue