diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 8405b52f2..7ccf61d96 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,10 @@ +2005-06-08 Alex Roitman + * 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 * src/gramps.glade (selecty_person): Change positioning; add icon. * src/edit_person.glade (event_tab): Correct tooltips. diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index b0597ba06..d3a0d2fbf 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -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("%s" % _("Par_ent")) else: self.flabel.set_label("%s" % _("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("%s" % _("Pa_rent")) else: self.mlabel.set_label("%s" % _("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() diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index e93ecd85c..e21ca0034 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -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")) diff --git a/gramps2/src/SelectChild.py b/gramps2/src/SelectChild.py index 90a168002..22fd96517 100644 --- a/gramps2/src/SelectChild.py +++ b/gramps2/src/SelectChild.py @@ -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) diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index b74c172c1..c132d449b 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -4714,23 +4714,7 @@ tories</b> - - True - Married - - - - 2 - 3 - 9 - 10 - fill - fill - - - - - + True @@ -4744,7 +4728,7 @@ tories</b> - + True @@ -4756,6 +4740,21 @@ tories</b> fill + + + + True + + + + 2 + 3 + 9 + 10 + fill + fill + + 0 @@ -5061,20 +5060,7 @@ tories</b> - - True - - - 1 - 2 - 1 - 2 - fill - - - - - + True @@ -5082,7 +5068,19 @@ tories</b> 2 0 1 - fill + fill + + + + + + True + + + 1 + 2 + 1 + 2 fill @@ -6836,9 +6834,8 @@ tories</b> - + True - 2 @@ -6851,9 +6848,8 @@ tories</b> - + True - 2