Merge branch 'master' into libArachne_rebased

This commit is contained in:
Remco Burema 2021-04-16 18:17:04 +02:00
commit f22e223d72
No known key found for this signature in database
GPG key ID: 215C49431D43F98C
46 changed files with 706 additions and 1957 deletions

View file

@ -4,8 +4,10 @@
import configparser
from typing import Tuple, List
import io
import json
from UM.VersionUpgrade import VersionUpgrade
from cura.API import Account
class VersionUpgrade48to49(VersionUpgrade):
@ -32,6 +34,13 @@ class VersionUpgrade48to49(VersionUpgrade):
if "categories_expanded" in parser["cura"] and any([setting in parser["cura"]["categories_expanded"] for setting in self._moved_visibility_settings]):
parser["cura"]["categories_expanded"] += ";top_bottom"
# If the account scope in 4.8 is outdated, delete it so that the user is enforced to log in again and get the
# correct permissions.
if "ultimaker_auth_data" in parser["general"]:
ultimaker_auth_data = json.loads(parser["general"]["ultimaker_auth_data"])
if set(Account.CLIENT_SCOPES.split(" ")) - set(ultimaker_auth_data["scope"].split(" ")):
parser["general"]["ultimaker_auth_data"] = "{}"
result = io.StringIO()
parser.write(result)
return [filename], [result.getvalue()]