diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 3c9f58a94..63ab9851d 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2005-07-10 Don Allingham + * src/plugins/NavWebPage.py: enhancements, almost usable + * src/Report.py: fixed spacing + 2005-07-09 Alex Roitman * src/ReadXML.py (stop_ref): Properly read id-based witness reference created by old gramps. diff --git a/gramps2/configure.in b/gramps2/configure.in index 824cb420f..07166034e 100644 --- a/gramps2/configure.in +++ b/gramps2/configure.in @@ -7,8 +7,8 @@ AC_PREREQ(2.57) AC_INIT(gramps, 2.0.6, gramps-bugs@lists.sourceforge.net) AC_CONFIG_SRCDIR(src/gramps.py) AM_INIT_AUTOMAKE(1.6.3) -RELEASE=0.CVS$(head -c 10 ${srcdir}/ChangeLog | tr -d '-') -dnl RELEASE=1 +dnl RELEASE=0.CVS$(head -c 10 ${srcdir}/ChangeLog | tr -d '-') +RELEASE=1 VERSIONSTRING=$VERSION if test x"$RELEASE" != "x" diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index a49f538e2..18040ec89 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -545,7 +545,7 @@ class BareReportDialog: label.set_use_markup(1) label.set_alignment(0.0,0.5) self.tbl.set_border_width(12) - self.tbl.attach(label,0,4,self.col,self.col+1) + self.tbl.attach(label, 0, 4, self.col, self.col+1, gtk.FILL|gtk.EXPAND) self.col += 1 def setup_center_person(self): @@ -1079,7 +1079,7 @@ class ReportDialog(BareReportDialog): label.set_use_markup(1) label.set_alignment(0.0,0.5) self.tbl.set_border_width(12) - self.tbl.attach(label,0,4,self.col,self.col+1) + self.tbl.attach(label, 0, 4, self.col, self.col+1, gtk.FILL) self.col += 1 hid = self.get_stylesheet_savefile() @@ -1090,13 +1090,15 @@ class ReportDialog(BareReportDialog): if self.get_target_is_directory(): self.target_fileentry.set_directory_entry(1) - label = gtk.Label("%s:" % _("Directory")) + self.doc_label = gtk.Label("%s:" % _("Directory")) else: - label = gtk.Label("%s:" % _("Filename")) - label.set_alignment(0.0,0.5) + self.doc_label = gtk.Label("%s:" % _("Filename")) + self.doc_label.set_alignment(0.0,0.5) - self.tbl.attach(label,1,2,self.col,self.col+1,gtk.SHRINK|gtk.FILL) - self.tbl.attach(self.target_fileentry,2,4,self.col,self.col+1) + self.tbl.attach(self.doc_label, 1, 2, self.col, self.col+1, + gtk.SHRINK|gtk.FILL) + self.tbl.attach(self.target_fileentry, 2, 4, self.col, self.col+1, + gtk.EXPAND|gtk.FILL) self.col += 1 spath = self.get_default_directory() diff --git a/gramps2/src/plugins/NavWebPage.py b/gramps2/src/plugins/NavWebPage.py index e8de2d3d4..e72cf7fac 100644 --- a/gramps2/src/plugins/NavWebPage.py +++ b/gramps2/src/plugins/NavWebPage.py @@ -28,6 +28,8 @@ # #------------------------------------------------------------------------ import os +import time +import locale import shutil from gettext import gettext as _ @@ -124,51 +126,102 @@ _css = [ ] +from cStringIO import StringIO + class BasePage: - def __init__(self,title): + def __init__(self, title, options, archive): self.title_str = title + self.inc_contact = options.handler.options_dict['NWEBcontact'] + self.inc_download = options.handler.options_dict['NWEBdownload'] + self.html_dir = options.handler.options_dict['NWEBod'] + self.options = options + self.archive = archive + self.image_dir = options.handler.options_dict['NWEBimagedir'].strip() + self.ext = options.handler.options_dict['NWEBext'] + + def copy_media(self,photo): + newpath = photo.gramps_id + os.path.splitext(photo.get_path())[1] + if self.image_dir: + newpath = os.path.join(self.image_dir,newpath) + if self.archive: + imagefile = open(photo.get_path(),"r") + self.archive.add_file(newpath,time.time(),imagefile) + imagefile.close() + else: + shutil.copyfile(photo.get_path(), + os.path.join(self.html_dir,newpath)) + return newpath + + def create_file(self,name): + if self.archive: + of = StringIO() + self.cur_name = name + "." + self.ext + else: + page_name = os.path.join(self.html_dir,name + "." + self.ext) + of = open(page_name, "w") + return of + + def close_file(self,of): + if self.archive: + self.archive.add_file(self.cur_name,time.time(),of) + of.close() + else: + of.close() def lnkfmt(self,text): return text.replace(' ','%20') def display_footer(self,of): - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('\n') - of.write('\n') - of.write('\n') + + format = locale.nl_langinfo(locale.D_FMT) + value = time.strftime(format,time.localtime(time.time())) + + msg = _('Generated by ' + 'GRAMPS on %(date)s' % { 'date' : value }) + + of.write(u'


\n') + of.write(u'\n' % msg) + of.write(u'\n') + of.write(u'\n') def display_header(self,of,title,author=""): - of.write('\n') - of.write('\n\n') - of.write('%s\n' % self.title_str) - of.write('\n') - of.write('\n') - of.write('\n') - of.write('\n') - of.write('\n') - of.write('\n') + + if author: + author = author.replace(',,,','') + year = time.localtime(time.time())[0] + cright = _(u'Copyright © %(person)s %(year)d') % { + 'person' : author, + 'year' : year } + + of.write(u'\n') + of.write(u'\n\n') + of.write(u'%s\n' % self.title_str) + of.write(u'\n') + of.write(u'\n') + of.write(u'\n') + of.write(u'\n') + of.write(u'\n') + of.write(u'\n') #------------------------------------------------------------------------ # @@ -177,22 +230,26 @@ class BasePage: #------------------------------------------------------------------------ class IndividualListPage(BasePage): - def __init__(self, db, title, person_handle_list, html_dir): - BasePage.__init__(self,title) - page_name = os.path.join(html_dir,"individuals.html") + def __init__(self, db, title, person_handle_list, options, archive): + BasePage.__init__(self, title, options, archive) - of = open(page_name, "w") + of = self.create_file("individuals") self.display_header(of,_('Individuals'), db.get_researcher().get_name()) - of.write('

%s

\n' % _('Individuals')) - of.write('

