Fixed a typing error from yesterday's open_file_with_default_application(). Completed work on default printer stylesheet also.
svn: r12702
This commit is contained in:
@ -331,80 +331,74 @@ class BasePage(object):
|
||||
name.set_display_as(name_format)
|
||||
return _nd.display_name(name)
|
||||
|
||||
def write_footer(self, counter, hyper=False):
|
||||
def write_footer(self):
|
||||
"""
|
||||
Will create and display the footer section of each page...
|
||||
"""
|
||||
db = self.report.database
|
||||
|
||||
footer = Html('div', id='footer')
|
||||
# begin footer division
|
||||
with Html('div', id='footer') as section:
|
||||
|
||||
# add top of page link
|
||||
if hyper and counter > 25:
|
||||
footer += Html('p', id='top', inline=True) + (
|
||||
Html('a', _('Top of Page'), id="top", href='#top'),
|
||||
Html('a', name='bottom', title=_('Bottom'))
|
||||
)
|
||||
|
||||
footer_note = self.report.options['footernote']
|
||||
if footer_note:
|
||||
note = db.get_note_from_gramps_id(footer_note)
|
||||
note_text = note.get()
|
||||
if note_text:
|
||||
user_footer = Html('div', id='user_footer')
|
||||
footer += user_footer
|
||||
footer_note = self.report.options['footernote']
|
||||
if footer_note:
|
||||
note = db.get_note_from_gramps_id(footer_note)
|
||||
note_text = note.get()
|
||||
if note_text:
|
||||
user_footer = Html('div', id='user_footer')
|
||||
section += user_footer
|
||||
|
||||
# styled notes
|
||||
htmlnotetext = self.styled_note(note.get_styledtext(),
|
||||
# styled notes
|
||||
htmlnotetext = self.styled_note(note.get_styledtext(),
|
||||
note.get_format())
|
||||
if htmlnotetext:
|
||||
text = htmlnotetext
|
||||
else:
|
||||
text = Html('p', note_text)
|
||||
user_footer += text
|
||||
if htmlnotetext:
|
||||
text = htmlnotetext
|
||||
else:
|
||||
text = Html('p', note_text)
|
||||
user_footer += text
|
||||
|
||||
value = _dd.display(date.Today())
|
||||
msg = _('Generated by <a href="%(homepage)s">'
|
||||
'GRAMPS</a> on %(date)s') % {
|
||||
'date': value, 'homepage' : const.URL_HOMEPAGE
|
||||
}
|
||||
value = _dd.display(date.Today())
|
||||
msg = _('Generated by <a href="%(homepage)s">'
|
||||
'GRAMPS</a> on %(date)s') % {
|
||||
'date': value, 'homepage' : const.URL_HOMEPAGE
|
||||
}
|
||||
|
||||
# optional "link-home" feature; see bug report #2736
|
||||
if self.report.options['linkhome']:
|
||||
home_person = db.get_default_person()
|
||||
if home_person:
|
||||
home_person_url = self.report.build_url_fname_html(home_person.handle, 'ppl', self.up)
|
||||
home_person_name = self.get_name(home_person)
|
||||
msg += _(' Created for <a href="%s">%s</a>') % (
|
||||
home_person_url, home_person_name)
|
||||
# optional "link-home" feature; see bug report #2736
|
||||
if self.report.options['linkhome']:
|
||||
home_person = db.get_default_person()
|
||||
if home_person:
|
||||
home_person_url = self.report.build_url_fname_html(home_person.handle, 'ppl', self.up)
|
||||
home_person_name = self.get_name(home_person)
|
||||
msg += _(' Created for <a href="%s">%s</a>') % (
|
||||
home_person_url, home_person_name)
|
||||
|
||||
# create date
|
||||
footer += Html('p', msg, id='createdate')
|
||||
# creation date
|
||||
section += Html('p', msg, id='createdate')
|
||||
|
||||
# get copyright license for all pages
|
||||
copy_nr = self.report.copyright
|
||||
# get copyright license for all pages
|
||||
copy_nr = self.report.copyright
|
||||
|
||||
text = ''
|
||||
if copy_nr == 0:
|
||||
if self.author:
|
||||
year = date.Today().get_year()
|
||||
text = '© %(year)d %(person)s' % {
|
||||
'person' : self.author,
|
||||
'year' : year}
|
||||
elif 0 < copy_nr <= len(_CC):
|
||||
# Note. This is a URL
|
||||
fname = '/'.join(["images", "somerights20.gif"])
|
||||
url = self.report.build_url_fname(fname, None, self.up)
|
||||
text = _CC[copy_nr] % {'gif_fname' : url}
|
||||
footer += Html('p', text, id='copyright')
|
||||
text = ''
|
||||
if copy_nr == 0:
|
||||
if self.author:
|
||||
year = date.Today().get_year()
|
||||
text = '© %(year)d %(person)s' % {
|
||||
'person' : self.author,
|
||||
'year' : year}
|
||||
elif 0 < copy_nr <= len(_CC):
|
||||
# Note. This is a URL
|
||||
fname = '/'.join(["images", "somerights20.gif"])
|
||||
url = self.report.build_url_fname(fname, None, self.up)
|
||||
text = _CC[copy_nr] % {'gif_fname' : url}
|
||||
section += Html('p', text, id='copyright')
|
||||
|
||||
# add clear line for proper styling
|
||||
footer += fullclear
|
||||
# add clear line for proper styling
|
||||
section += fullclear
|
||||
|
||||
# return footer to its caller
|
||||
return footer
|
||||
return section
|
||||
|
||||
def write_header(self, title, hyper=False):
|
||||
def write_header(self, title):
|
||||
"""
|
||||
Note. 'title' is used as currentsection in the navigation links and
|
||||
as part of the header title.
|
||||
@ -465,13 +459,6 @@ class BasePage(object):
|
||||
)
|
||||
body += headerdiv
|
||||
|
||||
# add bottom link
|
||||
if hyper:
|
||||
headerdiv += Html('p', id='bottom', inline=True) + (
|
||||
Html('a', id="bottom", href='#bottom', inline=True),
|
||||
Html('a', name='top')
|
||||
)
|
||||
|
||||
header_note = self.report.options['headernote']
|
||||
if header_note:
|
||||
note = db.get_note_from_gramps_id(header_note)
|
||||
@ -948,11 +935,8 @@ class IndividualListPage(BasePage):
|
||||
showpartner = report.options['showpartner']
|
||||
showparents = report.options['showparents']
|
||||
|
||||
# add top of page link
|
||||
counter = len(person_handle_list)
|
||||
|
||||
of = self.report.create_file("individuals")
|
||||
indlistpage, body = self.write_header(_('Individuals'), hyper=True)
|
||||
indlistpage, body = self.write_header(_('Individuals'))
|
||||
|
||||
# begin Individuals division
|
||||
with Html('div', class_='content', id='Individuals') as section:
|
||||
@ -979,9 +963,9 @@ class IndividualListPage(BasePage):
|
||||
thead += trow
|
||||
|
||||
# Table Header -- Surname and Given name columns
|
||||
trow += Html('th', _('Surname'), class_='ColumnSurname') + (
|
||||
Html('th', _('Name'), class_='ColumnName', inline=True)
|
||||
)
|
||||
tcell1 = Html('th', _('Surname'), class_='ColumnSurname', inline=True)
|
||||
tcell2 = Html('th', _('Name'), class_='ColumnName', inline=True)
|
||||
trow += (tcell1, tcell2)
|
||||
|
||||
# table header -- show birth column
|
||||
if showbirth:
|
||||
@ -1125,10 +1109,11 @@ class IndividualListPage(BasePage):
|
||||
|
||||
# create clear line for proper styling
|
||||
# create footer section
|
||||
footer = self.write_footer(counter, hyper=True)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(indlistpage, of)
|
||||
|
||||
class SurnamePage(BasePage):
|
||||
@ -1279,13 +1264,13 @@ class SurnamePage(BasePage):
|
||||
trow += tcell
|
||||
tbody += trow
|
||||
|
||||
# add surnames table
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer(counter=0)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(surnamepage, of)
|
||||
|
||||
class PlaceListPage(BasePage):
|
||||
@ -1295,11 +1280,8 @@ class PlaceListPage(BasePage):
|
||||
self.src_list = src_list # TODO verify that this is correct
|
||||
db = report.database
|
||||
|
||||
# add top of page link
|
||||
counter = len(place_handles)
|
||||
|
||||
of = self.report.create_file("places")
|
||||
placelistpage, body = self.write_header(_('Places'), hyper=True)
|
||||
placelistpage, body = self.write_header(_('Places'))
|
||||
|
||||
# begin places division
|
||||
with Html('div', class_='content', id='Places') as section:
|
||||
@ -1310,7 +1292,7 @@ class PlaceListPage(BasePage):
|
||||
"title will take you to that place’s page.")
|
||||
section += Html('p', msg, id='description')
|
||||
|
||||
# begin alphabetic navigation
|
||||
# begin alphabet navigation
|
||||
alpha_nav = alphabet_navigation(db, place_handles, _PLACE)
|
||||
if alpha_nav is not None:
|
||||
section += alpha_nav
|
||||
@ -1369,10 +1351,11 @@ class PlaceListPage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer(counter, hyper=True)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(placelistpage, of)
|
||||
|
||||
class PlacePage(BasePage):
|
||||
@ -1468,10 +1451,11 @@ class PlacePage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer(counter=0)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(placepage, of)
|
||||
|
||||
class MediaPage(BasePage):
|
||||
@ -1746,10 +1730,11 @@ class MediaPage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer(counter=0)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(mediapage, of)
|
||||
|
||||
def gallery_nav_link(self, handle, name, up=False):
|
||||
@ -1850,15 +1835,12 @@ class SurnameListPage(BasePage):
|
||||
BasePage.__init__(self, report, title)
|
||||
db = report.database
|
||||
|
||||
# amount of surnames to be created
|
||||
counter = len(person_handle_list)
|
||||
|
||||
if order_by == self.ORDER_BY_NAME:
|
||||
of = self.report.create_file(filename)
|
||||
surnamelist, body = self.write_header(_('Surnames'), hyper=True)
|
||||
surnamelist, body = self.write_header(_('Surnames'))
|
||||
else:
|
||||
of = self.report.create_file("surnames_count")
|
||||
surnamelist, body = self.write_header(_('Surnames by person count'), hyper=True)
|
||||
surnamelist, body = self.write_header(_('Surnames by person count'))
|
||||
|
||||
# begin surnames division
|
||||
with Html('div', class_='content', id='surnames') as section:
|
||||
@ -1942,7 +1924,7 @@ class SurnameListPage(BasePage):
|
||||
with Html('td', class_='ColumnLetter', inline=True) as tcell:
|
||||
trow += tcell
|
||||
tcell += Html('a', last_letter, name=last_letter)
|
||||
with Html('td', class_='ColumnSurname', inline=True) as tcell:
|
||||
with Html('td', class_='ColumnSurname') as tcell:
|
||||
trow += tcell
|
||||
tcell += self.surname_link(name_to_md5(surname), surname)
|
||||
elif surname != last_surname:
|
||||
@ -1950,7 +1932,7 @@ class SurnameListPage(BasePage):
|
||||
tbody += trow
|
||||
with Html('td', ' ', class_='ColumnLetter', inline=True) as tcell:
|
||||
trow += tcell
|
||||
with Html('td', class_='ColumnSurname', inline=True) as tcell:
|
||||
with Html('td', class_='ColumnSurname') as tcell:
|
||||
trow += tcell
|
||||
tcell += self.surname_link(name_to_md5(surname), surname)
|
||||
last_surname = surname
|
||||
@ -1959,11 +1941,11 @@ class SurnameListPage(BasePage):
|
||||
|
||||
# create footer section
|
||||
# add clearline for proper styling
|
||||
# bring all body pieces together
|
||||
footer = self.write_footer(counter, hyper=True)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(surnamelist, of)
|
||||
|
||||
def surname_link(self, fname, name, opt_val=None, up=False):
|
||||
@ -2013,10 +1995,11 @@ class IntroductionPage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# create footer section
|
||||
footer = self.write_footer(counter=0)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(intropage, of)
|
||||
|
||||
class HomePage(BasePage):
|
||||
@ -2056,10 +2039,11 @@ class HomePage(BasePage):
|
||||
|
||||
# create clear line for proper styling
|
||||
# create footer section
|
||||
footer = self.write_footer(counter=0)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(homepage, of)
|
||||
|
||||
class SourceListPage(BasePage):
|
||||
@ -2068,11 +2052,8 @@ class SourceListPage(BasePage):
|
||||
BasePage.__init__(self, report, title)
|
||||
db = report.database
|
||||
|
||||
# add bottom and top links
|
||||
counter = len(handle_set)
|
||||
|
||||
of = self.report.create_file("sources")
|
||||
sourcelistpage, body = self.write_header(_('Sources'), hyper=True)
|
||||
sourcelistpage, body = self.write_header(_('Sources'))
|
||||
|
||||
# begin source list division
|
||||
with Html('div', class_='content', id='sources') as section:
|
||||
@ -2121,10 +2102,11 @@ class SourceListPage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer(counter=0, hyper=True)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(sourcelistpage, of)
|
||||
|
||||
class SourcePage(BasePage):
|
||||
@ -2192,10 +2174,11 @@ class SourcePage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer(counter=0)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(sourcepage, of)
|
||||
|
||||
class MediaListPage(BasePage):
|
||||
@ -2208,7 +2191,7 @@ class MediaListPage(BasePage):
|
||||
counter = len(self.report.photo_list)
|
||||
|
||||
of = self.report.create_file("gallery")
|
||||
medialistpage, body = self.write_header(_('Gallery'), hyper=True)
|
||||
medialistpage, body = self.write_header(_('Gallery'))
|
||||
|
||||
# begin gallery division
|
||||
with Html('div', class_='content', id='Gallery') as section:
|
||||
@ -2265,10 +2248,11 @@ class MediaListPage(BasePage):
|
||||
|
||||
# add footer section
|
||||
# add clearline for proper styling
|
||||
footer = self.write_footer(counter, hyper=True)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(medialistpage, of)
|
||||
|
||||
def media_ref_link(self, handle, name, up=False):
|
||||
@ -2422,10 +2406,11 @@ class DownloadPage(BasePage):
|
||||
|
||||
# clear line for proper styling
|
||||
# create footer section
|
||||
footer = self.write_footer(counter=0)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(downloadpage, of)
|
||||
|
||||
class ContactPage(BasePage):
|
||||
@ -2493,10 +2478,11 @@ class ContactPage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer(counter=0)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for porcessing
|
||||
# and close the file
|
||||
self.mywriter(contactpage, of)
|
||||
|
||||
class IndividualPage(BasePage):
|
||||
@ -2606,14 +2592,16 @@ class IndividualPage(BasePage):
|
||||
# display ancestor tree
|
||||
if report.options['graph']:
|
||||
sect12 = self.display_tree()
|
||||
section += sect12
|
||||
if sect12 is not None:
|
||||
section += sect12
|
||||
|
||||
# add clearline for proper styling
|
||||
# create footer section
|
||||
footer = self.write_footer(counter=0)
|
||||
footer = self.write_footer()
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(indivdetpage, of)
|
||||
|
||||
def display_attr_list(self, attrlist=None):
|
||||
|
Reference in New Issue
Block a user