From 77613086bf3e87305949d1b7bbed41b0e0b19fdb Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 4 Nov 2018 20:23:25 +0000 Subject: [PATCH] error message update --- openlp/core/lib/pluginmanager.py | 8 +++++--- openlp/core/state.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index d9078f7cf..c29f65fb5 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -174,14 +174,16 @@ class PluginManager(RegistryBase, LogMixin, RegistryProperties): except Exception: uninitialised_plugins.append(plugin.name.title()) self.log_exception('Unable to initialise plugin {plugin}'.format(plugin=plugin.name)) - display_text = None + display_text = '' if uninitialised_plugins: display_text = translate('OpenLP.PluginManager', 'Unable to initialise the following plugins:') + \ '\n\n'.join(uninitialised_plugins) + '\n\n' + error_text = State().get_text() + if error_text: + display_text = display_text + error_text + '\n' if display_text: - display_text = display_text + \ - translate('OpenLP.PluginManager', 'See the log file for more details') + display_text = display_text + translate('OpenLP.PluginManager', 'See the log file for more details') QtWidgets.QMessageBox.critical(None, UiStrings().Error, display_text, QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok)) diff --git a/openlp/core/state.py b/openlp/core/state.py index c5bd58236..38c30a6d0 100644 --- a/openlp/core/state.py +++ b/openlp/core/state.py @@ -102,6 +102,17 @@ class State(LogMixin): """ self.modules[name].text = text + def get_text(self): + """ + return an string of error text + :return: a string of text + """ + error_text = '' + for mod in self.modules: + if self.modules[mod].text: + error_text = error_text + self.modules[mod].text + '\n' + return error_text + def update_pre_conditions(self, name, status): """ Updates the preconditions state of a module @@ -151,6 +162,10 @@ class State(LogMixin): return self.modules[mod].pass_preconditions def list_plugins(self): + """ + Return a list of plugins + :return: an array of plugins + """ plugins = [] for mod in self.modules: if self.modules[mod].is_plugin: