Skip to content

Commit

Permalink
Merge pull request Ultimaker#18745 from Ultimaker/CURA-11465-addprint…
Browse files Browse the repository at this point in the history
…er-window-jumps-to-cloud-printer

Implement syncing feature for Ultimaker account
  • Loading branch information
HellAholic authored Mar 29, 2024
2 parents 16ce5c8 + 3e5edaa commit a95418f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions cura/API/Account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions resources/qml/Cura.qml
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ UM.MainWindow
if(!visible)
{
wizardDialog = null
Cura.API.account.startSyncing()
}
}
}
Expand Down Expand Up @@ -891,6 +892,7 @@ UM.MainWindow
target: Cura.Actions.addMachine
function onTriggered()
{
Cura.API.account.stopSyncing()
wizardDialog = addMachineDialogLoader.createObject()
wizardDialog.show()
}
Expand Down
2 changes: 1 addition & 1 deletion resources/qml/WelcomePages/AddUltimakerPrinter.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
Expand Down

0 comments on commit a95418f

Please sign in to comment.