Two column index page for Web Page generation

svn: r920
This commit is contained in:
Don Allingham
2002-04-13 13:31:22 +00:00
parent 12e0753710
commit d5df9c9d7b
5 changed files with 144 additions and 184 deletions

View File

@@ -32,6 +32,7 @@ import os
import const
from RelLib import *
import GenericFilter
import AutoComp
import intl
_ = intl.gettext
@@ -217,6 +218,12 @@ class FilterEditor:
self.edit_rule(d)
def edit_rule(self,val):
self.pmap = {}
self.add_places = []
for p in self.db.getPlaces():
self.pmap[p.get_title()] = p
self.active_rule = val
self.rule = libglade.GladeXML(const.filterFile,'add_rule')
self.rule_top = self.rule.get_widget('add_rule')
@@ -258,7 +265,10 @@ class FilterEditor:
l = gtk.GtkLabel(v1)
l.set_alignment(1,0.5)
l.show()
if _name2list.has_key(v1):
if v == 'Place':
t = gtk.GtkCombo()
AutoComp.AutoCombo(t,self.pmap.keys())
elif _name2list.has_key(v1):
t = gtk.GtkCombo()
_name2list[v1].sort()
t.set_popdown_strings(_name2list[v1])
@@ -269,7 +279,7 @@ class FilterEditor:
t = gtk.GtkEntry()
tlist.append(t)
t.show()
table.attach(l,0,1,pos,pos+1,EXPAND|FILL,0,5,5)
table.attach(l,0,1,pos,pos+1,FILL,0,5,5)
table.attach(t,1,2,pos,pos+1,EXPAND|FILL,0,5,5)
pos = pos + 1
self.notebook.append_page(table,gtk.GtkLabel(name))

View File

@@ -528,112 +528,22 @@ class IndividualPage:
first = 1
for child in family.getChildList():
name = child.getPrimaryName().getRegularName()
if first == 1:
first = 0
else:
self.doc.write_text('\n')
if self.list.has_key(child):
self.doc.start_link("%s.html" % child.getId())
self.doc.write_text(child.getPrimaryName().getRegularName())
self.doc.write_text(name)
self.doc.end_link()
else:
self.doc.write_text(child.getPrimaryName().getRegularName())
self.doc.write_text(name)
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.end_row()
self.doc.end_table()
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def individual_filter(database,person,list,generations):
list.append(person)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def ancestor_filter(database,person,list,generations):
if person == None:
return
if person not in list:
list.append(person)
if generations <= 1:
return
family = person.getMainParents()
if family != None:
ancestor_filter(database,family.getFather(),list,generations-1)
ancestor_filter(database,family.getMother(),list,generations-1)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def descendant_filter(database,person,list,generations):
if person == None or person in list:
return
if person not in list:
list.append(person)
if generations <= 1:
return
for family in person.getFamilyList():
for child in family.getChildList():
descendant_filter(database,child,list,generations-1)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def an_des_filter(database,person,list,generations):
descendant_filter(database,person,list,generations)
ancestor_filter(database,person,list,generations)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def entire_db_filter(database,person,list,generations):
for entry in database.getPersonMap().values():
list.append(entry)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def an_des_of_gparents_filter(database,person,list,generations):
my_list = []
family = person.getMainParents()
if family == None:
return
for p in [ family.getMother(), family.getFather() ]:
if p:
pf = p.getMainParents()
if pf:
if pf.getFather():
my_list.append(pf.getFather())
if pf.getMother():
my_list.append(pf.getMother())
for person in my_list:
descendant_filter(database,person,list,generations)
ancestor_filter(database,person,list,generations)
#------------------------------------------------------------------------
#
#
@@ -676,14 +586,43 @@ class WebReport(Report):
doc.end_paragraph()
person_list.sort(sort.by_last_name)
doc.write_text('<div class="PersonIndex">')
a = {}
for person in person_list:
n = person.getPrimaryName().getSurname()
if n:
a[n[0]] = 1
else:
a[''] = 1
col_len = len(person_list) + len(a.keys())
col_len = col_len/2
doc.write_text('<table width="100%" border="0">')
doc.write_text('<tr><td width="50%" valign="top">')
last = ''
end_col = 0
for person in person_list:
name = person.getPrimaryName().getName()
if name and name[0] != last:
last = name[0]
doc.start_paragraph('IndexLabel')
doc.write_text(name[0])
doc.end_paragraph()
col_len = col_len - 1
doc.start_link("%s.html" % person.getId())
doc.write_text(name)
doc.end_link()
doc.newline()
doc.write_text('<div class="PersonIndex"/>')
if col_len <= 0 and end_col == 0:
doc.write_text('</td><td valign="top">')
doc.start_paragraph('IndexLabel')
doc.write_text(_("%s (continued)") % name[0])
doc.end_paragraph()
end_col = 1
else:
doc.newline()
col_len = col_len - 1
doc.write_text('</td></tr></table>')
doc.close()
def write_report(self):
@@ -908,7 +847,13 @@ class WebReportDialog(ReportDialog):
p = ParagraphStyle()
p.set(font=font,bborder=1)
self.default_style.add_style("SourcesTitle",p)
font = FontStyle()
font.set(bold=1,face=FONT_SANS_SERIF,size=14,italic=1)
p = ParagraphStyle()
p.set(font=font)
self.default_style.add_style("IndexLabel",p)
font = FontStyle()
font.set(bold=1,face=FONT_SANS_SERIF,size=12,italic=1)
p = ParagraphStyle()