From b71b4e9c7f1b28e3f948db9b11fe290d3f19c073 Mon Sep 17 00:00:00 2001 From: prculley Date: Tue, 20 Dec 2016 10:08:53 -0600 Subject: [PATCH] bug 9844; fix QuickReports for Cairo crash when no objects found --- gramps/plugins/quickview/ageondate.py | 3 ++- gramps/plugins/quickview/all_events.py | 18 ++++++++++++++---- gramps/plugins/quickview/attributematch.py | 5 ++++- gramps/plugins/quickview/reporef.py | 5 ++++- gramps/plugins/quickview/siblings.py | 5 ++++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/gramps/plugins/quickview/ageondate.py b/gramps/plugins/quickview/ageondate.py index 0121b3f55..003a5cb0a 100644 --- a/gramps/plugins/quickview/ageondate.py +++ b/gramps/plugins/quickview/ageondate.py @@ -81,7 +81,8 @@ def run(database, document, date): sdoc.paragraph(_("\nLiving matches: %(alive)d, " "Deceased matches: %(dead)d\n") % {'alive' : alive_matches, 'dead' : dead_matches}) - stab.write(sdoc) + if document.has_data: + stab.write(sdoc) sdoc.paragraph("") def get_event_date_from_ref(database, ref): diff --git a/gramps/plugins/quickview/all_events.py b/gramps/plugins/quickview/all_events.py index af4d1ba80..77defb644 100644 --- a/gramps/plugins/quickview/all_events.py +++ b/gramps/plugins/quickview/all_events.py @@ -64,7 +64,10 @@ def run(database, document, person): sdb.event_date_obj(event), sdb.event_place(event)) document.has_data = True - stab.write(sdoc) + if document.has_data: + stab.write(sdoc) + else: + sdoc.header1(_("Not found")) def run_fam(database, document, family): """ @@ -98,7 +101,8 @@ def run_fam(database, document, family): # display the results sdoc.title(_("Sorted events of family\n %(father)s - %(mother)s") % { - 'father' : sdb.name(sdb.father(family)), 'mother' : sdb.name(sdb.mother(family)) }) + 'father': sdb.name(sdb.father(family)), + 'mother': sdb.name(sdb.mother(family))}) sdoc.paragraph("") document.has_data = False @@ -110,7 +114,10 @@ def run_fam(database, document, family): sdb.event_date_obj(event), sdb.event_place(event)) document.has_data = True - stab.write(sdoc) + if document.has_data: + stab.write(sdoc) + else: + sdoc.header1(_("Not found\n")) stab = QuickTable(sdb) sdoc.header1(_("Personal events of the children")) @@ -121,4 +128,7 @@ def run_fam(database, document, family): sdb.event_date_obj(event), sdb.event_place(event)) document.has_data = True - stab.write(sdoc) + if document.has_data: + stab.write(sdoc) + else: + sdoc.header1(_("Not found\n")) diff --git a/gramps/plugins/quickview/attributematch.py b/gramps/plugins/quickview/attributematch.py index 3f7d24bfc..03f3a8c1e 100644 --- a/gramps/plugins/quickview/attributematch.py +++ b/gramps/plugins/quickview/attributematch.py @@ -44,4 +44,7 @@ def run(database, document, attribute, value=None): matches += 1 document.has_data = matches > 0 sdoc.paragraph(_("There are %d people with a matching attribute name.\n") % matches) - stab.write(sdoc) + if document.has_data: + stab.write(sdoc) + else: + sdoc.header1(_("Not found")) diff --git a/gramps/plugins/quickview/reporef.py b/gramps/plugins/quickview/reporef.py index eb98b0969..9a58e1e2c 100644 --- a/gramps/plugins/quickview/reporef.py +++ b/gramps/plugins/quickview/reporef.py @@ -77,4 +77,7 @@ def run(database, document, repo): stab.row(src.get_title(), media, call) document.has_data = True - stab.write(sdoc) + if document.has_data: + stab.write(sdoc) + else: + sdoc.header1(_("Not found")) diff --git a/gramps/plugins/quickview/siblings.py b/gramps/plugins/quickview/siblings.py index 7f416b74f..46ddbafe9 100644 --- a/gramps/plugins/quickview/siblings.py +++ b/gramps/plugins/quickview/siblings.py @@ -66,4 +66,7 @@ def run(database, document, person): sdb.birth_or_fallback(child), rel_str) document.has_data = True - stab.write(sdoc) + if document.has_data: + stab.write(sdoc) + else: + sdoc.header1(_("Not found\n"))