diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py
index 5cc58f278..60f0ecac7 100644
--- a/gramps2/src/ChooseParents.py
+++ b/gramps2/src/ChooseParents.py
@@ -80,6 +80,7 @@ class ChooseParents:
self.full_update = full_update
self.old_type = ""
self.type = ""
+ self.parent_selected = 0
self.date = person.getBirth().getDateObj()
@@ -115,7 +116,6 @@ class ChooseParents:
self.father_list_select_row)
self.mmodel = ListModel.ListModel(self.mother_list, _titles,
self.mother_list_select_row)
-
for (f,mr,fr) in self.person.getParentList():
if f == self.family:
@@ -206,9 +206,9 @@ class ChooseParents:
d = self.db.getPersonDisplay(idval)
info = [d[0],d[1],d[3],d[5],d[6]]
if self.type == "Partners":
- self.fmodel.add(info,None,fid==d[1])
+ self.fmodel.add(info,d[1],fid==d[1])
elif d[2] == const.male:
- self.fmodel.add(info,None,fid==d[1])
+ self.fmodel.add(info,d[1],fid==d[1])
if self.type == "Partners":
self.flabel.set_label("%s" % _("Parent"))
@@ -282,18 +282,16 @@ class ChooseParents:
d = self.db.getPersonDisplay(idval)
info = [d[0],d[1],d[3],d[5],d[6]]
if self.type == "Partners":
- self.mmodel.add(info,None,mid==d[1])
+ self.mmodel.add(info,d[1],mid==d[1])
elif d[2] == const.female:
- self.mmodel.add(info,None,mid==d[1])
+ self.mmodel.add(info,d[1],mid==d[1])
if self.type == "Partners":
self.mlabel.set_label("%s" % _("Parent"))
else:
self.mlabel.set_label("%s" % _("Mother"))
-
self.mmodel.connect_model()
-
def parent_relation_changed(self,obj):
"""Called everytime the parent relationship information is changegd"""
self.old_type = self.type
@@ -345,6 +343,14 @@ class ChooseParents:
else:
self.mother = None
+ if not self.parent_selected and self.mother:
+ self.parent_selected = 1
+ list = self.mother.getFamilyList()
+ if len(list) >= 1:
+ father = list[0].getFather()
+ self.fmodel.find(father.getId())
+ self.fmodel.center_selected()
+
def father_list_select_row(self,obj):
"""Called when a row is selected in the father list. Sets the
active father based off the id associated with the row."""
@@ -355,6 +361,14 @@ class ChooseParents:
else:
self.father = None
+ if not self.parent_selected and self.father:
+ self.parent_selected = 1
+ list = self.father.getFamilyList()
+ if len(list) >= 1:
+ mother = list[0].getMother()
+ self.mmodel.find(mother.getId())
+ self.mmodel.center_selected()
+
def save_parents_clicked(self,obj):
"""
Called with the OK button nis pressed. Saves the selected people as parents
diff --git a/gramps2/src/ListModel.py b/gramps2/src/ListModel.py
index 9ae04662a..f21c8f8dd 100644
--- a/gramps2/src/ListModel.py
+++ b/gramps2/src/ListModel.py
@@ -41,7 +41,7 @@ class ListModel:
self.count = 0
self.cid = None
self.cids = []
- self.objects = []
+ self.idmap = {}
cnum = 0
for name in dlist:
@@ -50,9 +50,6 @@ class ListModel:
column = gtk.TreeViewColumn(name[0],renderer,text=cnum)
column.set_min_width(name[2])
- self.objects.append(renderer)
- self.objects.append(column)
-
if name[0] == '':
column.set_visible(gtk.FALSE)
else:
@@ -189,6 +186,8 @@ class ListModel:
self.model.set_value(iter,col,object)
col = col + 1
self.model.set_value(iter,col,info)
+ if info:
+ self.idmap[info] = iter
if select:
self.selection.select_iter(iter)
return iter
@@ -204,6 +203,8 @@ class ListModel:
self.model.set_value(iter,col,object)
col = col + 1
self.model.set_value(iter,col,info)
+ if info:
+ self.idmap[info] = iter
if select:
self.sel_iter = iter
self.selection.select_iter(self.sel_iter)
@@ -215,6 +216,8 @@ class ListModel:
self.model.set_value(iter,col,object)
col = col + 1
self.model.set_value(iter,col,info)
+ if info:
+ self.idmap[info] = iter
if select:
self.sel_iter = iter
return iter
@@ -226,6 +229,8 @@ class ListModel:
for object in data:
self.model.set_value(iter,col,object)
col = col + 1
+ if info:
+ self.idmap[info] = iter
self.model.set_value(iter,col,info)
self.selection.select_iter(iter)
@@ -241,6 +246,9 @@ class ListModel:
return 1
return 0
+ def find(self,info):
+ iter = self.idmap[info]
+ self.selection.select_iter(iter)
+
def cleanup(self):
- for obj in self.objects:
- del obj
+ pass
diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade
index bd4eb0ca6..1f75d2bda 100644
--- a/gramps2/src/gramps.glade
+++ b/gramps2/src/gramps.glade
@@ -4264,7 +4264,7 @@
- 60
+ 150
True
True
True
@@ -4293,7 +4293,7 @@
- 60
+ 150
True
True
True