diff --git a/ChangeLog b/ChangeLog index 7cb6680c6..237a8b722 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-02-24 Don Allingham + * src/DisplayTabs.py: backreference tabs + * src/EditEventRef.py: backreference tabs + * src/EditMedia.py: backreference tabs + * src/EditMediaRef.py: backreference tabs + * src/EditPlace.py: backreference tabs + * src/EditSource.py: backreference tabs + * src/EventEdit.py: backreference tabs + * src/gramps.glade: notebook tab fixes + 2006-02-24 Alex Roitman * src/RelLib/_Person.py (Person.get_handle_referents): Add birth_ref and death_ref to the list of referents. diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index 4152b52c5..2fc3e7816 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -652,10 +652,10 @@ class PersonEventEmbedList(EventEmbedList): #------------------------------------------------------------------------- # -# SourceBackRefList +# BackRefList # #------------------------------------------------------------------------- -class SourceBackRefList(EmbeddedList): +class BackRefList(EmbeddedList): _HANDLE_COL = 3 @@ -665,18 +665,21 @@ class SourceBackRefList(EmbeddedList): (_('Name'),2, 250), ] - def __init__(self,dbstate,uistate,track,obj): + def __init__(self,dbstate,uistate,track,obj,refmodel): self.obj = obj EmbeddedList.__init__(self, dbstate, uistate, track, - _('References'), SourceBackRefModel) + _('References'), refmodel) + self.model.connect('row-inserted',self.update_label) + + def update_label(self,*obj): + if not self.model.empty: + self._set_label() def close(self): self.model.close() - def _set_label(self): - self.tab_image.show() - self.label.set_text("%s" % self.tab_name) - self.label.set_use_markup(True) + def is_empty(self): + return self.model.empty def create_buttons(self,share=False): self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked) @@ -693,30 +696,54 @@ class SourceBackRefList(EmbeddedList): else: self.edit_btn.set_sensitive(False) - def get_icon_name(self): - return 'gramps-source' - def get_data(self): return self.obj def column_order(self): return ((1,0),(1,1),(1,2)) - def add_button_clicked(self,obj): - pass - - def del_button_clicked(self,obj): - ref = self.get_selected() - if ref: - ref_list = self.obj.get_event_ref_list() - ref_list.remove(ref) - self.rebuild() - def edit_button_clicked(self,obj): ref = self.get_selected() if ref: print ref +class SourceBackRefList(BackRefList): + + def __init__(self,dbstate,uistate,track,obj): + BackRefList.__init__(self, dbstate, uistate, track, obj, + BackRefModel) + + def get_icon_name(self): + return 'gramps-source' + +class EventBackRefList(BackRefList): + + def __init__(self,dbstate,uistate,track,obj): + BackRefList.__init__(self, dbstate, uistate, track, obj, + BackRefModel) + + def get_icon_name(self): + return 'gramps-event' + +class MediaBackRefList(BackRefList): + + def __init__(self,dbstate,uistate,track,obj): + BackRefList.__init__(self, dbstate, uistate, track, obj, + BackRefModel) + + def get_icon_name(self): + return 'gramps-media' + +class PlaceBackRefList(BackRefList): + + def __init__(self,dbstate,uistate,track,obj): + BackRefList.__init__(self, dbstate, uistate, track, obj, + BackRefModel) + + def get_icon_name(self): + return 'gramps-place' + + #------------------------------------------------------------------------- # # DataEmbedList @@ -1210,7 +1237,6 @@ class GalleryTab(ButtonTab): obj, ref, self.edit_callback) def edit_callback(self, name): - print "Callback" self.changed = True self.rebuild() @@ -1479,7 +1505,10 @@ class EventRefModel(gtk.ListStore): if t == RelLib.EventRef.CUSTOM: return v else: - return Utils.event_roles.get(t,"error %d" % t) + try: + return Utils.event_roles[t] + except: + return Utils.family_event_roles.get(t,"error %d" % t) def column_date(self,event_ref): event = self.db.get_event_from_handle(event_ref.ref) @@ -1653,23 +1682,26 @@ class RepoRefModel(gtk.ListStore): #------------------------------------------------------------------------- # -# SourceBackRefModel +# BackRefModel # #------------------------------------------------------------------------- -class SourceBackRefModel(gtk.ListStore): +class BackRefModel(gtk.ListStore): def __init__(self,sref_list,db): gtk.ListStore.__init__(self,str,str,str,str) self.db = db self.sref_list = sref_list self.idle = 0 + self.empty = True self.idle = gobject.idle_add(self.load_model().next) def close(self): gobject.source_remove(self.idle) def load_model(self): + self.empty = True for ref in self.sref_list: + self.empty = False dtype = ref[0] if dtype == 'Person': p = self.db.get_person_from_handle(ref[1]) @@ -1714,3 +1746,4 @@ class SourceBackRefModel(gtk.ListStore): yield True yield False + diff --git a/src/EditEventRef.py b/src/EditEventRef.py index 0fbec842c..df19609c0 100644 --- a/src/EditEventRef.py +++ b/src/EditEventRef.py @@ -79,7 +79,6 @@ class EditEventRef(DisplayState.ManagedWindow): event, event_ref, referent, update): self.db = state.db self.state = state - self.uistate = uistate self.referent = referent self.event_ref = event_ref self.event = event @@ -214,7 +213,6 @@ class EditEventRef(DisplayState.ManagedWindow): """ Creates the notebook tabs and inserts them into the main window. - """ self.srcref_list = self._add_page(SourceEmbedList( @@ -229,6 +227,9 @@ class EditEventRef(DisplayState.ManagedWindow): self.gallery_tab = self._add_page(GalleryTab( self.state, self.uistate, self.track, self.event.get_media_list())) + self.backref_tab = self._add_page(EventBackRefList( + self.state, self.uistate, self.track, + self.state.db.find_backlink_handles(self.event.handle))) def build_menu_names(self,eventref): if self.event: diff --git a/src/EditMedia.py b/src/EditMedia.py index 8ca39bc38..4100edb18 100644 --- a/src/EditMedia.py +++ b/src/EditMedia.py @@ -80,7 +80,6 @@ class EditMedia(DisplayState.ManagedWindow): return self.state = state - self.uistate = uistate self.pdmap = {} self.obj = obj @@ -183,6 +182,15 @@ class EditMedia(DisplayState.ManagedWindow): self.notebook.set_tab_label(self.note_tab,self.note_tab.get_tab_widget()) self.notebook.set_tab_label(self.attr_list,self.attr_list.get_tab_widget()) + self.backref_list = self._add_page(MediaBackRefList( + self.state,self.uistate,self.track, + self.db.find_backlink_handles(self.obj.handle))) + + def _add_page(self,page): + self.notebook.insert_page(page) + self.notebook.set_tab_label(page,page.get_tab_widget()) + return page + def build_menu_names(self,person): win_menu_label = _("Media Properties") return (_('Edit Media Object'),win_menu_label) diff --git a/src/EditMediaRef.py b/src/EditMediaRef.py index ef4379c52..1f889824a 100644 --- a/src/EditMediaRef.py +++ b/src/EditMediaRef.py @@ -73,7 +73,6 @@ class EditMediaRef(DisplayState.ManagedWindow): media, media_ref, update): self.db = state.db self.state = state - self.uistate = uistate self.media_ref = media_ref self.media = media self.update = update @@ -161,6 +160,10 @@ class EditMediaRef(DisplayState.ManagedWindow): self.state,self.uistate,self.track, self.media_ref.get_attribute_list())) + self.backref_list = self._add_src_page(MediaBackRefList( + self.state,self.uistate,self.track, + self.db.find_backlink_handles(self.media.handle))) + self.note_ref_tab = self._add_ref_page(NoteTab( self.state, self.uistate, self.track, self.media_ref.get_note_object())) diff --git a/src/EditPlace.py b/src/EditPlace.py index e8610f2b2..0f00e6acf 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -70,7 +70,6 @@ class EditPlace(DisplayState.ManagedWindow): def __init__(self,dbstate,uistate,track,place): self.dbstate = dbstate - self.uistate = uistate DisplayState.ManagedWindow.__init__(self, uistate, track, place) @@ -200,7 +199,7 @@ class EditPlace(DisplayState.ManagedWindow): self.web_list = self._add_page(WebEmbedList( self.dbstate,self.uistate,self.track, self.place.get_url_list())) - self.backref_list = self._add_page(SourceBackRefList( + self.backref_list = self._add_page(PlaceBackRefList( self.dbstate,self.uistate,self.track, self.db.find_backlink_handles(self.place.handle))) diff --git a/src/EditSource.py b/src/EditSource.py index e9e0992cf..008f2f3f3 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -279,6 +279,7 @@ class EditSource(DisplayState.ManagedWindow): def on_delete_event(self,obj,b): self.backref_tab.close() + self.close() def on_help_clicked(self,obj): """Display the relevant portion of GRAMPS manual""" diff --git a/src/EventEdit.py b/src/EventEdit.py index 8e2567537..faea9efed 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -171,6 +171,9 @@ class EventEditor(DisplayState.ManagedWindow): self.gallery_tab = self._add_page(GalleryTab( self.dbstate, self.uistate, self.track, self.event.get_media_list())) + self.backref_tab = self._add_page(EventBackRefList( + self.dbstate, self.uistate, self.track, + self.dbstate.db.find_backlink_handles(self.event.handle))) self.notebook.show_all() vbox.pack_start(self.notebook,True) diff --git a/src/gramps.glade b/src/gramps.glade index 48be60403..f283032b2 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -4025,752 +4025,6 @@ Text Beside Icons - - True - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 550 - True - False - gramps.png - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - - True - False - 8 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - - True - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - False - 0 - - - - True - - False - True - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 5 - False - False - - - - - - True - False - 0 - - - - 12 - True - 12 - 4 - False - 6 - 12 - - - - True - _Confidence: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - conf - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 6 - 7 - fill - - - - - - - True - _Volume/Film/Page: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - spage - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 7 - 8 - fill - - - - - - - True - _Date: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - sdate - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 1 - 2 - 8 - 9 - fill - - - - - - - True - Te_xt: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 1 - 2 - 9 - 10 - fill - fill - - - - - - True - Co_mments: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 1 - 2 - 10 - 11 - fill - fill - - - - - - True - Publication information: - False - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 3 - 4 - fill - - - - - - - True - Author: - False - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 2 - 3 - fill - - - - - - - True - _Title: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 1 - 2 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 3 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 2 - 4 - 2 - 3 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 3 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 2 - 4 - 3 - 4 - fill - - - - - - - True - <b>Source selection</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 4 - 0 - 1 - fill - - - - - - - True - <b>Source details</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 4 - 5 - 6 - fill - - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 2 - 4 - 7 - 8 - fill - fill - - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 2 - 4 - 9 - 10 - fill - fill - - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 2 - 4 - 10 - 11 - fill - fill - - - - - - True - Creates a new source - True - _New... - True - GTK_RELIEF_NORMAL - True - - - - 3 - 4 - 1 - 2 - fill - - - - - - - True - True - _Private record - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 2 - 3 - 11 - 12 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 2 - 3 - 8 - 9 - - - - - - - True - Invoke date editor - True - GTK_RELIEF_NONE - True - - - - - True - 0.5 - 0.5 - 0 - 0 - - - - - 3 - 4 - 8 - 9 - fill - - - - - - - True - Very Low -Low -Normal -High -Very High - False - True - - - 2 - 4 - 6 - 7 - fill - fill - - - - - - True - False - True - - - 2 - 3 - 1 - 2 - fill - fill - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - GTK_WINDOW_TOPLEVEL @@ -16196,12 +15450,13 @@ Very High True False - 0 + 6 + True gtk-file - 4 + 1 0.5 0.5 0 @@ -16217,7 +15472,7 @@ Very High True - General + <b>General</b> False True GTK_JUSTIFY_CENTER @@ -16651,12 +15906,13 @@ Very High True False - 0 + 6 + True gtk-file - 4 + 1 0.5 0.5 0 @@ -16672,7 +15928,7 @@ Very High True - General + <b>General</b> False True GTK_JUSTIFY_CENTER @@ -16704,7 +15960,7 @@ Very High True - <b>Shared event information</b> + <b>Shared information</b> False True GTK_JUSTIFY_LEFT