Fixed the EditPerson dialog so that it does not convert females to unknown.

svn: r450
This commit is contained in:
Don Allingham 2001-10-06 21:31:38 +00:00
parent 4a438d859e
commit b7bc7a37e0
9 changed files with 70 additions and 134 deletions

7
NEWS
View File

@ -2,6 +2,13 @@ Version 0.5.1post
* Support for QUAY on GEDCOM import. * Support for QUAY on GEDCOM import.
* Confidence level moved to SourceReference instead of object * Confidence level moved to SourceReference instead of object
* Support for revision control * 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 Version 0.5.1
* Bug fixes * Bug fixes

View File

@ -42,8 +42,6 @@ import utils
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
OBJECT = "o" OBJECT = "o"
ROWS = "r"
INDEX = "i"
TOPINST = "top" TOPINST = "top"
NAMEINST = "namelist" NAMEINST = "namelist"
@ -123,24 +121,16 @@ class Bookmarks :
def edit(self): def edit(self):
top = libglade.GladeXML(const.bookFile,TOPINST) top = libglade.GladeXML(const.bookFile,TOPINST)
namelist = top.get_widget(NAMEINST) namelist = top.get_widget(NAMEINST)
self.index = 0 index = 0
for person in self.bookmarks: for person in self.bookmarks:
namelist.append([person.getPrimaryName().getName()]) namelist.append([person.getPrimaryName().getName()])
namelist.set_row_data(self.index,person) namelist.set_row_data(index,person)
self.index = self.index + 1 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({ top.signal_autoconnect({
"on_ok_clicked" : on_ok_clicked, "on_ok_clicked" : on_ok_clicked,
"on_down_clicked" : on_down_clicked, "on_down_clicked" : on_down_clicked,
"on_up_clicked" : on_up_clicked, "on_up_clicked" : on_up_clicked,
"on_namelist_select_row" : on_namelist_select_row,
"on_delete_clicked" : on_delete_clicked, "on_delete_clicked" : on_delete_clicked,
"on_cancel_clicked" : on_cancel_clicked "on_cancel_clicked" : on_cancel_clicked
}) })
@ -150,15 +140,6 @@ class Bookmarks :
topBox.set_data(NAMEINST,namelist) topBox.set_data(NAMEINST,namelist)
topBox.show() 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 # 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): def on_delete_clicked(obj):
index = obj.get_data(INDEX) if len(obj.selection) > 0:
rows = obj.get_data(ROWS) index = obj.selection[0]
if index >= 0:
obj.remove(index) 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): def on_up_clicked(obj):
index = obj.get_data(INDEX) if len(obj.selection) > 0:
if index > 0: index = obj.selection[0]
obj.swap_rows(index-1,index) 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): def on_down_clicked(obj):
index = obj.get_data(INDEX) if len(obj.selection) > 0:
rows = obj.get_data(ROWS) index = obj.selection[0]
if index != rows-1: if index != obj.rows-1:
obj.swap_rows(index+1,index) obj.swap_rows(index+1,index)
obj.set_data(INDEX,index+1)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -65,7 +65,6 @@ _DEFHTTP = "http://gramps.sourceforge.net"
# names. # names.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
INDEX = "i"
EDITPERSON = "p" EDITPERSON = "p"
OBJECT = "o" OBJECT = "o"
PHOTO = "p" PHOTO = "p"
@ -248,7 +247,7 @@ class EditPerson:
if person.getGender() == Person.male: if person.getGender() == Person.male:
self.is_male.set_active(1) self.is_male.set_active(1)
elif person.getGender() == Person.male: elif person.getGender() == Person.female:
self.is_female.set_active(1) self.is_female.set_active(1)
else: else:
self.is_unknown.set_active(1) self.is_unknown.set_active(1)
@ -270,15 +269,10 @@ class EditPerson:
# stored object data # stored object data
self.edit_person.set_data(EDITPERSON,self) self.edit_person.set_data(EDITPERSON,self)
self.event_list.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(EDITPERSON,self)
self.name_list.set_data(INDEX,-1)
self.web_list.set_data(EDITPERSON,self) 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(EDITPERSON,self)
self.attr_list.set_data(INDEX,-1)
self.addr_list.set_data(EDITPERSON,self) self.addr_list.set_data(EDITPERSON,self)
self.addr_list.set_data(INDEX,-1)
# draw lists # draw lists
self.redraw_event_list() self.redraw_event_list()
@ -588,7 +582,6 @@ def on_delete_event(obj,b):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_name_list_select_row(obj,row,b,c): def on_name_list_select_row(obj,row,b,c):
obj.set_data(INDEX,row)
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)
name = obj.get_row_data(row) 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): def on_web_list_select_row(obj,row,b,c):
obj.set_data(INDEX,row)
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)
url = obj.get_row_data(row) 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): def on_attr_list_select_row(obj,row,b,c):
obj.set_data(INDEX,row)
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)
attr = obj.get_row_data(row) 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): def on_addr_list_select_row(obj,row,b,c):
obj.set_data(INDEX,row)
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)
a = obj.get_row_data(row) 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): def on_aka_update_clicked(obj):
row = obj.get_data(INDEX) if len(obj.selection) >= 0:
if row >= 0: NameEditor(obj.get_data(EDITPERSON),obj.get_row_data(obj.selection[0]))
NameEditor(obj.get_data(EDITPERSON),obj.get_row_data(row))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -678,9 +667,8 @@ def on_aka_update_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_update_url_clicked(obj): def on_update_url_clicked(obj):
row = obj.get_data(INDEX) if len(obj.selection) > 0:
if row >= 0: UrlEditor(obj.get_data(EDITPERSON),obj.get_row_data(obj.selection[0]))
UrlEditor(obj.get_data(EDITPERSON),obj.get_row_data(row))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -688,9 +676,8 @@ def on_update_url_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_update_attr_clicked(obj): def on_update_attr_clicked(obj):
row = obj.get_data(INDEX) if len(obj.selection) > 0:
if row >= 0: AttributeEditor(obj.get_data(EDITPERSON),obj.get_row_data(obj.selection[0]))
AttributeEditor(obj.get_data(EDITPERSON),obj.get_row_data(row))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -698,9 +685,8 @@ def on_update_attr_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_update_addr_clicked(obj): def on_update_addr_clicked(obj):
row = obj.get_data(INDEX) if len(obj.selection) > 0:
if row >= 0: AddressEditor(obj.get_data(EDITPERSON),obj.get_row_data(obj.selection[0]))
AddressEditor(obj.get_data(EDITPERSON),obj.get_row_data(row))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -823,9 +809,8 @@ def on_edit_death_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_event_update_clicked(obj): def on_event_update_clicked(obj):
row = obj.get_data(INDEX) if len(obj.selection) > 0:
if row >= 0: EventEditor(obj.get_data(EDITPERSON),obj.get_row_data(obj.selection[0]),0)
EventEditor(obj.get_data(EDITPERSON),obj.get_row_data(row),0)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -835,7 +820,6 @@ def on_event_update_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_event_select_row(obj,row,b,c): def on_event_select_row(obj,row,b,c):
obj.set_data(INDEX,row)
event = obj.get_row_data(row) event = obj.get_row_data(row)
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)

View File

@ -58,7 +58,6 @@ _DEFHTTP = "http://gramps.sourceforge.net"
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
_INDEX = "i"
_PLACE = "p" _PLACE = "p"
class EditPlace: class EditPlace:
@ -154,11 +153,9 @@ class EditPlace:
self.top_window.get_widget("delete_photo").set_sensitive(0) self.top_window.get_widget("delete_photo").set_sensitive(0)
self.web_list.set_data(_PLACE,self) self.web_list.set_data(_PLACE,self)
self.web_list.set_data(_INDEX,-1)
self.redraw_url_list() self.redraw_url_list()
self.loc_list.set_data(_PLACE,self) self.loc_list.set_data(_PLACE,self)
self.loc_list.set_data(_INDEX,-1)
self.redraw_location_list() self.redraw_location_list()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -475,8 +472,8 @@ def on_apply_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_update_url_clicked(obj): def on_update_url_clicked(obj):
row = obj.get_data(_INDEX) if len(obj.selection) > 0:
if row >= 0: row = obj.selection[0]
UrlEditor(obj.get_data(_PLACE),obj.get_row_data(row)) 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): def on_update_loc_clicked(obj):
row = obj.get_data(_INDEX) if len(obj.selection) > 0:
if row >= 0: row = obj.selection[0]
LocationEditor(obj.get_data(_PLACE),obj.get_row_data(row)) 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): def on_web_list_select_row(obj,row,b,c):
obj.set_data(_INDEX,row)
epo = obj.get_data(_PLACE) epo = obj.get_data(_PLACE)
url = obj.get_row_data(row) 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): def on_loc_list_select_row(obj,row,b,c):
obj.set_data(_INDEX,row)
epo = obj.get_data(_PLACE) epo = obj.get_data(_PLACE)
loc = obj.get_row_data(row) loc = obj.get_row_data(row)

View File

@ -54,7 +54,6 @@ _ = intl.gettext
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
INDEX = "i"
SOURCE = "s" SOURCE = "s"
class EditSource: class EditSource:

View File

@ -51,7 +51,6 @@ import ImageSelect
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
INDEX = "i"
MARRIAGE = "m" MARRIAGE = "m"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -135,9 +134,7 @@ class Marriage:
# stored object data # stored object data
top_window.set_data(MARRIAGE,self) top_window.set_data(MARRIAGE,self)
self.event_list.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(MARRIAGE,self)
self.attr_list.set_data(INDEX,-1)
# set notes data # set notes data
self.notes_field.set_point(0) self.notes_field.set_point(0)
@ -380,8 +377,8 @@ def on_add_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_update_clicked(obj): def on_update_clicked(obj):
row = obj.get_data(INDEX) if len(obj.selection) > 0:
if row >= 0: row = obj.selection[0]
EventEditor(obj.get_data(MARRIAGE),obj.get_row_data(row)) 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): def on_select_row(obj,row,b,c):
obj.set_data(INDEX,row)
family_obj = obj.get_data(MARRIAGE) family_obj = obj.get_data(MARRIAGE)
event = obj.get_row_data(row) 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): def on_attr_list_select_row(obj,row,b,c):
obj.set_data(INDEX,row)
family_obj = obj.get_data(MARRIAGE) family_obj = obj.get_data(MARRIAGE)
attr = obj.get_row_data(row) 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): def on_update_attr_clicked(obj):
row = obj.get_data(INDEX) if len(obj.selection) > 0:
if row >= 0: row = obj.selection[0]
AttributeEditor(obj.get_data(MARRIAGE),obj.get_row_data(row)) AttributeEditor(obj.get_data(MARRIAGE),obj.get_row_data(row))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -45,7 +45,6 @@ from RelLib import *
SOURCEDISP = "s" SOURCEDISP = "s"
ACTIVESRC = "a" ACTIVESRC = "a"
INDEX = "i"
MENUVAL = "a" MENUVAL = "a"
class SourceSelector: class SourceSelector:

View File

@ -134,7 +134,6 @@ SURNAME = "s"
RELTYPE = "d" RELTYPE = "d"
PAD = 3 PAD = 3
CANVASPAD = 20 CANVASPAD = 20
INDEX = "i"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -869,9 +868,10 @@ def load_sources():
source_list.clear() source_list.clear()
source_list.freeze() source_list.freeze()
current_row = source_list.get_data(INDEX) if len(source_list.selection) > 0:
if current_row == None: current_row = source_list.selection[0]
current_row = -1 else:
current_row = 0
index = 0 index = 0
for src in database.getSourceMap().values(): for src in database.getSourceMap().values():
@ -880,12 +880,9 @@ def load_sources():
index = index + 1 index = index + 1
if index > 0: if index > 0:
if current_row == -1:
current_row = 0
source_list.select_row(current_row,0) source_list.select_row(current_row,0)
source_list.moveto(current_row) source_list.moveto(current_row)
source_list.set_data(INDEX,current_row)
source_list.thaw() source_list.thaw()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -895,8 +892,8 @@ def load_sources():
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_src_list_button_press_event(obj,event): def on_src_list_button_press_event(obj,event):
if event.button == 1 and event.type == GDK._2BUTTON_PRESS: if event.button == 1 and event.type == GDK._2BUTTON_PRESS:
index = obj.get_data(INDEX) if len(obj.selection) > 0:
if index >= 0: index = obj.selection[0]
source = obj.get_row_data(index) source = obj.get_row_data(index)
EditSource.EditSource(source,database,update_display_after_edit) 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): def on_place_list_button_press_event(obj,event):
if event.button == 1 and event.type == GDK._2BUTTON_PRESS: if event.button == 1 and event.type == GDK._2BUTTON_PRESS:
index = obj.get_data(INDEX) if len(obj.selection) > 0:
if index >= 0: index = obj.selection[0]
place = obj.get_row_data(index) place = obj.get_row_data(index)
EditPlace.EditPlace(place,database,update_display_after_edit) 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): def on_delete_place_clicked(obj):
index = obj.get_data(INDEX) if len(obj.selection) == 0:
if index == -1:
return return
else:
index = obj.selection[0]
pevent = [] pevent = []
fevent = [] fevent = []
@ -1038,8 +1028,8 @@ def on_force_delete_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_edit_source_clicked(obj): def on_edit_source_clicked(obj):
index = obj.get_data(INDEX) if len(obj.selection) > 0:
if index != -1: index = obj.selection[0]
source = obj.get_row_data(index) source = obj.get_row_data(index)
EditSource.EditSource(source,database,update_display_after_edit) EditSource.EditSource(source,database,update_display_after_edit)
@ -1049,8 +1039,8 @@ def on_edit_source_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_edit_place_clicked(obj): def on_edit_place_clicked(obj):
index = obj.get_data(INDEX) if len(obj.selection) > 0:
if index != -1: index = obj.selection[0]
place = obj.get_row_data(index) place = obj.get_row_data(index)
EditPlace.EditPlace(place,database,update_display_after_edit) EditPlace.EditPlace(place,database,update_display_after_edit)
@ -1667,6 +1657,8 @@ def delete_person_response(val):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def remove_from_person_list(person): def remove_from_person_list(person):
global active_person
person_list.freeze() person_list.freeze()
if id2col.has_key(person): if id2col.has_key(person):
for id in [id2col[person]] + alt2col[person]: for id in [id2col[person]] + alt2col[person]:
@ -1675,6 +1667,9 @@ def remove_from_person_list(person):
del id2col[person] del id2col[person]
del alt2col[person] del alt2col[person]
if row <= person_list.rows:
(active_person,alt) = person_list.get_row_data(row)
person_list.thaw() person_list.thaw()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -2064,9 +2059,10 @@ def load_places():
place_list.freeze() place_list.freeze()
place_list.clear() place_list.clear()
current_row = place_list.get_data(INDEX) if len(place_list.selection) == 0:
if current_row == None: current_row = 0
current_row = -1 else:
current_row = place_list.selection[0]
index = 0 index = 0
places = database.getPlaceMap().values() places = database.getPlaceMap().values()
@ -2090,12 +2086,9 @@ def load_places():
place_list.sort() place_list.sort()
if index > 0: if index > 0:
if current_row == -1:
current_row = 0
place_list.select_row(current_row,0) place_list.select_row(current_row,0)
place_list.moveto(current_row) place_list.moveto(current_row)
place_list.set_data(INDEX,current_row)
place_list.thaw() place_list.thaw()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -3290,7 +3283,6 @@ def main(arg):
"on_person_list_select_row" : on_person_list_select_row, "on_person_list_select_row" : on_person_list_select_row,
"on_place_list_button_press_event" : on_place_list_button_press_event, "on_place_list_button_press_event" : on_place_list_button_press_event,
"on_main_key_release_event" : on_main_key_release_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_places_activate" : on_places_activate,
"on_preferences_activate" : on_preferences_activate, "on_preferences_activate" : on_preferences_activate,
"on_remove_child_clicked" : on_remove_child_clicked, "on_remove_child_clicked" : on_remove_child_clicked,
@ -3299,7 +3291,6 @@ def main(arg):
"on_save_activate" : on_save_activate, "on_save_activate" : on_save_activate,
"on_save_as_activate" : on_save_as_activate, "on_save_as_activate" : on_save_as_activate,
"on_source_list_button_press_event" : on_src_list_button_press_event, "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_sources_activate" : on_sources_activate,
"on_spouselist_changed" : on_spouselist_changed, "on_spouselist_changed" : on_spouselist_changed,
"on_swap_clicked" : on_swap_clicked, "on_swap_clicked" : on_swap_clicked,

View File

@ -30,7 +30,6 @@ _ = intl.gettext
_modifiedFlag = 0 _modifiedFlag = 0
LISTOBJ = "s" LISTOBJ = "s"
INDEX = "i"
OBJECT = "o" OBJECT = "o"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -209,15 +208,13 @@ def redraw_list(dlist,clist,func):
clist.set_row_data(index,object) clist.set_row_data(index,object)
index = index + 1 index = index + 1
current_row = clist.get_data(INDEX) if len(clist.selection) == 0:
if index > 0: current_row = 0
if current_row <= 0: else:
current_row = 0 current_row = clist.selection[0]
elif index <= current_row:
current_row = current_row - 1 clist.select_row(current_row,0)
clist.select_row(current_row,0) clist.moveto(current_row,0)
clist.moveto(current_row,0)
clist.set_data(INDEX,current_row)
clist.thaw() clist.thaw()
return index return index
@ -227,12 +224,9 @@ def redraw_list(dlist,clist,func):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def delete_selected(obj,list): def delete_selected(obj,list):
row = obj.get_data(INDEX) if len(obj.selection) == 0:
if row < 0:
return 0 return 0
del list[row] del list[obj.selection[0]]
if row > len(list)-1:
obj.set_data(INDEX,row-1)
return 1 return 1
#------------------------------------------------------------------------- #-------------------------------------------------------------------------