Skip the Cloud page if the user is logged in

If the user goes through the welcome wizard, arrives at the login page,
logs in and then closes Cura, he/she will be logged in the next time.
In this case, he/she will go through the welcome page again but will
not see the sign in page at all.

CURA-7019
This commit is contained in:
Kostas Karmas 2020-04-21 11:23:42 +02:00
parent b4909e88ef
commit 1b1c006998

View file

@ -245,6 +245,7 @@ class WelcomePagesModel(ListModel):
}, },
{"id": "cloud", {"id": "cloud",
"page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"), "page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"),
"should_show_function": self.shouldShowCloudPage,
}, },
{"id": "add_network_or_local_printer", {"id": "add_network_or_local_printer",
"page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"), "page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"),
@ -286,6 +287,17 @@ class WelcomePagesModel(ListModel):
first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id) first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id)
return len([action for action in first_start_actions if action.needsUserInteraction()]) > 0 return len([action for action in first_start_actions if action.needsUserInteraction()]) > 0
def shouldShowCloudPage(self) -> bool:
"""
The cloud page should be shown only if the user is not logged in
:return: True if the user is not logged in, False if he/she is
"""
# Import CuraApplication locally or else it fails
from cura.CuraApplication import CuraApplication
api = CuraApplication.getInstance().getCuraAPI()
return not api.account.isLoggedIn
def addPage(self) -> None: def addPage(self) -> None:
pass pass