diff --git a/cura/API/Account.py b/cura/API/Account.py index 9864de1aaa..ef72d972c1 100644 --- a/cura/API/Account.py +++ b/cura/API/Account.py @@ -4,6 +4,7 @@ from typing import Optional, Dict, TYPE_CHECKING from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty +from UM.Logger import Logger from UM.Message import Message from UM.i18n import i18nCatalog from cura.OAuth2.AuthorizationService import AuthorizationService @@ -128,6 +129,12 @@ class Account(QObject): return None return user_profile.__dict__ + @pyqtSlot() + def sync(self) -> None: + """Checks for new cloud printers""" + + Logger.info("Starting account sync") + @pyqtSlot() def logout(self) -> None: if not self._logged_in: diff --git a/resources/qml/Account/UserOperations.qml b/resources/qml/Account/UserOperations.qml index 10a4119dfc..2bf570a995 100644 --- a/resources/qml/Account/UserOperations.qml +++ b/resources/qml/Account/UserOperations.qml @@ -13,6 +13,11 @@ Column spacing: UM.Theme.getSize("default_margin").height + SystemPalette + { + id: palette + } + Label { id: title @@ -24,6 +29,43 @@ Column color: UM.Theme.getColor("text") } + Row + { + width: childrenRect.width + height: childrenRect.height + anchors.horizontalCenter: parent.horizontalCenter + spacing: UM.Theme.getSize("narrow_margin").height + + + UM.RecolorImage + { + width: 20 * screenScaleFactor + height: width + + source: UM.Theme.getIcon("update") + color: palette.text + + } + + Label + { + id: accountSyncButton + text: catalog.i18nc("@button", "Check for account updates") + color: UM.Theme.getColor("secondary_button_text") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + + MouseArea + { + anchors.fill: parent + onClicked: Cura.API.account.sync() + hoverEnabled: true + onEntered: accountSyncButton.font.underline = true + onExited: accountSyncButton.font.underline = false + } + } + } + Cura.SecondaryButton { id: accountButton