* src/plugins/WebPage.py: proper handling of links in the MiniTree

svn: r2561
This commit is contained in:
Don Allingham 2003-12-27 23:13:54 +00:00
parent 793e0788cc
commit 7ef765703a

View File

@ -267,20 +267,21 @@ class IndividualPage:
else: else:
self.doc.write_text("%s. " % info) self.doc.write_text("%s. " % info)
def write_tree(self): def write_tree(self,ind_list):
if not self.mini_tree or not self.person.getMainParents(): return if not self.mini_tree or not self.person.getMainParents():
return
self.doc.start_paragraph("FamilyTitle") self.doc.start_paragraph("FamilyTitle")
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.start_paragraph("Data") self.doc.start_paragraph("Data")
self.doc.write_raw('<PRE>\n') self.doc.write_raw('<PRE>\n')
tree = MiniTree(self.person,self.doc) tree = MiniTree(self.person,self.doc,ind_list)
for line in tree.lines: for line in tree.lines:
if line: self.doc.write_raw(line + '\n') if line: self.doc.write_raw(line + '\n')
self.doc.write_raw('</PRE>\n') self.doc.write_raw('</PRE>\n')
self.doc.end_paragraph() self.doc.end_paragraph()
def create_page(self): def create_page(self,ind_list):
"""Generate the HTML page for the specific person""" """Generate the HTML page for the specific person"""
filebase = "%s.%s" % (self.person.getId(),self.ext) filebase = "%s.%s" % (self.person.getId(),self.ext)
@ -364,7 +365,7 @@ class IndividualPage:
self.write_sources() self.write_sources()
# draw mini-tree # draw mini-tree
self.write_tree() self.write_tree(ind_list)
if self.link: if self.link:
self.doc.start_paragraph("Data") self.doc.start_paragraph("Data")
@ -853,7 +854,7 @@ class WebReport(Report.Report):
self.include_link, self.include_mini_tree, self.include_link, self.include_mini_tree,
my_map, dir_name, self.image_dir, tdoc, my_map, dir_name, self.image_dir, tdoc,
self.use_id,self.id_link,self.ext) self.use_id,self.id_link,self.ext)
idoc.create_page() idoc.create_page(my_map)
idoc.close() idoc.close()
self.progress_bar_step() self.progress_bar_step()
while gtk.events_pending(): while gtk.events_pending():
@ -1229,7 +1230,8 @@ class MiniTree:
class. I'm sure that someone with more knowledge of GRAMPS can make class. I'm sure that someone with more knowledge of GRAMPS can make
it much cleaner. it much cleaner.
""" """
def __init__(self,person,doc): def __init__(self,person,doc,map):
self.map = map
self.doc = doc self.doc = doc
self.person = person self.person = person
self.lines = [ "" for i in range(9) ] self.lines = [ "" for i in range(9) ]
@ -1279,7 +1281,7 @@ class MiniTree:
self.lines[line] += ' ' * (indent-len(self.lines[line])) + text self.lines[line] += ' ' * (indent-len(self.lines[line])) + text
def draw_link(self, line, person, name): def draw_link(self, line, person, name):
if person and person.getId(): if person and person.getId() and self.map.has_key(person.getId()):
self.lines[line] += "<A HREF='%s%s'>%s</A>" % (person.getId(), self.lines[line] += "<A HREF='%s%s'>%s</A>" % (person.getId(),
self.doc.ext, name) self.doc.ext, name)
else: else: