diff --git a/gramps/gui/editors/editfamily.py b/gramps/gui/editors/editfamily.py old mode 100644 new mode 100755 index 25e715786..3af1d6da0 --- a/gramps/gui/editors/editfamily.py +++ b/gramps/gui/editors/editfamily.py @@ -82,6 +82,9 @@ from gramps.gen.utils.id import create_id from gramps.gen.const import URL_MANUAL_SECT1 from ..dbguielement import DbGUIElement +from gramps.gen.utils.file import media_path_full +from gramps.gui.widgets import Photo + #------------------------------------------------------------------------- # # Constants @@ -589,6 +592,9 @@ class EditFamily(EditPrimary): self.mname = self.top.get_object('mname') self.fname = self.top.get_object('fname') + + self.mimg = self.top.get_object('mimg') + self.fimg = self.top.get_object('fimg') self.mbutton_index = self.top.get_object('mbutton_index') self.mbutton_add = self.top.get_object('mbutton_add') @@ -803,7 +809,7 @@ class EditFamily(EditPrimary): self.top.get_object('vbox').pack_start(notebook, True, True, 0) def update_father(self, handle): - self.load_parent(handle, self.fname, self.fbirth, self.fbirth_label, + self.load_parent(handle, self.fname, self.fimg, self.fbirth, self.fbirth_label, self.fdeath, self.fdeath_label, self.fbutton_index, self.fbutton_add, self.fbutton_del, self.fbutton_edit) @@ -813,7 +819,7 @@ class EditFamily(EditPrimary): self.on_drag_fatherdata_received) def update_mother(self, handle): - self.load_parent(handle, self.mname, self.mbirth, self.mbirth_label, + self.load_parent(handle, self.mname, self.mimg, self.mbirth, self.mbirth_label, self.mdeath, self.mdeath_label, self.mbutton_index, self.mbutton_add, self.mbutton_del, self.mbutton_edit) @@ -975,7 +981,7 @@ class EditFamily(EditPrimary): except WindowActiveError: pass - def load_parent(self, handle, name_obj, birth_obj, birth_label, death_obj, + def load_parent(self, handle, name_obj, img_obj, birth_obj, birth_label, death_obj, death_label, btn_index, btn_add, btn_del, btn_edit): # is a parent used here: is_used = handle is not None @@ -1006,6 +1012,9 @@ class EditFamily(EditPrimary): btn_add.hide() btn_del.show() btn_edit.show() + + if img_obj: + load_person_image(self, person, img_obj) else: name = "" birth = None @@ -1281,3 +1290,37 @@ def button_activated(event, mouse_button): return True else: return False + +def destroy_cb(widget, data): + """ + Callback for gtk_container_foreach + """ + widget.destroy() + +def load_person_image(self, person, photo_container): + """ + Load the primary image if it exists. + """ + photo = Photo(True) + photo.show() + + photo_container.foreach(destroy_cb, None) + photo_container.add(photo) + + media_list = person.get_media_list() + if media_list: + media_ref = media_list[0] + object_handle = media_ref.get_reference_handle() + obj = self.dbstate.db.get_media_from_handle(object_handle) + full_path = media_path_full(self.dbstate.db, obj.get_path()) + mime_type = obj.get_mime_type() + if mime_type and mime_type.startswith("image"): + photo.set_image(full_path, mime_type, media_ref.get_rectangle()) + photo.set_uistate(self.uistate, object_handle) + else: + photo.set_image(None) + photo.set_uistate(None, None) + else: + photo.set_image(None) + photo.set_uistate(None, None) + diff --git a/gramps/gui/glade/editfamily.glade b/gramps/gui/glade/editfamily.glade old mode 100644 new mode 100755 index a634982e5..a041584a9 --- a/gramps/gui/glade/editfamily.glade +++ b/gramps/gui/glade/editfamily.glade @@ -1,33 +1,33 @@ - + - False - dialog + False + dialog True - False + False vertical True - False - end + False + end _Cancel - False + False True - True - True - True - True - Abandon changes and close window - Abandon changes and close window - True + True + True + True + True + Abandon changes and close window + Abandon changes and close window + True False @@ -38,16 +38,16 @@ _OK - False + False True - True - True - True - True - True - Accept changes and close window - Accept changes and close window - True + True + True + True + True + True + Accept changes and close window + Accept changes and close window + True False @@ -58,17 +58,17 @@ _Help - False + False True - True - True - True - True + True + True + True + True False False - end + end 2 @@ -76,86 +76,87 @@ False True - end + end 0 True - False - False + False + False True - False - 6 + False + 6 vertical 4 True - False + False True - False - False + False + False + - 132 + 132 True - False - 6 - 6 - 12 + False + 6 + 6 + 12 True - False + False start - 6 + 6 Name: - 0 - 1 + 1 + 1 True - False + False start - 6 + 6 Birth: - 0 - 2 + 1 + 2 True - False + False start - 6 + 6 Death: - 0 - 3 + 1 + 3 True - False + False True - False + False start Father/partner1 @@ -170,16 +171,16 @@ - False + False True - True - True + True + True none True - False - gtk-index + False + gtk-index Selector @@ -202,16 +203,16 @@ - False + False True - True - True + True + True none True - False - list-add + False + list-add Add @@ -233,16 +234,16 @@ - False + False True - True - True + True + True none True - False - list-remove + False + list-remove Remove @@ -264,16 +265,16 @@ - False + False True - True - True + True + True none True - False - gtk-edit + False + gtk-edit Edition @@ -296,48 +297,71 @@ - 0 - 0 + 1 + 0 2 True - False + False start True - 1 - 2 + 2 + 2 True - False + False start True - 1 - 3 + 2 + 3 True - False + False start True end - 1 - 1 + 2 + 1 + + + True + False + + + 0 + 0 + 4 + + + + + + + + + + + + + + @@ -353,87 +377,88 @@ True - False - False + False + False + - 132 + 132 True - False - 6 - 6 - 12 + False + 6 + 6 + 12 True - False + False start - 6 + 6 Name: - 0 - 1 + 1 + 1 True - False + False start - 6 + 6 Birth: - 0 - 2 + 1 + 2 True - False + False start - 6 + 6 Death: - 0 - 3 + 1 + 3 True - False + False start True - 1 - 3 + 2 + 3 True - False + False start True - 1 - 2 + 2 + 2 True - False + False True - False + False start Mother/partner2 @@ -448,16 +473,16 @@ - False + False True - True - True + True + True none True - False - gtk-index + False + gtk-index Selector @@ -479,16 +504,16 @@ - False + False True - True - True + True + True none True - False - list-add + False + list-add Add @@ -510,19 +535,19 @@ - False + False True - True - True - True - Indicates if the record is private - Indicates if the record is private + True + True + True + Indicates if the record is private + Indicates if the record is private none True - False - dialog-password + False + dialog-password Privacy @@ -535,22 +560,22 @@ False False - end + end 3 - False + False True - True - True + True + True none True - False - list-remove + False + list-remove Remove @@ -572,16 +597,16 @@ - False + False True - True - True + True + True none True - False - gtk-edit + False + gtk-edit Edition @@ -604,24 +629,47 @@ - 0 - 0 + 1 + 0 2 True - False + False start True end - 1 - 1 + 2 + 1 + + + True + False + + + 0 + 0 + 4 + + + + + + + + + + + + + + @@ -639,16 +687,17 @@ + True - False - 6 - 6 - 12 + False + 6 + 6 + 12 True - False + False start Relationship Information @@ -656,24 +705,24 @@ - 0 - 0 + 0 + 0 4 True - False + False start - 6 + 6 _ID: - True - gid + True + gid - 0 - 1 + 0 + 1 @@ -686,67 +735,67 @@ 6 - 1 - 1 + 1 + 1 True - False + False start _Type: - True + True center - marriage_type + marriage_type - 2 - 1 + 2 + 1 True - False - The relationship type, eg 'Married' or 'Unmarried'. Use Events for more details. + False + The relationship type, eg 'Married' or 'Unmarried'. Use Events for more details. True - True + True - True - True + True + True - 3 - 1 + 3 + 1 True - False + False start - 6 + 6 _Tags: - True - tag_button + True + tag_button - 0 - 2 + 0 + 2 True - False + False True - False + False True @@ -757,11 +806,11 @@ - False + False True - True - True - Edit the tag list + True + True + Edit the tag list @@ -782,8 +831,8 @@ - 1 - 2 + 1 + 2 3