5472: Update gramplets when database changed so that they correctly show if they have data. Also remove superfluous updates.

svn: r18679
This commit is contained in:
Nick Hall 2012-01-01 17:58:33 +00:00
parent f6271eb127
commit 24976ab0a6
13 changed files with 3 additions and 42 deletions

View File

@ -67,9 +67,9 @@ class Gramplet(object):
self.gui.on_motion)
self.connect_signal('Person', self._active_changed)
self._db_changed(self.dbstate.db)
active_person = self.get_active('Person')
if active_person: # already changed
self._db_changed(self.dbstate.db)
self._active_changed(active_person)
self.post_init()
@ -284,6 +284,8 @@ class Gramplet(object):
if self.dbstate.open:
#print " %s is not active" % self.gui.gname
self.update_has_data()
else:
self.set_has_data(False)
return
#print " %s is UPDATING" % self.gui.gname
self.dirty = False

View File

@ -84,7 +84,6 @@ class PersonAttributes(Attributes):
"""
def db_changed(self):
self.dbstate.db.connect('person-update', self.update)
self.update()
def active_changed(self, handle):
self.update()
@ -111,7 +110,6 @@ class EventAttributes(Attributes):
def db_changed(self):
self.dbstate.db.connect('event-update', self.update)
self.connect_signal('Event', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Event')
@ -135,7 +133,6 @@ class FamilyAttributes(Attributes):
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')
@ -159,7 +156,6 @@ class MediaAttributes(Attributes):
def db_changed(self):
self.dbstate.db.connect('media-update', self.update)
self.connect_signal('Media', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Media')

View File

@ -72,7 +72,6 @@ class PersonBacklinks(Backlinks):
"""
def db_changed(self):
self.dbstate.db.connect('person-update', self.update)
self.update()
def active_changed(self, handle):
self.update()
@ -96,7 +95,6 @@ class EventBacklinks(Backlinks):
def db_changed(self):
self.dbstate.db.connect('event-update', self.update)
self.connect_signal('Event', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Event')
@ -117,7 +115,6 @@ class FamilyBacklinks(Backlinks):
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')
@ -138,7 +135,6 @@ class PlaceBacklinks(Backlinks):
def db_changed(self):
self.dbstate.db.connect('place-update', self.update)
self.connect_signal('Place', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Place')
@ -159,7 +155,6 @@ class SourceBacklinks(Backlinks):
def db_changed(self):
self.dbstate.db.connect('source-update', self.update)
self.connect_signal('Source', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Source')
@ -180,7 +175,6 @@ class CitationBacklinks(Backlinks):
def db_changed(self):
self.dbstate.db.connect('citation-update', self.update)
self.connect_signal('Citation', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Citation')
@ -201,7 +195,6 @@ class RepositoryBacklinks(Backlinks):
def db_changed(self):
self.dbstate.db.connect('repository-update', self.update)
self.connect_signal('Repository', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Repository')
@ -222,7 +215,6 @@ class MediaBacklinks(Backlinks):
def db_changed(self):
self.dbstate.db.connect('media-update', self.update)
self.connect_signal('Media', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Media')
@ -243,7 +235,6 @@ class NoteBacklinks(Backlinks):
def db_changed(self):
self.dbstate.db.connect('note-update', self.update)
self.connect_signal('Note', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Note')

View File

@ -92,7 +92,6 @@ class PersonChildren(Children):
def db_changed(self):
self.dbstate.db.connect('person-update', self.update)
self.update()
def active_changed(self, handle):
self.update()
@ -189,7 +188,6 @@ class FamilyChildren(Children):
def db_changed(self):
self.dbstate.db.connect('family-update', self.update)
self.connect_signal('Family', self.update)
self.update()
def main(self):
active_handle = self.get_active('Family')

View File

@ -257,7 +257,6 @@ class PersonCitations(Citations):
"""
def db_changed(self):
self.dbstate.db.connect('person-update', self.update)
self.update()
def active_changed(self, handle):
self.update()
@ -332,7 +331,6 @@ class EventCitations(Citations):
def db_changed(self):
self.dbstate.db.connect('event-update', self.update)
self.connect_signal('Event', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Event')
@ -375,7 +373,6 @@ class FamilyCitations(Citations):
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')
@ -431,7 +428,6 @@ class PlaceCitations(Citations):
def db_changed(self):
self.dbstate.db.connect('place-update', self.update)
self.connect_signal('Place', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Place')
@ -474,7 +470,6 @@ class MediaCitations(Citations):
def db_changed(self):
self.dbstate.db.connect('media-update', self.update)
self.connect_signal('Media', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Media')

View File

@ -97,7 +97,6 @@ class PersonEvents(Events):
"""
def db_changed(self):
self.dbstate.db.connect('person-update', self.update)
self.update()
def active_changed(self, handle):
self.update()
@ -155,7 +154,6 @@ class FamilyEvents(Events):
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')

View File

@ -91,7 +91,6 @@ class PersonGallery(Gallery):
"""
def db_changed(self):
self.dbstate.db.connect('person-update', self.update)
self.update()
def active_changed(self, handle):
self.update()
@ -118,7 +117,6 @@ class FamilyGallery(Gallery):
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')
@ -142,7 +140,6 @@ class EventGallery(Gallery):
def db_changed(self):
self.dbstate.db.connect('event-update', self.update)
self.connect_signal('Event', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Event')
@ -166,7 +163,6 @@ class PlaceGallery(Gallery):
def db_changed(self):
self.dbstate.db.connect('place-update', self.update)
self.connect_signal('Place', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Place')
@ -190,7 +186,6 @@ class SourceGallery(Gallery):
def db_changed(self):
self.dbstate.db.connect('event-update', self.update)
self.connect_signal('Source', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Source')
@ -214,7 +209,6 @@ class CitationGallery(Gallery):
def db_changed(self):
self.dbstate.db.connect('event-update', self.update)
self.connect_signal('Citation', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Citation')

View File

@ -46,7 +46,6 @@ class MediaPreview(Gramplet):
def db_changed(self):
self.dbstate.db.connect('media-update', self.update)
self.connect_signal('Media', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Media')

View File

@ -138,7 +138,6 @@ class PersonNotes(Notes):
"""
def db_changed(self):
self.dbstate.db.connect('person-update', self.update)
self.update()
def active_changed(self, handle):
self.update()
@ -164,7 +163,6 @@ class EventNotes(Notes):
def db_changed(self):
self.dbstate.db.connect('event-update', self.update)
self.connect_signal('Event', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Event')
@ -187,7 +185,6 @@ class FamilyNotes(Notes):
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')
@ -210,7 +207,6 @@ class PlaceNotes(Notes):
def db_changed(self):
self.dbstate.db.connect('place-update', self.update)
self.connect_signal('Place', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Place')
@ -233,7 +229,6 @@ class SourceNotes(Notes):
def db_changed(self):
self.dbstate.db.connect('source-update', self.update)
self.connect_signal('Source', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Source')
@ -256,7 +251,6 @@ class CitationNotes(Notes):
def db_changed(self):
self.dbstate.db.connect('citation-update', self.update)
self.connect_signal('Citation', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Citation')
@ -279,7 +273,6 @@ class RepositoryNotes(Notes):
def db_changed(self):
self.dbstate.db.connect('repository-update', self.update)
self.connect_signal('Repository', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Repository')
@ -302,7 +295,6 @@ class MediaNotes(Notes):
def db_changed(self):
self.dbstate.db.connect('media-update', self.update)
self.connect_signal('Media', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Media')

View File

@ -84,7 +84,6 @@ class PersonDetails(Gramplet):
def db_changed(self):
self.dbstate.db.connect('person-update', self.update)
self.update()
def active_changed(self, handle):
self.update()

View File

@ -53,7 +53,6 @@ class PersonResidence(Gramplet):
def db_changed(self):
self.dbstate.db.connect('person-update', self.update)
self.update()
def active_changed(self, handle):
self.update()

View File

@ -81,7 +81,6 @@ class PlaceDetails(Gramplet):
def db_changed(self):
self.dbstate.db.connect('place-update', self.update)
self.connect_signal('Place', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Person')

View File

@ -77,7 +77,6 @@ class RepositoryDetails(Gramplet):
def db_changed(self):
self.dbstate.db.connect('repository-update', self.update)
self.connect_signal('Repository', self.update)
self.update()
def update_has_data(self):
active_handle = self.get_active('Person')