diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 6fd12375e..d24f9b571 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,15 @@ +2006-04-20 Don Allingham + * src/Editors/_EditPlace.py: fix display of shared info warning box + * src/Editors/_EditSourceRef.py: fix display of shared info warning box + * src/Editors/_EditReference.py: fix display of shared info warning box + * src/Editors/_EditSource.py: fix display of shared info warning box + * src/Editors/_EditMediaRef.py: fix display of shared info warning box + * src/Editors/_EditEventRef.py: fix display of shared info warning box + * src/Editors/_EditRepository.py: fix display of shared info warning box + * src/Editors/_EditMedia.py: fix display of shared info warning box + * src/Editors/_EditEvent.py: fix display of shared info warning box + * src/DisplayTabs.py: fix display of shared info warning box + 2006-04-20 Alex Roitman * src/RelLib/_EventRef.py (unserialize): Avoid class constructor. * src/RelLib/_Person.py (unserialize): Avoid class constructor. diff --git a/gramps2/src/DisplayTabs.py b/gramps2/src/DisplayTabs.py index 562d5b38b..151e114b9 100644 --- a/gramps2/src/DisplayTabs.py +++ b/gramps2/src/DisplayTabs.py @@ -787,21 +787,24 @@ class BackRefList(EmbeddedList): (_('Name'), 2, 250), ] - def __init__(self, dbstate, uistate, track, obj, refmodel): + def __init__(self, dbstate, uistate, track, obj, refmodel, callback=None): self.obj = obj EmbeddedList.__init__(self, dbstate, uistate, track, _('References'), refmodel) + self._callback = callback self.model.connect('row-inserted', self.update_label) def update_label(self, *obj): - if not self.model.empty: + if self.model.count > 0: self._set_label() + if self._callback and self.model.count > 1: + self._callback() def close(self): self.model.close() def is_empty(self): - return self.model.empty + return self.model.count == 0 def create_buttons(self, share=False): self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked) @@ -876,36 +879,36 @@ class BackRefList(EmbeddedList): class SourceBackRefList(BackRefList): - def __init__(self, dbstate, uistate, track, obj): + def __init__(self, dbstate, uistate, track, obj, callback=None): BackRefList.__init__(self, dbstate, uistate, track, obj, - BackRefModel) + BackRefModel, callback=callback) def get_icon_name(self): return 'gramps-source' class EventBackRefList(BackRefList): - def __init__(self, dbstate, uistate, track, obj): + def __init__(self, dbstate, uistate, track, obj, callback=None): BackRefList.__init__(self, dbstate, uistate, track, obj, - BackRefModel) + BackRefModel, callback) def get_icon_name(self): return 'gramps-event' class MediaBackRefList(BackRefList): - def __init__(self, dbstate, uistate, track, obj): + def __init__(self, dbstate, uistate, track, obj, callback=None): BackRefList.__init__(self, dbstate, uistate, track, obj, - BackRefModel) + BackRefModel, callback=callback) def get_icon_name(self): return 'gramps-media' class PlaceBackRefList(BackRefList): - def __init__(self, dbstate, uistate, track, obj): + def __init__(self, dbstate, uistate, track, obj, callback=None): BackRefList.__init__(self, dbstate, uistate, track, obj, - BackRefModel) + BackRefModel, callback=callback) def get_icon_name(self): return 'gramps-place' @@ -2183,16 +2186,16 @@ class BackRefModel(gtk.ListStore): self.db = db self.sref_list = sref_list self.idle = 0 - self.empty = True + self.count = 0 self.idle = gobject.idle_add(self.load_model().next) def close(self): gobject.source_remove(self.idle) def load_model(self): - self.empty = True + self.count = 0 for ref in self.sref_list: - self.empty = False + self.count += 1 dtype = ref[0] if dtype == 'Person': p = self.db.get_person_from_handle(ref[1]) diff --git a/gramps2/src/Editors/_EditEvent.py b/gramps2/src/Editors/_EditEvent.py index 65b2d3957..9ef01166f 100644 --- a/gramps2/src/Editors/_EditEvent.py +++ b/gramps2/src/Editors/_EditEvent.py @@ -156,11 +156,13 @@ class EditEvent(EditPrimary): notebook, GalleryTab(self.dbstate, self.uistate, self.track, self.obj.get_media_list())) - + self.backref_tab = self._add_tab( notebook, EventBackRefList(self.dbstate, self.uistate, self.track, - self.dbstate.db.find_backlink_handles(self.obj.handle))) + self.dbstate.db.find_backlink_handles(self.obj.handle), + self.enable_warnbox + )) notebook.show_all() self.top.get_widget('vbox').pack_start(notebook,True) diff --git a/gramps2/src/Editors/_EditEventRef.py b/gramps2/src/Editors/_EditEventRef.py index 51b6127f4..88b55ab88 100644 --- a/gramps2/src/Editors/_EditEventRef.py +++ b/gramps2/src/Editors/_EditEventRef.py @@ -170,7 +170,8 @@ class EditEventRef(EditReference): self.backref_tab = self._add_tab( notebook, EventBackRefList(self.dbstate, self.uistate, self.track, - self.db.find_backlink_handles(self.source.handle))) + self.db.find_backlink_handles(self.source.handle), + self.enable_warnbox)) def build_menu_names(self,eventref): if self.source: diff --git a/gramps2/src/Editors/_EditMedia.py b/gramps2/src/Editors/_EditMedia.py index d15fdf1ab..1f1d89bad 100644 --- a/gramps2/src/Editors/_EditMedia.py +++ b/gramps2/src/Editors/_EditMedia.py @@ -154,7 +154,9 @@ class EditMedia(EditPrimary): self.backref_list = self._add_tab( notebook, MediaBackRefList(self.dbstate,self.uistate,self.track, - self.db.find_backlink_handles(self.obj.handle))) + self.db.find_backlink_handles(self.obj.handle), + self.enable_warnbox + )) notebook.show_all() self.glade.get_widget('vbox').pack_start(notebook,True) diff --git a/gramps2/src/Editors/_EditMediaRef.py b/gramps2/src/Editors/_EditMediaRef.py index b54cc6858..beb673d6e 100644 --- a/gramps2/src/Editors/_EditMediaRef.py +++ b/gramps2/src/Editors/_EditMediaRef.py @@ -144,7 +144,9 @@ class EditMediaRef(EditReference): self.backref_list = self._add_tab( notebook_src, MediaBackRefList(self.dbstate,self.uistate,self.track, - self.db.find_backlink_handles(self.source.handle))) + self.db.find_backlink_handles(self.source.handle), + self.enable_warnbox + )) self.note_ref_tab = self._add_tab( notebook_ref, diff --git a/gramps2/src/Editors/_EditPlace.py b/gramps2/src/Editors/_EditPlace.py index 902e1d413..fd780119d 100644 --- a/gramps2/src/Editors/_EditPlace.py +++ b/gramps2/src/Editors/_EditPlace.py @@ -179,7 +179,9 @@ class EditPlace(EditPrimary): self.backref_list = self._add_tab( notebook, PlaceBackRefList(self.dbstate,self.uistate,self.track, - self.db.find_backlink_handles(self.obj.handle))) + self.db.find_backlink_handles(self.obj.handle), + self.enable_warnbox + )) def _cleanup_on_exit(self): self.backref_list.close() diff --git a/gramps2/src/Editors/_EditReference.py b/gramps2/src/Editors/_EditReference.py index ad3f02409..e5961b7cc 100644 --- a/gramps2/src/Editors/_EditReference.py +++ b/gramps2/src/Editors/_EditReference.py @@ -91,11 +91,10 @@ class EditReference(ManagedWindow.ManagedWindow): self.warn_box = box def _setup_warnbox(self): - if self.warn_box: - if self.source.handle: - self.warn_box.show_all() - else: - self.warn_box.hide() + pass + + def enable_warnbox(self): + self.warn_box.show_all() def define_expander(self,expander): expander.set_expanded(True) diff --git a/gramps2/src/Editors/_EditRepository.py b/gramps2/src/Editors/_EditRepository.py index 5b8cff5c7..71cd2beed 100644 --- a/gramps2/src/Editors/_EditRepository.py +++ b/gramps2/src/Editors/_EditRepository.py @@ -106,7 +106,9 @@ class EditRepository(EditPrimary): self.backref_tab = self._add_tab( notebook, SourceBackRefList(self.dbstate, self.uistate, self.track, - self.db.find_backlink_handles(self.obj.handle))) + self.db.find_backlink_handles(self.obj.handle), + self.enable_warnbox + )) notebook.show_all() self.glade.get_widget("vbox").pack_start(notebook,True,True) diff --git a/gramps2/src/Editors/_EditSource.py b/gramps2/src/Editors/_EditSource.py index 61c6c90c5..e188bca79 100644 --- a/gramps2/src/Editors/_EditSource.py +++ b/gramps2/src/Editors/_EditSource.py @@ -135,7 +135,9 @@ class EditSource(EditPrimary): self.backref_tab = self._add_tab( notebook, SourceBackRefList(self.dbstate, self.uistate, self.track, - self.db.find_backlink_handles(self.obj.handle))) + self.db.find_backlink_handles(self.obj.handle), + self.enable_warnbox + )) notebook.show_all() self.glade.get_widget('vbox').pack_start(notebook,True) diff --git a/gramps2/src/Editors/_EditSourceRef.py b/gramps2/src/Editors/_EditSourceRef.py index f68518b1f..18f47aeee 100644 --- a/gramps2/src/Editors/_EditSourceRef.py +++ b/gramps2/src/Editors/_EditSourceRef.py @@ -150,7 +150,9 @@ class EditSourceRef(EditReference): self.srcref_list = self._add_tab( notebook_src, SourceBackRefList(self.dbstate,self.uistate, self.track, - self.db.find_backlink_handles(self.source.handle))) + self.db.find_backlink_handles(self.source.handle), + self.enable_warnbox + )) self.comment_tab = self._add_tab( notebook_ref,