NarrativeWeb is now running once again. I do not have a good python exif library yet to use with Gramps. Tiny update to Visually impaired stylesheet to match some changes to plugin.

svn: r12843
This commit is contained in:
Rob G. Healey 2009-07-28 11:41:20 +00:00
parent 7f4732714b
commit b98caba34d
2 changed files with 86 additions and 84 deletions

View File

@ -897,6 +897,9 @@ table.infolist tbody tr td.ColumnValue p {
color:#696969; color:#696969;
margin:.2em 0 0 2em; margin:.2em 0 0 2em;
} }
table.eventtable tbody tr {
border-bottom:solid 1px #000;
}
/* Subsections : Attributes /* Subsections : Attributes
----------------------------------------------------- */ ----------------------------------------------------- */

View File

@ -66,9 +66,9 @@ from unicodedata import normalize
# attempt to import the python exif library? # attempt to import the python exif library?
try: try:
import pyexiv2 import pyexiv2
pyexiflib = True pyexiftaglib = True
except ImportError: except ImportError:
pyexiflib = False pyexiftaglib = False
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -334,20 +334,17 @@ class BasePage(object):
trow = Html('tr') trow = Html('tr')
thead += trow thead += trow
address_fields = [ for (label, colclass) in [
(_('Date'), 'date'), (_('Date'), 'date'),
(_('Street'), 'streetaddress'), (_('Street'), 'streetaddress'),
(_('City'), 'city'), (_('City'), 'city'),
(_('County'), 'county'), (_('County'), 'county'),
(_('State/ Province'), 'state'), (_('State/ Province'), 'state'),
(_('Country'), 'country') , (_('Country'), 'country') ,
(_('Zip/ Postal Code'), 'zip/ postal'), (_('Postal Code'), 'postalcode'),
(_('Phone'), 'phone') ] (_('Phone'), 'phone') ]:
for (label, colclass) in address_fields: trow += Html('th', label, class_='ColumnAttribute %s' % colclass, inline=True)
tcell = Html('th', label, class_='ColumnAttribute %s' % colclass, inline=True)
trow += tcell
# begin table body # begin table body
tbody = Html('tbody') tbody = Html('tbody')
@ -361,19 +358,19 @@ class BasePage(object):
date = _dd.display(address.get_date_object()) date = _dd.display(address.get_date_object())
address_data = [ for (label, value) in [
(_('Date'), date), (_('date'), date),
(_('Street'), address.get_street()), (_('streetaddress'), address.get_street()),
(_('City'), address.get_city()), (_('city'), address.get_city()),
(_('County'), address.get_county()), (_('county'), address.get_county()),
(_('State/Province'), address.get_state()), (_('State'), address.get_state()),
(_('Country'), address.get_country()), (_('country'), address.get_country()),
(_('Zip/ Postal Code'), address.get_postal_code()), (_('postalcode'), address.get_postal_code()),
(_('Phone'), address.get_phone()) ] (_('phone'), address.get_phone()) ]:
for (label, value ) in address_data:
tcell = Html('td', class_='ColumnValue %s' % label, inline=True) tcell = Html('td', class_='ColumnValue %s' % label, inline=True)
trow += tcell trow += tcell
if value: if value:
tcell += value tcell += value
else: else:
@ -385,6 +382,8 @@ class BasePage(object):
summaryarea += notelist summaryarea += notelist
# address: source references # address: source references
# if True, then an individual's address
# if False, then a repositories address
if spec: if spec:
sourcerefs = self.write_source_refs(address.get_source_references()) sourcerefs = self.write_source_refs(address.get_source_references())
if sourcerefs is not None: if sourcerefs is not None:
@ -412,8 +411,12 @@ class BasePage(object):
source_dict = {} source_dict = {}
# Sort the sources # Sort the sources
for handle in sourcelist: for handle in sourcelist:
# if source is not None, then add it?
source = db.get_source_from_handle(handle) source = db.get_source_from_handle(handle)
if source is not None:
key = source.get_title() + str(source.get_gramps_id()) key = source.get_title() + str(source.get_gramps_id())
print key
source_dict[key] = (source, handle) source_dict[key] = (source, handle)
keys = sorted(source_dict, key=locale.strxfrm) keys = sorted(source_dict, key=locale.strxfrm)
@ -971,7 +974,6 @@ class BasePage(object):
Html('img', src= thumbnailUrl, alt = "Image of " + person_name) Html('img', src= thumbnailUrl, alt = "Image of " + person_name)
) )
else: else:
# for proper spacing, force a new line after hyperlink url
hyper.attr += ' class= "noThumb"' hyper.attr += ' class= "noThumb"'
# 3. insert the person's name # 3. insert the person's name
@ -1728,7 +1730,9 @@ class MediaPage(BasePage):
(width, height) = ImgManip.image_size(orig_image_path) (width, height) = ImgManip.image_size(orig_image_path)
max_width = self.report.options['maxinitialimagewidth'] max_width = self.report.options['maxinitialimagewidth']
max_height = self.report.options['maxinitialimageheight'] max_height = self.report.options['maxinitialimageheight']
scale_w = (float(max_width)/width) or 1 # the 'or 1' is so that a max of zero is ignored scale_w = (float(max_width)/width) or 1 # the 'or 1' is so that
# a max of zero is ignored
scale_h = (float(max_height)/height) or 1 scale_h = (float(max_height)/height) or 1
scale = min(scale_w, scale_h) scale = min(scale_w, scale_h)
new_width = int(width*scale) new_width = int(width*scale)
@ -1852,14 +1856,14 @@ class MediaPage(BasePage):
table += trow table += trow
# display image Exif tags/ keys if any? # display image Exif tags/ keys if any?
if (pyexiflib and mime_type.startswith('image/')): if (pyexiftaglib and mime_type.startswith('image/')):
################################################# """
# Exif Tags/ Keys # # Exif Tags/ Keys
# # #
# Determine if the python exif lib is installed on the system? # # Determine if the python exif lib is installed on the system?
# yes, then use it and determine if the photo has anything written # # yes, then use it and determine if the photo has anything written
# inside of it? No, if not?, then do not show on the media page # # inside of it? No, if not?, then do not show on the media page
################################################# """
image = pyexiv2.Image('%s' % Utils.media_path_full(db, photo.get_path())) image = pyexiv2.Image('%s' % Utils.media_path_full(db, photo.get_path()))
image.readMetadata() image.readMetadata()
@ -1867,23 +1871,20 @@ class MediaPage(BasePage):
# exif data does exists # exif data does exists
if len(image.exifKeys()): if len(image.exifKeys()):
# add clearline for increased styling # add clearline for better page layout
mediadetail += fullclear mediadetail += fullclear
with Html('div', class_='infolist', id='ExifList') as exifdetail:
mediadetail += exifdetail
# add exif title header # add exif title header
exifdetail += Html('h4', _('Image Exif Tags'), inline=True) mediadetail += Html('h4', _('Image Exif Tags'), inline=True)
# begin exif table # begin exif table
with Html('table', class_='exifdata') as table: with Html('table', class_='exifdata') as table:
exifdetail += table mediadetail += table
for line in image.exifKeys(): for keytag in image.exifKeys():
trow = Html('tr') + ( trow = Html('tr') + (
Html('td', line, class_='ColumnAttribute', inline=True), Html('td', keytag, class_='ColumnAttribute', inline=True),
Html('td', image[line], class_='ColumnValue', inline=True) Html('td', image[keytag], class_='ColumnValue', inline=True)
) )
table += trow table += trow
@ -3293,7 +3294,7 @@ class IndividualPage(BasePage):
section += Html('h4', _('Addresses'), inline=True) section += Html('h4', _('Addresses'), inline=True)
# write out addresses() # write out addresses()
addresses = self.write_out_addresses(self.person) addresses = self.write_out_addresses(self.person, spec=True)
section += addresses section += addresses
# return address division to its caller # return address division to its caller
@ -3589,8 +3590,8 @@ class IndividualPage(BasePage):
family_list = self.person.get_family_handle_list() family_list = self.person.get_family_handle_list()
if not family_list: if not family_list:
return None return None
db = self.report.database db = self.report.database
# begin families division and section title # begin families division and section title
with Html('div', class_='subsection', id='families') as section: with Html('div', class_='subsection', id='families') as section:
section += Html('h4', _('Families'), inline=True) section += Html('h4', _('Families'), inline=True)
@ -3666,17 +3667,25 @@ class IndividualPage(BasePage):
trow += tcell trow += tcell
if partner_handle: if partner_handle:
gid = partner.gramps_id
if partner_handle in self.ind_list: if partner_handle in self.ind_list:
url = self.report.build_url_fname_html(partner_handle, 'ppl', True) url = self.report.build_url_fname_html(partner_handle, 'ppl', True)
tcell += self.person_link(url, partner, True, gid) tcell += self.person_link(url, partner, True, partner.gramps_id)
else: else:
tcell += partner_name tcell += partner_name
# TODO: Fix this section of code
# there is a table started underneath a table cell???
family_events = family.get_event_ref_list() family_events = family.get_event_ref_list()
trow = Html('tr') + (
Html('td', ' ', class_='ColumnType', inline=True),
Html('td', ' ', class_='ColumnAttribute', inline=True)
)
table += trow
tcell = Html('td', class_='ColumnValue')
trow += tcell
formatted_event = self.format_event(family_events) formatted_event = self.format_event(family_events)
table += formatted_event tcell += formatted_event
# get attributes # get attributes
for attr in family.get_attribute_list(): for attr in family.get_attribute_list():
@ -3771,6 +3780,9 @@ class IndividualPage(BasePage):
return trow return trow
def format_event(self, eventlist): def format_event(self, eventlist):
if not eventlist:
return None
db = self.report.database db = self.report.database
# begin eventlist table and table header # begin eventlist table and table header
@ -3932,7 +3944,7 @@ class RepositoryPage(BasePage):
table += trow table += trow
# repository: addresses # repository: addresses
addresses = self.write_out_addresses(repo, spec=True) addresses = self.write_out_addresses(repo)
if addresses is not None: if addresses is not None:
repositorydetail += addresses repositorydetail += addresses
@ -4718,21 +4730,21 @@ class NavWebOptions(MenuReportOptions):
self.__downloadnote.set_help( _("A note to be used on the download page")) self.__downloadnote.set_help( _("A note to be used on the download page"))
menu.add_option(category_name, "downloadnote", self.__downloadnote) menu.add_option(category_name, "downloadnote", self.__downloadnote)
self.__down_fname1 = DestinationOption(_("Download Filename #1"), self.__down_fname1 = DestinationOption(_("Download Filename"),
os.path.join(const.USER_HOME, "")) os.path.join(const.USER_HOME, ""))
self.__down_fname1.set_help(_("File to be used for downloading of database")) self.__down_fname1.set_help(_("File to be used for downloading of database"))
menu.add_option(category_name, "down_fname1", self.__down_fname1) menu.add_option(category_name, "down_fname1", self.__down_fname1)
self.__dl_descr1 = StringOption(_("Description for this Download"), _('Smith Family Tree')) self.__dl_descr1 = StringOption(_("Description for download"), _('Smith Family Tree'))
self.__dl_descr1.set_help(_('Give a description for this file.')) self.__dl_descr1.set_help(_('Give a description for this file.'))
menu.add_option(category_name, 'dl_descr1', self.__dl_descr1) menu.add_option(category_name, 'dl_descr1', self.__dl_descr1)
self.__down_fname2 = DestinationOption(_("Download Filename #2"), self.__down_fname2 = DestinationOption(_("Download Filename"),
os.path.join(const.USER_HOME, "")) os.path.join(const.USER_HOME, ""))
self.__down_fname2.set_help(_("File to be used for downloading of database")) self.__down_fname2.set_help(_("File to be used for downloading of database"))
menu.add_option(category_name, "down_fname2", self.__down_fname2) menu.add_option(category_name, "down_fname2", self.__down_fname2)
self.__dl_descr2 = StringOption(_("Description for this Download"), _('Johnson Family Tree')) self.__dl_descr2 = StringOption(_("Description for download"), _('Johnson Family Tree'))
self.__dl_descr2.set_help(_('Give a description for this file.')) self.__dl_descr2.set_help(_('Give a description for this file.'))
menu.add_option(category_name, 'dl_descr2', self.__dl_descr2) menu.add_option(category_name, 'dl_descr2', self.__dl_descr2)
@ -4781,19 +4793,16 @@ class NavWebOptions(MenuReportOptions):
showparents.set_help(_('Whether to include a parents column')) showparents.set_help(_('Whether to include a parents column'))
menu.add_option(category_name, 'showparents', showparents) menu.add_option(category_name, 'showparents', showparents)
self.__showallsiblings = BooleanOption(_("Include half and/ or " showallsiblings = BooleanOption(_("Include half and/ or "
"step-siblings on the individual pages"), False) "step-siblings on the individual pages"), False)
self.__showallsiblings.set_help(_( "Whether to include half and/ or " showallsiblings.set_help(_( "Whether to include half and/ or "
"step-siblings with the parents and siblings")) "step-siblings with the parents and siblings"))
menu.add_option(category_name, 'showhalfsiblings', self.__showallsiblings) menu.add_option(category_name, 'showhalfsiblings', showallsiblings)
self.__showallsiblings.connect('value-changed', self.__siblings_changed)
self.__birthorder = BooleanOption(_('Sort children in birth order'), False) birthorder = BooleanOption(_('Sort children in birth order'), False)
self.__birthorder.set_help(_('Whether to display children in birth order' birthorder.set_help(_('Whether to display children in birth order'
' or in entry order?')) ' or in entry order?'))
menu.add_option(category_name, 'birthorder', self.__birthorder) menu.add_option(category_name, 'birthorder', birthorder)
self.__siblings_changed()
inc_repository = BooleanOption(_('Include Repository Pages'), False) inc_repository = BooleanOption(_('Include Repository Pages'), False)
inc_repository.set_help(_('Whether to include the Repository Pages or not?')) inc_repository.set_help(_('Whether to include the Repository Pages or not?'))
@ -4878,16 +4887,6 @@ class NavWebOptions(MenuReportOptions):
self.__dl_descr2.set_available(False) self.__dl_descr2.set_available(False)
self.__dl_cright.set_available(False) self.__dl_cright.set_available(False)
def __siblings_changed(self):
"""
handles the changing nature of showallsiblings
"""
if self.__showallsiblings.get_value():
self.__birthorder.set_available(True)
else:
self.__birthorder.set_available(False)
# FIXME. Why do we need our own sorting? Why not use Sort.Sort? # FIXME. Why do we need our own sorting? Why not use Sort.Sort?
def sort_people(db, handle_list): def sort_people(db, handle_list):
sname_sub = {} sname_sub = {}