diff --git a/openlp/core/app.py b/openlp/core/app.py index 6656a2ba2..d81887016 100644 --- a/openlp/core/app.py +++ b/openlp/core/app.py @@ -106,10 +106,6 @@ class OpenLP(QtCore.QObject, LogMixin): else: QtCore.QCoreApplication.exit() sys.exit() - # Correct stylesheet bugs - application_stylesheet = get_application_stylesheet() - if application_stylesheet: - self.setStyleSheet(application_stylesheet) can_show_splash = Settings().value('core/show splash') if can_show_splash: self.splash = SplashScreen() @@ -122,6 +118,10 @@ class OpenLP(QtCore.QObject, LogMixin): loader() self.main_window = MainWindow() self.main_window.installEventFilter(self.main_window) + # Correct stylesheet bugs + application_stylesheet = get_application_stylesheet() + if application_stylesheet: + self.main_window.setStyleSheet(application_stylesheet) Registry().execute('bootstrap_initialise') State().flush_preconditions() Registry().execute('bootstrap_post_set_up') diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py index 3f4c8bfa7..1378d3c57 100644 --- a/openlp/core/display/window.py +++ b/openlp/core/display/window.py @@ -173,6 +173,14 @@ class DisplayWindow(QtWidgets.QWidget, RegistryProperties): if len(ScreenList()) > 1 or Settings().value('core/display on monitor'): self.show() + def deregister_display(self): + """ + De-register this displays callbacks in the registry to be able to remove it + """ + if self.is_display: + Registry().remove_function('live_display_hide', self.hide_display) + Registry().remove_function('live_display_show', self.show_display) + @property def is_initialised(self): return self._is_initialised diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index 31215a85b..fcfb66b36 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -100,7 +100,7 @@ class Ui_ExceptionDialog(object): 'Oops, OpenLP hit a problem and couldn\'t recover!

' 'You can help
the OpenLP developers to fix this' ' by
sending them a bug report to {email}{newlines}' - ).format(email=' bugs@openlp.org', + ).format(email=' bugs3@openlp.org', newlines='

