The approximate diameter needs to be in a static field because the list model filters on that field. The filter function is not clever enough to be able to filter on values being in some kind of range or rounded, so instead the decision was made that the rounded value needs to be set in a separate field so that the static filter can filter on it.
Contributes to issue CURA-2822.
It doesn't give a problem right now since we're only iterating over lists of length 1 here, but in the future this could cause weird bugs.
Contributes to issue CURA-2822.
Properties is a dictionary inside the metadata dictionary. If you change one of the properties, it'll check afterwards if the dictionary is different from what it was before, but since the dictionary is passed by reference all the time, it'll think that the dictionary didn't change: The reference is still the same, so the thing it checks against is updated along.
This solution is a bit ugly but it does notice when the metadata changed inside the properties and then emits a change signal.
Contributes to issue CURA-2822.
This new model inherits from InstanceContainersModel. The only change is that it updates when the metadata of a material container changes. This is needed to make the list of materials update when the material diameter changes.
Contributes to issue CURA-2822.
There's one copy for every stack. It doesn't matter which one we take as long as they have the same name. Global is always present, even in single extrusion. Seems the most logical one to display.
Contributes to issue CURA-3935.
NB: previously the "approximate_diameter" metadata was stored as a number. This caused some issues passing arguments from QML to Python. Now "approximate_diameter" is stored as a string.
CURA-3881
CuraContainerRegistry._activeMaterialId() can return an empty string
if there is no active material, and in this case, importing a custom
quality file will fail.
* 2.6:
Error out when trying to import a profile witha quality_type we dont have
Add default for colour code of material
When trying to convert None to RGBA, log it and return a usable default
Rather than successfully importing the profile and then not showing
anything, we now display an error. Not the perfect solution but the
easiest for now.
Contributes to #1873
Another small bug I found when looking through this MachineManager code. My IDE was complaining that the preferred_material_name was not always initialised and that preferred_material was an unused variable.
Doesn't contribute to issue CURA-3803.