The material is no longer listed in the profiles and no longer filtered for, so we don't need to create a new profile for each material.
Contributes to issues CURA-844 and CURA-2320.
It is checked if the file data is None or empty (the upgrade is then considered 'failed'). But to unpack the file data, it needs to be a tuple.
Contributes to issue CURA-844.
The current settings in 2.1 specified a machine instance. In 2.2 they specify a machine definition. There is not enough information in one file to be able to translate that.
Contributes to issue CURA-844.
Custom profiles are always quality changes. They should always say quality in the original anyway; that was an assumption we've made thousands of times.
Contributes to issue CURA-844.
We don't know the actual quality type, the quality profile that this profile is based on. Maybe there isn't one, even. As a solution we always base imported custom quality profiles on normal.
Contributes to issue CURA-844.
Currently it sets the user profile to 'empty', which is bad because empty is read-only. But it allows me to continue for now. I'll find a solution for that later.
Contributes to issue CURA-844.
Turns out that copy.copy() doesn't work on ConfigParsers. It returns a different instance but modifying that instance still modifies the old configs. Deep copy isn't allowed. But this dictionary copy works.
Contributes to issue CURA-844.
If the old profile didn't specify any material, it would be global. But if the new machine specifies that its profiles are material-specific, these profiles have to be split into multiple profiles in order to be able to show them in Cura 2.2.
Contributes to issue CURA-844.
This was required since Cura 2.1 produced files with the same filename (bar extension). This then resulted in two containers with the same ID. If you had bad luck, an instance container was chosen as global container (depending on which was first in the unordered dictionary). This gives the current settings the postfix _current_settings, fixing that issue.
Contributes to issue CURA-844.
Why there is a difference between 'general' and 'metadata', only His Noodleness knows. Also put in a default for the type. It should apparently be 'quality' unless it is a user profile.
Contributes to issue CURA-844.
A translation dictionary makes it much easier to edit the translations. Also this now just translates one printer, instead of a list.
Contributes to issue CURA-844.
They no longer mention the version number in their function names. I'd rather have named them import/export but that gave a name clash with Python's 'import' keyword.
Contributes to issue CURA-844.