mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-08 22:31:48 +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:
|
def isLoggedIn(self) -> bool:
|
||||||
return self._logged_in
|
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:
|
def _onLoginStateChanged(self, logged_in: bool = False, error_message: Optional[str] = None) -> None:
|
||||||
if error_message:
|
if error_message:
|
||||||
if self._error_message:
|
if self._error_message:
|
||||||
|
@ -864,6 +864,7 @@ UM.MainWindow
|
|||||||
if(!visible)
|
if(!visible)
|
||||||
{
|
{
|
||||||
wizardDialog = null
|
wizardDialog = null
|
||||||
|
Cura.API.account.startSyncing()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -891,6 +892,7 @@ UM.MainWindow
|
|||||||
target: Cura.Actions.addMachine
|
target: Cura.Actions.addMachine
|
||||||
function onTriggered()
|
function onTriggered()
|
||||||
{
|
{
|
||||||
|
Cura.API.account.stopSyncing()
|
||||||
wizardDialog = addMachineDialogLoader.createObject()
|
wizardDialog = addMachineDialogLoader.createObject()
|
||||||
wizardDialog.show()
|
wizardDialog.show()
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ Control
|
|||||||
text = catalog.i18nc("@button", "Waiting for new printers")
|
text = catalog.i18nc("@button", "Waiting for new printers")
|
||||||
busy = true;
|
busy = true;
|
||||||
enabled = false;
|
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