* src/ChooseParens.py: Support for (int,str) relationships.

* src/FamilyView.py (new_child_after_edit): Use tuple relationships.
* src/SelectChild.py: Support for (int,str) relationships.
* src/gramps.glade (selec_child,modparents,familyDialog): Replace
ComboBoxes with ComboBoxEntries.


svn: r4803
This commit is contained in:
Alex Roitman 2005-06-08 13:41:51 +00:00
parent 7bdd756df9
commit 6408226085
5 changed files with 126 additions and 73 deletions

View File

@ -1,3 +1,10 @@
2005-06-08 Alex Roitman <shura@gramps-project.org>
* src/ChooseParens.py: Support for (int,str) relationships.
* src/FamilyView.py (new_child_after_edit): Use tuple relationships.
* src/SelectChild.py: Support for (int,str) relationships.
* src/gramps.glade (selec_child,modparents,familyDialog): Replace
ComboBoxes with ComboBoxEntries.
2005-06-07 Alex Roitman <shura@gramps-project.org>
* src/gramps.glade (selecty_person): Change positioning; add icon.
* src/edit_person.glade (event_tab): Correct tooltips.

View File

@ -58,6 +58,19 @@ import NameDisplay
import DateHandler
import GenericFilter
from QuestionDialog import ErrorDialog, WarningDialog
import AutoComp
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
UNKNOWN_REL = (RelLib.Person.CHILD_UNKNOWN,
Utils.child_relations[RelLib.Person.CHILD_UNKNOWN])
BIRTH_REL = (RelLib.Person.CHILD_BIRTH,
Utils.child_relations[RelLib.Person.CHILD_BIRTH])
MARRIED_REL = (RelLib.Family.MARRIED,
Utils.family_relations[RelLib.Family.MARRIED])
#-------------------------------------------------------------------------
#
@ -147,15 +160,18 @@ class ChooseParents:
frel = fr
break
else:
mrel = RelLib.Person.CHILD_BIRTH
frel = RelLib.Person.CHILD_BIRTH
mrel = BIRTH_REL
frel = BIRTH_REL
if self.family:
self.type = self.family.get_relationship()
else:
self.type = RelLib.Family.MARRIED
self.type = MARRIED_REL
self.prel.set_active(self.type)
self.prel_selector = AutoComp.StandardCustomSelector(
Utils.child_relations,self.prel,
RelLib.Family.CUSTOM,RelLib.Family.MARIIED)
self.prel_selector.set_values(self.type)
self.redrawm()
self.glade.signal_autoconnect({
@ -169,9 +185,17 @@ class ChooseParents:
"on_familyDialog_delete_event" : self.on_delete_event,
})
self.keys = const.child_rel_list
self.build_list(self.mcombo,mrel)
self.build_list(self.fcombo,frel)
#self.build_list(self.mcombo,mrel)
#self.build_list(self.fcombo,frel)
self.frel_selector = AutoComp.StandardCustomSelector(
Utils.child_relations,self.fcombo,
RelLib.Person.CHILD_CUSTOM,RelLib.Person.CHILD_BIRTH)
self.mrel_selector = AutoComp.StandardCustomSelector(
Utils.child_relations,self.mcombo,
RelLib.Person.CHILD_CUSTOM,RelLib.Person.CHILD_BIRTH)
self.frel_selector.set_values(frel)
self.mrel_selector.set_values(mrel)
self.window.show()
@ -292,7 +316,7 @@ class ChooseParents:
self.father_model = PeopleModel.PeopleModel(self.db,self.father_filter)
self.father_list.set_model(self.father_model)
if self.type == RelLib.Family.CIVIL_UNION:
if self.type[0] == RelLib.Family.CIVIL_UNION:
self.flabel.set_label("<b>%s</b>" % _("Par_ent"))
else:
self.flabel.set_label("<b>%s</b>" % _("Fath_er"))
@ -302,7 +326,7 @@ class ChooseParents:
self.mother_model = PeopleModel.PeopleModel(self.db,self.mother_filter)
self.mother_list.set_model(self.mother_model)
if self.type == RelLib.Family.CIVIL_UNION:
if self.type[0] == RelLib.Family.CIVIL_UNION:
self.mlabel.set_label("<b>%s</b>" % _("Pa_rent"))
else:
self.mlabel.set_label("<b>%s</b>" % _("Mothe_r"))
@ -310,9 +334,9 @@ class ChooseParents:
def parent_relation_changed(self,obj):
"""Called everytime the parent relationship information is changed"""
self.old_type = self.type
self.type = self.prel.get_active()
if (self.old_type == RelLib.Family.CIVIL_UNION or
self.type == RelLib.Family.CIVIL_UNION):
self.type = self.prel_selector.get_values()
if (self.old_type[0] == RelLib.Family.CIVIL_UNION or
self.type[0] == RelLib.Family.CIVIL_UNION):
self.redrawf()
self.redrawm()
@ -445,14 +469,14 @@ class ChooseParents:
as parents of the main person.
"""
try:
mother_rel = self.mcombo.get_active()
mother_rel = self.mrel_selector.get_values()
except KeyError:
mother_rel = RelLib.Person.CHILD_BIRTH
mother_rel = BIRTH_REL
try:
father_rel = self.fcombo.get_active()
father_rel = self.frel_selector.get_values()
except KeyError:
father_rel = RelLib.Person.CHILD_BIRTH
father_rel = BIRTH_REL
trans = self.db.transaction_begin()
if self.father or self.mother:
@ -509,9 +533,9 @@ class ChooseParents:
person = epo.person
handle = person.get_handle()
name = person.get_primary_name().get_surname()
self.type = self.prel.get_active()
self.type = self.prel_selector.get_values()
if self.type == RelLib.Family.CIVIL_UNION:
if self.type[0] == RelLib.Family.CIVIL_UNION:
self.parent_relation_changed(self.prel)
elif person.get_gender() == RelLib.Person.MALE:
try:
@ -626,8 +650,8 @@ class ModifyParents:
self.fcombo = self.glade.get_widget('fcombo')
self.mcombo = self.glade.get_widget('mcombo')
self.orig_mrel = RelLib.Person.CHILD_BIRTH
self.orig_frel = RelLib.Person.CHILD_BIRTH
self.orig_mrel = BIRTH_REL
self.orig_frel = BIRTH_REL
for (f,mr,fr) in self.person.get_parent_family_handle_list():
if f == self.family.get_handle():
self.orig_mrel = mr
@ -675,11 +699,19 @@ class ModifyParents:
self.mcombo.set_sensitive(False)
self.glade.get_widget('ok').set_sensitive(False)
self.keys = const.child_rel_list
self.build_list(self.mcombo,self.orig_mrel)
self.build_list(self.fcombo,self.orig_frel)
#self.build_list(self.mcombo,self.orig_mrel)
#self.build_list(self.fcombo,self.orig_frel)
self.frel_selector = AutoComp.StandardCustomSelector(
Utils.child_relations,self.fcombo,
RelLib.Person.CHILD_CUSTOM,RelLib.Person.CHILD_BIRTH)
self.frel_selector.set_values(self.orig_frel)
self.mrel_selector = AutoComp.StandardCustomSelector(
Utils.child_relations,self.mcombo,
RelLib.Person.CHILD_CUSTOM,RelLib.Person.CHILD_BIRTH)
self.mrel_selector.set_values(self.orig_mrel)
self.val = self.window.run()
if self.val == gtk.RESPONSE_OK:
self.save_parents_clicked()
@ -703,8 +735,8 @@ class ModifyParents:
as parents of the main person.
"""
mother_rel = self.mcombo.get_active()
father_rel = self.fcombo.get_active()
mother_rel = self.mrel_selector.get_values()
father_rel = self.frel_selector.get_values()
mod = False
fhandle = self.family.get_handle()

View File

@ -64,6 +64,9 @@ from DdTargets import DdTargets
# Constants
#
#-------------------------------------------------------------------------
BIRTH_REL = (RelLib.Person.CHILD_BIRTH,
Utils.child_relations[RelLib.Person.CHILD_BIRTH])
_BORN = _('b.')
_DIED = _('d.')
@ -793,8 +796,8 @@ class FamilyView:
# TODO: Add child ordered by birth day
family.add_child_handle(new_person.get_handle())
new_person.add_parent_family_handle(family.get_handle(),
RelLib.Person.CHILD_BIRTH,
RelLib.Person.CHILD_BIRTH)
BIRTH_REL,BIRTH_REL)
self.parent.db.commit_person(new_person,trans)
self.parent.db.commit_family(family,trans)
self.parent.db.transaction_commit(trans,_("Add Child to Family"))

View File

@ -46,9 +46,17 @@ import const
import Utils
import PeopleModel
import NameDisplay
import AutoComp
from QuestionDialog import ErrorDialog
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
UNKNOWN_REL = (RelLib.Person.CHILD_UNKNOWN,
Utils.child_relations[RelLib.Person.CHILD_UNKNOWN])
#-------------------------------------------------------------------------
#
# SelectChild
@ -89,8 +97,15 @@ class SelectChild:
self.mrel = self.xml.get_widget("mrel_combo")
self.frel = self.xml.get_widget("frel_combo")
self.build_list(self.mrel,RelLib.Person.CHILD_BIRTH)
self.build_list(self.frel,RelLib.Person.CHILD_BIRTH)
self.frel_selector = AutoComp.StandardCustomSelector(
Utils.child_relations,self.frel,
RelLib.Person.CHILD_CUSTOM,RelLib.Person.CHILD_BIRTH)
self.mrel_selector = AutoComp.StandardCustomSelector(
Utils.child_relations,self.mrel,
RelLib.Person.CHILD_CUSTOM,RelLib.Person.CHILD_BIRTH)
#self.build_list(self.mrel,RelLib.Person.CHILD_BIRTH)
#self.build_list(self.frel,RelLib.Person.CHILD_BIRTH)
if self.family:
father = self.db.get_person_from_handle(self.family.get_father_handle())
@ -311,17 +326,17 @@ class SelectChild:
# TODO: Add child ordered by birth day
self.family.add_child_handle(select_child.get_handle())
mrel = self.mrel.get_active()
mrel = self.mrel_selector.get_values()
mother = self.db.get_person_from_handle(self.family.get_mother_handle())
if mother and mother.get_gender() != RelLib.Person.FEMALE:
if mrel == RelLib.Person.CHILD_BIRTH:
mrel = RelLib.Person.CHILD_UNKNOWN
if mrel[0] == RelLib.Person.CHILD_BIRTH:
mrel = UNKNOWN_REL
frel = self.frel.get_active()
frel = self.frel_selector.get_values()
father = self.db.get_person_from_handle(self.family.get_father_handle())
if father and father.get_gender() != RelLib.Person.MALE:
if frel == RelLib.Person.CHILD_BIRTH:
frel = RelLib.Person.CHILD_UNKNOWN
if frel[0] == RelLib.Person.CHILD_BIRTH:
frel = UNKNOWN_REL
select_child.add_parent_family_handle(self.family.get_handle(),
mrel,frel)

