Implement syncing feature for Ultimaker account

Updated account syncing functionality for logged-in and non-logged-in sessions in Ultimaker. More specifically, syncing is now engaged when the UI becomes visible and stopped when adding a machine action is triggered. The modifications also include fallback to login if the user is not logged in.

CURA-11465
This commit is contained in:
Saumya Jain 2024-03-27 16:42:45 +01:00
parent f89d4ddb4c
commit c3b0fa5bd3
3 changed files with 17 additions and 1 deletions

View file

@ -190,6 +190,20 @@ class Account(QObject):
def isLoggedIn(self) -> bool:
return self._logged_in
@pyqtSlot()
def stopSyncing(self) -> None:
Logger.debug(f"Stopping sync of cloud printers")
self._setManualSyncEnabled(True)
if self._update_timer.isActive():
self._update_timer.stop()
@pyqtSlot()
def startSyncing(self) -> None:
Logger.debug(f"Starting sync of cloud printers")
self._setManualSyncEnabled(False)
if not self._update_timer.isActive():
self._update_timer.start()
def _onLoginStateChanged(self, logged_in: bool = False, error_message: Optional[str] = None) -> None:
if error_message:
if self._error_message: