Merge pull request #18745 from Ultimaker/CURA-11465-addprinter-window-jumps-to-cloud-printer

Implement syncing feature for Ultimaker account
This commit is contained in:
HellAholic 2024-03-29 16:52:38 +01:00 committed by GitHub
commit a95418f072
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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:

View File

@ -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()
}

View File

@ -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();
}
}
}