diff --git a/NEWS b/NEWS index 849299998..103b7d4c9 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ Version 0.5.1post * Support for QUAY on GEDCOM import. * Confidence level moved to SourceReference instead of object * Support for revision control +* Support for multiple sources per item +* Improved GEDCOM import time +* Support of NCHI and CAUS on GEDCOM import +* All fields of birth and death events are editable. Clicking the + Edit button brings up the event editor. Birth and death fields + on the Edit Person dialog are now read only. +* Support for unknown gender Version 0.5.1 * Bug fixes diff --git a/src/Bookmarks.py b/src/Bookmarks.py index eb3a63330..1bfe4b200 100644 --- a/src/Bookmarks.py +++ b/src/Bookmarks.py @@ -42,8 +42,6 @@ import utils # #------------------------------------------------------------------------- OBJECT = "o" -ROWS = "r" -INDEX = "i" TOPINST = "top" NAMEINST = "namelist" @@ -123,24 +121,16 @@ class Bookmarks : def edit(self): top = libglade.GladeXML(const.bookFile,TOPINST) namelist = top.get_widget(NAMEINST) - self.index = 0 + index = 0 for person in self.bookmarks: namelist.append([person.getPrimaryName().getName()]) - namelist.set_row_data(self.index,person) - self.index = self.index + 1 + namelist.set_row_data(index,person) + index = index + 1 - if self.index > 0: - namelist.select_row(0,0) - namelist.set_data(INDEX,0) - else: - namelist.set_data(INDEX,-1) - namelist.set_data(ROWS,self.index) - top.signal_autoconnect({ "on_ok_clicked" : on_ok_clicked, "on_down_clicked" : on_down_clicked, "on_up_clicked" : on_up_clicked, - "on_namelist_select_row" : on_namelist_select_row, "on_delete_clicked" : on_delete_clicked, "on_cancel_clicked" : on_cancel_clicked }) @@ -150,15 +140,6 @@ class Bookmarks : topBox.set_data(NAMEINST,namelist) topBox.show() -#------------------------------------------------------------------------- -# -# on_namelist_select_row - changes the selected row stored on the namelist -# to the row that was just selected. -# -#------------------------------------------------------------------------- -def on_namelist_select_row(obj,row,junk,junk2): - obj.set_data(INDEX,row) - #------------------------------------------------------------------------- # # on_delete_clicked - gets the selected row and number of rows that have @@ -168,15 +149,9 @@ def on_namelist_select_row(obj,row,junk,junk2): # #------------------------------------------------------------------------- def on_delete_clicked(obj): - index = obj.get_data(INDEX) - rows = obj.get_data(ROWS) - if index >= 0: + if len(obj.selection) > 0: + index = obj.selection[0] obj.remove(index) - obj.set_data(ROWS,rows-1) - if index != 0: - obj.select_row(0,0) - else: - obj.unselect_all() #------------------------------------------------------------------------- # @@ -184,10 +159,9 @@ def on_delete_clicked(obj): # #------------------------------------------------------------------------- def on_up_clicked(obj): - index = obj.get_data(INDEX) - if index > 0: + if len(obj.selection) > 0: + index = obj.selection[0] obj.swap_rows(index-1,index) - obj.set_data(INDEX,index-1) #------------------------------------------------------------------------- # @@ -195,11 +169,10 @@ def on_up_clicked(obj): # #------------------------------------------------------------------------- def on_down_clicked(obj): - index = obj.get_data(INDEX) - rows = obj.get_data(ROWS) - if index != rows-1: - obj.swap_rows(index+1,index) - obj.set_data(INDEX,index+1) + if len(obj.selection) > 0: + index = obj.selection[0] + if index != obj.rows-1: + obj.swap_rows(index+1,index) #------------------------------------------------------------------------- # diff --git a/src/EditPerson.py b/src/EditPerson.py index 2aeece9cf..ac73ce7fb 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -65,7 +65,6 @@ _DEFHTTP = "http://gramps.sourceforge.net" # names. # #------------------------------------------------------------------------- -INDEX = "i" EDITPERSON = "p" OBJECT = "o" PHOTO = "p" @@ -248,7 +247,7 @@ class EditPerson: if person.getGender() == Person.male: self.is_male.set_active(1) - elif person.getGender() == Person.male: + elif person.getGender() == Person.female: self.is_female.set_active(1) else: self.is_unknown.set_active(1) @@ -270,15 +269,10 @@ class EditPerson: # stored object data self.edit_person.set_data(EDITPERSON,self) self.event_list.set_data(EDITPERSON,self) - self.event_list.set_data(INDEX,-1) self.name_list.set_data(EDITPERSON,self) - self.name_list.set_data(INDEX,-1) self.web_list.set_data(EDITPERSON,self) - self.web_list.set_data(INDEX,-1) self.attr_list.set_data(EDITPERSON,self) - self.attr_list.set_data(INDEX,-1) self.addr_list.set_data(EDITPERSON,self) - self.addr_list.set_data(INDEX,-1) # draw lists self.redraw_event_list() @@ -588,7 +582,6 @@ def on_delete_event(obj,b): # #------------------------------------------------------------------------- def on_name_list_select_row(obj,row,b,c): - obj.set_data(INDEX,row) epo = obj.get_data(EDITPERSON) name = obj.get_row_data(row) @@ -607,7 +600,6 @@ def on_name_list_select_row(obj,row,b,c): # #------------------------------------------------------------------------- def on_web_list_select_row(obj,row,b,c): - obj.set_data(INDEX,row) epo = obj.get_data(EDITPERSON) url = obj.get_row_data(row) @@ -630,7 +622,6 @@ def on_web_list_select_row(obj,row,b,c): # #------------------------------------------------------------------------- def on_attr_list_select_row(obj,row,b,c): - obj.set_data(INDEX,row) epo = obj.get_data(EDITPERSON) attr = obj.get_row_data(row) @@ -647,7 +638,6 @@ def on_attr_list_select_row(obj,row,b,c): # #------------------------------------------------------------------------- def on_addr_list_select_row(obj,row,b,c): - obj.set_data(INDEX,row) epo = obj.get_data(EDITPERSON) a = obj.get_row_data(row) @@ -668,9 +658,8 @@ def on_addr_list_select_row(obj,row,b,c): # #------------------------------------------------------------------------- def on_aka_update_clicked(obj): - row = obj.get_data(INDEX) - if row >= 0: - NameEditor(obj.get_data(EDITPERSON),obj.get_row_data(row)) + if len(obj.selection) >= 0: + NameEditor(obj.get_data(EDITPERSON),obj.get_row_data(obj.selection[0])) #------------------------------------------------------------------------- # @@ -678,9 +667,8 @@ def on_aka_update_clicked(obj): # #------------------------------------------------------------------------- def on_update_url_clicked(obj): - row = obj.get_data(INDEX) - if row >= 0: - UrlEditor(obj.get_data(EDITPERSON),obj.get_row_data(row)) + if len(obj.selection) > 0: + UrlEditor(obj.get_data(EDITPERSON),obj.get_row_data(obj.selection[0])) #------------------------------------------------------------------------- # @@ -688,9 +676,8 @@ def on_update_url_clicked(obj): # #------------------------------------------------------------------------- def on_update_attr_clicked(obj): - row = obj.get_data(INDEX) - if row >= 0: - AttributeEditor(obj.get_data(EDITPERSON),obj.get_row_data(row)) + if len(obj.selection) > 0: + AttributeEditor(obj.get_data(EDITPERSON),obj.get_row_data(obj.selection[0])) #------------------------------------------------------------------------- # @@ -698,9 +685,8 @@ def on_update_attr_clicked(obj): # #------------------------------------------------------------------------- def on_update_addr_clicked(obj): - row = obj.get_data(INDEX) - if row >= 0: - AddressEditor(obj.get_data(EDITPERSON),obj.get_row_data(row)) + if len(obj.selection) > 0: + AddressEditor(obj.get_data(EDITPERSON),obj.get_row_data(obj.selection[0])) #------------------------------------------------------------------------- # @@ -823,9 +809,8 @@ def on_edit_death_clicked(obj): # #------------------------------------------------------------------------- def on_event_update_clicked(obj): - row = obj.get_data(INDEX) - if row >= 0: - EventEditor(obj.get_data(EDITPERSON),obj.get_row_data(row),0) + if len(obj.selection) > 0: + EventEditor(obj.get_data(EDITPERSON),obj.get_row_data(obj.selection[0]),0) #------------------------------------------------------------------------- # @@ -835,7 +820,6 @@ def on_event_update_clicked(obj): # #------------------------------------------------------------------------- def on_event_select_row(obj,row,b,c): - obj.set_data(INDEX,row) event = obj.get_row_data(row) epo = obj.get_data(EDITPERSON) diff --git a/src/EditPlace.py b/src/EditPlace.py index 954c6cc70..8f9617098 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -58,7 +58,6 @@ _DEFHTTP = "http://gramps.sourceforge.net" # Constants # #------------------------------------------------------------------------- -_INDEX = "i" _PLACE = "p" class EditPlace: @@ -154,11 +153,9 @@ class EditPlace: self.top_window.get_widget("delete_photo").set_sensitive(0) self.web_list.set_data(_PLACE,self) - self.web_list.set_data(_INDEX,-1) self.redraw_url_list() self.loc_list.set_data(_PLACE,self) - self.loc_list.set_data(_INDEX,-1) self.redraw_location_list() #------------------------------------------------------------------------- @@ -475,8 +472,8 @@ def on_apply_clicked(obj): # #------------------------------------------------------------------------- def on_update_url_clicked(obj): - row = obj.get_data(_INDEX) - if row >= 0: + if len(obj.selection) > 0: + row = obj.selection[0] UrlEditor(obj.get_data(_PLACE),obj.get_row_data(row)) #------------------------------------------------------------------------- @@ -485,8 +482,8 @@ def on_update_url_clicked(obj): # #------------------------------------------------------------------------- def on_update_loc_clicked(obj): - row = obj.get_data(_INDEX) - if row >= 0: + if len(obj.selection) > 0: + row = obj.selection[0] LocationEditor(obj.get_data(_PLACE),obj.get_row_data(row)) #------------------------------------------------------------------------- @@ -604,7 +601,6 @@ def on_url_edit_ok_clicked(obj): # #------------------------------------------------------------------------- def on_web_list_select_row(obj,row,b,c): - obj.set_data(_INDEX,row) epo = obj.get_data(_PLACE) url = obj.get_row_data(row) @@ -627,7 +623,6 @@ def on_web_list_select_row(obj,row,b,c): # #------------------------------------------------------------------------- def on_loc_list_select_row(obj,row,b,c): - obj.set_data(_INDEX,row) epo = obj.get_data(_PLACE) loc = obj.get_row_data(row) diff --git a/src/EditSource.py b/src/EditSource.py index 0d00f71e4..a50032790 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -54,7 +54,6 @@ _ = intl.gettext # Constants # #------------------------------------------------------------------------- -INDEX = "i" SOURCE = "s" class EditSource: diff --git a/src/Marriage.py b/src/Marriage.py index e42f53df7..e9847aa54 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -51,7 +51,6 @@ import ImageSelect # Constants # #------------------------------------------------------------------------- -INDEX = "i" MARRIAGE = "m" #------------------------------------------------------------------------- @@ -135,9 +134,7 @@ class Marriage: # stored object data top_window.set_data(MARRIAGE,self) self.event_list.set_data(MARRIAGE,self) - self.event_list.set_data(INDEX,-1) self.attr_list.set_data(MARRIAGE,self) - self.attr_list.set_data(INDEX,-1) # set notes data self.notes_field.set_point(0) @@ -380,8 +377,8 @@ def on_add_clicked(obj): # #------------------------------------------------------------------------- def on_update_clicked(obj): - row = obj.get_data(INDEX) - if row >= 0: + if len(obj.selection) > 0: + row = obj.selection[0] EventEditor(obj.get_data(MARRIAGE),obj.get_row_data(row)) #------------------------------------------------------------------------- @@ -404,7 +401,6 @@ def on_delete_clicked(obj): # #------------------------------------------------------------------------- def on_select_row(obj,row,b,c): - obj.set_data(INDEX,row) family_obj = obj.get_data(MARRIAGE) event = obj.get_row_data(row) @@ -634,8 +630,6 @@ def on_ok_clicked(obj): # #------------------------------------------------------------------------- def on_attr_list_select_row(obj,row,b,c): - obj.set_data(INDEX,row) - family_obj = obj.get_data(MARRIAGE) attr = obj.get_row_data(row) @@ -649,8 +643,8 @@ def on_attr_list_select_row(obj,row,b,c): # #------------------------------------------------------------------------- def on_update_attr_clicked(obj): - row = obj.get_data(INDEX) - if row >= 0: + if len(obj.selection) > 0: + row = obj.selection[0] AttributeEditor(obj.get_data(MARRIAGE),obj.get_row_data(row)) #------------------------------------------------------------------------- diff --git a/src/Sources.py b/src/Sources.py index c050fbe33..cc8f3abeb 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -45,7 +45,6 @@ from RelLib import * SOURCEDISP = "s" ACTIVESRC = "a" -INDEX = "i" MENUVAL = "a" class SourceSelector: diff --git a/src/gramps_main.py b/src/gramps_main.py index cabc1f165..23424cf88 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -134,7 +134,6 @@ SURNAME = "s" RELTYPE = "d" PAD = 3 CANVASPAD = 20 -INDEX = "i" #------------------------------------------------------------------------- # @@ -869,9 +868,10 @@ def load_sources(): source_list.clear() source_list.freeze() - current_row = source_list.get_data(INDEX) - if current_row == None: - current_row = -1 + if len(source_list.selection) > 0: + current_row = source_list.selection[0] + else: + current_row = 0 index = 0 for src in database.getSourceMap().values(): @@ -880,12 +880,9 @@ def load_sources(): index = index + 1 if index > 0: - if current_row == -1: - current_row = 0 source_list.select_row(current_row,0) source_list.moveto(current_row) - source_list.set_data(INDEX,current_row) source_list.thaw() #------------------------------------------------------------------------- @@ -895,8 +892,8 @@ def load_sources(): #------------------------------------------------------------------------- def on_src_list_button_press_event(obj,event): if event.button == 1 and event.type == GDK._2BUTTON_PRESS: - index = obj.get_data(INDEX) - if index >= 0: + if len(obj.selection) > 0: + index = obj.selection[0] source = obj.get_row_data(index) EditSource.EditSource(source,database,update_display_after_edit) @@ -907,19 +904,11 @@ def on_src_list_button_press_event(obj,event): #------------------------------------------------------------------------- def on_place_list_button_press_event(obj,event): if event.button == 1 and event.type == GDK._2BUTTON_PRESS: - index = obj.get_data(INDEX) - if index >= 0: + if len(obj.selection) > 0: + index = obj.selection[0] place = obj.get_row_data(index) EditPlace.EditPlace(place,database,update_display_after_edit) -#------------------------------------------------------------------------- -# -# -# -#------------------------------------------------------------------------- -def on_list_select_row(obj,a,b,c): - obj.set_data(INDEX,a) - #------------------------------------------------------------------------- # # @@ -950,9 +939,10 @@ def on_delete_source_clicked(obj): # #------------------------------------------------------------------------- def on_delete_place_clicked(obj): - index = obj.get_data(INDEX) - if index == -1: + if len(obj.selection) == 0: return + else: + index = obj.selection[0] pevent = [] fevent = [] @@ -1038,8 +1028,8 @@ def on_force_delete_clicked(obj): # #------------------------------------------------------------------------- def on_edit_source_clicked(obj): - index = obj.get_data(INDEX) - if index != -1: + if len(obj.selection) > 0: + index = obj.selection[0] source = obj.get_row_data(index) EditSource.EditSource(source,database,update_display_after_edit) @@ -1049,8 +1039,8 @@ def on_edit_source_clicked(obj): # #------------------------------------------------------------------------- def on_edit_place_clicked(obj): - index = obj.get_data(INDEX) - if index != -1: + if len(obj.selection) > 0: + index = obj.selection[0] place = obj.get_row_data(index) EditPlace.EditPlace(place,database,update_display_after_edit) @@ -1667,6 +1657,8 @@ def delete_person_response(val): # #------------------------------------------------------------------------- def remove_from_person_list(person): + global active_person + person_list.freeze() if id2col.has_key(person): for id in [id2col[person]] + alt2col[person]: @@ -1675,6 +1667,9 @@ def remove_from_person_list(person): del id2col[person] del alt2col[person] + + if row <= person_list.rows: + (active_person,alt) = person_list.get_row_data(row) person_list.thaw() #------------------------------------------------------------------------- @@ -2064,9 +2059,10 @@ def load_places(): place_list.freeze() place_list.clear() - current_row = place_list.get_data(INDEX) - if current_row == None: - current_row = -1 + if len(place_list.selection) == 0: + current_row = 0 + else: + current_row = place_list.selection[0] index = 0 places = database.getPlaceMap().values() @@ -2090,12 +2086,9 @@ def load_places(): place_list.sort() if index > 0: - if current_row == -1: - current_row = 0 place_list.select_row(current_row,0) place_list.moveto(current_row) - place_list.set_data(INDEX,current_row) place_list.thaw() #------------------------------------------------------------------------- @@ -3290,7 +3283,6 @@ def main(arg): "on_person_list_select_row" : on_person_list_select_row, "on_place_list_button_press_event" : on_place_list_button_press_event, "on_main_key_release_event" : on_main_key_release_event, - "on_place_list_select_row" : on_list_select_row, "on_places_activate" : on_places_activate, "on_preferences_activate" : on_preferences_activate, "on_remove_child_clicked" : on_remove_child_clicked, @@ -3299,7 +3291,6 @@ def main(arg): "on_save_activate" : on_save_activate, "on_save_as_activate" : on_save_as_activate, "on_source_list_button_press_event" : on_src_list_button_press_event, - "on_source_list_select_row" : on_list_select_row, "on_sources_activate" : on_sources_activate, "on_spouselist_changed" : on_spouselist_changed, "on_swap_clicked" : on_swap_clicked, diff --git a/src/utils.py b/src/utils.py index c0762458b..f3e3a2713 100644 --- a/src/utils.py +++ b/src/utils.py @@ -30,7 +30,6 @@ _ = intl.gettext _modifiedFlag = 0 LISTOBJ = "s" -INDEX = "i" OBJECT = "o" #------------------------------------------------------------------------- @@ -209,15 +208,13 @@ def redraw_list(dlist,clist,func): clist.set_row_data(index,object) index = index + 1 - current_row = clist.get_data(INDEX) - if index > 0: - if current_row <= 0: - current_row = 0 - elif index <= current_row: - current_row = current_row - 1 - clist.select_row(current_row,0) - clist.moveto(current_row,0) - clist.set_data(INDEX,current_row) + if len(clist.selection) == 0: + current_row = 0 + else: + current_row = clist.selection[0] + + clist.select_row(current_row,0) + clist.moveto(current_row,0) clist.thaw() return index @@ -227,12 +224,9 @@ def redraw_list(dlist,clist,func): # #------------------------------------------------------------------------- def delete_selected(obj,list): - row = obj.get_data(INDEX) - if row < 0: + if len(obj.selection) == 0: return 0 - del list[row] - if row > len(list)-1: - obj.set_data(INDEX,row-1) + del list[obj.selection[0]] return 1 #-------------------------------------------------------------------------