diff --git a/ChangeLog b/ChangeLog index 060db3b4e..288643499 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2006-01-23 Don Allingham + * src/DisplayTabs.py: Add source ref model/tab + * src/PeopleModel.py: specify handle column + * src/PersonView.py: fix selection column * src/DisplayState.py: Warning log handler, add timeout handler - * src/EditFamily.py: remove icon in father/mother column + * src/EditFamily.py: remove icon in father/mother column, add source tab * src/EditPerson.py: remove commented out code * src/GrampsWidgets.py: add WarnButton * src/ViewManager.py: use WarnButton in the status bar diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index a77d1ac5a..f2a098553 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -332,6 +332,49 @@ class GalleryTab(ButtonTab): def edit_button_clicked(self,obj): print "Media Edit clicked" +#------------------------------------------------------------------------- +# +# SourceEmbedList +# +#------------------------------------------------------------------------- +class SourceEmbedList(EmbeddedList): + + _HANDLE_COL = 6 + + column_names = [ + (_('ID'),0), + (_('Title'),1), + ] + + def __init__(self,dbstate,uistate,track,obj): + self.obj = obj + EmbeddedList.__init__(self, dbstate, uistate, track, + _('Sources'), SourceRefModel) + + def get_icon_name(self): + return 'gramps-event' + + def get_data(self): + return self.obj + + def column_order(self): + return ((1,0),(1,1)) + + 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 + #------------------------------------------------------------------------- # # ChildModel @@ -512,6 +555,23 @@ class AttrModel(gtk.ListStore): else: return Utils.personal_attributes[t[0]] +#------------------------------------------------------------------------- +# +# SourceRefModel +# +#------------------------------------------------------------------------- +class SourceRefModel(gtk.ListStore): + + def __init__(self,sref_list,db): + gtk.ListStore.__init__(self,str,str) + self.db = db + for sref in sref_list: + src = db.get_source_from_handle(sref.ref) + self.append(row=[ + src.gramps_id, + src.title, + ]) + #------------------------------------------------------------------------- # # FamilyAttrModel diff --git a/src/EditFamily.py b/src/EditFamily.py index fc082c60a..78933f372 100644 --- a/src/EditFamily.py +++ b/src/EditFamily.py @@ -297,6 +297,8 @@ class EditFamily(DisplayState.ManagedWindow): self.track, self.family) self.event_list = EventEmbedList(self.dbstate,self.uistate, self.track,self.family) + self.src_list = SourceEmbedList(self.dbstate,self.uistate, + self.track,self.family.source_list) self.attr_list = AttrEmbedList(self.dbstate, self.uistate, self.track, self.family.get_attribute_list()) self.note_tab = NoteTab(self.dbstate, self.uistate, self.track, @@ -310,6 +312,9 @@ class EditFamily(DisplayState.ManagedWindow): self.notebook.insert_page(self.event_list) self.notebook.set_tab_label(self.event_list,self.event_list.get_tab_widget()) + self.notebook.insert_page(self.src_list) + self.notebook.set_tab_label(self.src_list,self.src_list.get_tab_widget()) + self.notebook.insert_page(self.attr_list) self.notebook.set_tab_label(self.attr_list,self.attr_list.get_tab_widget()) diff --git a/src/GrampsDb/_ReadGedcom.py b/src/GrampsDb/_ReadGedcom.py index 8dec2f20c..81c2d4588 100644 --- a/src/GrampsDb/_ReadGedcom.py +++ b/src/GrampsDb/_ReadGedcom.py @@ -59,6 +59,7 @@ import Errors import RelLib import Date import DateParser +import NameDisplay import DisplayTrace from ansel_utf8 import ansel_to_utf8 import Utils @@ -1000,9 +1001,16 @@ class GedcomParser: event.set_type((RelLib.Event.CUSTOM,val)) else: event.set_type((RelLib.Event.CUSTOM,matches[1])) + self.parse_family_event(event,2) if event.get_type()[0] == RelLib.Event.MARRIAGE: self.family.set_relationship((RelLib.Family.MARRIED,'')) - self.parse_family_event(event,2) + if event.get_type()[0] != RelLib.Event.CUSTOM: + if not event.get_description(): + text = _("%(event_name)s of %(family)s") % { + 'event_name' : Utils.family_events[event.get_type()[0]], + 'family' : Utils.family_name(self.family,self.db), + } + event.set_description(text) self.db.add_event(event,self.trans) event_ref = RelLib.EventRef() @@ -1959,6 +1967,7 @@ class GedcomParser: event.set_type((RelLib.Event.BIRTH,"")) self.parse_person_event(event,2) + person_event_name(event,state.person) self.db.add_event(event, self.trans) event_ref = RelLib.EventRef() @@ -1974,6 +1983,7 @@ class GedcomParser: event = RelLib.Event() event.set_type((RelLib.Event.ADOPT,'')) self.parse_adopt_event(event,2) + person_event_name(event,state.person) self.db.add_event(event, self.trans) event_ref = RelLib.EventRef() @@ -1988,6 +1998,7 @@ class GedcomParser: event.set_type((RelLib.Event.DEATH,"")) self.parse_person_event(event,2) + person_event_name(event,state.person) self.db.add_event(event, self.trans) event_ref = RelLib.EventRef() @@ -2063,6 +2074,7 @@ class GedcomParser: self.parse_person_event(event,2) if matches[2]: event.set_description(matches[2]) + person_event_name(event,state.person) self.db.add_event(event, self.trans) event_ref = RelLib.EventRef() @@ -2156,7 +2168,17 @@ class GedcomParser: def skip_record(self,matches,state): self.ignore_sub_junk(2) - + + +def person_event_name(event,person): + if event.get_type()[0] != RelLib.Event.CUSTOM: + if not event.get_description(): + text = _("%(event_name)s of %(person)s") % { + 'event_name' : Utils.personal_events[event.get_type()[0]], + 'person' : NameDisplay.displayer.display(person), + } + event.set_description(text) + #------------------------------------------------------------------------- # # diff --git a/src/PeopleModel.py b/src/PeopleModel.py index d0df05f90..34ad68625 100644 --- a/src/PeopleModel.py +++ b/src/PeopleModel.py @@ -486,7 +486,7 @@ COLUMN_DEFS = [ ] # dynamic calculation of column indices, for use by various Views -COLUMN_INT_ID = len(COLUMN_DEFS) - 1 +COLUMN_INT_ID = 14 # indices into main column definition table COLUMN_DEF_LIST = 0 diff --git a/src/PersonView.py b/src/PersonView.py index 9607a0367..2ce85406b 100644 --- a/src/PersonView.py +++ b/src/PersonView.py @@ -76,7 +76,7 @@ class PersonView(PageView.PersonNavView): self.inactive = False dbstate.connect('database-changed',self.change_db) dbstate.connect('active-changed',self.goto_active_person) - self.handle_col = len(column_names)+2 + self.handle_col = PeopleModel.COLUMN_INT_ID def change_page(self): self.generic_filter_widget.on_filter_name_changed(None) @@ -233,10 +233,7 @@ class PersonView(PageView.PersonNavView): self.generic_filter_widget.apply_filter() def goto_active_person(self,obj=None): - import time - t = time.time() self.goto_active_person_2(None) - print time.time() - t def goto_active_person_2(self,obj=None): """ @@ -329,7 +326,8 @@ class PersonView(PageView.PersonNavView): """ if self.active: self.model = PeopleModel.PeopleModel( - self.dbstate.db, self.generic_filter_widget.get_filter(), self.generic_filter_widget.inverted()) + self.dbstate.db, self.generic_filter_widget.get_filter(), + self.generic_filter_widget.inverted()) self.tree.set_model(self.model) if self.model.tooltip_column != None: @@ -351,7 +349,8 @@ class PersonView(PageView.PersonNavView): def edit(self,obj): if self.dbstate.active: - EditPerson.EditPerson(self.dbstate, self.uistate, [], self.dbstate.active) + EditPerson.EditPerson(self.dbstate, self.uistate, [], + self.dbstate.active) def remove(self,obj): mlist = self.get_selected_objects() @@ -591,7 +590,8 @@ class PersonView(PageView.PersonNavView): mlist = [] for path in paths: node = self.model.on_get_iter(path) - mlist.append(self.model.on_get_value(node, PeopleModel.COLUMN_INT_ID)) + handle = self.model.on_get_value(node, PeopleModel.COLUMN_INT_ID) + mlist.append(handle) return mlist def remove_from_person_list(self,person):