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",