Merge branch '4.9'

This commit is contained in:
Remco Burema 2021-04-09 09:49:44 +02:00
commit e2135088b9
No known key found for this signature in database
GPG Key ID: 215C49431D43F98C
3 changed files with 19 additions and 5 deletions

View File

@ -58,6 +58,11 @@ class Account(QObject):
manualSyncEnabledChanged = pyqtSignal(bool)
updatePackagesEnabledChanged = pyqtSignal(bool)
CLIENT_SCOPES = "account.user.read drive.backup.read drive.backup.write packages.download " \
"packages.rating.read packages.rating.write connect.cluster.read connect.cluster.write " \
"library.project.read library.project.write cura.printjob.read cura.printjob.write " \
"cura.mesh.read cura.mesh.write"
def __init__(self, application: "CuraApplication", parent = None) -> None:
super().__init__(parent)
self._application = application
@ -79,10 +84,7 @@ class Account(QObject):
CALLBACK_PORT=self._callback_port,
CALLBACK_URL="http://localhost:{}/callback".format(self._callback_port),
CLIENT_ID="um----------------------------ultimaker_cura",
CLIENT_SCOPES="account.user.read drive.backup.read drive.backup.write packages.download "
"packages.rating.read packages.rating.write connect.cluster.read connect.cluster.write "
"library.project.read library.project.write cura.printjob.read cura.printjob.write "
"cura.mesh.read cura.mesh.write",
CLIENT_SCOPES=self.CLIENT_SCOPES,
AUTH_DATA_PREFERENCE_KEY="general/ultimaker_auth_data",
AUTH_SUCCESS_REDIRECT="{}/app/auth-success".format(self._oauth_root),
AUTH_FAILED_REDIRECT="{}/app/auth-error".format(self._oauth_root)

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()]

View File

@ -5,6 +5,8 @@ import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Controls 2.3 as NewControls
import UM 1.2 as UM
import Cura 1.0 as Cura
@ -96,7 +98,7 @@ UM.PreferencesPage
onTextChanged: definitionsModel.filter = {"i18n_label": "*" + text}
}
ComboBox
NewControls.ComboBox
{
id: visibilityPreset
width: 150 * screenScaleFactor
@ -104,6 +106,7 @@ UM.PreferencesPage
{
top: parent.top
right: parent.right
bottom: scrollView.top
}
model: settingVisibilityPresetsModel.items