Webpage and REFN enhancements

svn: r981
This commit is contained in:
Don Allingham 2002-05-09 22:31:22 +00:00
parent f94c19ffee
commit a9a5069644
6 changed files with 44 additions and 13 deletions

View File

@ -464,7 +464,7 @@ class Note:
def append(self,text):
"""adds the text to the note's contents"""
return self.text + text
self.text = self.text + text
class Photo(SourceNote):
"""Containter for information about an image file, including location,

View File

@ -784,6 +784,12 @@ class ReportDialog:
self.target_path = self.target_fileentry.get_full_path(0)
if not self.target_path:
return None
if not self.get_target_is_directory() and os.path.isdir(self.target_path):
GnomeErrorDialog(_("The filename that you gave is a directory.\n"
"You need to provide a valid filename."))
return None
self.set_default_directory(os.path.dirname(self.target_path) + os.sep)
return 1

View File

@ -577,7 +577,7 @@ class Gramps:
if self.active_person:
SelectChild.NewChild(self.database,self.active_family,
self.active_person,self.update_after_newchild,
self.update_after_edit,
self.update_after_edit,
GrampsCfg.lastnamegen)
def on_choose_parents_clicked(self,obj):

View File

@ -440,10 +440,7 @@ class GedcomParser:
noteobj = Note()
self.nmap[matches[1]] = noteobj
text = matches[2][4:]
if text == "":
noteobj.append(self.parse_note_continue(1))
else:
noteobj.append(text + self.parse_note_continue(1))
noteobj.append(text + self.parse_continue_data(1))
self.parse_note_data(1)
elif matches[2] == "OBJE":
self.ignore_sub_junk(1)
@ -1007,6 +1004,8 @@ class GedcomParser:
address.setStreet(val)
elif matches[1] == "CITY":
address.setCity(matches[2])
elif matches[1] == "PHON":
address.setNote(matches[2])
elif matches[1] == "STAE":
address.setState(matches[2])
elif matches[1] == "POST":

View File

@ -72,9 +72,11 @@ class HtmlLinkDoc(HtmlDoc):
#------------------------------------------------------------------------
class IndividualPage:
def __init__(self,person,photos,restrict,private,uc,link,map,dir_name,imgdir,doc):
def __init__(self,person,photos,restrict,private,uc,link,map,dir_name,imgdir,doc,id,idlink):
self.person = person
self.doc = doc
self.use_id = id
self.id_link = idlink
self.list = map
self.private = private
self.alive = person.probablyAlive() and restrict
@ -235,6 +237,14 @@ class IndividualPage:
self.doc.start_table("one","IndTable")
self.write_normal_row("%s:" % _("Name"), name, name_obj.getSourceRefList())
if self.use_id:
if self.id_link:
val = '<a href="%s">%s</a>' % (self.id_link,self.person.getId())
val = string.replace(val,'#',self.person.getId())
else:
val = self.person.getId()
self.write_normal_row("%s:" % _("ID Number"),val,None)
if self.person.getGender() == Person.male:
self.write_normal_row("%s:" % _("Gender"), _("Male"),None)
else:
@ -551,8 +561,10 @@ class IndividualPage:
class WebReport(Report):
def __init__(self,db,person,target_path,max_gen,photos,filter,restrict,
private, srccomments, include_link, style, image_dir,
template_name):
template_name,use_id,id_link):
self.db = db
self.use_id = use_id
self.id_link = id_link
self.person = person
self.target_path = target_path
self.max_gen = max_gen
@ -680,7 +692,7 @@ class WebReport(Report):
idoc = IndividualPage(person, self.photos, self.restrict,
self.private, self.srccomments,
self.include_link, my_map, dir_name,
self.image_dir, tdoc)
self.image_dir, tdoc, self.use_id,self.id_link)
idoc.create_page()
idoc.close()
self.progress_bar_step()
@ -726,6 +738,7 @@ class WebReportDialog(ReportDialog):
no_img_msg = _("Do not use images")
no_limg_msg = _("Do not use images for living people")
no_com_msg = _("Do not include comments and text in source information")
include_id_msg = _("Include the GRAMPS ID in the report")
imgdir_msg = _("Image subdirectory")
self.use_link = GtkCheckButton(lnk_msg)
@ -736,11 +749,17 @@ class WebReportDialog(ReportDialog):
self.no_images = GtkCheckButton(no_img_msg)
self.no_living_images = GtkCheckButton(no_limg_msg)
self.no_comments = GtkCheckButton(no_com_msg)
self.include_id = GtkCheckButton(include_id_msg)
self.imgdir = GtkEntry()
self.imgdir.set_text("images")
self.linkpath = GtkEntry()
self.linkpath.set_sensitive(0)
self.include_id.connect('toggled',self.show_link)
self.add_option(imgdir_msg,self.imgdir)
self.add_option('',self.use_link)
self.add_option('',self.include_id)
self.add_option(_('GRAMPS ID link URL'),self.linkpath)
title = _("Privacy Options")
self.add_frame_option(title,None,self.no_private)
@ -751,6 +770,9 @@ class WebReportDialog(ReportDialog):
self.no_images.connect('toggled',self.on_nophotos_toggled)
def show_link(self,obj):
self.linkpath.set_sensitive(obj.get_active())
#------------------------------------------------------------------------
#
# Customization hooks
@ -963,6 +985,8 @@ class WebReportDialog(ReportDialog):
self.private = self.no_private.get_active()
self.img_dir_text = self.imgdir.get_text()
self.use_id = self.include_id.get_active()
self.id_link = string.strip(self.linkpath.get_text())
self.srccomments = self.no_comments.get_active()
if self.no_images.get_active() == 1:
self.photos = 0
@ -997,7 +1021,8 @@ class WebReportDialog(ReportDialog):
self.max_gen, self.photos, self.filter,
self.restrict, self.private, self.srccomments,
self.include_link, self.selected_style,
self.img_dir_text,self.template_name)
self.img_dir_text,self.template_name,
self.use_id,self.id_link)
MyReport.write_report()
#------------------------------------------------------------------------

View File

@ -486,6 +486,7 @@ class GedcomWriter:
for family in self.flist:
father_alive = mother_alive = 0
self.g.write("0 @%s@ FAM\n" % self.fid(family.getId()))
self.g.write('1 REFN %s\n' % family.getId())
person = family.getFather()
if person != None and person in self.plist:
self.g.write("1 HUSB @%s@\n" % self.pid(person.getId()))
@ -569,7 +570,7 @@ class GedcomWriter:
def write_person(self,person):
self.g.write("0 @%s@ INDI\n" % self.pid(person.getId()))
self.g.write('1 REFN %s\n' % person.getId())
self.write_person_name(person.getPrimaryName(),person.getNickName())
if self.altname == ALT_NAME_STD: