We can reuse our duplicateMaterial function again but in a simpler way. Also finding the preferred material is simpler with our container tree.
However there seems to be a problem with finding the preferred material; it's not finding generic_pla for UM3 and AA0.4 anyway, and then falls back on a random material. This needs to be fixed in the variant node class.
Contributes to issue CURA-6600.
Just like MaterialManager used to be. There can be only one instance of the page then.
This prevents a crash when Qt deletes the QObject because it's no longer used in the page when you close the preferences screen. But when you open it again it doesn't construct a new one. Now there is always one instance so that's not a problem any more. Also it allows other pages to access this item.
Contributes to issue CURA-6600.
Just like the QualityManagementModel, this class is intended to be used as proxy for the material management page in the preferences. I'm intending to move all relevant pyqtSlots from the material manager into this one. The advantage of this switch is that the material manager had no well-bounded scope and so tended to become a big mess of all sorts of functions. This one has a clear scope: serve as a proxy for the buttons you can press in the preferences screen for materials.
Contributes to issue CURA-6600.
The onActiveMaterialChanged signal is triggered upon loading a material for the first time. This is hard to fix without breaking stuff, so we will revert this part.
This re-introduces a bug where if you change a material diameter such that the material disappears from the list, it is still selected and you can change its properties in the details panel.
Contributes to issue CURA-6679.
In this case, if the user was updating some information in one material
and then select other material, the new data is stored.
Contributes to CURA-5682.
When a material is selected, but the brand or the type is collapsed,
those components are also highlighted to indicate the path to the
material.
Reuse the MaterialBrandSection also for the generic materials, that
allow us to only mantain one component.
Contributes to CURA-5682.
the page.
Change all the previous references to the currentItem in the page.
Automatically and correctly select the element that is selected in the
extruder.
Contributes to CURA-5682.
Contributes to CURA-5682
- Active material is now expanded by default when opening the manager
- Expanded and collapsed sections are saved to preferences
- Sections are now highlighted when collapsed and having a selected material inside
- Bug with losing focus between fields is not yet fixed
Did this so that models can be updated more often fixing bugs where when a material is set as "not favorite" in the favorites section, its updated accordingly in its "normal" section.
It's also the ground work for saving material section expansion to preferences.
Contributes to CURA-5378
I was hoping to completely nix the generic materials model (since it's basically just a brand "Generic", but then in the QML it has to be have the same in terms of sub-menus or fold-outs and that looked stupid (Generic -> ABS -> ABS)). So we keep that one for now. It is cleaner though.
Contributes to CURA-5162, CURA-5378