From 0bc491fbc12f57d94b442711ff4409f477124890 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 4 Oct 2001 04:22:41 +0000 Subject: [PATCH] Revision control support svn: r442 --- gramps/NEWS | 5 + gramps/src/Config.py | 10 + gramps/src/EditPerson.glade | 883 +++++++++++++++++-------------- gramps/src/EditPerson.py | 160 ++---- gramps/src/GrampsParser.py | 30 +- gramps/src/Marriage.py | 41 +- gramps/src/ReadXML.py | 42 ++ gramps/src/RelLib.py | 40 +- gramps/src/Sources.py | 9 +- gramps/src/WriteXML.py | 19 +- gramps/src/config.glade | 211 +++++--- gramps/src/const.py | 2 +- gramps/src/dialog.glade | 196 +++---- gramps/src/gramps.glade | 450 +++++++++++++++- gramps/src/gramps_main.py | 155 +++++- gramps/src/marriage.glade | 104 +++- gramps/src/plugins/ReadGedcom.py | 36 +- 17 files changed, 1566 insertions(+), 827 deletions(-) diff --git a/gramps/NEWS b/gramps/NEWS index 585a6926c..849299998 100644 --- a/gramps/NEWS +++ b/gramps/NEWS @@ -1,3 +1,8 @@ +Version 0.5.1post +* Support for QUAY on GEDCOM import. +* Confidence level moved to SourceReference instead of object +* Support for revision control + Version 0.5.1 * Bug fixes * Allow gramps' ids to be edited diff --git a/gramps/src/Config.py b/gramps/src/Config.py index 33d5db1d2..52800f6aa 100644 --- a/gramps/src/Config.py +++ b/gramps/src/Config.py @@ -92,6 +92,7 @@ owner = Researcher() prefsTop = None autoload = 0 usetabs = 0 +usevc = 0 uncompress = 0 show_detail = 0 hide_altnames = 0 @@ -150,6 +151,7 @@ def loadConfig(call): global autoload global owner global usetabs + global usevc global uncompress global id_visible global id_edit @@ -172,6 +174,7 @@ def loadConfig(call): _callback = call lastfile = gnome.config.get_string("/gramps/data/LastFile") usetabs = gnome.config.get_bool("/gramps/config/UseTabs") + usevc = gnome.config.get_bool("/gramps/config/UseVersionControl") uncompress = gnome.config.get_bool("/gramps/config/DontCompressXML") id_visible = gnome.config.get_bool("/gramps/config/IdVisible") id_edit = gnome.config.get_bool("/gramps/config/IdEdit") @@ -243,6 +246,8 @@ def loadConfig(call): autoload = 1 if usetabs == None: usetabs = 0 + if usevc == None: + usevc = 0 if uncompress == None: uncompress = 0 if id_visible == None: @@ -348,6 +353,7 @@ def on_propertybox_apply(obj,page): global nameof global owner global usetabs + global usevc global uncompress global id_visible global id_edit @@ -370,6 +376,7 @@ def on_propertybox_apply(obj,page): display_attr = prefsTop.get_widget("attr_display").get_active() attr_name = string.strip(prefsTop.get_widget("attr_name").get_text()) usetabs = prefsTop.get_widget("usetabs").get_active() + usevc = prefsTop.get_widget("use_vc").get_active() uncompress = prefsTop.get_widget("uncompress").get_active() id_visible = prefsTop.get_widget("gid_visible").get_active() id_edit = prefsTop.get_widget("gid_edit").get_active() @@ -400,6 +407,7 @@ def on_propertybox_apply(obj,page): output_preference = output_obj.get_data(DATA) gnome.config.set_bool("/gramps/config/UseTabs",usetabs) + gnome.config.set_bool("/gramps/config/UseVersionControl",usevc) gnome.config.set_bool("/gramps/config/DontCompressXML",uncompress) gnome.config.set_bool("/gramps/config/IdVisible",id_visible) gnome.config.set_bool("/gramps/config/IdEdit",id_edit) @@ -542,6 +550,7 @@ def display_preferences_box(): vis = prefsTop.get_widget("gid_visible") idedit = prefsTop.get_widget("gid_edit") tabs = prefsTop.get_widget("usetabs") + vc = prefsTop.get_widget("use_vc") compress = prefsTop.get_widget("uncompress") detail = prefsTop.get_widget("showdetail") display_attr_obj = prefsTop.get_widget("attr_display") @@ -549,6 +558,7 @@ def display_preferences_box(): auto.set_active(autoload) detail.set_active(show_detail) tabs.set_active(usetabs) + vc.set_active(usevc) compress.set_active(uncompress) vis.set_active(id_visible) idedit.set_active(id_edit) diff --git a/gramps/src/EditPerson.glade b/gramps/src/EditPerson.glade index a1213030d..fa5304a3a 100644 --- a/gramps/src/EditPerson.glade +++ b/gramps/src/EditPerson.glade @@ -175,12 +175,114 @@ GtkTable table16 - 3 - 2 + 4 + 3 False 0 0 + + GtkLabel + label244 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 0 + 1 + 0 + 0 + False + False + False + True + False + False + + + + + GtkLabel + label245 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 1 + 2 + 0 + 0 + False + False + True + False + False + False + + + + + GtkEntry + birthPlace + 275 + True + False + True + 0 + + + 2 + 3 + 1 + 2 + 3 + 3 + True + False + False + False + True + False + + + + + GtkEntry + birthDate + 250 + True + False + True + 0 + + + 2 + 3 + 0 + 1 + 3 + 3 + True + False + False + False + True + False + + + GtkLabel label25 @@ -196,8 +298,8 @@ 1 0 1 - 5 - 5 + 3 + 3 False False False @@ -222,8 +324,8 @@ 1 1 2 - 5 - 5 + 3 + 3 False False False @@ -234,123 +336,58 @@ - GtkEntry - birthDate - 250 + GtkButton + button99 + 1 True - True - True - 0 - + + clicked + on_edit_birth_clicked + editPerson + Tue, 02 Oct 2001 22:28:32 GMT + + + GTK_RELIEF_NORMAL - 1 - 2 - 0 - 1 - 5 - 5 - True - False - False - False - True - False - - - - - GtkCombo - bp_combo - False - True - False - True - False - - - 1 - 2 - 1 - 2 - 5 - 5 - True - False - False - False - True - False - - - - GtkEntry - GtkCombo:entry - birthPlace - True - True - True - 0 - - - - - - GtkHBox - hbox19 - False - 0 - - 1 - 2 - 2 - 3 + 2 + 3 + 3 + 4 0 0 False False False False - True - True + False + False + - - GtkButton - button99 - True - - clicked - on_birth_source_clicked - editPerson - Sun, 03 Jun 2001 20:10:22 GMT - - - GTK_RELIEF_NORMAL - - 0 - True - False - - - - - GtkButton - button100 - True - - clicked - on_birth_note_clicked - editPerson - Sun, 03 Jun 2001 20:10:35 GMT - - - GTK_RELIEF_NORMAL - - 0 - True - False - - + + GtkLabel + label250 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 3 + 2 + 3 + 0 + 0 + False + True + False + False + True + False + @@ -379,29 +416,131 @@ GtkTable table17 - 3 - 2 + 4 + 3 False 0 0 + + GtkEntry + deathPlace + 275 + True + False + True + 0 + + + 2 + 3 + 1 + 2 + 3 + 3 + True + False + False + False + True + False + + + + + GtkEntry + deathDate + 250 + True + False + True + 0 + + + 2 + 3 + 0 + 1 + 3 + 3 + True + False + False + False + True + False + + + GtkLabel - label28 - + label246 + GTK_JUSTIFY_CENTER False - 1 + 0 0.5 0 0 - 0 - 1 + 1 + 2 0 1 - 5 - 5 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label247 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label249 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 2 + 3 + 0 + 0 False False False @@ -426,8 +565,60 @@ 1 1 2 - 5 - 5 + 3 + 3 + False + False + False + False + True + False + + + + + GtkLabel + label28 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 0 + 1 + 3 + 3 + False + False + False + False + True + False + + + + + GtkLabel + label248 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 2 + 3 + 3 + 3 False False False @@ -439,122 +630,56 @@ GtkEntry - deathDate + deathCause 250 True - True + False True 0 - 1 - 2 - 0 - 1 - 5 - 5 - True - False - False - False - True - False - - - - - GtkCombo - dp_combo - False - True - False - True - False - - - 1 - 2 - 1 - 2 - 5 - 5 - True - False - False - False - True - False - - - - GtkEntry - GtkCombo:entry - deathPlace - True - True - True - 0 - - - - - - GtkHBox - hbox20 - False - 0 - - 1 - 2 + 2 + 3 2 3 + 3 + 3 + True + False + False + False + True + False + + + + + GtkButton + button126 + 1 + True + + clicked + on_edit_death_clicked + editPerson + Tue, 02 Oct 2001 22:28:47 GMT + + + GTK_RELIEF_NORMAL + + 2 + 3 + 3 + 4 0 0 False False False False - True - True + False + False - - - GtkButton - button101 - True - - clicked - on_death_source_clicked - editPerson - Sun, 03 Jun 2001 20:10:45 GMT - - - GTK_RELIEF_NORMAL - - 0 - True - False - - - - - GtkButton - button102 - True - - clicked - on_death_note_clicked - editPerson - Sun, 03 Jun 2001 20:10:54 GMT - - - GTK_RELIEF_NORMAL - - 0 - True - False - - @@ -1703,7 +1828,7 @@ GtkTable table7 - 4 + 5 3 False 0 @@ -1774,8 +1899,8 @@ 0 1 - 2 - 3 + 3 + 4 0 0 False @@ -1852,8 +1977,8 @@ 2 3 - 2 - 3 + 3 + 4 3 3 True @@ -1878,8 +2003,8 @@ 0 1 - 3 - 4 + 4 + 5 0 0 False @@ -1904,8 +2029,8 @@ 2 3 - 3 - 4 + 4 + 5 3 3 True @@ -1982,8 +2107,8 @@ 1 2 - 2 - 3 + 3 + 4 0 0 False @@ -2008,8 +2133,8 @@ 1 2 - 3 - 4 + 4 + 5 0 0 False @@ -2020,6 +2145,84 @@ False + + + GtkLabel + label241 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 3 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label242 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 3 + + 1 + 2 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + eventCause + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 3 + 2 + 3 + 3 + 3 + True + False + False + False + True + False + + @@ -4118,85 +4321,6 @@ - - GtkLabel - label184 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - False - - - - - GtkHBox - hbox28 - False - 0 - - 1 - 2 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - - - GtkOptionMenu - conf - True - Very Low -Low -Normal -High -Very High - - 2 - - 3 - True - True - - - - - GtkCheckButton - priv - True - - False - True - - 5 - False - False - - - - GtkLabel label186 @@ -4307,6 +4431,29 @@ Very High False + + + GtkCheckButton + priv + True + + False + True + + 1 + 2 + 4 + 5 + 0 + 0 + False + False + False + False + True + False + + @@ -4654,85 +4801,6 @@ Very High - - GtkLabel - label213 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 7 - 8 - 0 - 0 - False - False - False - False - True - False - - - - - GtkHBox - hbox32 - False - 0 - - 1 - 2 - 7 - 8 - 0 - 0 - False - False - False - False - True - True - - - - GtkOptionMenu - conf - True - Very Low -Low -Normal -High -Very High - - 2 - - 3 - True - True - - - - - GtkCheckButton - priv - True - - False - True - - 5 - False - False - - - - GtkLabel label214 @@ -4957,6 +5025,29 @@ Very High False + + + GtkCheckButton + priv + True + + False + True + + 1 + 2 + 7 + 8 + 0 + 0 + False + False + False + False + True + False + + diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py index 49469720e..71256f50b 100644 --- a/gramps/src/EditPerson.py +++ b/gramps/src/EditPerson.py @@ -67,7 +67,6 @@ _DEFHTTP = "http://gramps.sourceforge.net" INDEX = "i" EDITPERSON = "p" OBJECT = "o" -MENUVAL = "a" PHOTO = "p" TEXT = "t" NOTEOBJ = "n" @@ -101,6 +100,7 @@ class EditPerson: self.notes_field = self.get_widget("personNotes") self.event_name_field = self.get_widget("eventName") self.event_place_field = self.get_widget("eventPlace") + self.event_cause_field = self.get_widget("eventCause") self.event_date_field = self.get_widget("eventDate") self.event_descr_field = self.get_widget("eventDescription") self.event_details_field = self.get_widget("event_details") @@ -137,8 +137,7 @@ class EditPerson: self.title = self.get_widget("title") self.bdate = self.get_widget("birthDate") self.bplace = self.get_widget("birthPlace") - self.bpcombo = self.get_widget("bp_combo") - self.dpcombo = self.get_widget("dp_combo") + self.dcause = self.get_widget("deathCause") self.ddate = self.get_widget("deathDate") self.dplace = self.get_widget("deathPlace") self.is_male = self.get_widget("genderMale") @@ -173,6 +172,7 @@ class EditPerson: self.window.editable_enters(self.bplace); self.window.editable_enters(self.ddate); self.window.editable_enters(self.dplace); + self.window.editable_enters(self.dcause); self.top.signal_autoconnect({ "destroy_passed_object" : on_cancel_edit, @@ -186,10 +186,8 @@ class EditPerson: "on_aka_update_clicked" : on_aka_update_clicked, "on_apply_person_clicked" : on_apply_person_clicked, "on_attr_list_select_row" : on_attr_list_select_row, - "on_birth_note_clicked" : on_birth_note_clicked, - "on_birth_source_clicked" : on_birth_source_clicked, - "on_death_note_clicked" : on_death_note_clicked, - "on_death_source_clicked" : on_death_source_clicked, + "on_edit_birth_clicked" : on_edit_birth_clicked, + "on_edit_death_clicked" : on_edit_death_clicked, "on_delete_address_clicked" : on_delete_addr_clicked, "on_delete_attr_clicked" : on_delete_attr_clicked, "on_delete_event" : on_delete_event, @@ -224,11 +222,6 @@ class EditPerson: self.attr_list.set_column_visibility(2,Config.show_detail) self.addr_list.set_column_visibility(2,Config.show_detail) - plist = self.db.getPlaceMap().values() - if len(plist) > 0: - utils.attach_places(plist,self.dpcombo,self.death.getPlace()) - utils.attach_places(plist,self.bpcombo,self.birth.getPlace()) - if Config.display_attr: self.get_widget("user_label").set_text(Config.attr_name) val = "" @@ -257,10 +250,7 @@ class EditPerson: self.nick.set_text(person.getNickName()) self.title.set_text(self.pname.getTitle()) - self.bdate.set_text(self.birth.getDate()) - self.bplace.set_text(self.birth.getPlaceName()) - self.ddate.set_text(self.death.getDate()) - self.dplace.set_text(self.death.getPlaceName()) + self.update_birth_death() # load photos into the photo window photo_list = person.getPhotoList() @@ -330,22 +320,27 @@ class EditPerson: def redraw_attr_list(self): utils.redraw_list(self.alist,self.attr_list,disp_attr) - #--------------------------------------------------------------------- - # - # redraw_addr_list - redraws the address list for the person - # - #--------------------------------------------------------------------- def redraw_addr_list(self): + """redraws the address list for the person""" utils.redraw_list(self.plist,self.addr_list,disp_addr) - #--------------------------------------------------------------------- - # - # redraw_event_list - redraws the event list for the person - # - #--------------------------------------------------------------------- def redraw_event_list(self): + """redraws the event list for the person""" utils.redraw_list(self.elist,self.event_list,disp_event) + def update_birth_death(self): + self.bdate.set_text(self.birth.getDate()) + self.bplace.set_text(self.birth.getPlaceName()) + self.ddate.set_text(self.death.getDate()) + self.dplace.set_text(self.death.getPlaceName()) + self.dplace.set_text(self.death.getPlaceName()) + self.dcause.set_text(self.death.getCause()) + self.bdate.set_position(0) + self.ddate.set_position(0) + self.bplace.set_position(0) + self.dplace.set_position(0) + self.dcause.set_position(0) + #------------------------------------------------------------------------- # # add_thumbnail - Scale the image and add it to the IconList. @@ -486,22 +481,9 @@ def did_data_change(obj): if not epo.pname.getSourceRef().are_equal(name.getSourceRef()): changed = 1 - epo.birth.setDate(bdate) - - bplace_obj = utils.get_place_from_list(epo.bpcombo) - if bplace_obj == None and bplace != "": - changed = 1 - epo.birth.setPlace(bplace_obj) - if not epo.birth.are_equal(epo.person.getBirth()): changed = 1 - epo.death.setDate(ddate) - dplace_obj = utils.get_place_from_list(epo.dpcombo) - if dplace_obj == None and dplace != "": - changed = 1 - epo.death.setPlace(dplace_obj) - if not epo.death.are_equal(epo.person.getDeath()): changed = 1 @@ -788,6 +770,14 @@ def on_add_addr_clicked(obj): def on_event_add_clicked(obj): EventEditor(obj.get_data(EDITPERSON),None) +def on_edit_birth_clicked(obj): + person = obj.get_data(EDITPERSON) + EventEditor(person,person.birth) + +def on_edit_death_clicked(obj): + person = obj.get_data(EDITPERSON) + EventEditor(person,person.death) + #------------------------------------------------------------------------- # # on_event_update_clicked @@ -817,6 +807,7 @@ def on_event_select_row(obj,row,b,c): epo.event_date_field.set_text(event.getDate()) epo.event_place_field.set_text(event.getPlaceName()) epo.event_name_field.set_label(const.display_pevent(event.getName())) + epo.event_cause_field.set_text(event.getCause()) epo.event_descr_field.set_text(event.getDescription()) epo.event_details_field.set_text(utils.get_detail_text(event)) @@ -882,7 +873,7 @@ def on_primary_photo_clicked(obj): # actually changed. # #------------------------------------------------------------------------- -def update_event(event,name,date,place,desc,note,priv,conf): +def update_event(event,name,date,place,desc,note,priv,cause): changed = 0 if event.getPlace() != place: @@ -905,14 +896,14 @@ def update_event(event,name,date,place,desc,note,priv,conf): event.setDate(date) changed = 1 + if event.getCause() != cause: + event.setCause(cause) + changed = 1 + if event.getPrivacy() != priv: event.setPrivacy(priv) changed = 1 - if event.getConfidence() != conf: - event.setConfidence(conf) - changed = 1 - return changed #------------------------------------------------------------------------- @@ -924,7 +915,7 @@ def update_event(event,name,date,place,desc,note,priv,conf): # actually changed. # #------------------------------------------------------------------------- -def update_address(addr,date,street,city,state,country,postal,note,priv,conf): +def update_address(addr,date,street,city,state,country,postal,note,priv): changed = 0 d = Date() @@ -961,10 +952,6 @@ def update_address(addr,date,street,city,state,country,postal,note,priv,conf): addr.setPrivacy(priv) changed = 1 - if addr.getConfidence() != conf: - addr.setConfidence(conf) - changed = 1 - return changed #------------------------------------------------------------------------- @@ -976,7 +963,7 @@ def update_address(addr,date,street,city,state,country,postal,note,priv,conf): # actually changed. # #------------------------------------------------------------------------- -def update_attrib(attr,type,value,note,priv,conf): +def update_attrib(attr,type,value,note,priv): changed = 0 if attr.getType() != const.save_pattr(type): @@ -995,10 +982,6 @@ def update_attrib(attr,type,value,note,priv,conf): attr.setPrivacy(priv) changed = 1 - if attr.getConfidence() != conf: - attr.setConfidence(conf) - changed = 1 - return changed #------------------------------------------------------------------------- @@ -1036,7 +1019,7 @@ def update_url(url,des,addr,priv): # actually changed. # #------------------------------------------------------------------------- -def update_name(name,first,last,suffix,note,priv,conf): +def update_name(name,first,last,suffix,note,priv): changed = 0 if name.getFirstName() != first: @@ -1062,10 +1045,6 @@ def update_name(name,first,last,suffix,note,priv,conf): name.setPrivacy(priv) changed = 1 - if name.getConfidence() != conf: - name.setConfidence(conf) - changed = 1 - return changed #------------------------------------------------------------------------- @@ -1174,23 +1153,11 @@ def save_person(obj): epo.birth.setDate(epo.bdate.get_text()) - p1 = utils.get_place_from_list(epo.bpcombo) - if p1 == None and bplace != "": - p1 = Place() - p1.set_title(bplace) - epo.db.addPlace(p1) - epo.birth.setPlace(p1) if not person.getBirth().are_equal(epo.birth): person.setBirth(epo.birth) epo.death.setDate(epo.ddate.get_text()) - p2 = utils.get_place_from_list(epo.dpcombo) - if p2 == None and dplace != "": - p2 = Place() - p2.set_title(dplace) - epo.db.addPlace(p2) - epo.death.setPlace(p2) if not person.getDeath().are_equal(epo.death): person.setDeath(epo.death) @@ -1489,11 +1456,11 @@ class EventEditor: self.place_field = self.top.get_widget("eventPlace") self.place_combo = self.top.get_widget("eventPlace_combo") self.date_field = self.top.get_widget("eventDate") + self.cause_field = self.top.get_widget("eventCause") self.descr_field = self.top.get_widget("eventDescription") self.note_field = self.top.get_widget("eventNote") self.event_menu = self.top.get_widget("personalEvents") self.source_field = self.top.get_widget("event_source") - self.conf_menu = self.top.get_widget("conf") self.priv = self.top.get_widget("priv") name = parent.person.getPrimaryName().getName() @@ -1505,10 +1472,9 @@ class EventEditor: self.window.editable_enters(self.name_field); self.window.editable_enters(self.place_field); self.window.editable_enters(self.date_field); + self.window.editable_enters(self.cause_field); self.window.editable_enters(self.descr_field); - utils.build_confidence_menu(self.conf_menu) - values = self.parent.db.getPlaceMap().values() if event != None: self.name_field.set_text(event.getName()) @@ -1516,9 +1482,8 @@ class EventEditor: utils.attach_places(values,self.place_combo,event.getPlace()) self.place_field.set_text(event.getPlaceName()) self.date_field.set_text(event.getDate()) + self.cause_field.set_text(event.getCause()) self.descr_field.set_text(event.getDescription()) - self.conf_menu.set_history(event.getConfidence()) - self.priv.set_active(event.getPrivacy()) srcref_base = self.event.getSourceRef().getBase() @@ -1532,7 +1497,6 @@ class EventEditor: self.note_field.set_word_wrap(1) else: utils.attach_places(values,self.place_combo,None) - self.conf_menu.set_history(2) self.window.set_data(OBJECT,self) self.top.signal_autoconnect({ @@ -1561,12 +1525,12 @@ def on_event_edit_ok_clicked(obj): ename = ee.name_field.get_text() edate = ee.date_field.get_text() + ecause = ee.cause_field.get_text() eplace = string.strip(ee.place_field.get_text()) eplace_obj = utils.get_place_from_list(ee.place_combo) enote = ee.note_field.get_chars(0,-1) edesc = ee.descr_field.get_text() epriv = ee.priv.get_active() - econf = ee.conf_menu.get_menu().get_active().get_data(MENUVAL) if event == None: event = Event() @@ -1577,7 +1541,7 @@ def on_event_edit_ok_clicked(obj): eplace_obj.set_title(eplace) ee.parent.db.addPlace(eplace_obj) - if update_event(event,ename,edate,eplace_obj,edesc,enote,epriv,econf): + if update_event(event,ename,edate,eplace_obj,edesc,enote,epriv,ecause): ee.parent.lists_changed = 1 if not event.getSourceRef().are_equal(ee.srcref): @@ -1585,6 +1549,7 @@ def on_event_edit_ok_clicked(obj): ee.parent.lists_changed = 1 ee.parent.redraw_event_list() + ee.parent.update_birth_death() utils.destroy_passed_object(obj) #------------------------------------------------------------------------- @@ -1604,7 +1569,6 @@ class AttributeEditor: self.note_field = self.top.get_widget("attr_note") self.attrib_menu = self.top.get_widget("attr_menu") self.source_field = self.top.get_widget("attr_source") - self.conf_menu = self.top.get_widget("conf") self.priv = self.top.get_widget("priv") if self.attrib: self.srcref = SourceRef(self.attrib.getSourceRef()) @@ -1620,16 +1584,6 @@ class AttributeEditor: self.top.get_widget("attrTitle").set_text(_("Attribute Editor for %s") % name) self.attrib_menu.set_popdown_strings(const.personalAttributes) - myMenu = GtkMenu() - index = 0 - for name in const.confidence: - item = GtkMenuItem(name) - item.set_data(MENUVAL,index) - item.show() - myMenu.append(item) - index = index + 1 - self.conf_menu.set_menu(myMenu) - if attrib != None: self.type_field.set_text(attrib.getType()) self.value_field.set_text(attrib.getValue()) @@ -1638,16 +1592,11 @@ class AttributeEditor: self.source_field.set_text(srcref_base.getTitle()) else: self.source_field.set_text("") - - self.conf_menu.set_history(attrib.getConfidence()) - self.priv.set_active(attrib.getPrivacy()) self.note_field.set_point(0) self.note_field.insert_defaults(attrib.getNote()) self.note_field.set_word_wrap(1) - else: - self.conf_menu.set_history(2) self.window.set_data(OBJECT,self) self.top.signal_autoconnect({ @@ -1678,13 +1627,12 @@ def on_attrib_edit_ok_clicked(obj): value = ee.value_field.get_text() note = ee.note_field.get_chars(0,-1) priv = ee.priv.get_active() - conf = ee.conf_menu.get_menu().get_active().get_data(MENUVAL) if attrib == None: attrib = Attribute() ee.parent.alist.append(attrib) - if update_attrib(attrib,type,value,note,priv,conf): + if update_attrib(attrib,type,value,note,priv): ee.parent.lists_changed = 1 if not attrib.getSourceRef().are_equal(ee.srcref): @@ -1712,7 +1660,6 @@ class NameEditor: self.note_field = self.top.get_widget("alt_note") self.source_field = self.top.get_widget("alt_source") self.top.get_widget("alt_surname_list").set_popdown_strings(const.surnames) - self.conf_menu = self.top.get_widget("conf") self.priv = self.top.get_widget("priv") if self.name: self.srcref = SourceRef(self.name.getSourceRef()) @@ -1729,8 +1676,6 @@ class NameEditor: self.window.editable_enters(self.surname_field); self.window.editable_enters(self.suffix_field); - utils.build_confidence_menu(self.conf_menu) - if name != None: self.given_field.set_text(name.getFirstName()) self.surname_field.set_text(name.getSurname()) @@ -1740,13 +1685,10 @@ class NameEditor: self.source_field.set_text(srcref_base.getTitle()) else: self.source_field.set_text("") - self.conf_menu.set_history(name.getConfidence()) self.priv.set_active(name.getPrivacy()) self.note_field.set_point(0) self.note_field.insert_defaults(name.getNote()) self.note_field.set_word_wrap(1) - else: - self.conf_menu.set_history(2) self.window.set_data(OBJECT,self) self.top.signal_autoconnect({ @@ -1778,13 +1720,12 @@ def on_name_edit_ok_clicked(obj): suffix = ee.suffix_field.get_text() note = ee.note_field.get_chars(0,-1) priv = ee.priv.get_active() - conf = ee.conf_menu.get_menu().get_active().get_data(MENUVAL) if name == None: name = Name() ee.parent.nlist.append(name) - if update_name(name,first,last,suffix,note,priv,conf): + if update_name(name,first,last,suffix,note,priv): ee.parent.lists_changed = 1 if not name.getSourceRef().are_equal(ee.srcref): @@ -1814,7 +1755,6 @@ class AddressEditor: self.postal = self.top.get_widget("postal") self.note_field = self.top.get_widget("addr_note") self.source_field = self.top.get_widget("addr_source") - self.conf_menu = self.top.get_widget("conf") self.priv = self.top.get_widget("priv") if self.addr: self.srcref = SourceRef(self.addr.getSourceRef()) @@ -1835,8 +1775,6 @@ class AddressEditor: self.window.editable_enters(self.source_field); self.window.editable_enters(self.note_field); - utils.build_confidence_menu(self.conf_menu) - if addr != None: self.street.set_text(addr.getStreet()) self.city.set_text(addr.getCity()) @@ -1849,13 +1787,10 @@ class AddressEditor: else: self.source_field.set_text("") - self.conf_menu.set_history(addr.getConfidence()) self.priv.set_active(addr.getPrivacy()) self.note_field.set_point(0) self.note_field.insert_defaults(addr.getNote()) self.note_field.set_word_wrap(1) - else: - self.conf_menu.set_history(2) self.window.set_data(OBJECT,self) self.top.signal_autoconnect({ @@ -1890,13 +1825,12 @@ def on_addr_edit_ok_clicked(obj): postal = ee.postal.get_text() note = ee.note_field.get_chars(0,-1) priv = ee.priv.get_active() - conf = ee.conf_menu.get_menu().get_active().get_data(MENUVAL) if addr == None: addr = Address() ee.parent.plist.append(addr) - if update_address(addr,date,street,city,state,country,postal,note,priv,conf): + if update_address(addr,date,street,city,state,country,postal,note,priv): ee.parent.lists_changed = 1 if not addr.getSourceRef().are_equal(ee.srcref): diff --git a/gramps/src/GrampsParser.py b/gramps/src/GrampsParser.py index 3cfda11ef..34887f44a 100644 --- a/gramps/src/GrampsParser.py +++ b/gramps/src/GrampsParser.py @@ -77,6 +77,7 @@ class GrampsParser(handler.ContentHandler): self.scomments_list = [] self.note_list = [] self.tlist = [] + self.conf = 2 self.use_p = 0 self.in_note = 0 @@ -205,7 +206,9 @@ class GrampsParser(handler.ContentHandler): self.event = Event() self.event_type = u2l(attrs["type"]) if attrs.has_key("conf"): - self.event.confidence = int(attrs["conf"]) + self.conf = int(attrs["conf"]) + else: + self.conf = 2 if attrs.has_key("priv"): self.event.private = int(attrs["priv"]) @@ -217,7 +220,9 @@ class GrampsParser(handler.ContentHandler): def start_attribute(self,attrs): self.attribute = Attribute() if attrs.has_key("conf"): - self.attribute.confidence = int(attrs["conf"]) + self.conf = int(attrs["conf"]) + else: + self.conf = 2 if attrs.has_key("priv"): self.attribute.privacy = int(attrs["priv"]) if attrs.has_key('type'): @@ -239,7 +244,9 @@ class GrampsParser(handler.ContentHandler): self.address = Address() self.person.addAddress(self.address) if attrs.has_key("conf"): - self.address.confidence = int(attrs["conf"]) + self.conf = int(attrs["conf"]) + else: + self.conf = 2 if attrs.has_key("priv"): self.address.private = int(attrs["priv"]) @@ -379,7 +386,9 @@ class GrampsParser(handler.ContentHandler): def start_name(self,attrs): self.name = Name() if attrs.has_key("conf"): - self.name.confidence = int(attrs["conf"]) + self.conf = int(attrs["conf"]) + else: + self.conf = 2 if attrs.has_key("priv"): self.name.private = int(attrs["priv"]) @@ -399,6 +408,10 @@ class GrampsParser(handler.ContentHandler): def start_sourceref(self,attrs): self.source_ref = SourceRef() source = self.db.findSourceNoMap(u2l(attrs["ref"])) + if attrs.has_key("conf"): + self.source_ref.confidence = int(u2l(attrs["conf"])) + else: + self.source_ref.confidence = self.conf self.source_ref.setBase(source) if self.event: self.event.setSourceRef(self.source_ref) @@ -611,6 +624,14 @@ class GrampsParser(handler.ContentHandler): def stop_description(self,tag): self.event.setDescription(u2l(tag)) + #--------------------------------------------------------------------- + # + # + # + #--------------------------------------------------------------------- + def stop_cause(self,tag): + self.event.setCause(u2l(tag)) + #--------------------------------------------------------------------- # # @@ -906,6 +927,7 @@ class GrampsParser(handler.ContentHandler): "created" : (start_created, None), "database" : (None, None), "date" : (None, stop_date), + "cause" : (None, stop_cause), "description": (None, stop_description), "event" : (start_event, stop_event), "families" : (None, stop_families), diff --git a/gramps/src/Marriage.py b/gramps/src/Marriage.py index f57eadce2..1e590d8c6 100644 --- a/gramps/src/Marriage.py +++ b/gramps/src/Marriage.py @@ -103,6 +103,7 @@ class Marriage: # widgets self.date_field = self.get_widget("marriageDate") self.place_field = self.get_widget("marriagePlace") + self.cause_field = self.get_widget("marriageCause") self.name_field = self.get_widget("marriageEventName") self.descr_field = self.get_widget("marriageDescription") self.type_field = self.get_widget("marriage_type") @@ -379,6 +380,7 @@ def on_select_row(obj,row,b,c): family_obj.date_field.set_text(event.getDate()) family_obj.place_field.set_text(event.getPlaceName()) + family_obj.cause_field.set_text(event.getCause()) family_obj.name_field.set_label(const.display_fevent(event.getName())) family_obj.event_details.set_text(utils.get_detail_text(event)) family_obj.descr_field.set_text(event.getDescription()) @@ -392,7 +394,7 @@ def on_select_row(obj,row,b,c): # actually changed. # #------------------------------------------------------------------------- -def update_attrib(attr,type,value,note,priv,conf): +def update_attrib(attr,type,value,note,priv): changed = 0 if attr.getType() != const.save_pattr(type): @@ -411,10 +413,6 @@ def update_attrib(attr,type,value,note,priv,conf): attr.setPrivacy(priv) changed = 1 - if attr.getConfidence() != conf: - attr.setConfidence(conf) - changed = 1 - return changed #------------------------------------------------------------------------- @@ -426,7 +424,7 @@ def update_attrib(attr,type,value,note,priv,conf): # actually changed. # #------------------------------------------------------------------------- -def update_event(event,name,date,place,desc,note,priv,conf): +def update_event(event,name,date,place,desc,note,priv,cause): changed = 0 if event.getPlace() != place: event.setPlace(place) @@ -448,14 +446,14 @@ def update_event(event,name,date,place,desc,note,priv,conf): event.setDate(date) changed = 1 + if event.getCause() != cause: + event.setCause(cause) + changed = 1 + if event.getPrivacy() != priv: event.setPrivacy(priv) changed = 1 - if event.getConfidence() != conf: - event.setConfidence(conf) - changed = 1 - return changed #------------------------------------------------------------------------- @@ -734,13 +732,14 @@ class EventEditor: self.window = self.top.get_widget("event_edit") self.name_field = self.top.get_widget("eventName") self.place_field = self.top.get_widget("eventPlace") + self.cause_field = self.top.get_widget("eventCause") self.place_combo = self.top.get_widget("eventPlace_combo") self.date_field = self.top.get_widget("eventDate") + self.cause_field = self.top.get_widget("eventCause") self.descr_field = self.top.get_widget("eventDescription") self.note_field = self.top.get_widget("eventNote") self.event_menu = self.top.get_widget("personalEvents") self.source_field = self.top.get_widget("event_source") - self.conf_menu = self.top.get_widget("conf") self.priv = self.top.get_widget("priv") father = parent.family.getFather() @@ -760,10 +759,9 @@ class EventEditor: self.window.editable_enters(self.name_field); self.window.editable_enters(self.place_field); self.window.editable_enters(self.date_field); + self.window.editable_enters(self.cause_field); self.window.editable_enters(self.descr_field); - utils.build_confidence_menu(self.conf_menu) - values = self.parent.db.getPlaceMap().values() if event != None: self.name_field.set_text(event.getName()) @@ -771,9 +769,8 @@ class EventEditor: utils.attach_places(values,self.place_combo,event.getPlace()) self.place_field.set_text(event.getPlaceName()) self.date_field.set_text(event.getDate()) + self.cause_field.set_text(event.getCause()) self.descr_field.set_text(event.getDescription()) - self.conf_menu.set_history(event.getConfidence()) - self.priv.set_active(event.getPrivacy()) srcref_base = self.event.getSourceRef().getBase() @@ -787,7 +784,6 @@ class EventEditor: self.note_field.set_word_wrap(1) else: utils.attach_places(values,self.place_combo,None) - self.conf_menu.set_history(2) self.window.set_data("o",self) self.top.signal_autoconnect({ @@ -816,12 +812,12 @@ def on_event_edit_ok_clicked(obj): ename = ee.name_field.get_text() edate = ee.date_field.get_text() + ecause = ee.cause_field.get_text() eplace = string.strip(ee.place_field.get_text()) eplace_obj = utils.get_place_from_list(ee.place_combo) enote = ee.note_field.get_chars(0,-1) edesc = ee.descr_field.get_text() epriv = ee.priv.get_active() - econf = ee.conf_menu.get_menu().get_active().get_data("a") if event == None: event = Event() @@ -832,7 +828,7 @@ def on_event_edit_ok_clicked(obj): eplace_obj.set_title(eplace) ee.parent.db.addPlace(eplace_obj) - if update_event(event,ename,edate,eplace_obj,edesc,enote,epriv,econf): + if update_event(event,ename,edate,eplace_obj,edesc,enote,epriv,ecause): ee.parent.lists_changed = 1 if not source_refs_equal(event.getSourceRef(),ee.srcref): @@ -859,7 +855,6 @@ class AttributeEditor: self.note_field = self.top.get_widget("attr_note") self.attrib_menu = self.top.get_widget("attr_menu") self.source_field = self.top.get_widget("attr_source") - self.conf_menu = self.top.get_widget("conf") self.priv = self.top.get_widget("priv") if self.attrib: self.srcref = SourceRef(self.attrib.getSourceRef()) @@ -885,8 +880,6 @@ class AttributeEditor: if len(const.familyAttributes) > 0: self.attrib_menu.set_popdown_strings(const.familyAttributes) - utils.build_confidence_menu(self.conf_menu) - if attrib != None: self.type_field.set_text(attrib.getType()) self.value_field.set_text(attrib.getValue()) @@ -896,14 +889,11 @@ class AttributeEditor: else: self.source_field.set_text("") - self.conf_menu.set_history(attrib.getConfidence()) self.priv.set_active(attrib.getPrivacy()) self.note_field.set_point(0) self.note_field.insert_defaults(attrib.getNote()) self.note_field.set_word_wrap(1) - else: - self.conf_menu.set_history(2) self.window.set_data("o",self) self.top.signal_autoconnect({ @@ -934,13 +924,12 @@ def on_attrib_edit_ok_clicked(obj): value = ee.value_field.get_text() note = ee.note_field.get_chars(0,-1) priv = ee.priv.get_active() - conf = ee.conf_menu.get_menu().get_active().get_data("a") if attrib == None: attrib = Attribute() ee.parent.alist.append(attrib) - if update_attrib(attrib,type,value,note,priv,conf): + if update_attrib(attrib,type,value,note,priv): ee.parent.lists_changed = 1 if not source_refs_equal(attrib.getSourceRef(),ee.srcref): diff --git a/gramps/src/ReadXML.py b/gramps/src/ReadXML.py index 29094ded3..157f9b59c 100644 --- a/gramps/src/ReadXML.py +++ b/gramps/src/ReadXML.py @@ -187,6 +187,48 @@ def loadData(database, filename, callback=None): xml_file.close() return 1 +#------------------------------------------------------------------------- +# +# Initialization function for the module. Called to start the reading +# of data. +# +#------------------------------------------------------------------------- +def loadRevision(database, file, filename, revision, callback=None): + + basefile = os.path.dirname(filename) + database.smap = {} + database.pmap = {} + database.fmap = {} + + parser = make_parser() + parser.setContentHandler(GrampsParser(database,callback,basefile)) + + filename = _("%s (revision %s)") % (filename,revision) + + try: + parser.parse(file) + except SAXParseException,msg: + line = string.split(str(msg),':') + filemsg = _("%s is a corrupt file.") % filename + errtype = string.strip(line[3]) + errmsg = _('A "%s" error on line %s was detected.') % (errtype,line[1]) + GnomeErrorDialog("%s\n%s" % (filemsg,errmsg)) + return 0 + except IOError,msg: + errmsg = "%s\n%s" % (_("Error reading %s") % filename, str(msg)) + GnomeErrorDialog(errmsg) + import traceback + traceback.print_exc() + return 0 + except: + GnomeErrorDialog(_("Error reading %s") % filename) + import traceback + traceback.print_exc() + return 0 + + file.close() + return 1 + if __name__ == "__main__": import profile diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index 0b49a7c42..67c70a0d7 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -82,18 +82,15 @@ class SourceNote: return self.note class DataObj(SourceNote): - """Base class for data elements, providing source, note, privacy, - and confidence data""" + """Base class for data elements, providing source, note, and privacy data""" def __init__(self,source=None): """Create a new DataObj, copying data from a source object if provided""" SourceNote.__init__(self,source) if source: - self.confidence = source.confidence self.private = source.private else: - self.confidence = CONF_NORMAL self.private = 0 def setPrivacy(self,val): @@ -104,15 +101,6 @@ class DataObj(SourceNote): """Returns the privacy level of the data""" return self.private - def setConfidence(self,val): - """Sets the confidence level""" - self.confidence = val - - def getConfidence(self): - """Returns the confidence level""" - return self.confidence - - class Place(SourceNote): """Contains information related to a place, including multiple address information (since place names can change with time), longitude, latitude, @@ -593,8 +581,6 @@ class Name(DataObj): return 0 if self.private != other.private: return 0 - if self.confidence != other.confidence: - return 0 if self.getNote() != other.getNote(): return 0 if not self.getSourceRef().are_equal(other.getSourceRef()): @@ -913,11 +899,13 @@ class Event(DataObj): self.date = Date(source.date) self.description = source.description self.name = source.name + self.cause = source.cause else: self.place = None self.date = Date() self.description = "" self.name = "" + self.cause = "" def set(self,name,date,place,description): """sets the name, date, place, and description of an Event instance""" @@ -938,7 +926,7 @@ class Event(DataObj): return 0 if self.description != other.description: return 0 - if self.confidence != other.confidence: + if self.cause != other.cause: return 0 if self.private != other.private: return 0 @@ -962,6 +950,14 @@ class Event(DataObj): """returns the Place instance of the Event""" return self.place + def setCause(self,cause): + """sets the cause of the Event""" + self.cause = cause + + def getCause(self): + """returns the cause of the Event""" + return self.cause + def getPlaceName(self): """returns the title of the Place associated with the Event""" if self.place: @@ -1234,18 +1230,28 @@ class SourceRef: def __init__(self,source=None): """creates a new SourceRef, copying from the source if present""" if source: + self.confidence = source.confidence self.ref = source.ref self.page = source.page self.date = Date(source.date) self.comments = Note(source.comments.get()) self.text = source.text else: + self.confidence = CONF_NORMAL self.ref = None self.page = "" self.date = Date() self.comments = Note() self.text = "" + def setConfidence(self,val): + """Sets the confidence level""" + self.confidence = val + + def getConfidence(self): + """Returns the confidence level""" + return self.confidence + def setBase(self,ref): """sets the Source instance to which the SourceRef refers""" self.ref = ref @@ -1301,6 +1307,8 @@ class SourceRef: return 0 if self.getComments() != other.getComments(): return 0 + if self.confidence != other.confidence: + return 0 return 1 elif not self.ref and not other.ref: return 1 diff --git a/gramps/src/Sources.py b/gramps/src/Sources.py index b990bf2b5..0324d68c6 100644 --- a/gramps/src/Sources.py +++ b/gramps/src/Sources.py @@ -46,6 +46,7 @@ from RelLib import * SOURCEDISP = "s" ACTIVESRC = "a" INDEX = "i" +MENUVAL = "a" #------------------------------------------------------------------------- # @@ -74,7 +75,10 @@ class SourceEditor: self.source_field = self.get_widget("sourceList") self.title_menu = self.get_widget("source_title") self.title_menu.set_data("o",self) - + self.conf_menu = self.get_widget("conf") + utils.build_confidence_menu(self.conf_menu) + self.conf_menu.set_history(srcref.getConfidence()) + self.author_field = self.get_widget("sauthor") self.pub_field = self.get_widget("spubinfo") @@ -189,12 +193,14 @@ def on_sourceok_clicked(obj): page = src_edit.get_widget("spage").get_text() date = src_edit.get_widget("sdate").get_text() text = src_edit.get_widget("stext").get_chars(0,-1) + conf = src_edit.get_widget("conf").get_menu().get_active().get_data(MENUVAL) comments = src_edit.get_widget("scomment").get_chars(0,-1) src_edit.source_ref.setPage(page) src_edit.source_ref.getDate().set(date) src_edit.source_ref.setText(text) src_edit.source_ref.setComments(comments) + src_edit.source_ref.setConfidence(conf) if src_edit.update: if src_edit.source_ref.getBase(): @@ -229,3 +235,4 @@ def on_source_changed(obj): src_entry.get_widget("sdate").set_sensitive(active) src_entry.get_widget("stext").set_sensitive(active) src_entry.get_widget("scomment").set_sensitive(active) + src_entry.get_widget("conf").set_sensitive(active) diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py index 0cf5d142f..d7ab9c29b 100644 --- a/gramps/src/WriteXML.py +++ b/gramps/src/WriteXML.py @@ -89,15 +89,10 @@ def dump_event(g,event,index=1): # #------------------------------------------------------------------------- def conf_priv(obj): - if obj.getConfidence() != 2: - cnf = ' conf="%d" ' % obj.getConfidence() - else: - cnf = '' if obj.getPrivacy() != 0: - priv = ' priv="%d"' % obj.getPrivacy() + return ' priv="%d"' % obj.getPrivacy() else: - priv = '' - return "%s%s" % (cnf,priv) + return '' #------------------------------------------------------------------------- # @@ -111,6 +106,7 @@ def dump_my_event(g,name,event,index=1): date = event.getSaveDate() place = event.getPlace() description = event.getDescription() + cause = event.getCause() if (not name or name == "Birth" or name == "Death") and \ not date and not place and not description: return @@ -119,6 +115,7 @@ def dump_my_event(g,name,event,index=1): g.write('%s\n' % (sp,fix(name),conf_priv(event))) write_line(g,"date",date,index+1) write_ref(g,"place",place,index+1) + write_line(g,"cause",cause,index+1) write_line(g,"description",description,index+1) if event.getNote() != "": writeNote(g,"note",event.getNote(),index+1) @@ -139,11 +136,15 @@ def dump_source_ref(g,source_ref,index=1): c = source_ref.getComments() t = source_ref.getText() d = source_ref.getDate().getSaveDate() + q = source_ref.getConfidence() g.write(" " * index) - if p == "" and c == "" and t == "" and d == "": + if p == "" and c == "" and t == "" and d == "" and q == 2: g.write('\n' % source.getId()) else: - g.write('\n' % source.getId()) + if q == 2: + g.write('\n' % source.getId()) + else: + g.write('\n' % (source.getId(),q)) write_line(g,"spage",p,index+1) writeNote(g,"scomments",c,index+1) writeNote(g,"stext",t,index+1) diff --git a/gramps/src/config.glade b/gramps/src/config.glade index 94fea54a2..bfdeb355b 100644 --- a/gramps/src/config.glade +++ b/gramps/src/config.glade @@ -59,71 +59,12 @@ GtkTable table13 - 6 + 3 2 False 0 0 - - GtkEntry - attr_name - True - - changed - on_object_toggled - propertybox - Thu, 24 May 2001 21:14:30 GMT - - True - True - 0 - - - 1 - 2 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - - GtkCheckButton - attr_display - True - - toggled - on_object_toggled - propertybox - Thu, 24 May 2001 21:14:10 GMT - - - False - True - - 0 - 1 - 5 - 6 - 5 - 5 - False - False - False - False - True - False - - - GtkCheckButton autoload @@ -182,6 +123,140 @@ + + GtkCheckButton + use_vc + True + + toggled + on_object_toggled + propertybox + Tue, 02 Oct 2001 14:14:35 GMT + + + False + True + + 0 + 1 + 2 + 3 + 5 + 5 + False + False + False + False + True + False + + + + + GtkOptionMenu + vc_menu + True + RCS + + 0 + + 1 + 2 + 2 + 3 + 5 + 5 + True + False + False + False + True + False + + + + + + GtkLabel + Notebook:tab + label61 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkTable + table27 + 4 + 2 + False + 0 + 0 + + + GtkEntry + attr_name + True + + changed + on_object_toggled + propertybox + Thu, 24 May 2001 21:14:30 GMT + + True + True + 0 + + + 1 + 2 + 3 + 4 + 0 + 0 + True + False + False + False + True + False + + + + + GtkCheckButton + attr_display + True + + toggled + on_object_toggled + propertybox + Thu, 24 May 2001 21:14:10 GMT + + + False + True + + 0 + 1 + 3 + 4 + 5 + 5 + False + False + False + False + True + False + + + GtkCheckButton usetabs @@ -198,8 +273,8 @@ 0 2 - 2 - 3 + 0 + 1 5 5 False @@ -227,8 +302,8 @@ 0 2 - 3 - 4 + 1 + 2 5 5 False @@ -256,8 +331,8 @@ 0 2 - 4 - 5 + 2 + 3 5 5 False @@ -273,8 +348,8 @@ GtkLabel Notebook:tab - label61 - + label209 + GTK_JUSTIFY_CENTER False 0.5 diff --git a/gramps/src/const.py b/gramps/src/const.py index 7cf2297b8..f4ccf2879 100644 --- a/gramps/src/const.py +++ b/gramps/src/const.py @@ -75,7 +75,7 @@ gtkrcFile = rootDir + os.sep + "gtkrc" # #------------------------------------------------------------------------- progName = "gramps" -version = "0.5.1" +version = "0.6.0pre" copyright = "(C) 2001 Donald N. Allingham" authors = ["Donald N. Allingham"] comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program that can be extended by using the Python programming language.") diff --git a/gramps/src/dialog.glade b/gramps/src/dialog.glade index a8f4a2179..ea6adbea0 100644 --- a/gramps/src/dialog.glade +++ b/gramps/src/dialog.glade @@ -125,7 +125,7 @@ GtkTable table21 - 7 + 8 2 False 0 @@ -201,8 +201,8 @@ 0 1 - 3 - 4 + 4 + 5 0 0 False @@ -248,8 +248,8 @@ 1 2 - 3 - 4 + 4 + 5 3 3 True @@ -321,8 +321,8 @@ 0 1 - 4 - 5 + 5 + 6 0 0 False @@ -407,8 +407,8 @@ 1 2 - 6 - 7 + 7 + 8 3 3 False @@ -441,8 +441,8 @@ 0 1 - 6 - 7 + 7 + 8 0 0 False @@ -462,8 +462,8 @@ 1 2 - 4 - 5 + 5 + 6 0 0 False @@ -512,20 +512,17 @@ - GtkLabel - label178 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 8 + GtkCheckButton + priv + True + + False + True - 0 - 1 - 5 - 6 + 1 + 2 + 6 + 7 0 0 False @@ -538,15 +535,20 @@ - GtkHBox - hbox24 - False - 0 + GtkLabel + causelabel + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 - 1 - 2 - 5 - 6 + 0 + 1 + 3 + 4 0 0 False @@ -554,40 +556,32 @@ False False True - True + False + - - GtkOptionMenu - conf - True - Very Low -Low -Normal -High -Very High - - 0 - - 3 - True - True - - - - - GtkCheckButton - priv - True - - False - True - - 5 - False - False - - + + GtkEntry + eventCause + True + True + True + 0 + + + 1 + 2 + 3 + 4 + 3 + 3 + True + False + False + False + True + False + @@ -974,36 +968,12 @@ Very High - GtkLabel - label177 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 8 - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - - - - - GtkHBox - hbox25 - False - 0 + GtkCheckButton + priv + True + + False + True 1 2 @@ -1016,40 +986,8 @@ Very High False False True - True + False - - - GtkOptionMenu - conf - True - Very Low -Low -Normal -High -Very High - - 0 - - 3 - True - True - - - - - GtkCheckButton - priv - True - - False - True - - 5 - False - False - - diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index b1b29aadc..f16a2be03 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -4738,7 +4738,7 @@ Unknown GtkTable table19 - 4 + 5 2 False 0 @@ -4759,8 +4759,8 @@ Unknown 1 2 - 3 - 4 + 4 + 5 5 5 False @@ -4792,8 +4792,8 @@ Unknown 1 2 - 2 - 3 + 3 + 4 5 5 False @@ -4824,8 +4824,8 @@ Unknown 1 2 - 1 - 2 + 2 + 3 5 5 True @@ -4848,8 +4848,8 @@ Unknown 1 2 - 0 - 1 + 1 + 2 5 5 True @@ -4867,15 +4867,15 @@ Unknown GTK_JUSTIFY_CENTER False - 0.5 + 1 0.5 5 0 0 1 - 0 - 1 + 1 + 2 0 0 True @@ -4900,8 +4900,8 @@ Unknown 0 1 - 1 - 2 + 2 + 3 0 0 True @@ -4926,8 +4926,8 @@ Unknown 0 1 - 2 - 3 + 3 + 4 0 0 True @@ -4952,8 +4952,8 @@ Unknown 0 1 - 3 - 4 + 4 + 5 0 0 True @@ -4964,6 +4964,59 @@ Unknown True + + + GtkLabel + label243 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkOptionMenu + conf + True + Very Low +Low +Normal +High +Very High + + 2 + + 1 + 2 + 0 + 1 + 5 + 5 + False + False + False + False + True + False + + @@ -6049,4 +6102,365 @@ Unknown + + GnomeDialog + dbopen + Gramps - Open a database + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox15 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area15 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button127 + True + True + + clicked + on_ok_button1_clicked + dbopen + Wed, 03 Oct 2001 02:55:59 GMT + + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button129 + True + True + + clicked + destroy_passed_object + dbopen + Wed, 03 Oct 2001 02:56:46 GMT + + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkVBox + vbox44 + False + 0 + + 0 + False + True + + + + GtkLabel + label245 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 5 + False + False + + + + + GtkHSeparator + hseparator24 + + 10 + True + True + + + + + GtkHBox + hbox33 + False + 0 + + 0 + True + True + + + + GtkLabel + label246 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 5 + 5 + + 0 + False + False + + + + + GnomeFileEntry + dbname + 400 + recentdbs + 15 + Open a GRAMPS Databases + True + False + + 0 + True + True + + + + GtkEntry + GnomeEntry:entry + combo-entry2 + True + True + True + 0 + + + + + + + GtkCheckButton + getoldrev + 10 + True + + False + True + + 0 + False + False + + + + + + + + GnomeDialog + revselect + Gramps - Select an older revision + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox16 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area16 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button132 + True + True + + clicked + on_loadrev_clicked + revselect + Wed, 03 Oct 2001 04:33:08 GMT + + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button134 + True + True + + clicked + destroy_passed_object + revselect + Wed, 03 Oct 2001 04:32:38 GMT + + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkVBox + vbox45 + False + 0 + + 0 + True + True + + + + GtkLabel + label247 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkHSeparator + hseparator25 + + 5 + False + True + + + + + GtkScrolledWindow + scrolledwindow29 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkCList + revlist + 500 + 200 + True + 3 + 77,128,80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN + + + GtkLabel + CList:title + label250 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + label251 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + comlabel + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + + diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 81b4f4074..d143f5ba1 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -68,7 +68,7 @@ import EditPerson import EditPlace import Marriage import Find - +import VersionControl #------------------------------------------------------------------------- # # Global variables. @@ -1105,12 +1105,55 @@ def on_reports_clicked(obj): #------------------------------------------------------------------------- def on_ok_button1_clicked(obj): new_database_response(0) - filename = obj.get_filename() + dbname = obj.get_data("dbname") + getoldrev = obj.get_data("getoldrev") + filename = dbname.get_full_path(1) utils.destroy_passed_object(obj) - if filename != "": - read_file(filename) + if getoldrev.get_active(): + dialog = libglade.GladeXML(const.gladeFile, "revselect") + revsel = dialog.get_widget("revselect") + dialog.signal_autoconnect({ + "destroy_passed_object" : utils.destroy_passed_object, + "on_loadrev_clicked" : on_loadrev_clicked, + }) + revlist = dialog.get_widget("revlist") + revsel.set_data("o",revlist) + vc = VersionControl.RcsVersionControl(filename) + l = vc.revision_list() + l.reverse() + index = 0 + for f in l: + revlist.append([f[0],f[1],f[2]]) + revlist.set_row_data(index,f[0]) + index = index + 1 + revlist.set_data("n",filename) + else: + if filename != "": + read_file(filename) +def on_loadrev_clicked(obj): + clist = obj.get_data("o") + filename = clist.get_data("n") + if len(clist.selection) > 0: + rev = clist.get_row_data(clist.selection[0]) + vc = VersionControl.RcsVersionControl(filename) + f = vc.get_version(rev) + load_revision(f,filename,rev) + utils.destroy_passed_object(obj) + + active_person = None + for person in database.getPersonMap().values(): + if active_person == None: + active_person = person + lastname = person.getPrimaryName().getSurname() + if lastname and lastname not in const.surnames: + const.surnames.append(lastname) + + statusbar.set_progress(1.0) + full_update() + statusbar.set_progress(0.0) + #------------------------------------------------------------------------- # # @@ -1144,6 +1187,39 @@ def read_file(filename): full_update() statusbar.set_progress(0.0) +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def read_revision(filename,rev): + base = os.path.basename(filename) + if base == const.indexFile: + filename = os.path.dirname(filename) + elif not os.path.isdir(filename): + displayError(_("%s is not a directory") % filename) + return + + statusbar.set_status(_("Loading %s ...") % filename) + + if load_database(filename) == 1: + topWindow.set_title("%s - %s" % (_("Gramps"),filename)) + else: + statusbar.set_status("") + Config.save_last_file("") + + active_person = None + for person in database.getPersonMap().values(): + if active_person == None: + active_person = person + lastname = person.getPrimaryName().getSurname() + if lastname and lastname not in const.surnames: + const.surnames.append(lastname) + + statusbar.set_progress(1.0) + full_update() + statusbar.set_progress(0.0) + #------------------------------------------------------------------------- # # Called from the fileselector, when the OK button is pressed (Save @@ -1164,7 +1240,9 @@ def on_ok_button2_clicked(obj): #------------------------------------------------------------------------- def save_file(filename): import WriteXML + import VersionControl + path = filename filename = os.path.normpath(filename) statusbar.set_status(_("Saving %s ...") % filename) @@ -1199,6 +1277,11 @@ def save_file(filename): database.setSavePath(old_file) utils.clearModified() Config.save_last_file(old_file) + + if Config.usevc: + vc = VersionControl.RcsVersionControl(path) + vc.checkin(filename,"comments not supported yet",not Config.uncompress) + statusbar.set_status("") statusbar.set_progress(0) @@ -1839,14 +1922,19 @@ def on_spouse_list_select_row(obj,row,b,c): # #------------------------------------------------------------------------- def on_open_activate(obj): - wFs = libglade.GladeXML (const.gladeFile, FILESEL) + wFs = libglade.GladeXML(const.gladeFile, "dbopen") wFs.signal_autoconnect({ "on_ok_button1_clicked": on_ok_button1_clicked, "destroy_passed_object": utils.destroy_passed_object }) - fileSelector = wFs.get_widget(FILESEL) - fileSelector.set_filename(Config.db_dir) + fileSelector = wFs.get_widget("dbopen") + dbname = wFs.get_widget("dbname") + getoldrev = wFs.get_widget("getoldrev") + fileSelector.set_data("dbname",dbname) + dbname.set_default_path(Config.db_dir) + fileSelector.set_data("getoldrev",getoldrev) + getoldrev.set_sensitive(Config.usevc) fileSelector.show() #------------------------------------------------------------------------- @@ -2786,6 +2874,59 @@ def load_database(name): active_person = person return 1 +def load_revision(f,name,revision): + global active_person + + filename = name + os.sep + const.indexFile + + if ReadXML.loadRevision(database,f,filename, revision,load_progress) == 0: + return 0 + + database.setSavePath(name) + + res = database.getResearcher() + if res.getName() == "" and Config.owner.getName() != "": + database.setResearcher(Config.owner) + utils.modified() + + setup_bookmarks() + + mylist = database.getPersonEventTypes() + for type in mylist: + ntype = const.display_pevent(type) + if ntype not in const.personalEvents: + const.personalEvents.append(ntype) + + mylist = database.getFamilyEventTypes() + for type in mylist: + ntype = const.display_fevent(type) + if ntype not in const.marriageEvents: + const.marriageEvents.append(ntype) + + mylist = database.getPersonAttributeTypes() + for type in mylist: + ntype = const.display_pattr(type) + if ntype not in const.personalAttributes: + const.personalAttributes.append(ntype) + + mylist = database.getFamilyAttributeTypes() + for type in mylist: + if type not in const.familyAttributes: + const.familyAttributes.append(type) + + mylist = database.getFamilyRelationTypes() + for type in mylist: + if type not in const.familyRelations: + const.familyRelations.append(type) + + Config.save_last_file(name) + gtop.get_widget("filter").set_text("") + + person = database.getDefaultPerson() + if person: + active_person = person + return 1 + #------------------------------------------------------------------------- # # diff --git a/gramps/src/marriage.glade b/gramps/src/marriage.glade index 99829d3ac..023bfe20a 100644 --- a/gramps/src/marriage.glade +++ b/gramps/src/marriage.glade @@ -318,7 +318,7 @@ GtkTable table8 - 4 + 5 3 False 0 @@ -389,8 +389,8 @@ 0 1 - 2 - 3 + 3 + 4 0 0 False @@ -467,8 +467,8 @@ 2 3 - 2 - 3 + 3 + 4 3 3 True @@ -493,8 +493,8 @@ 0 1 - 3 - 4 + 4 + 5 0 0 False @@ -519,8 +519,8 @@ 2 3 - 3 - 4 + 4 + 5 3 3 True @@ -597,8 +597,8 @@ 1 2 - 2 - 3 + 3 + 4 0 0 False @@ -623,8 +623,86 @@ 1 2 - 3 - 4 + 4 + 5 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label230 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 3 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label231 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + marriageCause + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 3 + 2 + 3 0 0 False diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py index 07fcb65e2..9047dd42c 100644 --- a/gramps/src/plugins/ReadGedcom.py +++ b/gramps/src/plugins/ReadGedcom.py @@ -496,7 +496,6 @@ class GedcomParser: elif matches[1] == "CHIL": mrel,frel = self.parse_ftw_relations(2) child = self.db.findPerson(matches[2],self.pmap) - print child.getPrimaryName().getName(),mrel,frel self.family.addChild(child) if (mrel == "Birth" or mrel == "") and \ (frel == "Birth" or frel == "") : @@ -967,10 +966,7 @@ class GedcomParser: self.ignore_sub_junk(level+1) elif matches[1] == "CAUS": info = matches[2] + self.parse_continue_data(level+1) - if note == "": - note = "%s: %s" % (_("Cause of Death"), info) - else: - note = "%s\n%s: %s" % (note,_("Cause of Death"), info) + event.setCause(info) elif matches[1] == "NOTE": info = matches[2] + self.parse_continue_data(level+1) if note == "": @@ -1061,12 +1057,8 @@ class GedcomParser: else: self.barf(level+1) - #--------------------------------------------------------------------- - # - # - # - #--------------------------------------------------------------------- def parse_source_reference(self,source,level): + """Reads the data associated with a SOUR reference""" while 1: matches = self.get_next() @@ -1082,7 +1074,11 @@ class GedcomParser: source.setDate(d) source.setText(text) elif matches[1] == "QUAY": - pass + val = int(matches[2]) + if val > 1: + source.setConfidence(val+1) + else: + source.setConfidence(val) elif matches[1] == "NOTE": if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@": note = matches[1] + self.parse_continue_data(1) @@ -1099,11 +1095,7 @@ class GedcomParser: self.barf(level+1) def parse_source_data(self,level): - #--------------------------------------------------------------------- - # - # - # - #--------------------------------------------------------------------- + """Parses the source data""" date = "" note = "" while 1: @@ -1120,12 +1112,8 @@ class GedcomParser: else: self.barf(level+1) - #--------------------------------------------------------------------- - # - # - # - #--------------------------------------------------------------------- def parse_name(self,name,level): + """Parses the person's name information""" while 1: matches = self.get_next() @@ -1174,12 +1162,8 @@ class GedcomParser: else: self.barf(level+1) - #--------------------------------------------------------------------- - # - # - # - #--------------------------------------------------------------------- def parse_header_head(self): + """validiates that this is a valid GEDCOM file""" line = string.replace(self.lines[self.index],'\r','') match = headRE.search(line) if not match: