From 4a95564277395d8ec8ad9a7d4617b601ffcd7d15 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 15 Mar 2019 11:30:07 +0100 Subject: [PATCH] Only show Welcome-Pages when needed. [CURA-6057] --- cura/CuraApplication.py | 8 ++------ resources/qml/Cura.qml | 9 ++++++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index d02e630911..2b6546ba1e 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -245,8 +245,6 @@ class CuraApplication(QtApplication): self._update_platform_activity_timer = None - self._need_to_show_user_agreement = True - self._sidebar_custom_menu_items = [] # type: list # Keeps list of custom menu items for the side bar self._plugins_loaded = False @@ -530,8 +528,6 @@ class CuraApplication(QtApplication): preferences.addPreference("cura/expanded_brands", "") preferences.addPreference("cura/expanded_types", "") - self._need_to_show_user_agreement = not preferences.getValue("general/accepted_user_agreement") - for key in [ "dialog_load_path", # dialog_save_path is in LocalFileOutputDevicePlugin "dialog_profile_path", @@ -553,11 +549,11 @@ class CuraApplication(QtApplication): @pyqtProperty(bool) def needToShowUserAgreement(self) -> bool: - return self._need_to_show_user_agreement + return not self.getPreferences().getValue("general/accepted_user_agreement") @pyqtSlot(bool) def setNeedToShowUserAgreement(self, set_value = True) -> None: - self._need_to_show_user_agreement = set_value + self.getPreferences().setValue("general/accepted_user_agreement", not set_value) @pyqtSlot(str, str) def writeToLog(self, severity: str, message: str) -> None: diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 9d1a3e1201..72d3c77838 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -45,7 +45,7 @@ UM.MainWindow WelcomeDialog { id: welcomeDialog - visible: CuraApplication.needToShowUserAgreement + visible: true // True, so if somehow no preferences are found/loaded, it's shown anyway. } Rectangle @@ -83,6 +83,13 @@ UM.MainWindow // This has been fixed for QtQuick Controls 2 since the Shortcut item has a context property. Cura.Actions.parent = backgroundItem CuraApplication.purgeWindows() + + if (CuraApplication.needToShowUserAgreement) + { + welcomeDialog.visible = true; + welcomeDialog.currentStep = 0; + welcomeDialog.show(); + } } Item