Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cura/API
diff options
context:
space:
mode:
authorKostas Karmas <konskarm@gmail.com>2020-05-26 10:49:58 +0300
committerKostas Karmas <konskarm@gmail.com>2020-05-26 10:49:58 +0300
commitfad02193abad63c80abc00e42c212f1bad35d831 (patch)
tree4134124ca462fae041c75a05377e4f60f779121c /cura/API
parent7388829fc10122625fbaf2fee4533b190a721f07 (diff)
Fix sync button not appearing when opening popup after clicking away
This was achieved by adding an IDLE state, which is the default state when opening the account management popup. The state is now reseted when the popup opens instead of when it closes. In addition, now either the "You are in sync with your account" label or the "Check account for updates" button will appear in the popup based on the state, not both. Finally, with theses changes, if the popup is open and an autosync occurs, the user will be informed that the account is synced and he/she will have to close and reopen the popup in order to trigger a manual update. CURA-7290
Diffstat (limited to 'cura/API')
-rw-r--r--cura/API/Account.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/cura/API/Account.py b/cura/API/Account.py
index 00afe9e528..06125d4819 100644
--- a/cura/API/Account.py
+++ b/cura/API/Account.py
@@ -23,6 +23,7 @@ class SyncState:
SYNCING = 0
SUCCESS = 1
ERROR = 2
+ IDLE = 3
## The account API provides a version-proof bridge to use Ultimaker Accounts
@@ -59,7 +60,7 @@ class Account(QObject):
self._error_message = None # type: Optional[Message]
self._logged_in = False
- self._sync_state = SyncState.SUCCESS
+ self._sync_state = SyncState.IDLE
self._manual_sync_enabled = False
self._last_sync_str = "-"
@@ -116,11 +117,13 @@ class Account(QObject):
if any(val == SyncState.SYNCING for val in self._sync_services.values()):
self._sync_state = SyncState.SYNCING
+ self._setManualSyncEnabled(False)
elif any(val == SyncState.ERROR for val in self._sync_services.values()):
self._sync_state = SyncState.ERROR
self._setManualSyncEnabled(True)
else:
self._sync_state = SyncState.SUCCESS
+ self._setManualSyncEnabled(False)
if self._sync_state != prev_state:
self.syncStateChanged.emit(self._sync_state)
@@ -238,8 +241,10 @@ class Account(QObject):
self._sync()
@pyqtSlot()
- def popupClosed(self) -> None:
+ def popupOpened(self) -> None:
self._setManualSyncEnabled(True)
+ self._sync_state = SyncState.IDLE
+ self.syncStateChanged.emit(self._sync_state)
@pyqtSlot()
def logout(self) -> None: