Better handing of parents/spouses in family view.

svn: r858
This commit is contained in:
Don Allingham 2002-03-26 15:43:04 +00:00
parent 507cde7298
commit 54da58996a
5 changed files with 617 additions and 770 deletions

View File

@ -82,16 +82,6 @@ class AddSpouse:
self.spouse_list = self.glade.get_widget("spouseList")
self.relation_def = self.glade.get_widget("reldef")
self.top = self.glade.get_widget("spouseDialog")
self.given = self.glade.get_widget("given")
self.surname = self.glade.get_widget("surname")
self.surname_combo = self.glade.get_widget("surname_combo")
self.rel_combo.set_popdown_strings(const.familyRelations)
Utils.attach_surnames(self.surname_combo)
# Typing CR selects 'Add Existing' button
self.top.editable_enters(self.given)
self.top.editable_enters(self.surname)
self.name_list = self.db.getPersonMap().values()
self.name_list.sort(sort.by_last_name)
@ -114,38 +104,26 @@ class AddSpouse:
Called when the spouse to be added does not exist, and needs
to be created and added to the database
"""
spouse = RelLib.Person()
self.db.addPerson(spouse)
name = spouse.getPrimaryName()
name.setSurname(string.strip(self.surname.get_text()))
name.setFirstName(string.strip(self.given.get_text()))
import QuickAdd
relation = const.save_frel(self.relation_type.get_text())
if relation == "Partners":
spouse.setGender(self.person.getGender())
elif self.person.getGender() == RelLib.Person.male:
spouse.setGender(RelLib.Person.female)
else:
spouse.setGender(RelLib.Person.male)
family = self.db.newFamily()
family.setRelationship(relation)
self.person.addFamily(family)
spouse.addFamily(family)
if self.person.getGender() == RelLib.Person.male:
family.setMother(spouse)
family.setFather(self.person)
gen = "male"
else:
family.setFather(spouse)
family.setMother(self.person)
gen = "female"
elif self.person.getGender() == RelLib.Person.male:
gen = "female"
else:
gen = "male"
Utils.destroy_passed_object(obj)
Utils.modified()
self.addperson(spouse)
self.update(family)
QuickAdd.QuickAdd(self.db,gen,self.update_list)
def update_list(self,person):
self.name_list.append(person)
self.name_list.sort(sort.by_last_name)
self.addperson(person)
self.relation_type_changed(self.relation_type)
def select_spouse_clicked(self,obj):
"""

View File

@ -70,8 +70,6 @@ class ChooseParents:
self.fcombo = self.glade.get_widget("prel_combo")
self.prel = self.glade.get_widget("prel")
self.title = self.glade.get_widget("chooseTitle")
self.father_name = self.glade.get_widget("fatherName")
self.mother_name = self.glade.get_widget("motherName")
self.father_list = self.glade.get_widget("fatherList")
self.mother_list = self.glade.get_widget("motherList")
self.flabel = self.glade.get_widget("flabel")
@ -91,8 +89,7 @@ class ChooseParents:
"on_motherList_select_row" : self.mother_list_select_row,
"on_fatherList_select_row" : self.father_list_select_row,
"on_save_parents_clicked" : self.save_parents_clicked,
"on_addmother_clicked" : self.add_mother_clicked,
"on_addfather_clicked" : self.add_father_clicked,
"on_add_parent_clicked" : self.add_parent_clicked,
"on_prel_changed" : self.parent_relation_changed,
"on_combo_insert_text" : Utils.combo_insert_text,
"destroy_passed_object" : Utils.destroy_passed_object
@ -110,9 +107,6 @@ class ChooseParents:
type = obj.get_text()
self.father_name.set_text(GrampsCfg.nameof(self.father))
self.mother_name.set_text(GrampsCfg.nameof(self.mother))
self.father_list.freeze()
self.mother_list.freeze()
self.father_list.clear()
@ -128,11 +122,17 @@ class ChooseParents:
people.sort(sort.by_last_name)
father_index = 1
mother_index = 1
fsel = 0
msel = 0
for person in people:
if person == self.person:
continue
if person.getGender() == RelLib.Person.unknown:
continue
if self.father == person:
fsel = father_index
if self.mother == person:
msel = mother_index
rdata = [Utils.phonebook_name(person),Utils.birthday(person)]
if type == "Partners":
self.father_list.append(rdata)
@ -150,12 +150,17 @@ class ChooseParents:
self.mother_list.set_row_data(mother_index,person)
mother_index = mother_index + 1
self.mother_list.select_row(msel,0)
self.mother_list.moveto(msel,0)
self.father_list.select_row(fsel,0)
self.father_list.moveto(fsel,0)
if type == "Partners":
self.mlabel.set_text(_("Parent"))
self.flabel.set_text(_("Parent"))
self.mlabel.set_label(_("Parent"))
self.flabel.set_label(_("Parent"))
else:
self.mlabel.set_text(_("Mother"))
self.flabel.set_text(_("Father"))
self.mlabel.set_label(_("Mother"))
self.flabel.set_label(_("Father"))
self.mother_list.thaw()
self.father_list.thaw()
@ -188,17 +193,18 @@ class ChooseParents:
def mother_list_select_row(self,obj,a,b,c):
self.mother = obj.get_row_data(a)
self.mother_name.set_text(GrampsCfg.nameof(self.mother))
def father_list_select_row(self,obj,a,b,c):
self.father = obj.get_row_data(a)
self.father_name.set_text(GrampsCfg.nameof(self.father))
def save_parents_clicked(self,obj):
mother_rel = const.childRelations[self.mother_rel.get_text()]
father_rel = const.childRelations[self.father_rel.get_text()]
type = const.save_frel(self.prel.get_text())
msel = self.mother_list.selection
fsel = self.father_list.selection
if self.father or self.mother:
if self.mother and not self.father:
if self.mother.getGender() == RelLib.Person.male:
@ -230,25 +236,13 @@ class ChooseParents:
self.change_family_type(self.family,mother_rel,father_rel)
self.family_update(None)
def add_parent_clicked(self,obj,sex):
self.xml = libglade.GladeXML(const.gladeFile,"addperson")
self.xml.get_widget(sex).set_active(1)
self.xml.signal_autoconnect({
"on_addfather_close": self.add_parent_close,
"on_combo_insert_text" : Utils.combo_insert_text,
"destroy_passed_object" : Utils.destroy_passed_object
})
def add_new_parent(self,person):
self.parent_relation_changed(self.prel)
self.full_update()
window = self.xml.get_widget("addperson")
window.editable_enters(self.xml.get_widget("given"))
window.editable_enters(self.xml.get_widget("surname"))
Utils.attach_surnames(self.xml.get_widget("surnameCombo"))
def add_father_clicked(self,obj):
self.add_parent_clicked(obj,"male")
def add_mother_clicked(self,obj):
self.add_parent_clicked(obj,"female")
def add_parent_clicked(self,obj):
import QuickAdd
QuickAdd.QuickAdd(self.db,"male",self.add_new_parent)
def change_family_type(self,family,mother_rel,father_rel):
"""

62
gramps/src/QuickAdd.py Normal file
View File

@ -0,0 +1,62 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import libglade
import Utils
import AutoComp
import const
import RelLib
class QuickAdd:
def __init__(self,db,sex,callback):
self.db = db
self.callback = callback
self.xml = libglade.GladeXML(const.gladeFile,"addperson")
self.xml.get_widget(sex).set_active(1)
self.xml.signal_autoconnect({
"on_addfather_close": self.close,
"destroy_passed_object" : Utils.destroy_passed_object
})
self.window = self.xml.get_widget("addperson")
self.window.editable_enters(self.xml.get_widget("given"))
self.window.editable_enters(self.xml.get_widget("surname"))
self.c = AutoComp.AutoCombo(self.xml.get_widget("surnameCombo"),
const.surnames)
def close(self,obj):
surname = self.xml.get_widget("surname").get_text()
given = self.xml.get_widget("given").get_text()
person = RelLib.Person()
self.db.addPerson(person)
name = person.getPrimaryName()
name.setSurname(surname)
name.setFirstName(given)
if self.xml.get_widget("male").get_active():
person.setGender(RelLib.Person.male)
self.father = person
else:
person.setGender(RelLib.Person.female)
self.mother = person
Utils.modified()
Utils.destroy_passed_object(self.window)
self.callback(person)

View File

@ -1570,25 +1570,19 @@
</widget>
<widget>
<class>GtkNotebook</class>
<name>rel_notebook</name>
<visible>False</visible>
<show_tabs>False</show_tabs>
<show_border>False</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
<scrollable>False</scrollable>
<tab_hborder>2</tab_hborder>
<tab_vborder>2</tab_vborder>
<popup_enable>False</popup_enable>
<class>GtkHBox</class>
<name>hbox77</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>True</yexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
@ -1596,83 +1590,110 @@
</child>
<widget>
<class>GtkCheckButton</class>
<name>prefrel</name>
<class>GtkHButtonBox</class>
<name>hbuttonbox30</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>30</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkButton</class>
<name>pref_spouse</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<name>clicked</name>
<handler>on_prefrel_toggled</handler>
<last_modification_time>Sat, 23 Mar 2002 15:15:51 GMT</last_modification_time>
<last_modification_time>Tue, 26 Mar 2002 15:03:14 GMT</last_modification_time>
</signal>
<label>Make this the preferred relationship</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label296</name>
<label>label296</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<name>label298</name>
<label>Preferred Relationship</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label297</name>
<label>label297</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<label>Make this the preferred spouse</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
<widget>
<class>GtkNotebook</class>
<name>lab_or_list</name>
<show_tabs>False</show_tabs>
<show_border>False</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
<scrollable>False</scrollable>
<tab_hborder>2</tab_hborder>
<tab_vborder>2</tab_vborder>
<popup_enable>False</popup_enable>
<class>GtkVBox</class>
<name>multi_spouse</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>5</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkButton</class>
<name>button150</name>
<tooltip>Make the current father the active person</tooltip>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_spouse_up_clicked</handler>
<last_modification_time>Tue, 26 Mar 2002 15:18:30 GMT</last_modification_time>
</signal>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkArrow</class>
<name>arrow13</name>
<width>10</width>
<height>10</height>
<arrow_type>GTK_ARROW_UP</arrow_type>
<shadow_type>GTK_SHADOW_OUT</shadow_type>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
<widget>
<class>GtkButton</class>
<name>button151</name>
<tooltip>Make the current mother the active person</tooltip>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_spouse_down_clicked</handler>
<last_modification_time>Tue, 26 Mar 2002 15:18:40 GMT</last_modification_time>
</signal>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkArrow</class>
<name>arrow14</name>
<width>10</width>
<height>10</height>
<arrow_type>GTK_ARROW_DOWN</arrow_type>
<shadow_type>GTK_SHADOW_OUT</shadow_type>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkEntry</class>
<name>fv_spouse1</name>
@ -1681,42 +1702,20 @@
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label224</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>fv_spouse</name>
<can_focus>True</can_focus>
<items>
</items>
<initial_choice>0</initial_choice>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label225</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
@ -2192,18 +2191,14 @@
</widget>
<widget>
<class>GtkCheckButton</class>
<name>preffam</name>
<visible>False</visible>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_preffam_toggled</handler>
<last_modification_time>Sun, 24 Mar 2002 16:20:15 GMT</last_modification_time>
</signal>
<label>Make this the preferred family</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<class>GtkHButtonBox</class>
<name>hbuttonbox31</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>30</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
@ -2216,8 +2211,22 @@
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkButton</class>
<name>preffam</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_preffam_clicked</handler>
<last_modification_time>Tue, 26 Mar 2002 15:04:33 GMT</last_modification_time>
</signal>
<label>Make these the preferred parents</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
</widget>
@ -4586,7 +4595,7 @@
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>hbuttonbox6</name>
<layout_style>GTK_BUTTONBOX_SPREAD</layout_style>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>0</spacing>
<child_min_width>0</child_min_width>
<child_min_height>0</child_min_height>
@ -4599,21 +4608,6 @@
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>spouseNewPerson</name>
<can_default>True</can_default>
<has_default>True</has_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_new_spouse_clicked</handler>
<object>spouseDialog</object>
<last_modification_time>Thu, 23 Aug 2001 21:21:10 GMT</last_modification_time>
</signal>
<label>Add new person</label>
</widget>
<widget>
<class>GtkButton</class>
<name>spouseExistingPerson</name>
@ -4625,7 +4619,7 @@
<object>spouseDialog</object>
<last_modification_time>Thu, 23 Aug 2001 21:21:01 GMT</last_modification_time>
</signal>
<label>Select existing person</label>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
@ -4670,12 +4664,10 @@
</widget>
<widget>
<class>GtkFrame</class>
<name>frame5</name>
<border_width>5</border_width>
<label>Select existing person as spouse</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<class>GtkVBox</class>
<name>vbox50</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
@ -4692,6 +4684,11 @@
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkCList</class>
@ -4735,154 +4732,36 @@
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame4</name>
<border_width>5</border_width>
<label>Add new person as spouse</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<class>GtkHButtonBox</class>
<name>hbuttonbox28</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>30</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>5</padding>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkTable</class>
<name>table25</name>
<rows>2</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>5</row_spacing>
<column_spacing>5</column_spacing>
<widget>
<class>GtkLabel</class>
<name>label235</name>
<label>Given Name</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>5</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</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>label236</name>
<label>Surname</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>5</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</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>GtkEntry</class>
<name>given</name>
<class>GtkButton</class>
<name>spouseNewPerson</name>
<can_default>True</can_default>
<has_default>True</has_default>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<signal>
<name>activate</name>
<handler>on_given_activate</handler>
<name>clicked</name>
<handler>on_new_spouse_clicked</handler>
<object>spouseDialog</object>
<last_modification_time>Sat, 22 Sep 2001 04:20:27 GMT</last_modification_time>
<last_modification_time>Thu, 23 Aug 2001 21:21:10 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>surname_combo</name>
<border_width>5</border_width>
<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>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</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>surname</name>
<can_focus>True</can_focus>
<signal>
<name>insert_text</name>
<handler>on_combo_insert_text</handler>
<object>surname_combo</object>
<last_modification_time>Tue, 30 Oct 2001 09:51:42 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
<label>Add new person</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
</widget>
@ -4974,7 +4853,7 @@
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
@ -5072,91 +4951,34 @@
<name>hseparator15</name>
<child>
<padding>5</padding>
<expand>True</expand>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox6</name>
<class>GtkFrame</class>
<name>flabel</name>
<border_width>5</border_width>
<label>Father</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox51</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>10</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>flabel</name>
<label>Father</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>fatherName</name>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button123</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_addfather_clicked</handler>
<object>prel</object>
<last_modification_time>Thu, 27 Sep 2001 23:08:17 GMT</last_modification_time>
</signal>
<label>Add</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow11</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkCList</class>
<name>fatherList</name>
<border_width>3</border_width>
<width>400</width>
<height>100</height>
<can_focus>True</can_focus>
@ -5169,6 +4991,11 @@
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
@ -5196,17 +5023,17 @@
<ypad>0</ypad>
</widget>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox24</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>8</padding>
<expand>False</expand>
<fill>False</fill>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
@ -5264,95 +5091,32 @@ Unknown
</widget>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator17</name>
<class>GtkFrame</class>
<name>mlabel</name>
<border_width>5</border_width>
<label>Mother</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>10</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox7</name>
<class>GtkVBox</class>
<name>vbox52</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>10</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>mlabel</name>
<label>Mother</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>motherName</name>
<can_focus>True</can_focus>
<editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button124</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_addmother_clicked</handler>
<object>prel</object>
</signal>
<label>Add</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow12</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkCList</class>
<name>motherList</name>
<border_width>3</border_width>
<height>100</height>
<can_focus>True</can_focus>
<signal>
@ -5364,6 +5128,11 @@ Unknown
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
@ -5391,15 +5160,15 @@ Unknown
<ypad>0</ypad>
</widget>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox16</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>8</padding>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
@ -5459,13 +5228,45 @@ Unknown
</widget>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkHButtonBox</class>
<name>hbuttonbox29</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>30</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkButton</class>
<name>button123</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_add_parent_clicked</handler>
<object>prel</object>
<last_modification_time>Tue, 26 Mar 2002 14:41:53 GMT</last_modification_time>
</signal>
<label>Add New Person</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator19</name>
<child>
<padding>10</padding>
<expand>True</expand>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
@ -5477,7 +5278,7 @@ Unknown
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<expand>False</expand>
<fill>True</fill>
</child>
@ -7092,7 +6893,7 @@ Unknown
<widget>
<class>GnomeDialog</class>
<name>addperson</name>
<title>Edit Person - GRAMPS</title>
<title>Add Person - GRAMPS</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>True</modal>

View File

@ -89,6 +89,7 @@ class Gramps:
self.active_mother = None
self.active_parents = None
self.parents_index = 0
self.spouse_index = 0
self.active_person = None
self.active_spouse = None
self.bookmarks = None
@ -176,7 +177,8 @@ class Gramps:
self.qual_label = self.gtop.get_widget("qual")
self.child_type = self.gtop.get_widget("childtype")
self.spouse_tab = self.gtop.get_widget("lab_or_list")
self.spouse_ptab = self.gtop.get_widget("rel_notebook")
self.pref_spouse = self.gtop.get_widget("pref_spouse")
self.multi_spouse= self.gtop.get_widget("multi_spouse")
self.spouse_pref = self.gtop.get_widget("prefrel")
self.spouse_edit = self.gtop.get_widget("edit_sp")
self.spouse_del = self.gtop.get_widget("delete_sp")
@ -211,9 +213,11 @@ class Gramps:
self.gtop.signal_autoconnect({
"delete_event" : self.delete_event,
"destroy_passed_object" : Utils.destroy_passed_object,
"on_preffam_toggled" : self.on_preferred_fam_toggled,
"on_preffam_clicked" : self.on_preferred_fam_toggled,
"on_family_up_clicked" : self.family_up_clicked,
"on_family_down_clicked" : self.family_down_clicked,
"on_spouse_up_clicked" : self.spouse_up_clicked,
"on_spouse_down_clicked" : self.spouse_down_clicked,
"on_prefrel_toggled" : self.on_preferred_rel_toggled,
"on_about_activate" : self.on_about_activate,
"on_add_bookmark_activate" : self.on_add_bookmark_activate,
@ -285,7 +289,6 @@ class Gramps:
"on_show_plugin_status" : self.on_show_plugin_status,
"on_source_list_button_press_event" : self.source_view.on_button_press_event,
"on_sources_activate" : self.on_sources_activate,
"on_spouselist_changed" : self.on_spouselist_changed,
"on_swap_clicked" : self.on_swap_clicked,
"on_tools_clicked" : self.on_tools_clicked,
"on_gramps_home_page_activate" : self.on_gramps_home_page_activate,
@ -1300,18 +1303,12 @@ class Gramps:
filter.hide()
filter.set_sensitive(obj.get_data("qual"))
def on_spouselist_changed(self,obj):
if self.active_person:
self.display_marriage(obj.get_data("family"))
def on_preferred_rel_toggled(self,obj):
self.spouse_ptab.set_page(1)
self.spouse_pref.set_active(0)
self.active_person.setPreferred(self.active_family)
self.load_family(self.active_family)
Utils.modified()
def on_preferred_fam_toggled(self,obj):
obj.set_active(0)
self.active_person.setMainParents(self.active_parents)
self.change_parents(self.active_parents)
Utils.modified()
@ -1389,7 +1386,6 @@ class Gramps:
self.active_family = family
if self.active_family:
flist = self.active_person.getFamilyList()
if self.active_family:
if self.active_person != self.active_family.getFather() and \
self.active_family != self.active_family.getMother():
if len(flist) > 0:
@ -1397,6 +1393,8 @@ class Gramps:
else:
self.active_family = None
self.spouse_index = 0
family_types = []
main_family = None
@ -1425,35 +1423,37 @@ class Gramps:
flist = self.active_person.getFamilyList()
number_of_families = len(flist)
if number_of_families > 1:
myMenu = gtk.GtkMenu()
index = 0
opt_index = 0
for f in flist:
person = None
if f.getMother() == self.active_person:
if f.getFather() != None:
person = f.getFather()
if self.active_family == None:
self.active_family = flist[0]
else:
if f.getMother() != None:
person = f.getMother()
for f in flist:
if f == self.active_family:
break
self.spouse_index = self.spouse_index + 1
menuitem = gtk.GtkMenuItem(GrampsCfg.nameof(person))
myMenu.append(menuitem)
menuitem.set_data("person",person)
menuitem.set_data("family",f)
menuitem.connect("activate",self.on_spouselist_changed)
menuitem.show()
if family and f == family:
opt_index = index
index = index + 1
self.spouse_menu.set_menu(myMenu)
self.spouse_menu.set_history(opt_index)
self.spouse_tab.set_page(1)
self.spouse_pref.set_active(0)
self.pref_spouse.show()
self.multi_spouse.show()
if self.active_family == flist[0]:
self.pref_spouse.set_sensitive(0)
msg = _("Preferred Relationship (%d of %d)") % (self.spouse_index+1,
len(flist))
else:
msg = _("Relationship (%d of %d)") % (self.spouse_index+1,
len(flist))
self.pref_spouse.set_sensitive(1)
self.gtop.get_widget('rel_frame').set_label(msg)
if self.active_person != self.active_family.getFather():
spouse = self.active_family.getFather()
else:
spouse = self.active_family.getMother()
self.spouse_text.set_text(GrampsCfg.nameof(spouse))
self.spouse_edit.set_sensitive(1)
self.spouse_del.set_sensitive(1)
elif number_of_families == 1:
self.spouse_tab.set_page(0)
self.pref_spouse.hide()
self.multi_spouse.hide()
f = self.active_person.getFamilyList()[0]
if self.active_person != f.getFather():
spouse = f.getFather()
@ -1461,18 +1461,17 @@ class Gramps:
spouse = f.getMother()
self.active_spouse = spouse
self.spouse_text.set_text(GrampsCfg.nameof(spouse))
self.spouse_text.set_data("person",spouse)
self.spouse_text.set_data("family",self.active_person.getFamilyList()[0])
self.spouse_edit.set_sensitive(1)
self.spouse_del.set_sensitive(1)
self.gtop.get_widget('rel_frame').set_label(_("Relationship"))
else:
self.spouse_tab.set_page(0)
self.pref_spouse.hide()
self.multi_spouse.hide()
self.spouse_text.set_text("")
self.spouse_text.set_data("person",None)
self.spouse_text.set_data("family",None)
self.active_spouse = None
self.spouse_edit.set_sensitive(0)
self.spouse_del.set_sensitive(0)
self.gtop.get_widget('rel_frame').set_label(_("No Relationship"))
if number_of_families > 0:
if family:
@ -1577,15 +1576,6 @@ class Gramps:
if family:
flist = self.active_person.getFamilyList()
if len(flist) <= 1:
self.spouse_ptab.hide()
else:
if family == flist[0]:
self.spouse_ptab.set_page(1)
else:
self.spouse_ptab.set_page(0)
self.spouse_ptab.show()
if self.active_person.getGender() == Person.male:
self.active_spouse = family.getMother()
else:
@ -1855,6 +1845,28 @@ class Gramps:
self.active_parents = flist[self.parents_index][0]
self.change_parents(self.active_parents)
def spouse_up_clicked(self,obj):
if self.active_family == None:
return
flist = self.active_person.getFamilyList()
if self.spouse_index == 0:
self.spouse_index = len(flist)-1
else:
self.spouse_index = self.spouse_index - 1
self.active_family = flist[self.spouse_index]
self.load_family()
def spouse_down_clicked(self,obj):
if self.active_family == None:
return
flist = self.active_person.getFamilyList()
if self.spouse_index == len(flist)-1:
self.spouse_index = 0
else:
self.spouse_index = self.spouse_index + 1
self.active_family = flist[self.spouse_index]
self.load_family()
def export_callback(self,obj,plugin_function):
"""Call the export plugin, with the active person and database"""
if self.active_person: