Add manual sync button (non-functional)

CURA-7290
This commit is contained in:
Nino van Hooff 2020-04-30 17:19:14 +02:00
parent 4fd5c6e337
commit 828e931f52
2 changed files with 49 additions and 0 deletions

View File

@ -4,6 +4,7 @@ from typing import Optional, Dict, TYPE_CHECKING
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty
from UM.Logger import Logger
from UM.Message import Message from UM.Message import Message
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from cura.OAuth2.AuthorizationService import AuthorizationService from cura.OAuth2.AuthorizationService import AuthorizationService
@ -128,6 +129,12 @@ class Account(QObject):
return None return None
return user_profile.__dict__ return user_profile.__dict__
@pyqtSlot()
def sync(self) -> None:
"""Checks for new cloud printers"""
Logger.info("Starting account sync")
@pyqtSlot() @pyqtSlot()
def logout(self) -> None: def logout(self) -> None:
if not self._logged_in: if not self._logged_in:

View File

@ -13,6 +13,11 @@ Column
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
SystemPalette
{
id: palette
}
Label Label
{ {
id: title id: title
@ -24,6 +29,43 @@ Column
color: UM.Theme.getColor("text") 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 Cura.SecondaryButton
{ {
id: accountButton id: accountButton