Better handling of perferred spouse, and rework of parents
svn: r854
This commit is contained in:
parent
c63c61be7e
commit
26cc165273
@ -259,45 +259,16 @@ class ChooseParents:
|
||||
Changes the family type of the specified family. If the family
|
||||
is None, the the relationship type shoud be deleted.
|
||||
"""
|
||||
is_main = mother_rel == "Birth" and father_rel == "Birth"
|
||||
|
||||
if family == self.person.getMainFamily():
|
||||
# make sure that the person is listed as a child
|
||||
if self.person not in family.getChildList():
|
||||
family.addChild(self.person)
|
||||
# if the relationships indicate that this is no longer
|
||||
# the main family, we need to delete the main family,
|
||||
# and add it as an alternate family (assuming that it
|
||||
# does not already in the list)
|
||||
if not is_main:
|
||||
self.person.setMainFamily(None)
|
||||
for fam in self.person.getAltFamilyList():
|
||||
if fam[0] == family:
|
||||
if fam[1] == mother_rel and fam[2] == father_rel:
|
||||
return
|
||||
else:
|
||||
self.person.removeFamily(fam[0])
|
||||
else:
|
||||
self.person.addAltFamily(family,mother_rel,father_rel)
|
||||
# The family is not already the main family
|
||||
else:
|
||||
if self.person not in family.getChildList():
|
||||
family.addChild(self.person)
|
||||
for fam in self.person.getAltFamilyList():
|
||||
if family == fam[0]:
|
||||
if is_main:
|
||||
self.person.setMainFamily(family)
|
||||
self.person.removeAltFamily(family)
|
||||
break
|
||||
if mother_rel == fam[1] and father_rel == fam[2]:
|
||||
return
|
||||
if mother_rel != fam[1] or father_rel != fam[2]:
|
||||
self.person.removeAltFamily(family)
|
||||
self.person.addAltFamily(family,mother_rel,father_rel)
|
||||
break
|
||||
else:
|
||||
if is_main:
|
||||
self.person.setMainFamily(family)
|
||||
else:
|
||||
self.person.addAltFamily(family,mother_rel,father_rel)
|
||||
Utils.modified()
|
||||
|
@ -288,23 +288,17 @@ class GrampsParser:
|
||||
|
||||
def start_childof(self,attrs):
|
||||
family = self.db.findFamilyNoMap(u2l(attrs["ref"]))
|
||||
if len(attrs) == 1:
|
||||
self.person.MainFamily = family
|
||||
else:
|
||||
mrel = ""
|
||||
frel = ""
|
||||
if attrs.has_key("mrel"):
|
||||
mrel = u2l(attrs["mrel"])
|
||||
else:
|
||||
mrel = "Birth"
|
||||
if attrs.has_key("frel"):
|
||||
frel = u2l(attrs["frel"])
|
||||
if mrel=="Birth" and frel=="Birth":
|
||||
self.person.MainFamily = family
|
||||
else:
|
||||
if mrel or frel:
|
||||
frel = "Birth"
|
||||
self.person.AltFamilyList.append((family,mrel,frel))
|
||||
else:
|
||||
type = u2l(attrs["type"])
|
||||
self.person.AltFamilyList.append((family,type,type))
|
||||
if attrs.has_key('pref'):
|
||||
self.person.setMainFamily(family)
|
||||
|
||||
def start_parentin(self,attrs):
|
||||
self.person.FamilyList.append(self.db.findFamilyNoMap(u2l(attrs["ref"])))
|
||||
@ -872,14 +866,6 @@ class GrampsImportParser(GrampsParser):
|
||||
if attrs.has_key("type"):
|
||||
self.family.setRelationship(u2l(attrs["type"]))
|
||||
|
||||
def start_childof(self,attrs):
|
||||
family = self.db.findFamily(u2l(attrs["ref"]),self.fmap)
|
||||
if attrs.has_key("type"):
|
||||
type = u2l(attrs["type"])
|
||||
self.person.addAltFamily(family,type)
|
||||
else:
|
||||
self.person.setMainFamily(family)
|
||||
|
||||
def start_sourceref(self,attrs):
|
||||
self.source_ref = SourceRef()
|
||||
self.source = self.db.findSource(u2l(attrs["ref"]),self.smap)
|
||||
|
@ -886,7 +886,6 @@ class Person:
|
||||
self.EventList = []
|
||||
self.FamilyList = []
|
||||
self.AltFamilyList = []
|
||||
self.MainFamily = None
|
||||
self.photoList = []
|
||||
self.nickname = ""
|
||||
self.alternateNames = []
|
||||
@ -1022,6 +1021,11 @@ class Person:
|
||||
parent or spouse"""
|
||||
self.FamilyList.append(family)
|
||||
|
||||
def setPreferred(self,family):
|
||||
if family in self.FamilyList:
|
||||
self.FamilyList.remove(family)
|
||||
self.FamilyList = [family] + self.FamilyList
|
||||
|
||||
def getFamilyList(self) :
|
||||
"""returns the list of Family instances in which the
|
||||
person is a parent or spouse"""
|
||||
@ -1082,16 +1086,40 @@ class Person:
|
||||
for f in self.AltFamilyList[:]:
|
||||
if f[0] == family:
|
||||
self.AltFamilyList.remove(f)
|
||||
return f
|
||||
else:
|
||||
return None
|
||||
|
||||
def has_family(self,family):
|
||||
for f in self.AltFamilyList:
|
||||
if f[0] == family:
|
||||
return f
|
||||
else:
|
||||
return None
|
||||
|
||||
def setMainFamily(self,family):
|
||||
"""sets the main Family of the Person, the Family in which the
|
||||
Person is a natural born child"""
|
||||
self.MainFamily = family
|
||||
assert(family in self.AltFamilyList)
|
||||
|
||||
f = self.removeFamily(family)
|
||||
self.AltFamilyList = [f] + self.AltFamilyList
|
||||
|
||||
def getMainFamily(self):
|
||||
"""returns the main Family of the Person, the Family in which the
|
||||
Person is a natural born child"""
|
||||
return self.MainFamily
|
||||
if len(self.AltFamilyList) == 0:
|
||||
return None
|
||||
else:
|
||||
return self.AltFamilyList[0][0]
|
||||
|
||||
def getMainFamilyRel(self):
|
||||
"""returns the main Family of the Person, the Family in which the
|
||||
Person is a natural born child"""
|
||||
if len(self.AltFamilyList) == 0:
|
||||
return None
|
||||
else:
|
||||
return self.AltFamilyList
|
||||
|
||||
def setNote(self,text):
|
||||
"""sets the note attached to the Person to the passed text"""
|
||||
@ -1127,8 +1155,7 @@ class Person:
|
||||
def setAncestor(self, value):
|
||||
"""set ancestor flag and recurse"""
|
||||
self.ancestor = value
|
||||
family = self.MainFamily
|
||||
if family:
|
||||
for (family,m,f) in self.AltFamilyList:
|
||||
if family.Father:
|
||||
# Don't waste time if the ancestor is already flagged.
|
||||
# This will happen when cousins marry.
|
||||
@ -1712,7 +1739,6 @@ class GrampsDB:
|
||||
self.familyMap = {}
|
||||
|
||||
for p in self.personMap.values():
|
||||
p.MainFamily = None
|
||||
p.AltFamilyList = []
|
||||
p.FamilyList = []
|
||||
self.personMap = {}
|
||||
|
@ -193,13 +193,13 @@ class SelectChild:
|
||||
if frel == "Birth":
|
||||
frel = "Unknown"
|
||||
|
||||
if mrel == "Birth" and frel == "Birth":
|
||||
family = select_child.getMainFamily()
|
||||
if family != None and family != self.family:
|
||||
family.removeChild(select_child)
|
||||
|
||||
select_child.setMainFamily(self.family)
|
||||
else:
|
||||
# if mrel == "Birth" and frel == "Birth":
|
||||
# family = select_child.getMainFamily()
|
||||
# if family != None and family != self.family:
|
||||
# family.removeChild(select_child)
|
||||
#
|
||||
# select_child.setMainFamily(self.family)
|
||||
# else:
|
||||
select_child.addAltFamily(self.family,mrel,frel)
|
||||
|
||||
Utils.modified()
|
||||
@ -373,9 +373,9 @@ class NewChild:
|
||||
mrel = const.childRelations[self.mrel.get_text()]
|
||||
frel = const.childRelations[self.frel.get_text()]
|
||||
|
||||
if mrel == "Birth" and frel == "Birth":
|
||||
person.setMainFamily(self.family)
|
||||
else:
|
||||
# if mrel == "Birth" and frel == "Birth":
|
||||
# person.setMainFamily(self.family)
|
||||
# else:
|
||||
person.addAltFamily(self.family,mrel,frel)
|
||||
|
||||
self.family.addChild(person)
|
||||
|
@ -29,7 +29,7 @@ class HaveAltFamilies(Filter.Filter):
|
||||
"People who were adopted"
|
||||
|
||||
def match(self,person):
|
||||
return len(person.getAltFamilyList()) > 0
|
||||
return len(person.getAltFamilyList()) > 1
|
||||
|
||||
|
||||
Filter.register_filter(HaveAltFamilies,
|
||||
|
@ -1443,36 +1443,6 @@
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox28</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label226</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>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
@ -1536,22 +1506,6 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label227</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>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -1564,7 +1518,7 @@
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
@ -1575,11 +1529,13 @@
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox25</name>
|
||||
<border_width>5</border_width>
|
||||
<class>GtkTable</class>
|
||||
<name>table28</name>
|
||||
<rows>2</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
@ -1598,12 +1554,100 @@
|
||||
<label>Spouse</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>5</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>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>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>True</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>True</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>prefrel</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>on_prefrel_toggled</handler>
|
||||
<last_modification_time>Sat, 23 Mar 2002 15:15:51 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>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkNotebook</class>
|
||||
<name>lab_or_list</name>
|
||||
@ -1615,9 +1659,18 @@
|
||||
<tab_vborder>2</tab_vborder>
|
||||
<popup_enable>False</popup_enable>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
<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>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
@ -1679,8 +1732,8 @@
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
@ -1751,7 +1804,7 @@
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table24</name>
|
||||
<rows>3</rows>
|
||||
<rows>5</rows>
|
||||
<columns>3</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
@ -1868,8 +1921,8 @@
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
@ -1892,8 +1945,8 @@
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
@ -1919,8 +1972,8 @@
|
||||
<child>
|
||||
<left_attach>2</left_attach>
|
||||
<right_attach>3</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
@ -1946,17 +1999,211 @@
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>childtype</name>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox50</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<left_attach>2</left_attach>
|
||||
<right_attach>3</right_attach>
|
||||
<top_attach>4</top_attach>
|
||||
<bottom_attach>5</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>True</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>family_up</name>
|
||||
<tooltip>Make the current father the active person</tooltip>
|
||||
<can_focus>True</can_focus>
|
||||
<items>
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_family_up_clicked</handler>
|
||||
<last_modification_time>Sun, 24 Mar 2002 02:58:49 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>arrow11</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>family_down</name>
|
||||
<tooltip>Make the current mother the active person</tooltip>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_family_down_clicked</handler>
|
||||
<last_modification_time>Sun, 24 Mar 2002 02:58:37 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>arrow12</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>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox75</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_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>True</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label301</name>
|
||||
<label>Related by:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>5</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>frel</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>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox76</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>3</top_attach>
|
||||
<bottom_attach>4</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>True</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label302</name>
|
||||
<label>Related by:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>5</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>mrel</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>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>preffam</name>
|
||||
<visible>False</visible>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Preferred Family</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>4</top_attach>
|
||||
<bottom_attach>5</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
@ -1980,7 +2227,7 @@
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
|
@ -88,6 +88,7 @@ class Gramps:
|
||||
self.active_father = None
|
||||
self.active_mother = None
|
||||
self.active_parents = None
|
||||
self.parents_index = 0
|
||||
self.active_person = None
|
||||
self.active_spouse = None
|
||||
self.bookmarks = None
|
||||
@ -175,6 +176,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.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")
|
||||
|
||||
@ -208,6 +211,9 @@ class Gramps:
|
||||
self.gtop.signal_autoconnect({
|
||||
"delete_event" : self.delete_event,
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_family_up_clicked" : self.family_up_clicked,
|
||||
"on_family_down_clicked" : self.family_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,
|
||||
"on_add_child_clicked" : self.on_add_child_clicked,
|
||||
@ -422,7 +428,8 @@ class Gramps:
|
||||
return
|
||||
|
||||
self.active_family.removeChild(self.active_child)
|
||||
self.active_child.setMainFamily(None)
|
||||
self.active_child.removeAltFamily(self.active_child)
|
||||
|
||||
if len(self.active_family.getChildList()) == 0:
|
||||
if self.active_family.getFather() == None:
|
||||
self.delete_family_from(self.active_family.getMother())
|
||||
@ -437,7 +444,7 @@ class Gramps:
|
||||
self.database.deleteFamily(self.active_family)
|
||||
flist = self.active_person.getFamilyList()
|
||||
if len(flist) > 0:
|
||||
self.active_family = flist[0]
|
||||
self.active_family = flist[0][0]
|
||||
else:
|
||||
self.active_family = None
|
||||
|
||||
@ -822,14 +829,14 @@ class Gramps:
|
||||
if self.active_person.getGender == Person.male:
|
||||
if family.getMother() == None:
|
||||
for child in family.getChildList():
|
||||
child.setMainFamily(None)
|
||||
child.removeAltFamily(family)
|
||||
del familymap[family]
|
||||
else:
|
||||
family.setFather(None)
|
||||
else:
|
||||
if family.getFather() == None:
|
||||
for child in family.getChildList():
|
||||
child.setMainFamily(None)
|
||||
child.removeAltFamily(family)
|
||||
del familymap[family]
|
||||
else:
|
||||
family.setMother(None)
|
||||
@ -869,9 +876,6 @@ class Gramps:
|
||||
return
|
||||
|
||||
self.active_parents.removeChild(self.active_person)
|
||||
if self.active_parents == self.active_person.getMainFamily():
|
||||
self.active_person.setMainFamily(None)
|
||||
else:
|
||||
self.active_person.removeAltFamily(self.active_parents)
|
||||
self.load_family()
|
||||
|
||||
@ -1299,6 +1303,11 @@ class Gramps:
|
||||
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)
|
||||
|
||||
def new_after_edit(self,epo,plist):
|
||||
if epo:
|
||||
if epo.person.getId() == "":
|
||||
@ -1370,54 +1379,64 @@ class Gramps:
|
||||
def load_family(self,family=None):
|
||||
if family != None:
|
||||
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:
|
||||
self.active_family = flist[0]
|
||||
else:
|
||||
self.active_family = None
|
||||
|
||||
family_types = []
|
||||
main_family = None
|
||||
|
||||
main_family = None
|
||||
self.person_text.set_text(GrampsCfg.nameof(self.active_person))
|
||||
|
||||
if self.active_person:
|
||||
main_family = self.active_person.getMainFamily()
|
||||
self.active_parents = main_family
|
||||
self.parents_index = 0
|
||||
family_types = self.active_person.getAltFamilyList()
|
||||
|
||||
if self.active_parents == None and len(family_types) > 0:
|
||||
fam = family_types[0]
|
||||
self.active_parents = fam[0]
|
||||
self.active_parents = family_types[0][0]
|
||||
else:
|
||||
self.active_parents = None
|
||||
|
||||
if len(family_types) > 0:
|
||||
typeMenu = gtk.GtkMenu()
|
||||
if main_family:
|
||||
menuitem = gtk.GtkMenuItem(_("Birth"))
|
||||
menuitem.set_data("parents",main_family)
|
||||
menuitem.connect("activate",self.on_current_type_changed)
|
||||
menuitem.show()
|
||||
typeMenu.append(menuitem)
|
||||
for fam in family_types:
|
||||
if self.active_person == fam[0].getFather():
|
||||
menuitem = gtk.GtkMenuItem("%s/%s" % (fam[1],fam[2]))
|
||||
else:
|
||||
menuitem = gtk.GtkMenuItem("%s/%s" % (fam[2],fam[1]))
|
||||
menuitem.set_data("parents",fam[0])
|
||||
menuitem.connect("activate",self.on_current_type_changed)
|
||||
menuitem.show()
|
||||
typeMenu.append(menuitem)
|
||||
self.child_type.set_menu(typeMenu)
|
||||
self.child_type.show()
|
||||
else:
|
||||
self.child_type.hide()
|
||||
# if len(family_types) > 0:
|
||||
# typeMenu = gtk.GtkMenu()
|
||||
# index = 0
|
||||
# pref = 0
|
||||
# for fam in family_types:
|
||||
# if fam[0] == main_family:
|
||||
# pref = index
|
||||
# if self.active_person == fam[0].getFather():
|
||||
# menuitem = gtk.GtkMenuItem("%s/%s" % (fam[1],fam[2]))
|
||||
# else:
|
||||
# menuitem = gtk.GtkMenuItem("%s/%s" % (fam[2],fam[1]))
|
||||
# menuitem.set_data("parents",fam[0])
|
||||
# menuitem.connect("activate",self.on_current_type_changed)
|
||||
# menuitem.show()
|
||||
# typeMenu.append(menuitem)
|
||||
# index = index + 1
|
||||
# self.child_type.set_menu(typeMenu)
|
||||
# self.child_type.set_history(pref)
|
||||
# self.child_type.show()
|
||||
# else:
|
||||
# self.child_type.hide()
|
||||
|
||||
self.change_parents(self.active_parents)
|
||||
|
||||
if self.active_person:
|
||||
number_of_families = len(self.active_person.getFamilyList())
|
||||
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 self.active_person.getFamilyList():
|
||||
for f in flist:
|
||||
person = None
|
||||
if f.getMother() == self.active_person:
|
||||
if f.getFather() != None:
|
||||
@ -1438,6 +1457,7 @@ class Gramps:
|
||||
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.spouse_edit.set_sensitive(1)
|
||||
self.spouse_del.set_sensitive(1)
|
||||
elif number_of_families == 1:
|
||||
@ -1505,6 +1525,10 @@ class Gramps:
|
||||
else :
|
||||
fv_mother.set_text("")
|
||||
mother_next.set_sensitive(0)
|
||||
for f in self.active_person.getAltFamilyList():
|
||||
if f[0] == family:
|
||||
self.gtop.get_widget("mrel").set_text(_(f[1]))
|
||||
self.gtop.get_widget("frel").set_text(_(f[2]))
|
||||
elif self.active_person == None:
|
||||
fv_father.set_text("")
|
||||
fv_mother.set_text("")
|
||||
@ -1522,6 +1546,8 @@ class Gramps:
|
||||
|
||||
def display_marriage(self,family):
|
||||
|
||||
if self.active_person == None:
|
||||
return
|
||||
self.active_family = family
|
||||
fv_prev = self.gtop.get_widget("fv_prev")
|
||||
|
||||
@ -1533,7 +1559,17 @@ class Gramps:
|
||||
self.child_list.set_sort_column(self.c_sort_col)
|
||||
self.child_list.set_reorderable(self.c_sort_col == self.c_birth_order)
|
||||
|
||||
if family != None:
|
||||
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:
|
||||
@ -1784,8 +1820,26 @@ class Gramps:
|
||||
self.database.setDefaultPerson(self.active_person)
|
||||
Utils.modified()
|
||||
|
||||
def on_current_type_changed(self,obj):
|
||||
self.active_parents = obj.get_data("parents")
|
||||
def family_up_clicked(self,obj):
|
||||
if self.active_parents == None:
|
||||
return
|
||||
flist = self.active_person.getAltFamilyList()
|
||||
if self.parents_index == 0:
|
||||
self.parents_index = len(flist)-1
|
||||
else:
|
||||
self.parents_index = self.parents_index - 1
|
||||
self.active_parents = flist[self.parents_index][0]
|
||||
self.change_parents(self.active_parents)
|
||||
|
||||
def family_down_clicked(self,obj):
|
||||
if self.active_parents == None:
|
||||
return
|
||||
flist = self.active_person.getAltFamilyList()
|
||||
if self.parents_index == len(flist)-1:
|
||||
self.parents_index = 0
|
||||
else:
|
||||
self.parents_index = self.parents_index + 1
|
||||
self.active_parents = flist[self.parents_index][0]
|
||||
self.change_parents(self.active_parents)
|
||||
|
||||
def export_callback(self,obj,plugin_function):
|
||||
|
Loading…
Reference in New Issue
Block a user