7813: Add check for empty handle in gramplets

This commit is contained in:
Nick Hall 2014-10-17 23:05:57 +01:00
parent 457e7207c3
commit 294e053212
17 changed files with 552 additions and 328 deletions

View File

@ -104,7 +104,10 @@ class Ancestor(Gramplet):
def update_has_data(self):
active_handle = self.get_active('Person')
self.set_has_data(self.get_has_data(active_handle))
if active_handle:
self.set_has_data(self.get_has_data(active_handle))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Person')

View File

@ -89,16 +89,21 @@ class PersonAttributes(Attributes):
def update_has_data(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.model.clear()
if active:
self.display_attributes(active)
active_handle = self.get_active('Person')
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
if active:
self.display_attributes(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -112,16 +117,21 @@ class EventAttributes(Attributes):
def update_has_data(self):
active_handle = self.get_active('Event')
active = self.dbstate.db.get_event_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_event_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Event')
active = self.dbstate.db.get_event_from_handle(active_handle)
self.model.clear()
if active:
self.display_attributes(active)
active_handle = self.get_active('Event')
if active_handle:
active = self.dbstate.db.get_event_from_handle(active_handle)
if active:
self.display_attributes(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -135,16 +145,21 @@ class FamilyAttributes(Attributes):
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))
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Family')
active = self.dbstate.db.get_family_from_handle(active_handle)
self.model.clear()
if active:
self.display_attributes(active)
active_handle = self.get_active('Family')
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
if active:
self.display_attributes(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -158,16 +173,20 @@ class MediaAttributes(Attributes):
def update_has_data(self):
active_handle = self.get_active('Media')
active = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Media')
active = self.dbstate.db.get_object_from_handle(active_handle)
self.model.clear()
if active:
self.display_attributes(active)
if active_handle:
active = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.model.clear()
active_handle = self.get_active('Media')
if active_handle:
active = self.dbstate.db.get_object_from_handle(active_handle)
if active:
self.display_attributes(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)

View File

@ -105,8 +105,11 @@ class PersonChildren(Children):
def update_has_data(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def get_has_data(self, active_person):
"""
@ -200,8 +203,11 @@ class FamilyChildren(Children):
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))
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def get_has_data(self, active_family):
"""

View File

@ -279,18 +279,23 @@ class PersonCitations(Citations):
def update_has_data(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.model.clear()
self.callman.unregister_all()
if active:
self.callman.register_obj(active)
self.display_citations(active)
active_handle = self.get_active('Person')
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
if active:
self.callman.register_obj(active)
self.display_citations(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -351,18 +356,23 @@ class EventCitations(Citations):
def update_has_data(self):
active_handle = self.get_active('Event')
active = self.dbstate.db.get_event_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_event_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Event')
active = self.dbstate.db.get_event_from_handle(active_handle)
self.model.clear()
self.callman.unregister_all()
if active:
self.callman.register_obj(active)
self.display_citations(active)
active_handle = self.get_active('Event')
if active_handle:
active = self.dbstate.db.get_event_from_handle(active_handle)
if active:
self.callman.register_obj(active)
self.display_citations(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -394,18 +404,23 @@ class FamilyCitations(Citations):
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))
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Family')
active = self.dbstate.db.get_family_from_handle(active_handle)
self.model.clear()
self.callman.unregister_all()
if active:
self.callman.register_obj(active)
self.display_citations(active)
active_handle = self.get_active('Family')
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
if active:
self.callman.register_obj(active)
self.display_citations(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -450,18 +465,23 @@ class PlaceCitations(Citations):
def update_has_data(self):
active_handle = self.get_active('Place')
active = self.dbstate.db.get_place_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_place_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Place')
active = self.dbstate.db.get_place_from_handle(active_handle)
self.model.clear()
self.callman.unregister_all()
if active:
self.callman.register_obj(active)
self.display_citations(active)
active_handle = self.get_active('Place')
if active_handle:
active = self.dbstate.db.get_place_from_handle(active_handle)
if active:
self.callman.register_obj(active)
self.display_citations(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -493,18 +513,23 @@ class MediaCitations(Citations):
def update_has_data(self):
active_handle = self.get_active('Media')
active = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Media')
active = self.dbstate.db.get_object_from_handle(active_handle)
self.model.clear()
self.callman.unregister_all()
if active:
self.callman.register_obj(active)
self.display_citations(active)
active_handle = self.get_active('Media')
if active_handle:
active = self.dbstate.db.get_object_from_handle(active_handle)
if active:
self.callman.register_obj(active)
self.display_citations(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)

View File

@ -108,7 +108,10 @@ class Descendant(Gramplet):
def update_has_data(self):
active_handle = self.get_active('Person')
self.set_has_data(self.get_has_data(active_handle))
if active_handle:
self.set_has_data(self.get_has_data(active_handle))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Person')

View File

@ -168,8 +168,11 @@ class PersonEvents(Events):
def update_has_data(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def get_has_data(self, active_person):
"""
@ -234,8 +237,11 @@ class FamilyEvents(Events):
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))
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def get_has_data(self, active_family):
"""

View File

@ -96,16 +96,21 @@ class PersonGallery(Gallery):
def update_has_data(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.clear_images()
if active:
self.load_images(active)
active_handle = self.get_active('Person')
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
if active:
self.load_images(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -119,16 +124,21 @@ class FamilyGallery(Gallery):
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))
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
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)
active_handle = self.get_active('Family')
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
if active:
self.load_images(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -142,16 +152,21 @@ class EventGallery(Gallery):
def update_has_data(self):
active_handle = self.get_active('Event')
active = self.dbstate.db.get_event_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_event_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Event')
active = self.dbstate.db.get_event_from_handle(active_handle)
self.clear_images()
if active:
self.load_images(active)
active_handle = self.get_active('Event')
if active_handle:
active = self.dbstate.db.get_event_from_handle(active_handle)
if active:
self.load_images(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -165,16 +180,21 @@ class PlaceGallery(Gallery):
def update_has_data(self):
active_handle = self.get_active('Place')
active = self.dbstate.db.get_place_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_place_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Place')
active = self.dbstate.db.get_place_from_handle(active_handle)
self.clear_images()
if active:
self.load_images(active)
active_handle = self.get_active('Place')
if active_handle:
active = self.dbstate.db.get_place_from_handle(active_handle)
if active:
self.load_images(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -188,16 +208,21 @@ class SourceGallery(Gallery):
def update_has_data(self):
active_handle = self.get_active('Source')
active = self.dbstate.db.get_source_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_source_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Source')
active = self.dbstate.db.get_source_from_handle(active_handle)
self.clear_images()
if active:
self.load_images(active)
active_handle = self.get_active('Source')
if active_handle:
active = self.dbstate.db.get_source_from_handle(active_handle)
if active:
self.load_images(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
@ -211,16 +236,20 @@ class CitationGallery(Gallery):
def update_has_data(self):
active_handle = self.get_active('Citation')
active = self.dbstate.db.get_citation_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Citation')
active = self.dbstate.db.get_citation_from_handle(active_handle)
self.clear_images()
if active:
self.load_images(active)
if active_handle:
active = self.dbstate.db.get_citation_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_images()
active_handle = self.get_active('Citation')
if active_handle:
active = self.dbstate.db.get_citation_from_handle(active_handle)
if active:
self.load_images(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)

View File

@ -47,20 +47,26 @@ class MediaPreview(Gramplet):
def update_has_data(self):
active_handle = self.get_active('Media')
active_media = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(active_media is not None)
if active_handle:
active_media = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(active_media is not None)
else:
self.set_has_data(False)
def main(self):
active_handle = self.get_active('Media')
media = self.dbstate.db.get_object_from_handle(active_handle)
self.top.hide()
if media:
self.load_image(media)
self.set_has_data(True)
if active_handle:
media = self.dbstate.db.get_object_from_handle(active_handle)
self.top.hide()
if media:
self.load_image(media)
self.set_has_data(True)
else:
self.photo.set_image(None)
self.set_has_data(False)
self.top.show()
else:
self.photo.set_image(None)
self.set_has_data(False)
self.top.show()
def load_image(self, media):
"""

View File

@ -44,19 +44,24 @@ class MetadataViewer(Gramplet):
def main(self):
active_handle = self.get_active('Media')
media = self.dbstate.db.get_object_from_handle(active_handle)
if media:
full_path = media_path_full(self.dbstate.db, media.get_path())
has_data = self.view.display_exif_tags(full_path)
self.set_has_data(has_data)
if active_handle:
media = self.dbstate.db.get_object_from_handle(active_handle)
if media:
full_path = media_path_full(self.dbstate.db, media.get_path())
has_data = self.view.display_exif_tags(full_path)
self.set_has_data(has_data)
else:
self.set_has_data(False)
else:
self.set_has_data(False)
def update_has_data(self):
active_handle = self.get_active('Media')
active = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def get_has_data(self, media):
"""

View File

@ -143,16 +143,22 @@ class PersonNotes(Notes):
def update_has_data(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Person')
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
class EventNotes(Notes):
@ -165,16 +171,22 @@ class EventNotes(Notes):
def update_has_data(self):
active_handle = self.get_active('Event')
active = self.dbstate.db.get_event_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Event')
active = self.dbstate.db.get_event_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_event_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Event')
if active_handle:
active = self.dbstate.db.get_event_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
class FamilyNotes(Notes):
@ -187,16 +199,22 @@ class FamilyNotes(Notes):
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)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Family')
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
class PlaceNotes(Notes):
@ -209,16 +227,22 @@ class PlaceNotes(Notes):
def update_has_data(self):
active_handle = self.get_active('Place')
active = self.dbstate.db.get_place_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Place')
active = self.dbstate.db.get_place_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_place_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Place')
if active_handle:
active = self.dbstate.db.get_place_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
class SourceNotes(Notes):
@ -231,16 +255,22 @@ class SourceNotes(Notes):
def update_has_data(self):
active_handle = self.get_active('Source')
active = self.dbstate.db.get_source_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Source')
active = self.dbstate.db.get_source_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_source_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Source')
if active_handle:
active = self.dbstate.db.get_source_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
class CitationNotes(Notes):
@ -253,16 +283,22 @@ class CitationNotes(Notes):
def update_has_data(self):
active_handle = self.get_active('Citation')
active = self.dbstate.db.get_citation_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Citation')
active = self.dbstate.db.get_citation_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_citation_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Citation')
if active_handle:
active = self.dbstate.db.get_citation_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
class RepositoryNotes(Notes):
@ -275,16 +311,22 @@ class RepositoryNotes(Notes):
def update_has_data(self):
active_handle = self.get_active('Repository')
active = self.dbstate.db.get_repository_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Repository')
active = self.dbstate.db.get_repository_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_repository_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Repository')
if active_handle:
active = self.dbstate.db.get_repository_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
class MediaNotes(Notes):
@ -297,15 +339,20 @@ class MediaNotes(Notes):
def update_has_data(self):
active_handle = self.get_active('Media')
active = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Media')
active = self.dbstate.db.get_object_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.clear_text()
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Media')
if active_handle:
active = self.dbstate.db.get_object_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.set_has_data(False)

View File

@ -239,6 +239,8 @@ class PedigreeGramplet(Gramplet):
self._generations = {}
self.gui.buffer.set_text("")
active_handle = self.get_active('Person')
if active_handle is None:
return
active_person = self.dbstate.db.get_person_from_handle(active_handle)
#no wrap in Gramplet
self.no_wrap()

View File

@ -90,20 +90,26 @@ class PersonDetails(Gramplet):
def update_has_data(self):
active_handle = self.get_active('Person')
active_person = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(active_person is not None)
if active_handle:
active_person = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(active_person is not None)
else:
self.set_has_data(False)
def main(self): # return false finishes
self.display_empty()
active_handle = self.get_active('Person')
active_person = self.dbstate.db.get_person_from_handle(active_handle)
self.top.hide()
if active_person:
self.display_person(active_person)
self.set_has_data(True)
if active_handle:
active_person = self.dbstate.db.get_person_from_handle(active_handle)
self.top.hide()
if active_person:
self.display_person(active_person)
self.set_has_data(True)
else:
self.set_has_data(False)
self.top.show()
else:
self.display_empty()
self.set_has_data(False)
self.top.show()
def display_person(self, active_person):
"""

View File

@ -58,8 +58,11 @@ class PersonResidence(Gramplet):
def update_has_data(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def get_has_data(self, active_person):
"""
@ -74,12 +77,14 @@ class PersonResidence(Gramplet):
return False
def main(self): # return false finishes
active_handle = self.get_active('Person')
active_person = self.dbstate.db.get_person_from_handle(active_handle)
self.model.clear()
if active_person:
self.display_person(active_person)
active_handle = self.get_active('Person')
if active_handle:
active_person = self.dbstate.db.get_person_from_handle(active_handle)
if active_person:
self.display_person(active_person)
else:
self.set_has_data(False)
else:
self.set_has_data(False)

View File

@ -84,20 +84,26 @@ class PlaceDetails(Gramplet):
def update_has_data(self):
active_handle = self.get_active('Person')
active_person = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(active_person is not None)
if active_handle:
active_person = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(active_person is not None)
else:
self.set_has_data(False)
def main(self):
self.display_empty()
active_handle = self.get_active('Place')
place = self.dbstate.db.get_place_from_handle(active_handle)
self.top.hide()
if place:
self.display_place(place)
self.set_has_data(True)
if active_handle:
place = self.dbstate.db.get_place_from_handle(active_handle)
self.top.hide()
if place:
self.display_place(place)
self.set_has_data(True)
else:
self.set_has_data(False)
self.top.show()
else:
self.display_empty()
self.set_has_data(False)
self.top.show()
def display_place(self, place):
"""

View File

@ -63,6 +63,8 @@ class RelativesGramplet(Gramplet):
self.set_text("")
database = self.dbstate.db
active_handle = self.get_active('Person')
if not active_handle:
return
active_person = self.dbstate.db.get_person_from_handle(active_handle)
if not active_person:
return

View File

@ -78,21 +78,27 @@ class RepositoryDetails(Gramplet):
self.connect_signal('Repository', self.update)
def update_has_data(self):
active_handle = self.get_active('Person')
active_person = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(active_person is not None)
active_handle = self.get_active('Repository')
if active_handle:
repo = self.dbstate.db.get_repository_from_handle(active_handle)
self.set_has_data(repo is not None)
else:
self.set_has_data(False)
def main(self):
self.display_empty()
active_handle = self.get_active('Repository')
repo = self.dbstate.db.get_repository_from_handle(active_handle)
self.top.hide()
if repo:
self.display_repo(repo)
self.set_has_data(True)
if active_handle:
repo = self.dbstate.db.get_repository_from_handle(active_handle)
self.top.hide()
if repo:
self.display_repo(repo)
self.set_has_data(True)
else:
self.set_has_data(False)
self.top.show()
else:
self.display_empty()
self.set_has_data(False)
self.top.show()
def display_repo(self, repo):
"""

View File

@ -193,16 +193,22 @@ class PersonToDo(ToDo):
def update_has_data(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Person')
active = self.dbstate.db.get_person_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Person')
if active_handle:
active = self.dbstate.db.get_person_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
def created(self, handle):
@ -220,16 +226,22 @@ class EventToDo(ToDo):
def update_has_data(self):
active_handle = self.get_active('Event')
active = self.dbstate.db.get_event_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Event')
active = self.dbstate.db.get_event_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_event_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Event')
if active_handle:
active = self.dbstate.db.get_event_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
def created(self, handle):
@ -247,16 +259,22 @@ class FamilyToDo(ToDo):
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)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Family')
if active_handle:
active = self.dbstate.db.get_family_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
def created(self, handle):
@ -274,16 +292,22 @@ class PlaceToDo(ToDo):
def update_has_data(self):
active_handle = self.get_active('Place')
active = self.dbstate.db.get_place_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Place')
active = self.dbstate.db.get_place_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_place_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Place')
if active_handle:
active = self.dbstate.db.get_place_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
def created(self, handle):
@ -301,16 +325,22 @@ class SourceToDo(ToDo):
def update_has_data(self):
active_handle = self.get_active('Source')
active = self.dbstate.db.get_source_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Source')
active = self.dbstate.db.get_source_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_source_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Source')
if active_handle:
active = self.dbstate.db.get_source_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
def created(self, handle):
@ -328,16 +358,22 @@ class CitationToDo(ToDo):
def update_has_data(self):
active_handle = self.get_active('Citation')
active = self.dbstate.db.get_citation_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Citation')
active = self.dbstate.db.get_citation_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_citation_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Citation')
if active_handle:
active = self.dbstate.db.get_citation_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
def created(self, handle):
@ -355,16 +391,22 @@ class RepositoryToDo(ToDo):
def update_has_data(self):
active_handle = self.get_active('Repository')
active = self.dbstate.db.get_repository_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Repository')
active = self.dbstate.db.get_repository_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_repository_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Repository')
if active_handle:
active = self.dbstate.db.get_repository_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
def created(self, handle):
@ -382,16 +424,22 @@ class MediaToDo(ToDo):
def update_has_data(self):
active_handle = self.get_active('Media')
active = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
def main(self):
active_handle = self.get_active('Media')
active = self.dbstate.db.get_object_from_handle(active_handle)
if active:
self.get_notes(active)
if active_handle:
active = self.dbstate.db.get_object_from_handle(active_handle)
self.set_has_data(self.get_has_data(active))
else:
self.set_has_data(False)
def main(self):
self.clear_text()
active_handle = self.get_active('Media')
if active_handle:
active = self.dbstate.db.get_object_from_handle(active_handle)
if active:
self.get_notes(active)
else:
self.set_has_data(False)
else:
self.clear_text()
self.set_has_data(False)
def created(self, handle):