')) self.message_label.setText( translate('OpenLP.ExceptionDialog', '{first_part}' diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 8cababc15..26ff0f76c 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -139,7 +139,7 @@ class ExceptionForm(QtWidgets.QDialog, Ui_ExceptionDialog, RegistryProperties): libs=content['libs'])) if self.file_attachment: mail_urlquery.addQueryItem('attach', self.file_attachment) - mail_to_url = QtCore.QUrl('mailto:bugs@openlp.org') + mail_to_url = QtCore.QUrl('mailto:bugs3@openlp.org') mail_to_url.setQuery(mail_urlquery) QtGui.QDesktopServices.openUrl(mail_to_url) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index fe8decfc4..dbb10222c 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -101,8 +101,9 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): Create and set up the first time wizard. """ super(FirstTimeForm, self).__init__(parent) - self.web_access = True + self.has_web_access = True self.web = '' + self.is_index_downloaded = False self.setup_ui(self) self.customButtonClicked.connect(self._on_custom_button_clicked) self.themes_list_widget.itemSelectionChanged.connect(self.on_themes_list_widget_selection_changed) @@ -132,7 +133,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): """ self.application.process_events() if self.currentId() == FirstTimePage.Download: - if not self.web_access: + if not self.has_web_access: return FirstTimePage.NoInternet else: return FirstTimePage.Songs @@ -164,11 +165,14 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): """ Download the configuration file and kick off the theme screenshot download threads """ + # Check if the index file has already been downloaded + if self.is_index_downloaded: + return # check to see if we have web access - self.web_access = False + self.has_web_access = False self.config = '' web_config = None - user_agent = 'OpenLP/' + Registry().get('application').applicationVersion() + user_agent = 'OpenLP/' + QtWidgets.QApplication.applicationVersion() self.application.process_events() try: web_config = get_web_page('{host}{name}'.format(host=self.web, name='download_3.0.json'), @@ -179,10 +183,11 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): 'to connect to retrieve initial configuration information'), QtWidgets.QMessageBox.Ok) if web_config and self._parse_config(web_config): - self.web_access = True + self.has_web_access = True self.application.process_events() self.downloading = translate('OpenLP.FirstTimeWizard', 'Downloading {name}...') self.application.set_normal_cursor() + self.is_index_downloaded = True def _parse_config(self, web_config): try: @@ -419,7 +424,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): 'download, so further downloads will be skipped. Try to re-run the ' 'First Time Wizard later.')) self.max_progress = 0 - self.web_access = None + self.has_web_access = None if self.max_progress: # Add on 2 for plugins status setting plus a "finished" point. self.max_progress += 2 @@ -465,7 +470,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): Run the tasks in the wizard. """ - if self.web_access: + if self.has_web_access: if not self._download_selected(): critical_error_message_box(translate('OpenLP.FirstTimeWizard', 'Download Error'), translate('OpenLP.FirstTimeWizard', 'There was a connection problem while ' diff --git a/openlp/core/ui/icons.py b/openlp/core/ui/icons.py index 57a0e590e..918ccf416 100644 --- a/openlp/core/ui/icons.py +++ b/openlp/core/ui/icons.py @@ -28,7 +28,9 @@ from PyQt5 import QtGui, QtWidgets from openlp.core.common import Singleton from openlp.core.common.applocation import AppLocation +from openlp.core.common.settings import Settings from openlp.core.lib import build_icon +from openlp.core.ui.style import HAS_DARK_STYLE log = logging.getLogger(__name__) @@ -164,6 +166,7 @@ class UiIcons(metaclass=Singleton): """ Load the list of icons to be processed """ + is_dark = (HAS_DARK_STYLE and Settings().value('advanced/use_dark_style')) for key in icon_list: try: icon = icon_list[key]['icon'] @@ -171,7 +174,10 @@ class UiIcons(metaclass=Singleton): attr = icon_list[key]['attr'] setattr(self, key, qta.icon(icon, color=attr)) except KeyError: - setattr(self, key, qta.icon(icon)) + if is_dark: + setattr(self, key, qta.icon(icon, color='white')) + else: + setattr(self, key, qta.icon(icon)) except Exception: import sys log.error('Unexpected error: %s' % sys.exc_info()) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 96fef9dd1..092d12e77 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -169,11 +169,16 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties): return if self.displays: # Delete any existing displays - del self.displays[:] + for display in self.displays: + display.deregister_display() + display.setParent(None) + del display + self.displays = [] for screen in self.screens: if screen.is_display: display = DisplayWindow(self, screen) self.displays.append(display) + self._reset_blank(False) if self.display: self.__add_actions_to_widget(self.display) diff --git a/resources/forms/exceptiondialog.ui b/resources/forms/exceptiondialog.ui index 9fd138092..df65565ba 100644 --- a/resources/forms/exceptiondialog.ui +++ b/resources/forms/exceptiondialog.ui @@ -126,7 +126,7 @@ - Oops! OpenLP hit a problem, and couldn't recover. The text in the box below contains information that might be helpful to the OpenLP developers, so please e-mail it to bugs@openlp.org, along with a detailed description of what you were doing when the problem occurred. + Oops! OpenLP hit a problem, and couldn't recover. The text in the box below contains information that might be helpful to the OpenLP developers, so please e-mail it to bugs3@openlp.org, along with a detailed description of what you were doing when the problem occurred. true diff --git a/tests/functional/openlp_core/test_app.py b/tests/functional/openlp_core/test_app.py index c59ae9063..556fc740c 100644 --- a/tests/functional/openlp_core/test_app.py +++ b/tests/functional/openlp_core/test_app.py @@ -220,16 +220,16 @@ def test_set_normal_cursor(mocked_restoreOverrideCursor, mocked_processEvents, q @patch('openlp.core.app.get_version') @patch('openlp.core.app.QtWidgets.QMessageBox.question') -def test_backup_on_upgrade_first_install(mocked_question, mocked_get_version, qapp): +def test_backup_on_upgrade_first_install(mocked_question, mocked_get_version, qapp, settings): """ Test that we don't try to backup on a new install """ # GIVEN: Mocked data version and OpenLP version which are the same old_install = False MOCKED_VERSION = { - 'full': '2.4.0-bzr000', + 'full': '2.4.0', 'version': '2.4.0', - 'build': 'bzr000' + 'build': None } Settings().setValue('core/application version', '2.4.0') mocked_get_version.return_value = MOCKED_VERSION @@ -245,18 +245,18 @@ def test_backup_on_upgrade_first_install(mocked_question, mocked_get_version, qa @patch('openlp.core.app.get_version') @patch('openlp.core.app.QtWidgets.QMessageBox.question') -def test_backup_on_upgrade(mocked_question, mocked_get_version, qapp): +def test_backup_on_upgrade(mocked_question, mocked_get_version, qapp, settings): """ Test that we try to backup on a new install """ # GIVEN: Mocked data version and OpenLP version which are different old_install = True MOCKED_VERSION = { - 'full': '2.4.0-bzr000', - 'version': '2.4.0', - 'build': 'bzr000' + 'full': '2.9.0.dev2963+97ba02d1f', + 'version': '2.9.0', + 'build': '97ba02d1f' } - Settings().setValue('core/application version', '2.0.5') + Settings().setValue('core/application version', '2.4.6') qapp.splash = MagicMock() qapp.splash.isVisible.return_value = True mocked_get_version.return_value = MOCKED_VERSION @@ -266,7 +266,7 @@ def test_backup_on_upgrade(mocked_question, mocked_get_version, qapp): qapp.backup_on_upgrade(old_install, True) # THEN: It should ask if we want to create a backup - assert Settings().value('core/application version') == '2.4.0', 'Version should be upgraded!' + assert Settings().value('core/application version') == '2.9.0', 'Version should be upgraded!' assert mocked_question.call_count == 1, 'A question should have been asked!' qapp.splash.hide.assert_called_once_with() qapp.splash.show.assert_called_once_with() diff --git a/tests/functional/openlp_core/ui/test_firsttimeform.py b/tests/functional/openlp_core/ui/test_firsttimeform.py index 1b89798c6..51fed03ca 100644 --- a/tests/functional/openlp_core/ui/test_firsttimeform.py +++ b/tests/functional/openlp_core/ui/test_firsttimeform.py @@ -121,7 +121,7 @@ class TestFirstTimeForm(TestCase, TestMixin): # THEN: The screens should be set up, and the default values initialised assert expected_screens == frw.screens, 'The screens should be correct' - assert frw.web_access is True, 'The default value of self.web_access should be True' + assert frw.has_web_access is True, 'The default value of self.web_access should be True' assert [] == frw.thumbnail_download_threads, 'The list of threads should be empty' assert frw.has_run_wizard is False, 'has_run_wizard should be False'