From a9a5069644f0d672391c3c77e80b760a7d150bf2 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 9 May 2002 22:31:22 +0000 Subject: [PATCH] Webpage and REFN enhancements svn: r981 --- gramps/src/RelLib.py | 2 +- gramps/src/Report.py | 6 +++++ gramps/src/gramps_main.py | 2 +- gramps/src/plugins/ReadGedcom.py | 7 +++--- gramps/src/plugins/WebPage.py | 37 ++++++++++++++++++++++++++----- gramps/src/plugins/WriteGedcom.py | 3 ++- 6 files changed, 44 insertions(+), 13 deletions(-) diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index d0e23c159..0477c5cf5 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -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, diff --git a/gramps/src/Report.py b/gramps/src/Report.py index 76d716c5a..16d14d4bd 100644 --- a/gramps/src/Report.py +++ b/gramps/src/Report.py @@ -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 diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 5a420fb37..b423c36ff 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -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): diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py index 087e6986f..91c1ab6f3 100644 --- a/gramps/src/plugins/ReadGedcom.py +++ b/gramps/src/plugins/ReadGedcom.py @@ -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": diff --git a/gramps/src/plugins/WebPage.py b/gramps/src/plugins/WebPage.py index fea08ef4c..9827a854d 100644 --- a/gramps/src/plugins/WebPage.py +++ b/gramps/src/plugins/WebPage.py @@ -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 = '%s' % (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) @@ -750,7 +769,10 @@ class WebReportDialog(ReportDialog): self.add_frame_option(title,None,self.no_comments) self.no_images.connect('toggled',self.on_nophotos_toggled) - + + def show_link(self,obj): + self.linkpath.set_sensitive(obj.get_active()) + #------------------------------------------------------------------------ # # Customization hooks @@ -962,7 +984,9 @@ class WebReportDialog(ReportDialog): self.restrict = self.restrict_living.get_active() 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() #------------------------------------------------------------------------ diff --git a/gramps/src/plugins/WriteGedcom.py b/gramps/src/plugins/WriteGedcom.py index ed66ec809..6ec06e080 100644 --- a/gramps/src/plugins/WriteGedcom.py +++ b/gramps/src/plugins/WriteGedcom.py @@ -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: