mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-29 07:14:24 +08:00
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:
commit
a95418f072
@ -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:
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user