* src/GrampsParser.py: handle new witness format in XML file

* src/WriteXML.py: handle new witness format in XML file
* src/dialog.glade: removed unused callbacks
* src/gramps.glade: adjust window size
* src/ListModel.py: add the ability to find an entry
* src/ChooseParents.py: Select the preferred spouse of the first
selected person.


svn: r2252
This commit is contained in:
Don Allingham 2003-10-14 04:22:24 +00:00
parent b57e63e9b7
commit 15f45d4a44
3 changed files with 37 additions and 15 deletions

View File

@ -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()
@ -116,7 +117,6 @@ class ChooseParents:
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:
self.mother_rel.set_text(_(mr))
@ -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("<b>%s</b>" % _("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("<b>%s</b>" % _("Parent"))
else:
self.mlabel.set_label("<b>%s</b>" % _("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

View File

@ -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

View File

@ -4264,7 +4264,7 @@
<child>
<widget class="GtkTreeView" id="father_list">
<property name="height_request">60</property>
<property name="height_request">150</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
@ -4293,7 +4293,7 @@
<child>
<widget class="GtkTreeView" id="mother_list">
<property name="height_request">60</property>
<property name="height_request">150</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>