59 lines
2.0 KiB
Diff
59 lines
2.0 KiB
Diff
84a85,87
|
|
> from gramps.gen.utils.file import media_path_full
|
|
> from gramps.gui.widgets import Photo
|
|
>
|
|
591a595,597
|
|
>
|
|
> self.mimg = self.top.get_object('mimg')
|
|
> self.fimg = self.top.get_object('fimg')
|
|
806c812
|
|
< self.load_parent(handle, self.fname, self.fbirth, self.fbirth_label,
|
|
---
|
|
> self.load_parent(handle, self.fname, self.fimg, self.fbirth, self.fbirth_label,
|
|
816c822
|
|
< self.load_parent(handle, self.mname, self.mbirth, self.mbirth_label,
|
|
---
|
|
> self.load_parent(handle, self.mname, self.mimg, self.mbirth, self.mbirth_label,
|
|
978c984
|
|
< 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,
|
|
1008a1015,1018
|
|
>
|
|
> if img_obj:
|
|
> load_person_image(self, person, img_obj)
|
|
>
|
|
1283a1294,1325
|
|
> 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)
|