Browse Source

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
Kostas Karmas 4 years ago
parent
commit
1b1c006998
1 changed files with 12 additions and 0 deletions
  1. 12 0
      cura/UI/WelcomePagesModel.py

+ 12 - 0
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