View File

@ -4714,23 +4714,7 @@ tories&lt;/b&gt;</property>
</child>
<child>
<widget class="GtkComboBox" id="prel_combo">
<property name="visible">True</property>
<property name="items" translatable="yes">Married</property>
<signal name="changed" handler="on_prel_changed" last_modification_time="Fri, 30 Jul 2004 15:32:53 GMT"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="fcombo">
<widget class="GtkComboBoxEntry" id="mrel_combo">
<property name="visible">True</property>
</widget>
<packing>
@ -4744,7 +4728,7 @@ tories&lt;/b&gt;</property>
</child>
<child>
<widget class="GtkComboBox" id="mcombo">
<widget class="GtkComboBoxEntry" id="mcombo">
<property name="visible">True</property>
</widget>
<packing>
@ -4756,6 +4740,21 @@ tories&lt;/b&gt;</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBoxEntry" id="prel_combo">
<property name="visible">True</property>
<signal name="changed" handler="on_prel_changed" last_modification_time="Wed, 08 Jun 2005 13:12:04 GMT"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -5061,20 +5060,7 @@ tories&lt;/b&gt;</property>
</child>
<child>
<widget class="GtkComboBox" id="mrel_combo">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="frel_combo">
<widget class="GtkComboBoxEntry" id="frel_combo">
<property name="visible">True</property>
</widget>
<packing>
@ -5082,7 +5068,19 @@ tories&lt;/b&gt;</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBoxEntry" id="mrel_combo">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">fill</property>
</packing>
</child>
@ -6836,9 +6834,8 @@ tories&lt;/b&gt;</property>
</child>
<child>
<widget class="GtkComboBox" id="fcombo">
<widget class="GtkComboBoxEntry" id="fcombo">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -6851,9 +6848,8 @@ tories&lt;/b&gt;</property>
</child>
<child>
<widget class="GtkComboBox" id="mcombo">
<widget class="GtkComboBoxEntry" id="mcombo">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
</widget>
<packing>
<property name="left_attach">2</property>