From 455c5ef4a0688efaa370c9b75c1011d3ca1a4624 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Wed, 4 May 2011 23:00:30 +0000 Subject: [PATCH] Add family gallery bottombar gramplet svn: r17409 --- src/plugins/gramplet/Gallery.py | 24 ++++++++++++++++++++++++ src/plugins/gramplet/bottombar.gpr.py | 14 ++++++++++++++ src/plugins/view/familyview.py | 3 ++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/plugins/gramplet/Gallery.py b/src/plugins/gramplet/Gallery.py index 292853577..5f7619de5 100644 --- a/src/plugins/gramplet/Gallery.py +++ b/src/plugins/gramplet/Gallery.py @@ -110,6 +110,30 @@ class PersonGallery(Gallery): else: self.set_has_data(False) +class FamilyGallery(Gallery): + """ + Displays a gallery of media objects for a family. + """ + def db_changed(self): + self.dbstate.db.connect('family-update', self.update) + self.connect_signal('Family', self.update) + self.update() + + def update_has_data(self): + active_handle = self.get_active('Family') + active = self.dbstate.db.get_family_from_handle(active_handle) + self.set_has_data(self.get_has_data(active)) + + def main(self): + active_handle = self.get_active('Family') + active = self.dbstate.db.get_family_from_handle(active_handle) + + self.clear_images() + if active: + self.load_images(active) + else: + self.set_has_data(False) + class EventGallery(Gallery): """ Displays a gallery of media objects for an event. diff --git a/src/plugins/gramplet/bottombar.gpr.py b/src/plugins/gramplet/bottombar.gpr.py index 8ece414e2..ffd295db7 100644 --- a/src/plugins/gramplet/bottombar.gpr.py +++ b/src/plugins/gramplet/bottombar.gpr.py @@ -161,6 +161,20 @@ register(GRAMPLET, navtypes=["Person"], ) +register(GRAMPLET, + id="Family Gallery Gramplet", + name=_("Family Gallery Gramplet"), + description = _("Gramplet showing media objects for a family"), + version="1.0.0", + gramps_target_version="3.4", + status = STABLE, + fname="Gallery.py", + height=200, + gramplet = 'FamilyGallery', + gramplet_title=_("Gallery"), + navtypes=["Family"], + ) + register(GRAMPLET, id="Event Gallery Gramplet", name=_("Event Gallery Gramplet"), diff --git a/src/plugins/view/familyview.py b/src/plugins/view/familyview.py index 6650151f8..63190c400 100644 --- a/src/plugins/view/familyview.py +++ b/src/plugins/view/familyview.py @@ -345,7 +345,8 @@ class FamilyView(ListView): Define the default gramplets for the sidebar and bottombar. """ return (("Family Filter Gramplet",), - ("Family Events Gramplet", + ("Family Gallery Gramplet", + "Family Events Gramplet", "Family Children Gramplet", "Family Sources Gramplet", "Family Notes Gramplet",