diff options
author | Ghostkeeper <rubend@tutanota.com> | 2021-10-27 15:21:05 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2021-10-27 15:21:05 +0300 |
commit | 88d08b27d13bc6a0e005381ca75863292d59d707 (patch) | |
tree | c5da950b57293392dfa937b2bb2fa7cdc834e9f9 /cura/API | |
parent | 273e93314581c5d78ce3291167ebaaf3b8800128 (diff) | |
parent | 101056bca68c9f36630e0267867836ec88a6e912 (diff) |
Merge branch 'master' into CURA-8609_sync_materials_to_printer
Conflicts:
cura/Machines/Models/MaterialManagementModel.py -> On Master we had temporarily reverted the action of this button because it became apparent that the sync wasn't going to be in 4.12. That revert is no longer necessary if this is merged.
Diffstat (limited to 'cura/API')
-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 |