%s

\n' % _('Index of individuals, sorted by last name.')) - of.write('
\n') - of.write('\n') - of.write('\n' % _('Surname')) - of.write('\n' % _('Name')) - of.write('\n') + msg = _("This page contains an index of all the individuals in the " + "database, sorted by their last names. Selecting the GRAMPS " + "ID next to a person's name will take you to that person's " + "individual page.") + + of.write(u'

%s

\n' % _('Individuals')) + of.write(u'

%s

\n' % msg) + of.write(u'
\n') + of.write(u'
%s%s
\n') + of.write(u'\n' % _('Surname')) + of.write(u'\n' % _('Name')) + of.write(u'\n') self.sort = Sort.Sort(db) person_handle_list.sort(self.sort.by_last_name) @@ -202,23 +259,22 @@ class IndividualListPage(BasePage): person = db.get_person_from_handle(person_handle) n = person.get_primary_name().get_surname() if n != last_surname: - of.write('\n') - of.write('\n') + of.write(u'\n') + of.write(u' ' % (person.gramps_id,self.ext)) + of.write(u"[%s]" % person.gramps_id) + of.write(u'\n') last_surname = n - of.write('
%s%s
 
') + of.write(u'
 
') if n != last_surname: - of.write('%s' % (self.lnkfmt(n),n)) + of.write(u'%s' % (self.lnkfmt(n),n)) else: - of.write(' ') - of.write('') + of.write(u' ') + of.write(u'') of.write(person.get_primary_name().get_first_name()) - of.write(' ' % person.gramps_id) - of.write("[%s]" % person.gramps_id) - of.write('
\n
\n') + of.write(u'\n\n') self.display_footer(of) - of.close() - return + self.close_file(of) #------------------------------------------------------------------------ # @@ -227,25 +283,29 @@ class IndividualListPage(BasePage): #------------------------------------------------------------------------ class PlaceListPage(BasePage): - def __init__(self, db, title, place_handles, html_dir, src_list): - BasePage.__init__(self,title) - page_name = os.path.join(html_dir,"places.html") - of = open(page_name, "w") + def __init__(self, db, title, place_handles, src_list, options, archive): + BasePage.__init__(self, title, options, archive) + of = self.create_file("places") self.display_header(of,_('Places'), db.get_researcher().get_name()) - of.write('

%s

\n' % _('Places')) - of.write('

%s

\n' % _('Index of all the places in the ' - 'project.')) + msg = _("This page contains an index of all the places in the " + "database, sorted by their title. Selecting the GRAMPS " + "ID next to a person's name will take you to that place's " + "page.") + - of.write('
\n') - of.write('\n') - of.write('\n' % _('Letter')) - of.write('\n' % _('Place')) - of.write('\n') + of.write(u'

%s

\n' % _('Places')) + of.write(u'

%s

\n' % msg ) + + of.write(u'
\n') + of.write(u'
') - of.write('%s') - of.write('%s
\n') + of.write(u'\n' % _('Letter')) + of.write(u'\n' % _('Place')) + of.write(u'\n') self.sort = Sort.Sort(db) handle_list = list(place_handles) @@ -262,25 +322,26 @@ class PlaceListPage(BasePage): if n[0] != last_letter: last_letter = n[0] - of.write('\n') - of.write('' % last_letter) - of.write('\n') + of.write(u'' % last_letter) + of.write(u'') - elif n != last_letter: + of.write(u' ' % (place.gramps_id,self.ext)) + of.write(u'[%s]' % place.gramps_id) + of.write(u'') last_surname = n - of.write('') - of.write('') + of.write(u'') + of.write(u' ' % (place.gramps_id,self.ext)) + of.write(u'[%s]' % place.gramps_id) + of.write(u'') + last_surname = n - of.write('
') + of.write(u'%s') + of.write(u'%s
 
%s') + of.write(u'
 
%s') of.write(n) - of.write(' ' % place.gramps_id) - of.write('[%s]' % place.gramps_id) - of.write('
 ') + elif n != last_surname: + of.write(u'
 ') of.write(n) - of.write(' ' % place.gramps_id) - of.write('[%s]' % place.gramps_id) - of.write('
\n
\n') + of.write(u'\n\n') self.display_footer(of) - of.close() + self.close_file(of) #------------------------------------------------------------------------ # @@ -289,15 +350,14 @@ class PlaceListPage(BasePage): #------------------------------------------------------------------------ class PlacePage(BasePage): - def __init__(self, db, title, place_handle, html_dir, src_list): + def __init__(self, db, title, place_handle, src_list, options, archive): place = db.get_place_from_handle( place_handle) - BasePage.__init__(self,title) - page_name = os.path.join(html_dir,place.get_gramps_id()+".html") - of = open(page_name, "w") + BasePage.__init__(self,title,options,archive) + of = self.create_file(place.get_gramps_id()) place_name = ReportUtils.place_name(db,place_handle) self.display_header(of,place_name, db.get_researcher().get_name()) - of.write('

%s

\n' % place_name) + of.write(u'

%s

\n' % place_name) photolist = place.get_media_list() if photolist: @@ -305,13 +365,12 @@ class PlacePage(BasePage): photo = db.get_object_from_handle(photo_handle) try: - newpath = photo.gramps_id + os.path.splitext(photo.get_path())[1] - shutil.copyfile(photo.get_path(),os.path.join(html_dir,newpath)) - of.write('
\n') - of.write('' % newpath) - of.write('') - of.write('
\n') + newpath = self.copy_media(photo) + of.write(u'
\n') + of.write(u'' % newpath) + of.write(u'') + of.write(u'
\n') except (IOError,OSError),msg: ErrorDialog(str(msg)) @@ -326,13 +385,13 @@ class PlacePage(BasePage): text = noteobj.get() if format: - text = "
" + "
".join(text.split("\n")) + text = u"
" + u"
".join(text.split("\n")) else: - text = "

".join(text.split("\n")) - of.write('

%s

\n' % text) + text = u"

".join(text.split("\n")) + of.write(u'

%s

\n' % text) self.display_footer(of) - of.close() + self.close_file(of) #------------------------------------------------------------------------ # @@ -341,28 +400,26 @@ class PlacePage(BasePage): #------------------------------------------------------------------------ class SurnameListPage(BasePage): - def __init__(self, db, title, person_handle_list, html_dir): - BasePage.__init__(self,title) - page_name = os.path.join(html_dir,"surnames.html") - - of = open(page_name, "w") + def __init__(self, db, title, person_handle_list, options, archive): + BasePage.__init__(self, title, options, archive) + of = self.create_file("surnames") self.display_header(of,_('Surnames'), db.get_researcher().get_name()) - of.write('

%s

\n' % _('Surnames')) - of.write('

%s

\n' % _('Index of all the surnames in the ' - 'project. The links lead to a list ' - 'of individuals in the database with ' - 'this same surname.')) + of.write(u'

%s

\n' % _('Surnames')) + of.write(u'

%s

\n' % _('This page contains an index of all the ' + 'surnames in the database. Selecting a link ' + 'will lead to a list of individuals in the ' + 'database with this same surname.')) - of.write('
\n') - of.write('\n') - of.write('\n' % _('Letter')) - of.write('\n' % _('Surname')) - of.write('\n') + of.write(u'
\n') + of.write(u'
') - of.write('%s') - of.write('%s
\n') + of.write(u'\n' % _('Letter')) + of.write(u'\n' % _('Surname')) + of.write(u'\n') self.sort = Sort.Sort(db) person_handle_list.sort(self.sort.by_last_name) @@ -378,22 +435,23 @@ class SurnameListPage(BasePage): if n[0] != last_letter: last_letter = n[0] - of.write('' % last_letter) - of.write('' % last_letter) + of.write(u'') - elif n != last_surname: + of.write(u'') last_surname = n - of.write('') - of.write('') + of.write(u'') + of.write(u'') + last_surname = n - of.write('
') + of.write(u'%s') + of.write(u'%s
%s') - of.write('' % self.lnkfmt(n)) + of.write(u'
%s') + of.write(u'' % (self.lnkfmt(n),self.ext)) of.write(n) - of.write('
 ') - of.write('' % self.lnkfmt(n)) + elif n != last_surname: + of.write(u'
 ') + of.write(u'' % (self.lnkfmt(n),self.ext)) of.write(n) - of.write('
\n
\n') + of.write(u'\n\n') self.display_footer(of) - of.close() + self.close_file(of) return #------------------------------------------------------------------------ @@ -403,15 +461,15 @@ class SurnameListPage(BasePage): #------------------------------------------------------------------------ class IntroductionPage(BasePage): - def __init__(self, db, title, html_dir, note_id): - BasePage.__init__(self,title) - page_name = os.path.join(html_dir,"introduction.html") + def __init__(self, db, title, options, archive): + BasePage.__init__(self, title, options, archive) + note_id = options.handler.options_dict['NWEBintronote'] - of = open(page_name, "w") + of = self.create_file("introduction") self.display_header(of,_('Introduction'), db.get_researcher().get_name()) - of.write('

%s

\n' % _('Introduction')) + of.write(u'

%s

\n' % _('Introduction')) if note_id: obj = db.get_object_from_gramps_id(note_id) @@ -421,14 +479,14 @@ class IntroductionPage(BasePage): note_obj = obj.get_note_object() text = note_obj.get() if note_obj.get_format(): - of.write('
\n%s\n
\n' % text) + of.write(u'
\n%s\n
\n' % text) else: - of.write('

') - of.write('

'.join(text.split('\n'))) - of.write('

') + of.write(u'

') + of.write(u'

'.join(text.split('\n'))) + of.write(u'

') self.display_footer(of) - of.close() + self.close_file(of) #------------------------------------------------------------------------ # @@ -437,18 +495,18 @@ class IntroductionPage(BasePage): #------------------------------------------------------------------------ class HomePage(BasePage): - def __init__(self, db, title, html_dir, note_id): - BasePage.__init__(self,title) - page_name = os.path.join(html_dir,"index.html") + def __init__(self, db, title, options, archive): + BasePage.__init__(self, title, options, archive) + note_id = options.handler.options_dict['NWEBhomenote'] - of = open(page_name, "w") + of = self.create_file("index") self.display_header(of,_('Home'), db.get_researcher().get_name()) of.write('

%s

\n' % _('Home')) if note_id: - obj = db.get_object_from_gramps_id(note_id) + obj = db.get_object_from_handle(note_id) if not obj: print "%s object not found" % note_id @@ -456,13 +514,11 @@ class HomePage(BasePage): mime_type = obj.get_mime_type() if mime_type and mime_type.startswith("image"): try: - newpath = obj.gramps_id + os.path.splitext(obj.get_path())[1] - shutil.copyfile(obj.get_path(), - os.path.join(html_dir,newpath)) - of.write('
\n') - of.write('' % newpath) - of.write('
\n') + newpath = self.copy_media(obj) + of.write(u'
\n') + of.write(u'' % newpath) + of.write(u'
\n') except (IOError,OSError),msg: ErrorDialog(str(msg)) @@ -470,14 +526,14 @@ class HomePage(BasePage): if note_obj: text = note_obj.get() if note_obj.get_format(): - of.write('
\n%s\n
\n' % text) + of.write(u'
\n%s\n
\n' % text) else: - of.write('

') - of.write('

'.join(text.split('\n'))) - of.write('

') + of.write(u'

') + of.write(u'

'.join(text.split('\n'))) + of.write(u'

') self.display_footer(of) - of.close() + self.close_file(of) #------------------------------------------------------------------------ # @@ -486,33 +542,32 @@ class HomePage(BasePage): #------------------------------------------------------------------------ class SourcesPage(BasePage): - def __init__(self, db, title, handle_set, html_dir): - BasePage.__init__(self,title) - page_name = os.path.join(html_dir,"sources.html") + def __init__(self, db, title, handle_set, options, archive): + BasePage.__init__(self, title, options, archive) - of = open(page_name, "w") + of = self.create_file("sources") self.display_header(of,_('Sources'), db.get_researcher().get_name()) handle_list = list(handle_set) - of.write('

%s

\n

' % _('Sources')) + of.write(u'

%s

\n

' % _('Sources')) of.write(_('All sources cited in the project.')) - of.write('

\n
\n\n') + of.write(u'

\n
\n
\n') index = 1 for handle in handle_list: source = db.get_source_from_handle(handle) - of.write('\n' % index) - of.write('\n' % index) + of.write(u'\n') + of.write(u'\n') index += 1 - of.write('
%d.') + of.write(u'
%d.') of.write(source.get_title()) - of.write('
\n
\n') + of.write(u'\n
\n') self.display_footer(of) - of.close() + self.close_file(of) #------------------------------------------------------------------------ # @@ -521,18 +576,17 @@ class SourcesPage(BasePage): #------------------------------------------------------------------------ class DownloadPage(BasePage): - def __init__(self, db, title, html_dir): - BasePage.__init__(self,title) - page_name = os.path.join(html_dir,"download.html") + def __init__(self, db, title, options, archive): + BasePage.__init__(self, title, options, archive) - of = open(page_name, "w") + of = self.create_file("download") self.display_header(of,_('Download'), db.get_researcher().get_name()) - of.write('

