diff options
Diffstat (limited to 'cura/API/Account.py')
-rw-r--r-- | cura/API/Account.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cura/API/Account.py b/cura/API/Account.py index f922c89977..2d4b204333 100644 --- a/cura/API/Account.py +++ b/cura/API/Account.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from datetime import datetime -from typing import Optional, Dict, TYPE_CHECKING, Callable +from typing import Any, Optional, Dict, TYPE_CHECKING, Callable from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty, QTimer, Q_ENUMS @@ -46,6 +46,9 @@ class Account(QObject): loginStateChanged = pyqtSignal(bool) """Signal emitted when user logged in or out""" + additionalRightsChanged = pyqtSignal("QVariantMap") + """Signal emitted when a users additional rights change""" + accessTokenChanged = pyqtSignal() syncRequested = pyqtSignal() """Sync services may connect to this signal to receive sync triggers. @@ -70,6 +73,7 @@ class Account(QObject): self._error_message = None # type: Optional[Message] self._logged_in = False + self._additional_rights: Dict[str, Any] = {} self._sync_state = SyncState.IDLE self._manual_sync_enabled = False self._update_packages_enabled = False @@ -301,3 +305,14 @@ class Account(QObject): return # Nothing to do, user isn't logged in. self._authorization_service.deleteAuthData() + + def updateAdditionalRight(self, **kwargs) -> None: + """Update the additional rights of the account. + The argument(s) are the rights that need to be set""" + self._additional_rights.update(kwargs) + self.additionalRightsChanged.emit(self._additional_rights) + + @pyqtProperty("QVariantMap", notify = additionalRightsChanged) + def additionalRights(self) -> Dict[str, Any]: + """A dictionary which can be queried for additional account rights.""" + return self._additional_rights |