This makes for ugly g-code files, true, but at least the functionality of saving settings is useful now: It's traceable. Could've implemented this somewhere else too, but this is fine for now.
Contributes to issue CURA-1278.
The settings that are serialised at the end of the g-code are now the serialised global container stack. That's fairly useless since the serialised version of a container stack just lists the IDs of the containers in the stack, not the settings themselves. One of these containers is likely a current_profile container and that's all the information you'll get from that serialisation.
Contributes to issue CURA-1278.
Instead of escaping it each time you read a function with that ugly inline for loop, escape the characters when initialising the dict itself.
Contributes to issue CURA-34.
A serialised version of the settings are now appended to the g-code. It doesn't introduce line breaks yet, so the g-code may be invalid if the firmware doesn't handle lines longer than 80 characters.
Contributes to issue CURA-34.