diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 8ec47e9a9..be35045a9 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -115,7 +115,12 @@ def critical_error_message_box(title=None, message=None, parent=None, question=F return QtWidgets.QMessageBox.critical(parent, UiStrings().Error, message, QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)) - return Registry().get('main_window').error_message(title if title else UiStrings().Error, message) + # If used before the main window is created, fall back to direct use of QMessageBox + main_window = Registry().get('main_window') + if main_window: + return main_window.error_message(title if title else UiStrings().Error, message) + else: + QtWidgets.QMessageBox.critical(parent, title, message) def create_horizontal_adjusting_combo_box(parent, name): diff --git a/openlp/core/pages/background.py b/openlp/core/pages/background.py index e07df9d36..54b2e917c 100644 --- a/openlp/core/pages/background.py +++ b/openlp/core/pages/background.py @@ -150,7 +150,7 @@ class BackgroundPage(GridLayoutPage): self.stream_color_button.setObjectName('stream_color_button') self.layout.addWidget(self.stream_color_button, 7, 1) self.stream_widgets = [self.stream_label, self.stream_lineedit, self.device_stream_select_button, - self.stream_color_label, self.stream_color_button] + self.network_stream_select_button, self.stream_color_label, self.stream_color_button] # Force everything up self.layout_spacer = QtWidgets.QSpacerItem(1, 1) self.layout.addItem(self.layout_spacer, 8, 0, 1, 4) diff --git a/openlp/core/threading.py b/openlp/core/threading.py index b2e4d7579..df79414b6 100644 --- a/openlp/core/threading.py +++ b/openlp/core/threading.py @@ -67,7 +67,9 @@ def run_thread(worker, thread_name, can_start=True): thread.started.connect(worker.start) worker.quit.connect(thread.quit) worker.quit.connect(worker.deleteLater) - worker.error.connect(main_window.error_message) + # when used from the FTW the main window is not yet available + if main_window: + worker.error.connect(main_window.error_message) thread.finished.connect(thread.deleteLater) thread.finished.connect(make_remove_thread(thread_name)) if can_start: diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index bd855bc58..a0f49e877 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -219,10 +219,10 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): self.application.process_events() except Exception: log.exception('Unable to parse sample config file %s', web_config) - critical_error_message_box( - translate('OpenLP.FirstTimeWizard', 'Invalid index file'), - translate('OpenLP.FirstTimeWizard', 'OpenLP was unable to read the resource index file. ' - 'Please try again later.')) + QtWidgets.QMessageBox.critical(self, translate('OpenLP.FirstTimeWizard', 'Invalid index file'), + translate('OpenLP.FirstTimeWizard', + 'OpenLP was unable to read the resource index file. ' + 'Please try again later.')) return False return True diff --git a/openlp/plugins/songs/lib/importer.py b/openlp/plugins/songs/lib/importer.py index cbf6f27bc..12ff66768 100644 --- a/openlp/plugins/songs/lib/importer.py +++ b/openlp/plugins/songs/lib/importer.py @@ -289,7 +289,11 @@ class SongFormat(object): 'prefix': 'liveWorship', 'selectMode': SongFormatSelect.SingleFile, 'filter': '{text} (*.xml)'.format(text=translate('SongsPlugin.ImportWizardForm', - 'LiveWorship Database')) + 'LiveWorship Database')), + 'descriptionText': translate('SongsPlugin.ImportWizardForm', + 'First convert your LiveWorship database to an XML text file, as ' + 'explained in the User Manual.') }, Lyrix: { 'class': LyrixImport, diff --git a/tests/functional/openlp_core/ui/test_firsttimeform.py b/tests/functional/openlp_core/ui/test_firsttimeform.py index a5ad9d8b5..b8148772c 100644 --- a/tests/functional/openlp_core/ui/test_firsttimeform.py +++ b/tests/functional/openlp_core/ui/test_firsttimeform.py @@ -278,8 +278,8 @@ def test_on_custom_button_clicked_internet_settings(mocked_proxy_dialog): mocked_proxy_dialog().exec.assert_called_once() -@patch('openlp.core.ui.firsttimeform.critical_error_message_box') -def test__parse_config_invalid_config(mocked_critical_error_message_box): +@patch('openlp.core.ui.firsttimeform.QtWidgets.QMessageBox') +def test__parse_config_invalid_config(mocked_message_box): """ Test `FirstTimeForm._parse_config` when called with invalid data """ @@ -291,7 +291,9 @@ def test__parse_config_invalid_config(mocked_critical_error_message_box): # THEN: _parse_data should return False and the user should have should have been informed. assert result is False - mocked_critical_error_message_box.assert_called_once() + mocked_message_box.critical.assert_called_once_with( + first_time_form, 'Invalid index file', + 'OpenLP was unable to read the resource index file. Please try again later.') @patch('openlp.core.ui.firsttimeform.get_web_page')