From 1b1c00699876ce6d96359be4595bc98ac722152c Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Tue, 21 Apr 2020 11:23:42 +0200 Subject: [PATCH] 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 --- cura/UI/WelcomePagesModel.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 429e8b2665..611e62cfd6 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -245,6 +245,7 @@ class WelcomePagesModel(ListModel): }, {"id": "cloud", "page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"), + "should_show_function": self.shouldShowCloudPage, }, {"id": "add_network_or_local_printer", "page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"), @@ -286,6 +287,17 @@ class WelcomePagesModel(ListModel): first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id) 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: pass