From 10d25f81733ec68985be7f93b912fdb142bef0bf Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 27 Jan 2015 15:52:18 +0100 Subject: [PATCH] Added a cancel-button to FTW when no internet is available. Fixes bug 1410738 Fixes: https://launchpad.net/bugs/1410738 --- openlp/core/ui/firsttimeform.py | 13 +++++++++++++ openlp/core/ui/firsttimewizard.py | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 9c3b7bf09..8e5ab219f 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -268,9 +268,11 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties): self.web = 'http://openlp.org/files/frw/' self.cancel_button.clicked.connect(self.on_cancel_button_clicked) self.no_internet_finish_button.clicked.connect(self.on_no_internet_finish_button_clicked) + self.no_internet_cancel_button.clicked.connect(self.on_no_internet_cancel_button_clicked) self.currentIdChanged.connect(self.on_current_id_changed) Registry().register_function('config_screen_changed', self.update_screen_list_combo) self.no_internet_finish_button.setVisible(False) + self.no_internet_cancel_button.setVisible(False) # Check if this is a re-run of the wizard. self.has_run_wizard = Settings().value('core/has run wizard') check_directory_exists(os.path.join(gettempdir(), 'openlp')) @@ -327,6 +329,10 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties): self.next_button.setVisible(False) self.cancel_button.setVisible(False) self.no_internet_finish_button.setVisible(True) + if self.has_run_wizard: + self.no_internet_cancel_button.setVisible(False) + else: + self.no_internet_cancel_button.setVisible(True) elif page_id == FirstTimePage.Plugins: self.back_button.setVisible(False) elif page_id == FirstTimePage.Progress: @@ -372,6 +378,13 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties): Settings().setValue('core/has run wizard', True) self.close() + def on_no_internet_cancel_button_clicked(self): + """ + Process the triggering of the "Cancel" button on the No Internet page. + """ + self.was_cancelled = True + self.close() + def url_get_file(self, url, f_path): """" Download a file given a URL. The file is retrieved in chunks, giving the ability to cancel the download at any diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index 63695a09a..041cfc050 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -59,7 +59,8 @@ class UiFirstTimeWizard(object): first_time_wizard.resize(550, 386) first_time_wizard.setModal(True) first_time_wizard.setOptions(QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage | - QtGui.QWizard.NoBackButtonOnLastPage | QtGui.QWizard.HaveCustomButton1) + QtGui.QWizard.NoBackButtonOnLastPage | QtGui.QWizard.HaveCustomButton1 | + QtGui.QWizard.HaveCustomButton2) if is_macosx(): first_time_wizard.setPixmap(QtGui.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png')) @@ -69,6 +70,7 @@ class UiFirstTimeWizard(object): self.finish_button = self.button(QtGui.QWizard.FinishButton) self.no_internet_finish_button = self.button(QtGui.QWizard.CustomButton1) self.cancel_button = self.button(QtGui.QWizard.CancelButton) + self.no_internet_cancel_button = self.button(QtGui.QWizard.CustomButton2) self.next_button = self.button(QtGui.QWizard.NextButton) self.back_button = self.button(QtGui.QWizard.BackButton) add_welcome_page(first_time_wizard, ':/wizards/wizard_firsttime.bmp') @@ -271,3 +273,4 @@ class UiFirstTimeWizard(object): 'and OpenLP is configured.')) self.progress_label.setText(translate('OpenLP.FirstTimeWizard', 'Starting configuration process...')) first_time_wizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.FirstTimeWizard', 'Finish')) + first_time_wizard.setButtonText(QtGui.QWizard.CustomButton2, translate('OpenLP.FirstTimeWizard', 'Cancel'))