%s

\n' % _('Download')) + of.write(u'

%s

\n' % _('Download')) self.display_footer(of) - of.close() + self.close_file(of) #------------------------------------------------------------------------ # @@ -541,18 +595,17 @@ class DownloadPage(BasePage): #------------------------------------------------------------------------ class ContactPage(BasePage): - def __init__(self, db, title, html_dir): - BasePage.__init__(self,title) - page_name = os.path.join(html_dir,"contact.html") + def __init__(self, db, title, options, archive): + BasePage.__init__(self, title, options, archive) - of = open(page_name, "w") + of = self.create_file("contact") self.display_header(of,_('Contact'), db.get_researcher().get_name()) - of.write('

%s

\n' % _('Contact')) + of.write(u'

%s

\n' % _('Contact')) self.display_footer(of) - of.close() + self.close_file(of) #------------------------------------------------------------------------ # @@ -567,19 +620,18 @@ class IndividualPage(BasePage): RelLib.Person.UNKNOWN : const.unknown, } - def __init__(self, db, person, title, dirpath, ind_list, - place_list, src_list): - BasePage.__init__(self,title) + def __init__(self, db, person, title, ind_list, + place_list, src_list, options, archive): + BasePage.__init__(self, title, options, archive) self.person = person self.db = db self.ind_list = ind_list - self.dirpath = dirpath self.src_list = src_list self.place_list = place_list self.sort_name = _nd.sorted(self.person) self.name = _nd.sorted(self.person) - of = open(os.path.join(dirpath,"%s.html" % person.gramps_id), "w") + of = self.create_file(person.gramps_id) self.display_header(of, title, self.db.get_researcher().get_name()) self.display_ind_general(of) @@ -589,16 +641,16 @@ class IndividualPage(BasePage): self.display_ind_sources(of) self.display_ind_pedigree(of) self.display_footer(of) - of.close() + self.close_file(of) def display_ind_sources(self,of): sreflist = self.person.get_source_references() if not sreflist: return - of.write('

%s

\n' % _('Sources')) - of.write('
\n') - of.write('\n') + of.write(u'

%s

\n' % _('Sources')) + of.write(u'
\n') + of.write(u'
\n') index = 1 for sref in sreflist: @@ -609,7 +661,7 @@ class IndividualPage(BasePage): title = source.get_title() publisher = source.get_publication_info() date = _dd.display(sref.get_date_object()) - of.write('\n') - of.write('
%d. ' % index) + of.write(u'
%d. ' % index) values = [] if author: values.append(author) @@ -619,9 +671,9 @@ class IndividualPage(BasePage): values.append(publisher) if date: values.append(date) - of.write(', '.join(values)) - of.write('
\n') + of.write(u', '.join(values)) + of.write(u'\n') + of.write(u'\n') def display_ind_pedigree(self,of): @@ -638,33 +690,33 @@ class IndividualPage(BasePage): father = None mother = None - of.write('

%s

\n' % _('Pedigree')) - of.write('
\n
\n') - of.write('\n') - of.write('\n\n
\n') + of.write(u'

%s

\n' % _('Pedigree')) + of.write(u'
\n
\n') + of.write(u'\n') + of.write(u'\n\n
\n') if father or mother: - of.write('
\n') + of.write(u'
\n') if father: self.pedigree_person(of,father) if mother: self.pedigree_person(of,mother) - of.write('
\n') + of.write(u'
\n') if family: for child_handle in family.get_child_handle_list(): if child_handle == self.person.handle: - of.write('| %s
\n' % self.name) + of.write(u'| %s
\n' % self.name) self.pedigree_family(of) else: child = self.db.get_person_from_handle(child_handle) self.pedigree_person(of,child) else: - of.write('| %s
\n' % self.name) + of.write(u'| %s
\n' % self.name) self.pedigree_family(of) - of.write('
\n') + of.write(u'
\n') if father or mother: - of.write('
\n') - of.write('
\n') + of.write(u'\n') + of.write(u'
\n') def display_ind_general(self,of): @@ -674,66 +726,65 @@ class IndividualPage(BasePage): photo = self.db.get_object_from_handle(photo_handle) try: - newpath = self.person.gramps_id + os.path.splitext(photo.get_path())[1] - shutil.copyfile(photo.get_path(),os.path.join(self.dirpath,newpath)) - of.write('
\n') - of.write('' % newpath) - of.write('') - of.write('
\n') + newpath = self.copy_media(photo) + of.write(u'
\n') + of.write(u'' % newpath) + of.write(u'') + of.write(u'
\n') except (IOError,OSError),msg: ErrorDialog(str(msg)) - of.write('
\n') - of.write('

%s

\n' % self.sort_name) - of.write('\n') + of.write(u'
\n') + of.write(u'

%s

\n' % self.sort_name) + of.write(u'
\n') # Gender - of.write('\n' % _('Gender')) + of.write(u'\n' % _('Gender')) gender = self.gender_map[self.person.gender] - of.write('\n' % gender) - of.write('\n') + of.write(u'\n' % gender) + of.write(u'\n') # Birth handle = self.person.get_birth_handle() if handle: event = self.db.get_event_from_handle(handle) - of.write('\n' % _('Birth')) - of.write('\n' % self.format_event(event)) - of.write('\n') + of.write(u'\n' % _('Birth')) + of.write(u'\n' % self.format_event(event)) + of.write(u'\n') # Death handle = self.person.get_death_handle() if handle: event = self.db.get_event_from_handle(handle) - of.write('\n' % _('Death')) - of.write('\n' % self.format_event(event)) - of.write('\n') + of.write(u'\n' % _('Death')) + of.write(u'\n' % self.format_event(event)) + of.write(u'\n') - of.write('
%s
%s%s
%s
%s%s
%s%s
%s%s
%s%s
\n') - of.write('
\n') + of.write(u'\n') + of.write(u'\n') def display_ind_events(self,of): - of.write('

%s

\n' % _('Events')) - of.write('
\n') - of.write('\n') + of.write(u'

%s

\n' % _('Events')) + of.write(u'
\n') + of.write(u'
\n') for event_id in self.person.get_event_list(): event = self.db.get_event_from_handle(event_id) - of.write('\n' % event.get_name()) - of.write('\n' % event.get_name()) + of.write(u'\n') - of.write('\n') + of.write(u'\n') + of.write(u'\n') - of.write('
%s\n') + of.write(u'
%s\n') of.write(self.format_event(event)) - of.write('
\n') + of.write(u'\n') def display_ind_narrative(self,of): - of.write('

%s

\n' % _('Narrative')) - of.write('
\n') + of.write(u'

%s

\n' % _('Narrative')) + of.write(u'
\n') noteobj = self.person.get_note_object() if noteobj: @@ -741,22 +792,22 @@ class IndividualPage(BasePage): text = noteobj.get() if format: - text = "
" + "
".join(text.split("\n")) + text = u"
" + u"
".join(text.split("\n")) else: - text = "

".join(text.split("\n")) - of.write('

%s

\n' % text) + text = u"

".join(text.split("\n")) + of.write(u'

%s

\n' % text) def display_parent(self,of,handle,title): use_link = handle in self.ind_list person = self.db.get_person_from_handle(handle) - of.write('%s\n' % title) - of.write('') + of.write(u'%s\n' % title) + of.write(u'') of.write(_nd.display(person)) if use_link: val = person.gramps_id - of.write(' [%s]' % (val,val)) - of.write('\n') + of.write(u' [%s]' % (val,self.ext,val)) + of.write(u'\n') def display_ind_relationships(self,of): parent_list = self.person.get_parent_family_handle_list() @@ -765,30 +816,30 @@ class IndividualPage(BasePage): if not parent_list and not family_list: return - of.write('

%s

\n' % _("Relationships")) - of.write('
\n') - of.write('\n') + of.write(u'

%s

\n' % _("Relationships")) + of.write(u'
\n') + of.write(u'
\n') if parent_list: for (family_handle,mrel,frel) in parent_list: family = self.db.get_family_from_handle(family_handle) - of.write('\n') - of.write('\n' % _("Parents")) + of.write(u'\n') + of.write(u'\n' % _("Parents")) father_handle = family.get_father_handle() if father_handle: self.display_parent(of,father_handle,_('Father')) - of.write('\n') + of.write(u'\n') mother_handle = family.get_mother_handle() if mother_handle: self.display_parent(of,mother_handle,_('Mother')) - of.write('\n') - of.write('\n') + of.write(u'\n') + of.write(u'\n') if family_list: - of.write('\n' % _("Spouses")) + of.write(u'\n' % _("Spouses")) first = True for family_handle in family_list: family = self.db.get_family_from_handle(family_handle) @@ -796,20 +847,20 @@ class IndividualPage(BasePage): first = False childlist = family.get_child_handle_list() if childlist: - of.write('\n') - of.write('\n' % _("Children")) - of.write('\n') + of.write(u'\n' % _("Children")) + of.write(u'\n\n') - of.write('
 
%s
 
%s
 
 
 
 
%s
%s
 %s\n') + of.write(u'
 %s\n') for child_handle in childlist: use_link = child_handle in self.ind_list child = self.db.get_person_from_handle(child_handle) - if use_link: - of.write('' % child.get_gramps_id()) of.write(_nd.display(child)) if use_link: - of.write('\n') - of.write("
