Recently we changed the empty containers such that there is only one empty container instance and it doesn't have the proper type any more. Instead we have properties on the stack that allows us to find the container with the proper type. It's faster and easier to use.
We've had a few bugs about this so I decided to update all of them to remove those for the future, except the ones in plugins/MachineSettingsAction/MachineSettingsAction.py because we have a pending pull request that fixes those. Fixing them would give merge conflicts for fieldOfView.
It doesn't really belong to CURA-4024 but I'm sticking it under that nomer anyway to get it reviewed.
CURA-3975
GlobalStack has metadata type "machine", which is different from what is
registered in the VersionUpgradeManager "machine_stack". This commit
makes sure that Cura can find the correct upgrade route for the
GlobalStack files.
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