diff --git a/cura/API/Account.py b/cura/API/Account.py index 2651037e9e4..c6027acdb5f 100644 --- a/cura/API/Account.py +++ b/cura/API/Account.py @@ -190,6 +190,20 @@ def is_staging(self) -> bool: 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: diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 776417e15d7..678bf85c974 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -864,6 +864,7 @@ UM.MainWindow if(!visible) { wizardDialog = null + Cura.API.account.startSyncing() } } } @@ -891,6 +892,7 @@ UM.MainWindow target: Cura.Actions.addMachine function onTriggered() { + Cura.API.account.stopSyncing() wizardDialog = addMachineDialogLoader.createObject() wizardDialog.show() } diff --git a/resources/qml/WelcomePages/AddUltimakerPrinter.qml b/resources/qml/WelcomePages/AddUltimakerPrinter.qml index ff87a723302..0c9b7d4f7f5 100644 --- a/resources/qml/WelcomePages/AddUltimakerPrinter.qml +++ b/resources/qml/WelcomePages/AddUltimakerPrinter.qml @@ -133,7 +133,7 @@ Control text = catalog.i18nc("@button", "Waiting for new printers") busy = true; enabled = false; - Cura.API.account.login(); + Cura.API.account.isLoggedIn? Cura.API.account.sync():Cura.API.account.login(); } } }