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

@ -103,13 +103,10 @@ class Date:
Error = "Illegal Date" Error = "Illegal Date"
# The last part of these two strings must remain untranslated. It fstr = _("(from|between|bet|bet.)")
# is required to read saved data from XML. tstr = _("(and|to|-)")
from_str = _("(from|between|bet|bet.") + "|FROM)"
to_str = _("(and|to|-") + "|TO)"
fmt = compile(r"\s*" + from_str + r"\s+(.+)\s+" + to_str + r"\s+(.+)\s*$", fmt = compile("\s*%s\s+(.+)\s+%s\s+(.+)\s*$" % (fstr,tstr),IGNORECASE)
IGNORECASE)
def __init__(self,source=None): def __init__(self,source=None):
if source: if source:
@ -491,7 +488,7 @@ class SingleDate:
return "%s%s%s" % (y,m,d) return "%s%s%s" % (y,m,d)
def _format1(self): def _format1(self):
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF:
return "" return ""
elif self.day == UNDEF: elif self.day == UNDEF:
if self.month == UNDEF: if self.month == UNDEF:

View File

@ -452,7 +452,7 @@ def save_frel(st):
# #
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def initialize_personal_event_list(): def init_personal_event_list():
p = [] p = []
for event in personalConstantEvents.keys(): for event in personalConstantEvents.keys():
p.append(_pe_e2l[event]) p.append(_pe_e2l[event])
@ -464,7 +464,7 @@ def initialize_personal_event_list():
# #
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def initialize_marriage_event_list(): def init_marriage_event_list():
p = [] p = []
for event in familyConstantEvents.keys(): for event in familyConstantEvents.keys():
p.append(_fe_e2l[event]) p.append(_fe_e2l[event])
@ -476,7 +476,7 @@ def initialize_marriage_event_list():
# #
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def initialize_personal_attribute_list(): def init_personal_attribute_list():
p = [] p = []
for event in personalConstantAttributes.keys(): for event in personalConstantAttributes.keys():
p.append(_pa_e2l[event]) p.append(_pa_e2l[event])
@ -488,7 +488,7 @@ def initialize_personal_attribute_list():
# #
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def initialize_family_attribute_list(): def init_family_attribute_list():
p = [] p = []
for event in familyConstantAttributes.keys(): for event in familyConstantAttributes.keys():
p.append(_fa_e2l[event]) p.append(_fa_e2l[event])
@ -500,18 +500,18 @@ def initialize_family_attribute_list():
# #
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def initialize_family_relation_list(): def init_family_relation_list():
p = [] p = []
for event in _fr_e2l.keys(): for event in _fr_e2l.keys():
p.append(_fr_e2l[event]) p.append(_fr_e2l[event])
p.sort() p.sort()
return p return p
personalEvents = initialize_personal_event_list() personalEvents = init_personal_event_list()
personalAttributes = initialize_personal_attribute_list() personalAttributes = init_personal_attribute_list()
marriageEvents = initialize_marriage_event_list() marriageEvents = init_marriage_event_list()
familyAttributes = initialize_family_attribute_list() familyAttributes = init_family_attribute_list()
familyRelations = initialize_family_relation_list() familyRelations = init_family_relation_list()
places = [] places = []
surnames = [] surnames = []

View File

