diff options
Diffstat (limited to 'cura/UI/WelcomePagesModel.py')
-rw-r--r-- | cura/UI/WelcomePagesModel.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index c16ec3763e..b816833d67 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -119,8 +119,10 @@ class WelcomePagesModel(ListModel): return next_page_index = idx + is_final_page = page_item.get("is_final_page") + # If we have reached the last page, emit allFinished signal and reset. - if next_page_index == len(self._items): + if next_page_index == len(self._items) or is_final_page: self.atEnd() return @@ -243,6 +245,10 @@ class WelcomePagesModel(ListModel): {"id": "data_collections", "page_url": self._getBuiltinWelcomePagePath("DataCollectionsContent.qml"), }, + {"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"), "next_page_id": "machine_actions", @@ -251,14 +257,15 @@ class WelcomePagesModel(ListModel): "page_url": self._getBuiltinWelcomePagePath("AddPrinterByIpContent.qml"), "next_page_id": "machine_actions", }, + {"id": "add_cloud_printers", + "page_url": self._getBuiltinWelcomePagePath("AddCloudPrintersView.qml"), + "is_final_page": True, # If we end up in this page, the next button will close the dialog + "next_page_button_text": self._catalog.i18nc("@action:button", "Finish"), + }, {"id": "machine_actions", "page_url": self._getBuiltinWelcomePagePath("FirstStartMachineActionsContent.qml"), - "next_page_id": "cloud", "should_show_function": self.shouldShowMachineActions, }, - {"id": "cloud", - "page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"), - }, ] pages_to_show = all_pages_list @@ -287,6 +294,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 |