error message update

This commit is contained in:
Tim Bentley 2018-11-04 20:23:25 +00:00
parent 0540453892
commit 77613086bf
2 changed files with 20 additions and 3 deletions

View File

@ -174,14 +174,16 @@ class PluginManager(RegistryBase, LogMixin, RegistryProperties):
except Exception: except Exception:
uninitialised_plugins.append(plugin.name.title()) uninitialised_plugins.append(plugin.name.title())
self.log_exception('Unable to initialise plugin {plugin}'.format(plugin=plugin.name)) self.log_exception('Unable to initialise plugin {plugin}'.format(plugin=plugin.name))
display_text = None display_text = ''
if uninitialised_plugins: if uninitialised_plugins:
display_text = translate('OpenLP.PluginManager', display_text = translate('OpenLP.PluginManager',
'Unable to initialise the following plugins:') + \ 'Unable to initialise the following plugins:') + \
'\n\n'.join(uninitialised_plugins) + '\n\n' '\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: if display_text:
display_text = display_text + \ display_text = display_text + translate('OpenLP.PluginManager', 'See the log file for more details')
translate('OpenLP.PluginManager', 'See the log file for more details')
QtWidgets.QMessageBox.critical(None, UiStrings().Error, display_text, QtWidgets.QMessageBox.critical(None, UiStrings().Error, display_text,
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok)) QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok))

View File

@ -102,6 +102,17 @@ class State(LogMixin):
""" """
self.modules[name].text = text 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): def update_pre_conditions(self, name, status):
""" """
Updates the preconditions state of a module Updates the preconditions state of a module
@ -151,6 +162,10 @@ class State(LogMixin):
return self.modules[mod].pass_preconditions return self.modules[mod].pass_preconditions
def list_plugins(self): def list_plugins(self):
"""
Return a list of plugins
:return: an array of plugins
"""
plugins = [] plugins = []
for mod in self.modules: for mod in self.modules:
if self.modules[mod].is_plugin: if self.modules[mod].is_plugin: