Pass new place information from an EditPerson window to an EventEdit window.

svn: r494
This commit is contained in:
David Hampton 2001-10-19 04:43:55 +00:00
parent 380e6f8ebd
commit 0a53a166af
3 changed files with 19 additions and 7 deletions

View File

@ -321,7 +321,7 @@ class EditPerson:
"""Brings up the EventEditor for a new event""" """Brings up the EventEditor for a new event"""
import EventEdit import EventEdit
pname = self.person.getPrimaryName().getName() pname = self.person.getPrimaryName().getName()
EventEdit.EventEditor(self,pname,const.personalEvents,const.save_fevent,None,0) EventEdit.EventEditor(self,pname,const.personalEvents,const.save_fevent,None,None,0)
def on_edit_birth_clicked(self,obj): def on_edit_birth_clicked(self,obj):
"""Brings up the EventEditor for the birth record, event name cannot be changed""" """Brings up the EventEditor for the birth record, event name cannot be changed"""
@ -332,8 +332,11 @@ class EditPerson:
p = utils.get_place_from_list(self.bpcombo) p = utils.get_place_from_list(self.bpcombo)
if p != None: if p != None:
event.setPlace(p) event.setPlace(p)
def_placename = None
else:
def_placename = self.bpcombo.entry.get_text()
EventEdit.EventEditor(self,pname,const.personalEvents,\ EventEdit.EventEditor(self,pname,const.personalEvents,\
const.save_fevent,event,1) const.save_fevent,event,def_placename,1)
def on_edit_death_clicked(self,obj): def on_edit_death_clicked(self,obj):
"""Brings up the EventEditor for the death record, event name cannot be changed""" """Brings up the EventEditor for the death record, event name cannot be changed"""
@ -344,7 +347,11 @@ class EditPerson:
p = utils.get_place_from_list(self.dpcombo) p = utils.get_place_from_list(self.dpcombo)
if p != None: if p != None:
event.setPlace(p) event.setPlace(p)
EventEdit.EventEditor(self,pname,const.personalEvents,const.save_fevent,event,1) def_placename = None
else:
def_placename = self.dpcombo.entry.get_text()
EventEdit.EventEditor(self,pname,const.personalEvents,\
const.save_fevent,event,def_placename,1)
def on_aka_delete_clicked(self,obj): def on_aka_delete_clicked(self,obj):
"""Deletes the selected name from the name list""" """Deletes the selected name from the name list"""
@ -502,7 +509,7 @@ class EditPerson:
return return
pname = self.person.getPrimaryName().getName() pname = self.person.getPrimaryName().getName()
event = obj.get_row_data(obj.selection[0]) event = obj.get_row_data(obj.selection[0])
EventEdit.EventEditor(self,pname,const.personalEvents,const.save_fevent,event,0) EventEdit.EventEditor(self,pname,const.personalEvents,const.save_fevent,event,None,0)
def on_event_select_row(self,obj,row,b,c): def on_event_select_row(self,obj,row,b,c):
event = obj.get_row_data(row) event = obj.get_row_data(row)

View File

@ -46,7 +46,7 @@ from RelLib import *
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class EventEditor: class EventEditor:
def __init__(self,parent,name,list,trans,event,read_only): def __init__(self,parent,name,list,trans,event,def_placename,read_only):
self.parent = parent self.parent = parent
self.event = event self.event = event
self.trans = trans self.trans = trans
@ -71,6 +71,7 @@ class EventEditor:
self.event_menu.set_popdown_strings(list) self.event_menu.set_popdown_strings(list)
if read_only: if read_only:
self.event_menu.set_sensitive(0) self.event_menu.set_sensitive(0)
self.date_field.grab_focus()
# Typing CR selects OK button # Typing CR selects OK button
self.window.editable_enters(self.name_field); self.window.editable_enters(self.name_field);
@ -85,6 +86,8 @@ class EventEditor:
utils.attach_places(values,self.place_combo,event.getPlace()) utils.attach_places(values,self.place_combo,event.getPlace())
self.place_field.set_text(event.getPlaceName()) self.place_field.set_text(event.getPlaceName())
if (def_placename):
self.place_field.set_text(def_placename)
self.date_field.set_text(event.getDate()) self.date_field.set_text(event.getDate())
self.cause_field.set_text(event.getCause()) self.cause_field.set_text(event.getCause())
self.descr_field.set_text(event.getDescription()) self.descr_field.set_text(event.getDescription())
@ -95,6 +98,8 @@ class EventEditor:
self.note_field.set_word_wrap(1) self.note_field.set_word_wrap(1)
else: else:
utils.attach_places(values,self.place_combo,None) utils.attach_places(values,self.place_combo,None)
if (def_placename):
self.place_field.set_text(def_placename)
self.window.set_data("o",self) self.window.set_data("o",self)
self.top.signal_autoconnect({ self.top.signal_autoconnect({

View File

@ -253,7 +253,7 @@ class Marriage:
name = father.getPrimaryName().getName() name = father.getPrimaryName().getName()
else: else:
name = mother.getPrimaryName().getName() name = mother.getPrimaryName().getName()
EventEdit.EventEditor(self,name,const.marriageEvents,const.save_pevent,None,0) EventEdit.EventEditor(self,name,const.marriageEvents,const.save_pevent,None,None,0)
def on_update_clicked(self,obj): def on_update_clicked(self,obj):
import EventEdit import EventEdit
@ -270,7 +270,7 @@ class Marriage:
name = father.getPrimaryName().getName() name = father.getPrimaryName().getName()
else: else:
name = mother.getPrimaryName().getName() name = mother.getPrimaryName().getName()
EventEdit.EventEditor(self,name,const.marriageEvents,const.save_pevent,event,0) EventEdit.EventEditor(self,name,const.marriageEvents,const.save_pevent,event,None,0)
def on_delete_clicked(self,obj): def on_delete_clicked(self,obj):
if utils.delete_selected(obj,self.elist): if utils.delete_selected(obj,self.elist):