Added missing function; allow failed plugin message to show

This commit is contained in:
Doug Blank 2015-05-16 02:15:02 -04:00
parent d3bd2b6692
commit 276052d231
2 changed files with 27 additions and 1 deletions

View File

@ -88,3 +88,24 @@ from .base import *
from .dbconst import *
from .txn import *
from .exceptions import *
def find_surname_name(key, data):
"""
Creating a surname from raw name, to use for sort and index
returns a byte string
"""
return __index_surname(data[5])
def __index_surname(surn_list):
"""
All non pa/matronymic surnames are used in indexing.
pa/matronymic not as they change for every generation!
returns a byte string
"""
from gramps.gen.lib import NameOriginType
if surn_list:
surn = " ".join([x[0] for x in surn_list if not (x[3][0] in [
NameOriginType.PATRONYMIC, NameOriginType.MATRONYMIC]) ])
else:
surn = ""
return surn

View File

@ -1591,6 +1591,11 @@ def run_plugin(pdata, dbstate, uistate):
mod = pmgr.load_plugin(pdata)
if not mod:
#import of plugin failed
failed = pmgr.get_fail_list()
if failed:
error_msg = failed[-1][1][1]
else:
error_msg = "(no error message)"
ErrorDialog(
_('Failed Loading Plugin'),
_('The plugin %(name)s did not load and reported an error.\n\n'
@ -1605,7 +1610,7 @@ def run_plugin(pdata, dbstate, uistate):
'gramps_bugtracker_url' : URL_BUGHOME,
'firstauthoremail': pdata.authors_email[0] if
pdata.authors_email else '...',
'error_msg': pmgr.get_fail_list()[-1][1][1]})
'error_msg': error_msg})
return
if pdata.ptype == REPORT: