Hide the splash screen when the backup dialog shows and when the exception form shows

This commit is contained in:
Raoul Snyman 2016-12-15 19:45:46 +02:00
parent 955fdc50ac
commit 47ab1ce1a7

View File

@ -129,21 +129,21 @@ class OpenLP(OpenLPMixin, QtWidgets.QApplication):
application_stylesheet += WIN_REPAIR_STYLESHEET application_stylesheet += WIN_REPAIR_STYLESHEET
if application_stylesheet: if application_stylesheet:
self.setStyleSheet(application_stylesheet) self.setStyleSheet(application_stylesheet)
show_splash = Settings().value('core/show splash') can_show_splash = Settings().value('core/show splash')
if show_splash: if can_show_splash:
self.splash = SplashScreen() self.splash = SplashScreen()
self.splash.show() self.splash.show()
# make sure Qt really display the splash screen # make sure Qt really display the splash screen
self.processEvents() self.processEvents()
# Check if OpenLP has been upgrade and if a backup of data should be created # Check if OpenLP has been upgrade and if a backup of data should be created
self.backup_on_upgrade(has_run_wizard) self.backup_on_upgrade(has_run_wizard, can_show_splash)
# start the main app window # start the main app window
self.main_window = MainWindow() self.main_window = MainWindow()
Registry().execute('bootstrap_initialise') Registry().execute('bootstrap_initialise')
Registry().execute('bootstrap_post_set_up') Registry().execute('bootstrap_post_set_up')
Registry().initialise = False Registry().initialise = False
self.main_window.show() self.main_window.show()
if show_splash: if can_show_splash:
# now kill the splashscreen # now kill the splashscreen
self.splash.finish(self.main_window) self.splash.finish(self.main_window)
log.debug('Splashscreen closed') log.debug('Splashscreen closed')
@ -224,13 +224,20 @@ class OpenLP(OpenLPMixin, QtWidgets.QApplication):
self.exception_form = ExceptionForm() self.exception_form = ExceptionForm()
self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback))) self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback)))
self.set_normal_cursor() self.set_normal_cursor()
is_splash_visible = False
if hasattr(self, 'splash') and self.splash.isVisible():
is_splash_visible = True
self.splash.hide()
self.exception_form.exec() self.exception_form.exec()
if is_splash_visible:
self.splash.show()
def backup_on_upgrade(self, has_run_wizard): def backup_on_upgrade(self, has_run_wizard, can_show_splash):
""" """
Check if OpenLP has been upgraded, and ask if a backup of data should be made Check if OpenLP has been upgraded, and ask if a backup of data should be made
:param has_run_wizard: OpenLP has been run before :param has_run_wizard: OpenLP has been run before
:param can_show_splash: Should OpenLP show the splash screen
""" """
data_version = Settings().value('core/application version') data_version = Settings().value('core/application version')
openlp_version = get_application_version()['version'] openlp_version = get_application_version()['version']
@ -239,6 +246,8 @@ class OpenLP(OpenLPMixin, QtWidgets.QApplication):
Settings().setValue('core/application version', openlp_version) Settings().setValue('core/application version', openlp_version)
# If data_version is different from the current version ask if we should backup the data folder # If data_version is different from the current version ask if we should backup the data folder
elif data_version != openlp_version: elif data_version != openlp_version:
if self.splash.isVisible():
self.splash.hide()
if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'), if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'),
translate('OpenLP', 'OpenLP has been upgraded, do you want to create\n' translate('OpenLP', 'OpenLP has been upgraded, do you want to create\n'
'a backup of the old data folder?'), 'a backup of the old data folder?'),
@ -261,6 +270,8 @@ class OpenLP(OpenLPMixin, QtWidgets.QApplication):
# Update the version in the settings # Update the version in the settings
Settings().setValue('core/application version', openlp_version) Settings().setValue('core/application version', openlp_version)
if can_show_splash:
self.splash.show()
def process_events(self): def process_events(self):
""" """