@ -581,11 +581,11 @@ class Gramps:
def clear_database(self): def clear_database(self):
"""Clear out the database if permission was granted""" """Clear out the database if permission was granted"""
const.personalEvents = const.initialize_personal_event_list() const.personalEvents = const.init_personal_event_list()
const.personalAttributes = const.initialize_personal_attribute_list() const.personalAttributes = const.init_personal_attribute_list()
const.marriageEvents = const.initialize_marriage_event_list() const.marriageEvents = const.init_marriage_event_list()
const.familyAttributes = const.initialize_family_attribute_list() const.familyAttributes = const.init_family_attribute_list()
const.familyRelations = const.initialize_family_relation_list() const.familyRelations = const.init_family_relation_list()
self.database.new() self.database.new()
self.topWindow.set_title("GRAMPS") self.topWindow.set_title("GRAMPS")
@ -685,7 +685,8 @@ class Gramps:
autosave = "%s/autosave.gramps" % dirname autosave = "%s/autosave.gramps" % dirname
if os.path.isfile(autosave): if os.path.isfile(autosave):
q = _("An autosave file exists for %s.\nShould this be loaded instead of the last saved version?") % dirname q = _("An autosave file exists for %s.\nShould this "
"be loaded instead of the last saved version?") % dirname
self.yname = autosave self.yname = autosave
self.nname = filename self.nname = filename
gnome.ui.GnomeQuestionDialog(q,self.autosave_query) gnome.ui.GnomeQuestionDialog(q,self.autosave_query)
@ -708,7 +709,6 @@ class Gramps:
self.displayError(_("%s is not a directory") % filename) self.displayError(_("%s is not a directory") % filename)
return return
self.statusbar.set_status(_("Loading %s ...") % filename) self.statusbar.set_status(_("Loading %s ...") % filename)
if self.load_database(filename) == 1: if self.load_database(filename) == 1:
@ -748,8 +748,8 @@ class Gramps:
try: try:
os.mkdir(filename) os.mkdir(filename)
except (OSError,IOError), msg: except (OSError,IOError), msg:
gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename +\ emsg = _("Could not create %s") % filename + "\n" + str(msg)
"\n" + str(msg)) gnome.ui.GnomeErrorDialog(emsg)
return return
except: except:
gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename) gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename)
@ -759,13 +759,9 @@ class Gramps:
filename = filename + os.sep + const.indexFile filename = filename + os.sep + const.indexFile
try: try:
WriteXML.exportData(self.database,filename,self.load_progress) WriteXML.exportData(self.database,filename,self.load_progress)
except IOError, msg: except (OSError,IOError), msg:
gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename +\ emsg = _("Could not create %s") % filename + "\n" + str(msg)
"\n" + str(msg)) gnome.ui.GnomeErrorDialog(emsg)
return
except OSError, msg:
gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename + \
"\n" + str(msg))
return return
self.database.setSavePath(old_file) self.database.setSavePath(old_file)
@ -801,7 +797,7 @@ class Gramps:
WriteXML.quick_write(self.database,filename,self.quick_progress) WriteXML.quick_write(self.database,filename,self.quick_progress)
self.statusbar.set_status(_("autosave complete")); self.statusbar.set_status(_("autosave complete"));
except (IOError,OSError),msg: except (IOError,OSError),msg:
self.statusbar.set_status(_("autosave failed") + (" - %s" % msg)); self.statusbar.set_status("%s - %s" % (_("autosave failed"),msg))
except: except:
import traceback import traceback
traceback.print_exc() traceback.print_exc()
@ -839,11 +835,12 @@ class Gramps:
def on_delete_person_clicked(self,obj): def on_delete_person_clicked(self,obj):
if len(self.person_list.selection) == 1: if len(self.person_list.selection) == 1:
msg = _("Do you really wish to delete %s?") % \ name = GrampsCfg.nameof(self.active_person)
GrampsCfg.nameof(self.active_person) msg = _("Do you really wish to delete %s?") % name
gnome.ui.GnomeQuestionDialog( msg, self.delete_person_response) gnome.ui.GnomeQuestionDialog(msg, self.delete_person_response)
elif len(self.person_list.selection) > 1: elif len(self.person_list.selection) > 1:
gnome.ui.GnomeErrorDialog(_("Currently, you can only delete one person at a time")) msg = _("Currently, you can only delete one person at a time")
gnome.ui.GnomeErrorDialog(msg)
def delete_person_response(self,val): def delete_person_response(self,val):
if val == 1: if val == 1:
@ -1035,9 +1032,10 @@ class Gramps:
def on_child_list_click_column(self,clist,column): def on_child_list_click_column(self,clist,column):
"""Called when the user selects a column header on the self.person_list """Called when the user selects a column header on the self.person_list
window. Change the sort function (column 0 is the name column, and column window. Change the sort function (column 0 is the name column, and
2 is the birthdate column), set the arrows on the labels to the correct column 2 is the birthdate column), set the arrows on the labels to
orientation, and then call apply_filter to redraw the list""" the correct orientation, and then call apply_filter to redraw the
list"""
if column == self.c_name: if column == self.c_name:
self.child_change_sort(clist,self.c_name,self.cNameArrow) self.child_change_sort(clist,self.c_name,self.cNameArrow)
elif column == self.c_gender: elif column == self.c_gender:
@ -1140,7 +1138,8 @@ class Gramps:
# Check birth date order in the new list # Check birth date order in the new list
if (EditPerson.birth_dates_in_order(desired_order) == 0): if (EditPerson.birth_dates_in_order(desired_order) == 0):
clist.emit_stop_by_name("row_move") clist.emit_stop_by_name("row_move")
gnome.ui.GnomeWarningDialog(_("Invalid move. Children must be ordered by birth date.")) msg = _("Invalid move. Children must be ordered by birth date.")
gnome.ui.GnomeWarningDialog(msg)
return return
# OK, this birth order works too. Update the family data structures. # OK, this birth order works too. Update the family data structures.
@ -1162,7 +1161,7 @@ class Gramps:
# Update the clist indices so any change of sorting works # Update the clist indices so any change of sorting works
i = 0 i = 0
for tmp in clist_order: for tmp in clist_order:
clist.set_text(i, self.c_birth_order, "%2d"%(new_order[tmp]+1)) clist.set_text(i,self.c_birth_order,"%2d"%(new_order[tmp]+1))
i = i + 1 i = i + 1
# Need to save the changed order # Need to save the changed order
@ -1186,19 +1185,21 @@ class Gramps:
def on_revert_activate(self,obj): def on_revert_activate(self,obj):
if self.database.getSavePath() != "": if self.database.getSavePath() != "":
msg = _("Do you wish to abandon your changes and revert to the last saved database?") msg = _("Do you wish to abandon your changes and "
"revert to the last saved database?")
gnome.ui.GnomeQuestionDialog(msg,self.revert_query) gnome.ui.GnomeQuestionDialog(msg,self.revert_query)
else: else:
msg = _("Cannot revert to a previous database, since one does not exist") msg = _("Cannot revert to a previous database, since "
"one does not exist")
gnome.ui.GnomeWarningDialog(msg) gnome.ui.GnomeWarningDialog(msg)
def revert_query(self,value): def revert_query(self,value):
if value == 0: if value == 0:
const.personalEvents = const.initialize_personal_event_list() const.personalEvents = const.init_personal_event_list()
const.personalAttributes = const.initialize_personal_attribute_list() const.personalAttributes = const.init_personal_attribute_list()
const.marriageEvents = const.initialize_marriage_event_list() const.marriageEvents = const.init_marriage_event_list()
const.familyAttributes = const.initialize_family_attribute_list() const.familyAttributes = const.init_family_attribute_list()
const.familyRelations = const.initialize_family_relation_list() const.familyRelations = const.init_family_relation_list()
file = self.database.getSavePath() file = self.database.getSavePath()
self.database.new() self.database.new()
@ -1233,7 +1234,8 @@ class Gramps:
if GrampsCfg.usevc and GrampsCfg.vc_comment: if GrampsCfg.usevc and GrampsCfg.vc_comment:
self.display_comment_box(self.database.getSavePath()) self.display_comment_box(self.database.getSavePath())
else: else:
self.save_file(self.database.getSavePath(),_("No Comment Provided")) msg = _("No Comment Provided")
self.save_file(self.database.getSavePath(),msg)
def on_save_activate_quit(self): def on_save_activate_quit(self):
"""Saves the file, first prompting for a comment if revision """Saves the file, first prompting for a comment if revision
@ -1244,7 +1246,8 @@ class Gramps:
if GrampsCfg.usevc and GrampsCfg.vc_comment: if GrampsCfg.usevc and GrampsCfg.vc_comment:
self.display_comment_box(self.database.getSavePath()) self.display_comment_box(self.database.getSavePath())
else: else:
self.save_file(self.database.getSavePath(),_("No Comment Provided")) msg = _("No Comment Provided")
self.save_file(self.database.getSavePath(),msg)
def display_comment_box(self,filename): def display_comment_box(self,filename):
"""Displays a dialog box, prompting for a revison control comment""" """Displays a dialog box, prompting for a revison control comment"""
@ -1293,7 +1296,7 @@ class Gramps:
elif page == 5: elif page == 5:
self.merge_button.set_sensitive(0) self.merge_button.set_sensitive(0)
self.media_view.load_media() self.media_view.load_media()
def on_swap_clicked(self,obj): def on_swap_clicked(self,obj):
if not self.active_person: if not self.active_person:
return return
@ -1305,14 +1308,16 @@ class Gramps:
def on_apply_filter_clicked(self,obj): def on_apply_filter_clicked(self,obj):
invert_filter = self.filter_inv.get_active() invert_filter = self.filter_inv.get_active()
qualifer = self.filter_text.get_text() qualifer = self.filter_text.get_text()
class_init = self.filter_list.get_menu().get_active().get_data("function") mi = self.filter_list.get_menu().get_active()
class_init = mi.get_data("function")
self.DataFilter = class_init(qualifer) self.DataFilter = class_init(qualifer)
self.DataFilter.set_invert(invert_filter) self.DataFilter.set_invert(invert_filter)
self.apply_filter() self.apply_filter()
def on_filter_name_changed(self,obj): def on_filter_name_changed(self,obj):
filter = obj.get_data("filter") filter = obj.get_data("filter")
if obj.get_data("qual"): qual = obj.get_data('qual')
if qual:
self.qual_label.show() self.qual_label.show()
self.qual_label.set_sensitive(1) self.qual_label.set_sensitive(1)
self.qual_label.set_text(obj.get_data("label")) self.qual_label.set_text(obj.get_data("label"))
@ -1320,7 +1325,7 @@ class Gramps:
else: else:
self.qual_label.hide() self.qual_label.hide()
filter.hide() filter.hide()
filter.set_sensitive(obj.get_data("qual")) filter.set_sensitive(qual)
def on_preferred_rel_toggled(self,obj): def on_preferred_rel_toggled(self,obj):
self.active_person.setPreferred(self.active_family) self.active_person.setPreferred(self.active_family)
@ -1407,22 +1412,10 @@ class Gramps:
sel = None sel = None
for f in self.active_person.getFamilyList(): for f in self.active_person.getFamilyList():
if self.active_person == f.getFather(): if self.active_person == f.getFather():
if f.getMother() == None: sname = self.parent_name(f.getMother())
sname = _("Unknown")
else:
sname = GrampsCfg.nameof(f.getMother())
else: else:
if f.getFather() == None: sname = self.parent_name(f.getFather())
sname = _("Unknown") c = self.list_item(sname,f)
else:
sname = GrampsCfg.nameof(f.getFather())
l = gtk.GtkLabel(sname)
l.show()
l.set_alignment(0,0.5)
c = gtk.GtkListItem()
c.add(l)
c.set_data('d',f)
c.show()
list.append(c) list.append(c)
if f == self.active_family or sel == None: if f == self.active_family or sel == None:
sel = c sel = c
@ -1436,6 +1429,22 @@ class Gramps:
self.spouse_combo.set_item_string(mymap[v],mynmap[v]) self.spouse_combo.set_item_string(mymap[v],mynmap[v])
self.spouse_combo.list.select_child(sel) self.spouse_combo.list.select_child(sel)
def list_item(self,label,filter):
l = gtk.GtkLabel(label)
l.set_alignment(0,0.5)
l.show()
c = gtk.GtkListItem()
c.add(l)
c.set_data('d',filter)
c.show()
return c
def parent_name(self,person):
if person == None:
return _("Unknown")
else:
return GrampsCfg.nameof(person)
def load_family(self,family=None): def load_family(self,family=None):
if family != None: if family != None:
self.active_family = family self.active_family = family
@ -1447,7 +1456,7 @@ class Gramps:
if self.active_family: if self.active_family:
flist = self.active_person.getFamilyList() flist = self.active_person.getFamilyList()
if self.active_person != self.active_family.getFather() and \ if self.active_person != self.active_family.getFather() and \
self.active_family != self.active_family.getMother(): self.active_person != self.active_family.getMother():
if len(flist) > 0: if len(flist) > 0:
self.active_family = flist[0] self.active_family = flist[0]
else: else:
@ -1515,7 +1524,8 @@ class Gramps:
self.spouse_text.set_text(GrampsCfg.nameof(spouse)) self.spouse_text.set_text(GrampsCfg.nameof(spouse))
self.spouse_edit.set_sensitive(1) self.spouse_edit.set_sensitive(1)
self.spouse_del.set_sensitive(1) self.spouse_del.set_sensitive(1)
self.gtop.get_widget('rel_frame').set_label(_("Relationship")) msg = _("Relationship")
self.gtop.get_widget('rel_frame').set_label(msg)
else: else:
self.pref_spouse.hide() self.pref_spouse.hide()
self.spouse_tab.set_page(0) self.spouse_tab.set_page(0)
@ -1523,13 +1533,13 @@ class Gramps:
self.active_spouse = None self.active_spouse = None
self.spouse_edit.set_sensitive(0) self.spouse_edit.set_sensitive(0)
self.spouse_del.set_sensitive(0) self.spouse_del.set_sensitive(0)
self.gtop.get_widget('rel_frame').set_label(_("No Relationship")) msg = _("No Relationship")
self.gtop.get_widget('rel_frame').set_label()
if number_of_families > 0: if number_of_families > 0:
if family: if not family:
self.display_marriage(family) family = self.active_person.getFamilyList()[0]
else: self.display_marriage(family)
self.display_marriage(self.active_person.getFamilyList()[0])
else: else:
self.display_marriage(None) self.display_marriage(None)
else: else:
@ -1541,7 +1551,7 @@ class Gramps:
"""Switches to a different set of parents on the Family View""" """Switches to a different set of parents on the Family View"""
if self.active_parents and self.active_parents.getRelationship() == "Partners": if self.active_parents and self.active_parents.getRelationship() == "Partners":
fn = _("Parent") fn = _("Parent")
mn = _("Parent") mn = _("Parent")
else: else:
fn = _("Father") fn = _("Father")
@ -1553,14 +1563,13 @@ class Gramps:
if self.active_parents == self.active_person.getMainParents(): if self.active_parents == self.active_person.getMainParents():
self.gtop.get_widget('preffam').set_sensitive(0) self.gtop.get_widget('preffam').set_sensitive(0)
if val > 1: if val > 1:
pframe.set_label(_("Preferred Parents (%d of %d)") % \ msg = _("Preferred Parents (%d of %d)") % (self.parents_index+1,val)
(self.parents_index+1,val))
else: else:
pframe.set_label(_("Preferred Parents")) msg = _("Preferred Parents")
else: else:
self.gtop.get_widget('preffam').set_sensitive(1) self.gtop.get_widget('preffam').set_sensitive(1)
pframe.set_label(_("Alternate Parents (%d of %d)") % \ msg = _("Alternate Parents (%d of %d)") % (self.parents_index+1,val)
(self.parents_index+1,val)) pframe.set_label(msg)
else: else:
self.gtop.get_widget('parent_frame').set_label(_("No Parents")) self.gtop.get_widget('parent_frame').set_label(_("No Parents"))
@ -1628,7 +1637,6 @@ class Gramps:
self.child_list.set_reorderable(self.c_sort_col == self.c_birth_order) self.child_list.set_reorderable(self.c_sort_col == self.c_birth_order)
if family: if family:
flist = self.active_person.getFamilyList()
if self.active_person == family.getFather(): if self.active_person == family.getFather():
self.active_spouse = family.getMother() self.active_spouse = family.getMother()
else: else:

View File

@ -32,6 +32,7 @@ import os
import const import const
from RelLib import * from RelLib import *
import GenericFilter import GenericFilter
import AutoComp
import intl import intl
_ = intl.gettext _ = intl.gettext
@ -217,6 +218,12 @@ class FilterEditor:
self.edit_rule(d) self.edit_rule(d)
def edit_rule(self,val): 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.active_rule = val
self.rule = libglade.GladeXML(const.filterFile,'add_rule') self.rule = libglade.GladeXML(const.filterFile,'add_rule')
self.rule_top = self.rule.get_widget('add_rule') self.rule_top = self.rule.get_widget('add_rule')
@ -258,7 +265,10 @@ class FilterEditor:
l = gtk.GtkLabel(v1) l = gtk.GtkLabel(v1)
l.set_alignment(1,0.5) l.set_alignment(1,0.5)
l.show() 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() t = gtk.GtkCombo()
_name2list[v1].sort() _name2list[v1].sort()
t.set_popdown_strings(_name2list[v1]) t.set_popdown_strings(_name2list[v1])
@ -269,7 +279,7 @@ class FilterEditor:
t = gtk.GtkEntry() t = gtk.GtkEntry()
tlist.append(t) tlist.append(t)
t.show() 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) table.attach(t,1,2,pos,pos+1,EXPAND|FILL,0,5,5)
pos = pos + 1 pos = pos + 1
self.notebook.append_page(table,gtk.GtkLabel(name)) self.notebook.append_page(table,gtk.GtkLabel(name))

View File

@ -528,112 +528,22 @@ class IndividualPage:
first = 1 first = 1
for child in family.getChildList(): for child in family.getChildList():
name = child.getPrimaryName().getRegularName()
if first == 1: if first == 1:
first = 0 first = 0
else: else:
self.doc.write_text('\n') self.doc.write_text('\n')
if self.list.has_key(child): if self.list.has_key(child):
self.doc.start_link("%s.html" % child.getId()) self.doc.start_link("%s.html" % child.getId())
self.doc.write_text(child.getPrimaryName().getRegularName()) self.doc.write_text(name)
self.doc.end_link() self.doc.end_link()
else: else:
self.doc.write_text(child.getPrimaryName().getRegularName()) self.doc.write_text(name)
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.end_row() self.doc.end_row()
self.doc.end_table() 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() doc.end_paragraph()
person_list.sort(sort.by_last_name) 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: for person in person_list:
name = person.getPrimaryName().getName() 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.start_link("%s.html" % person.getId())
doc.write_text(name) doc.write_text(name)
doc.end_link() doc.end_link()
doc.newline() if col_len <= 0 and end_col == 0:
doc.write_text('<div class="PersonIndex"/>') 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() doc.close()
def write_report(self): def write_report(self):
@ -908,7 +847,13 @@ class WebReportDialog(ReportDialog):
p = ParagraphStyle() p = ParagraphStyle()
p.set(font=font,bborder=1) p.set(font=font,bborder=1)
self.default_style.add_style("SourcesTitle",p) 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 = FontStyle()
font.set(bold=1,face=FONT_SANS_SERIF,size=12,italic=1) font.set(bold=1,face=FONT_SANS_SERIF,size=12,italic=1)
p = ParagraphStyle() p = ParagraphStyle()