\n") - of.write('
\n') + gid = child.get_gramps_id() + of.write(u'' % (gid,self.ext)) + of.write(u'[%s] \n' % gid) + of.write(u"
\n") + of.write(u'\n\n') + of.write(u'\n') def display_spouse(self,of,family,first=True): gender = self.person.get_gender() @@ -832,37 +883,36 @@ class IndividualPage(BasePage): else: name = _("unknown") if not first: - of.write(' \n') - of.write(' ') - of.write('%s\n' % relstr) - of.write('') + of.write(u' \n') + of.write(u' ') + of.write(u'%s\n' % relstr) + of.write(u'') use_link = spouse_id in self.ind_list - if use_link: - of.write('' % spouse.get_gramps_id()) of.write(name) if use_link: - of.write('') + gid = spouse.get_gramps_id() + of.write(u' [%s]' % (gid,self.ext,gid)) - of.write('\n\n') + of.write(u'\n\n') for event_id in family.get_event_list(): event = self.db.get_event_from_handle(event_id) - of.write(' \n') - of.write('%s\n' % event.get_name()) - of.write('\n') + of.write(u' \n') + of.write(u'%s\n' % event.get_name()) + of.write(u'\n') of.write(self.format_event(event)) - of.write('\n\n') + of.write(u'\n\n') def pedigree_person(self,of,person,bullet='|'): person_link = person.handle in self.ind_list - of.write('%s ' % bullet) + of.write(u'%s ' % bullet) if person_link: - of.write('' % person.gramps_id) + of.write(u'' % (person.gramps_id,self.ext)) of.write(_nd.display(person)) if person_link: - of.write('') - of.write('
\n') + of.write(u'') + of.write(u'
\n') def pedigree_family(self,of): for family_handle in self.person.get_family_handle_list(): @@ -873,11 +923,11 @@ class IndividualPage(BasePage): self.pedigree_person(of,spouse,'•') childlist = rel_family.get_child_handle_list() if childlist: - of.write('
\n') + of.write(u'
\n') for child_handle in childlist: child = self.db.get_person_from_handle(child_handle) self.pedigree_person(of,child) - of.write('
\n') + of.write(u'
\n') def format_event(self,event): for sref in event.get_source_references(): @@ -928,25 +978,25 @@ class WebReport(Report.Report): filter od - HTMLimg - HTMLrestrictinfo - HTMLincpriv - HTMLnotxtsi - HTMLlnktoalphabet - HTMLsplita - HTMLplaceidx - HTMLshorttree - HTMLidxcol - HTMLimagedir - HTMLincid - HTMLidurl - HTMLlinktidx - HTMLext - HTMLtreed - HTMLidxt - HTMLidxbirth - HTMLintronote - HTMLhomenote + NWEBimg + NWEBrestrictinfo + NWEBincpriv + NWEBnotxtsi + NWEBlnktoalphabet + NWEBsplita + NWEBplaceidx + NWEBshorttree + NWEBidxcol + NWEBimagedir + NWEBincid + NWEBidurl + NWEBlinktidx + NWEBext + NWEBtreed + NWEBidxt + NWEBidxbirth + NWEBintronote + NWEBhomenote yearso """ self.database = database @@ -957,22 +1007,22 @@ class WebReport(Report.Report): filters = options_class.get_report_filters(person) filters.extend(GenericFilter.CustomFilters.get_filters()) self.filter = filters[filter_num] - self.template_name = options_class.handler.template_name - self.target_path = options_class.handler.options_dict['HTMLod'] - self.ext = options_class.handler.options_dict['HTMLext'] - self.id_link = options_class.handler.options_dict['HTMLlinktidx'] - self.photos = options_class.handler.options_dict['HTMLimg'] - self.restrict = options_class.handler.options_dict['HTMLrestrictinfo'] - self.private = options_class.handler.options_dict['HTMLincpriv'] - self.srccomments = options_class.handler.options_dict['HTMLcmtxtsi'] - self.image_dir = options_class.handler.options_dict['HTMLimagedir'] - self.title = options_class.handler.options_dict['HTMLtitle'] - self.separate_alpha = options_class.handler.options_dict['HTMLsplita'] - self.depth = options_class.handler.options_dict['HTMLtreed'] - self.intro_id = options_class.handler.options_dict['HTMLintronote'] - self.home_id = options_class.handler.options_dict['HTMLhomenote'] + self.target_path = options_class.handler.options_dict['NWEBod'] + self.ext = options_class.handler.options_dict['NWEBext'] + self.id_link = options_class.handler.options_dict['NWEBlinktidx'] + self.photos = options_class.handler.options_dict['NWEBimg'] + self.restrict = options_class.handler.options_dict['NWEBrestrictinfo'] + self.private = options_class.handler.options_dict['NWEBincpriv'] + self.srccomments = options_class.handler.options_dict['NWEBcmtxtsi'] + self.image_dir = options_class.handler.options_dict['NWEBimagedir'] + self.title = options_class.handler.options_dict['NWEBtitle'] + self.separate_alpha = options_class.handler.options_dict['NWEBsplita'] + self.depth = options_class.handler.options_dict['NWEBtreed'] self.sort = Sort.Sort(self.database) + self.inc_contact = options_class.handler.options_dict['NWEBcontact'] + self.inc_download = options_class.handler.options_dict['NWEBdownload'] + self.use_archive = options_class.handler.options_dict['NWEBarchive'] def get_progressbar_data(self): return (_("Generate HTML reports - GRAMPS"), @@ -980,43 +1030,44 @@ class WebReport(Report.Report): _("Creating Web Pages")) def write_report(self): - dir_name = self.target_path - if dir_name == None: - dir_name = os.getcwd() - elif not os.path.isdir(dir_name): - parent_dir = os.path.dirname(dir_name) - if not os.path.isdir(parent_dir): - ErrorDialog(_("Neither %s nor %s are directories") % \ - (dir_name,parent_dir)) - return + if not self.use_archive: + dir_name = self.target_path + if dir_name == None: + dir_name = os.getcwd() + elif not os.path.isdir(dir_name): + parent_dir = os.path.dirname(dir_name) + if not os.path.isdir(parent_dir): + ErrorDialog(_("Neither %s nor %s are directories") % \ + (dir_name,parent_dir)) + return + else: + try: + os.mkdir(dir_name) + except IOError, value: + ErrorDialog(_("Could not create the directory: %s") % \ + dir_name + "\n" + value[1]) + return + except: + ErrorDialog(_("Could not create the directory: %s") % \ + dir_name) + return + + if self.image_dir: + image_dir_name = os.path.join(dir_name, self.image_dir) else: + image_dir_name = dir_name + if not os.path.isdir(image_dir_name) and self.photos != 0: try: - os.mkdir(dir_name) + os.mkdir(image_dir_name) except IOError, value: ErrorDialog(_("Could not create the directory: %s") % \ - dir_name + "\n" + value[1]) + image_dir_name + "\n" + value[1]) return except: ErrorDialog(_("Could not create the directory: %s") % \ - dir_name) + image_dir_name) return - if self.image_dir: - image_dir_name = os.path.join(dir_name, self.image_dir) - else: - image_dir_name = dir_name - if not os.path.isdir(image_dir_name) and self.photos != 0: - try: - os.mkdir(image_dir_name) - except IOError, value: - ErrorDialog(_("Could not create the directory: %s") % \ - image_dir_name + "\n" + value[1]) - return - except: - ErrorDialog(_("Could not create the directory: %s") % \ - image_dir_name) - return - ind_list = self.database.get_person_handles(sort_handles=False) ind_list = self.filter.apply(self.database,ind_list) progress_steps = len(ind_list) @@ -1025,14 +1076,21 @@ class WebReport(Report.Report): progress_steps = progress_steps+1 self.progress_bar_setup(float(progress_steps)) - self.write_css(dir_name) + if self.use_archive: + import TarFile + archive = TarFile.TarFile(self.target_path) + else: + archive = None - HomePage(self.database,self.title,dir_name,self.home_id) - ContactPage(self.database,self.title,dir_name) - DownloadPage(self.database,self.title,dir_name) + self.write_css(archive) + + HomePage(self.database, self.title, self.options_class, archive) + if self.inc_contact: + ContactPage(self.database, self.title, self.options_class, archive) + if self.inc_download: + DownloadPage(self.database, self.title, self.options_class, archive) - IntroductionPage(self.database,self.title,dir_name, - self.intro_id) + IntroductionPage(self.database, self.title, self.options_class, archive) place_list = sets.Set() source_list = sets.Set() @@ -1043,32 +1101,44 @@ class WebReport(Report.Report): person = ReportUtils.sanitize_person(self.database,person) idoc = IndividualPage(self.database, person, self.title, - dir_name, ind_list, place_list, source_list) + ind_list, place_list, source_list, + self.options_class, archive) self.progress_bar_step() while gtk.events_pending(): gtk.main_iteration() if len(ind_list) > 1: - IndividualListPage(self.database, self.title, ind_list, dir_name) - SurnameListPage(self.database, self.title, ind_list, dir_name) + IndividualListPage(self.database, self.title, ind_list, + self.options_class, archive) + SurnameListPage(self.database, self.title, ind_list, + self.options_class, archive) self.progress_bar_step() while gtk.events_pending(): gtk.main_iteration() PlaceListPage(self.database, self.title, place_list, - dir_name, source_list) + source_list,self.options_class, archive) for place in place_list: - print place - PlacePage(self.database, self.title, place, dir_name, source_list) + PlacePage(self.database, self.title, place, source_list, + self.options_class, archive) - SourcesPage(self.database,self.title, source_list, dir_name) + SourcesPage(self.database,self.title, source_list, self.options_class, + archive) + if archive: + archive.close() self.progress_bar_done() - def write_css(self,dir_name): - f = open(os.path.join(dir_name,_NARRATIVE), "w") - f.write('\n'.join(_css)) - f.close() + def write_css(self,archive): + if archive: + f = StringIO() + f.write('\n'.join(_css)) + archive.add_file(_NARRATIVE,time.time(),f) + f.close() + else: + f = open(os.path.join(self.target_path,_NARRATIVE), "w") + f.write('\n'.join(_css)) + f.close() def add_styles(self,doc): pass @@ -1084,33 +1154,37 @@ class WebReportOptions(ReportOptions.ReportOptions): Defines options and provides handling interface. """ - def __init__(self,name,person_id=None): + def __init__(self,name,database,person_id=None): ReportOptions.ReportOptions.__init__(self,name,person_id) - + self.db = database + def set_new_options(self): # Options specific for this report self.options_dict = { - 'HTMLod' : '', - 'HTMLimg' : 2, - 'HTMLrestrictinfo' : 0, - 'HTMLincpriv' : 0, - 'HTMLcmtxtsi' : 0, - 'HTMLlnktoalphabet' : 0, - 'HTMLsplita' : 0, - 'HTMLshorttree' : 1, - 'HTMLimagedir' : 'images', - 'HTMLtitle' : _('My Family Tree'), - 'HTMLincid' : 0, - 'HTMLidurl' : '', - 'HTMLlinktidx' : 1, - 'HTMLext' : 'html', - 'HTMLtreed' : 3, - 'HTMLidxt' : '', - 'HTMLintronote' : '', - 'HTMLhomenote' : '', - 'HTMLidxbirth' : 0, - 'HTMLplaceidx' : 0, - 'HTMLyearso' : 1, + 'NWEBarchive' : 0, + 'NWEBod' : '', + 'NWEBimg' : 2, + 'NWEBrestrictinfo' : 0, + 'NWEBincpriv' : 0, + 'NWEBcmtxtsi' : 0, + 'NWEBlnktoalphabet' : 0, + 'NWEBsplita' : 0, + 'NWEBcontact' : 0, + 'NWEBdownload' : 0, + 'NWEBshorttree' : 1, + 'NWEBimagedir' : 'images', + 'NWEBtitle' : _('My Family Tree'), + 'NWEBincid' : 0, + 'NWEBidurl' : '', + 'NWEBlinktidx' : 1, + 'NWEBext' : 'html', + 'NWEBtreed' : 3, + 'NWEBidxt' : '', + 'NWEBintronote' : '', + 'NWEBhomenote' : '', + 'NWEBidxbirth' : 0, + 'NWEBplaceidx' : 0, + 'NWEByearso' : 1, } self.options_help = { @@ -1164,18 +1238,26 @@ class WebReportOptions(ReportOptions.ReportOptions): ext_msg = _("File extension") sep_alpha_msg = _("Split alphabetical sections to separate pages") tree_msg = _("Include short ancestor tree") + contact_msg = _("Include publisher contact page") + download_msg = _("Include download page") self.no_private = gtk.CheckButton(priv_msg) - self.no_private.set_active(not self.options_dict['HTMLincpriv']) + self.no_private.set_active(not self.options_dict['NWEBincpriv']) self.restrict_living = gtk.CheckButton(restrict_msg) - self.restrict_living.set_active(self.options_dict['HTMLrestrictinfo']) + self.restrict_living.set_active(self.options_dict['NWEBrestrictinfo']) + + self.inc_contact = gtk.CheckButton(contact_msg) + self.inc_contact.set_active(self.options_dict['NWEBcontact']) + + self.inc_download = gtk.CheckButton(download_msg) + self.inc_download.set_active(self.options_dict['NWEBdownload']) # FIXME: document this: # 0 -- no images of any kind # 1 -- no living images, but some images # 2 -- any images - images = self.options_dict['HTMLimg'] + images = self.options_dict['NWEBimg'] self.no_images = gtk.CheckButton(no_img_msg) self.no_images.set_active(not images) @@ -1184,41 +1266,62 @@ class WebReportOptions(ReportOptions.ReportOptions): self.no_living_images.set_active(images in (0,1)) self.no_comments = gtk.CheckButton(no_com_msg) - self.no_comments.set_active(not self.options_dict['HTMLcmtxtsi']) + self.no_comments.set_active(not self.options_dict['NWEBcmtxtsi']) self.imgdir = gtk.Entry() - self.imgdir.set_text(self.options_dict['HTMLimagedir']) + self.imgdir.set_text(self.options_dict['NWEBimagedir']) self.intro_note = gtk.Entry() - self.intro_note.set_text(self.options_dict['HTMLintronote']) - - self.home_note = gtk.Entry() - self.home_note.set_text(self.options_dict['HTMLhomenote']) + self.intro_note.set_text(self.options_dict['NWEBintronote']) self.title = gtk.Entry() - self.title.set_text(self.options_dict['HTMLtitle']) + self.title.set_text(self.options_dict['NWEBtitle']) self.linkpath = gtk.Entry() - self.linkpath.set_sensitive(self.options_dict['HTMLincid']) - self.linkpath.set_text(self.options_dict['HTMLidurl']) + self.linkpath.set_sensitive(self.options_dict['NWEBincid']) + self.linkpath.set_text(self.options_dict['NWEBidurl']) self.ext = gtk.combo_box_new_text() - ext_options = ['.html','.htm','.shtml','.php','.php3','.cgi'] - for text in ext_options: + self.ext_options = ['.html','.htm','.shtml','.php','.php3','.cgi'] + for text in self.ext_options: self.ext.append_text(text) - def_ext = "." + self.options_dict['HTMLext'] - self.ext.set_active(ext_options.index(def_ext)) + def_ext = "." + self.options_dict['NWEBext'] + self.ext.set_active(self.ext_options.index(def_ext)) dialog.add_option(title_msg,self.title) dialog.add_option(imgdir_msg,self.imgdir) dialog.add_option(ext_msg,self.ext) - title = _("Text") - dialog.add_frame_option(title,_('Home Note ID'), + title = _("Page Generation") + + cursor = self.db.get_media_cursor() + media_list = [['',None]] + data = cursor.first() + while data: + (handle, value) = data + media_list.append([value[4],handle]) + data = cursor.next() + cursor.close() + media_list.sort() + + home_node = None + home_note = self.options_dict['NWEBhomenote'] + + store = gtk.ListStore(str,str) + for data in media_list: + if data[1] == home_note: + home_node = store.append(row=data) + else: + store.append(row=data) + self.home_note = GrampsNoteComboBox(store,home_node) + + dialog.add_frame_option(title,_('Home Media/Note ID'), self.home_note) - dialog.add_frame_option(title,_('Introduction Note ID'), + dialog.add_frame_option(title,_('Introduction Media/Note ID'), self.intro_note) + dialog.add_frame_option(title,None,self.inc_contact) + dialog.add_frame_option(title,None,self.inc_download) title = _("Privacy") dialog.add_frame_option(title,None,self.no_private) @@ -1232,30 +1335,35 @@ class WebReportOptions(ReportOptions.ReportOptions): """Parse the privacy options frame of the dialog. Save the user selected choices for later use.""" - self.options_dict['HTMLrestrictinfo'] = int(self.restrict_living.get_active()) - self.options_dict['HTMLincpriv'] = int(not self.no_private.get_active()) - self.options_dict['HTMLimagedir'] = unicode(self.imgdir.get_text()) - self.options_dict['HTMLtitle'] = unicode(self.title.get_text()) - self.options_dict['HTMLintronote'] = unicode(self.intro_note.get_text()) - self.options_dict['HTMLhomenote'] = unicode(self.home_note.get_text()) + self.options_dict['NWEBrestrictinfo'] = int(self.restrict_living.get_active()) + self.options_dict['NWEBincpriv'] = int(not self.no_private.get_active()) + self.options_dict['NWEBcontact'] = int(not self.inc_contact.get_active()) + self.options_dict['NWEBdownload'] = int(not self.inc_download.get_active()) + self.options_dict['NWEBimagedir'] = unicode(self.imgdir.get_text()) + self.options_dict['NWEBtitle'] = unicode(self.title.get_text()) + self.options_dict['NWEBintronote'] = unicode(self.intro_note.get_text()) + self.options_dict['NWEBhomenote'] = unicode(self.home_note.get_handle()) - #html_ext = unicode(self.ext.entry.get_text().strip()) - html_ext = ".html" + index = self.ext.get_active() + if index >= 0: + html_ext = self.ext_options[index] + else: + html_ext = "html" if html_ext[0] == '.': html_ext = html_ext[1:] - self.options_dict['HTMLext'] = html_ext + self.options_dict['NWEBext'] = html_ext - self.options_dict['HTMLidurl'] = unicode(self.linkpath.get_text().strip()) + self.options_dict['NWEBidurl'] = unicode(self.linkpath.get_text().strip()) - self.options_dict['HTMLcmtxtsi'] = int(not self.no_comments.get_active()) + self.options_dict['NWEBcmtxtsi'] = int(not self.no_comments.get_active()) if self.no_images.get_active(): photos = 0 elif self.no_living_images.get_active(): photos = 1 else: photos = 2 - self.options_dict['HTMLimg'] = photos - self.options_dict['HTMLod'] = dialog.target_path + self.options_dict['NWEBimg'] = photos + self.options_dict['NWEBod'] = dialog.target_path #------------------------------------------------------------------------ # @@ -1288,7 +1396,7 @@ class WebReportDialog(Report.ReportDialog): self.person = person name = "navwebpage" translated_name = _("Generate Web Site") - self.options_class = WebReportOptions(name) + self.options_class = WebReportOptions(name,database) self.category = const.CATEGORY_WEB Report.ReportDialog.__init__(self,database,person,self.options_class, name,translated_name) @@ -1310,6 +1418,41 @@ class WebReportDialog(Report.ReportDialog): """The style frame is not used in this dialog.""" pass + def parse_html_frame(self): + self.options_class.handler.options_dict['NWEBarchive'] = self.archive.get_active() + + def parse_paper_frame(self): + pass + + def setup_html_frame(self): + self.html_table = gtk.Table(3,3) + self.html_table.set_col_spacings(12) + self.html_table.set_row_spacings(6) + self.html_table.set_border_width(0) + html_label = gtk.Label("%s" % _("HTML Options")) + html_label.set_alignment(0.0,0.5) + html_label.set_use_markup(True) + self.html_table.attach(html_label, 0, 3, 0, 1, gtk.FILL) + + label = gtk.Label(_("HTML Options")) + self.output_notebook.append_page(self.html_table,label) + + self.archive = gtk.CheckButton(_('Store web pages in .tar.gz archive')) + self.archive.set_alignment(0.0,0.5) + self.archive.connect('toggled',self.archive_toggle) + self.html_table.attach(self.archive, 1, 2, 1, 2, gtk.SHRINK|gtk.FILL) + + def archive_toggle(self,obj): + if obj.get_active(): + self.target_fileentry.set_directory_entry(False) + self.doc_label.set_label("%s:" % _("Filename")) + else: + self.target_fileentry.set_directory_entry(True) + self.doc_label.set_label("%s:" % _("Directory")) + + def setup_paper_frame(self): + pass + def get_title(self): """The window title for this dialog""" return "%s - %s - GRAMPS" % (_("Generate Web Site"),_("Web Page")) @@ -1327,7 +1470,7 @@ class WebReportDialog(Report.ReportDialog): """Get the name of the directory to which the target dialog box should default. This value can be set in the preferences panel.""" - return self.options_class.handler.options_dict['HTMLod'] + return self.options_class.handler.options_dict['NWEBod'] def make_document(self): """Do Nothing. This document will be created in the @@ -1335,7 +1478,7 @@ class WebReportDialog(Report.ReportDialog): pass def setup_format_frame(self): - """Do nothing, since we don't want a format frame (HTML only)""" + """Do nothing, since we don't want a format frame (NWEB only)""" pass def setup_post_process(self): @@ -1391,6 +1534,40 @@ class EmptyDoc: def init(self): pass +#------------------------------------------------------------------------- +# +# GrampsNoteComboBox +# +#------------------------------------------------------------------------- +class GrampsNoteComboBox(gtk.ComboBox): + """ + Derived from the ComboBox, this widget provides handling of Report + Styles. + """ + + def __init__(self,model=None,node=None): + """ + Initializes the combobox, building the display column. + """ + gtk.ComboBox.__init__(self,model) + cell = gtk.CellRendererText() + self.pack_start(cell,True) + self.add_attribute(cell,'text',0) + if node: + self.set_active_iter(node) + self.local_store = model + + def get_handle(self): + """ + Returns the selected key (style sheet name). + + @returns: Returns the name of the selected style sheet + @rtype: str + """ + active = self.get_active_iter() + handle = self.local_store.get_value(active,1) + return handle + #------------------------------------------------------------------------- # #