Birth/death editable on the main page

svn: r469
This commit is contained in:
Don Allingham 2001-10-14 20:37:28 +00:00
parent f3b46772b9
commit 694886dfa8
2 changed files with 117 additions and 155 deletions

View File

@ -175,7 +175,7 @@
<widget>
<class>GtkTable</class>
<name>table16</name>
<rows>4</rows>
<rows>3</rows>
<columns>3</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
@ -233,37 +233,12 @@
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>birthPlace</name>
<width>275</width>
<can_focus>True</can_focus>
<editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>birthDate</name>
<width>250</width>
<can_focus>True</can_focus>
<editable>False</editable>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
@ -351,8 +326,8 @@
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@ -365,29 +340,39 @@
</widget>
<widget>
<class>GtkLabel</class>
<name>label250</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<class>GtkCombo</class>
<name>bpcombo</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>True</yexpand>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>birthPlace</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
</widget>
@ -416,43 +401,18 @@
<widget>
<class>GtkTable</class>
<name>table17</name>
<rows>4</rows>
<rows>3</rows>
<columns>3</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<widget>
<class>GtkEntry</class>
<name>deathPlace</name>
<width>275</width>
<can_focus>True</can_focus>
<editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>deathDate</name>
<width>250</width>
<can_focus>True</can_focus>
<editable>False</editable>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
@ -524,32 +484,6 @@
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label249</name>
<label>:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label30</name>
@ -602,57 +536,6 @@
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label248</name>
<label>Cause</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>deathCause</name>
<width>250</width>
<can_focus>True</can_focus>
<editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button126</name>
@ -669,8 +552,8 @@
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@ -681,6 +564,42 @@
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>dpcombo</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>deathPlace</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
</widget>

View File

@ -117,9 +117,10 @@ class EditPerson:
self.title = self.get_widget("title")
self.bdate = self.get_widget("birthDate")
self.bplace = self.get_widget("birthPlace")
self.dcause = self.get_widget("deathCause")
self.bpcombo = self.get_widget("bpcombo")
self.ddate = self.get_widget("deathDate")
self.dplace = self.get_widget("deathPlace")
self.dpcombo = self.get_widget("dpcombo")
self.is_male = self.get_widget("genderMale")
self.is_female = self.get_widget("genderFemale")
self.is_unknown = self.get_widget("genderUnknown")
@ -152,7 +153,6 @@ 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" : self.on_cancel_edit,
@ -203,6 +203,11 @@ 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 = ""
@ -284,6 +289,10 @@ class EditPerson:
def redraw_event_list(self):
"""redraws the event list for the person"""
utils.redraw_list(self.elist,self.event_list,disp_event)
self.bplace.set_text(self.birth.getPlaceName())
self.dplace.set_text(self.death.getPlaceName())
self.bdate.set_text(self.birth.getDate())
self.ddate.set_text(self.death.getDate())
def on_add_addr_clicked(self,obj):
"""Invokes the address editor to add a new address"""
@ -315,12 +324,21 @@ class EditPerson:
import EventEdit
pname = self.person.getPrimaryName().getName()
event = self.birth
EventEdit.EventEditor(self,pname,const.personalEvents,const.save_fevent,event,1)
event.setDate(self.bdate.get_text())
p = utils.get_place_from_list(self.bpcombo)
if p != None:
event.setPlace(p)
EventEdit.EventEditor(self,pname,const.personalEvents,\
const.save_fevent,event,1)
def on_edit_death_clicked(self,obj):
import EventEdit
pname = self.person.getPrimaryName().getName()
event = self.death
event.setDate(self.ddate.get_text())
p = utils.get_place_from_list(self.dpcombo)
if p != None:
event.setPlace(p)
EventEdit.EventEditor(self,pname,const.personalEvents,const.save_fevent,event,1)
def on_aka_delete_clicked(self,obj):
@ -390,6 +408,19 @@ class EditPerson:
if self.pname.getNote() != name.getNote():
changed = 1
bplace = string.strip(self.bplace.get_text())
dplace = string.strip(self.dplace.get_text())
p1 = utils.get_place_from_list(self.bpcombo)
if p1 == None and bplace != "":
changed = 1
self.birth.setPlace(p1)
p1 = utils.get_place_from_list(self.dpcombo)
if p1 == None and dplace != "":
changed = 1
self.death.setPlace(p1)
if not self.birth.are_equal(self.person.getBirth()):
changed = 1
@ -418,12 +449,10 @@ class EditPerson:
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)
def on_update_attr_clicked(self,obj):
import AttrEdit
@ -579,11 +608,25 @@ class EditPerson:
utils.modified()
self.birth.setDate(self.bdate.get_text())
bplace_obj = utils.get_place_from_list(self.bpcombo)
bplace = string.strip(self.bplace.get_text())
if bplace_obj == None and bplace != "":
p1 = Place()
p1.set_title(bplace)
self.db.addPlace(p1)
self.birth.setPlace(bplace_obj)
if not self.person.getBirth().are_equal(self.birth):
self.person.setBirth(self.birth)
self.death.setDate(self.ddate.get_text())
dplace_obj = utils.get_place_from_list(self.dpcombo)
dplace = string.strip(self.dplace.get_text())
if dplace_obj == None and dplace != "":
p1 = Place()
p1.set_title(dplace)
self.db.addPlace(p1)
self.death.setPlace(dplace_obj)
if not self.person.getDeath().are_equal(self.death):
self.person.setDeath(self.death)