More cleanup work on stylesheet. Continuing to convert NarrativeWeb to use the Html class and the with statement.
svn: r12698
This commit is contained in:
@ -206,7 +206,7 @@ span.preposition {
|
||||
margin:0;
|
||||
height:1.5cm;
|
||||
padding:0 0 .9em 0;
|
||||
background-color:#542;
|
||||
background-color:#453619;
|
||||
border-bottom:solid 2px #6AF364;
|
||||
}
|
||||
#SiteTitle {
|
||||
@ -235,9 +235,20 @@ p#user_header {
|
||||
color:#FFF;
|
||||
margin:0;
|
||||
padding:0;
|
||||
background-color:#542;
|
||||
background-color:#453619;
|
||||
border-top:solid 2px #6AF364;
|
||||
}
|
||||
#footer p#top {
|
||||
float:right;
|
||||
text-align:right;
|
||||
margin-top:20px;
|
||||
margin-right:20px;
|
||||
display:block;
|
||||
}
|
||||
#footer p#top a {
|
||||
width:60px;
|
||||
text-decoration:underline;
|
||||
}
|
||||
#footer a, #footer a:visited {
|
||||
text-decoration:none;
|
||||
color:#FFF;
|
||||
@ -252,21 +263,19 @@ p#user_header {
|
||||
}
|
||||
#footer p#createdate {
|
||||
float:left;
|
||||
width:45%;
|
||||
width:230px;
|
||||
text-align:left;
|
||||
margin-left:10px;
|
||||
color:#FFF;
|
||||
}
|
||||
#footer p#copyright {
|
||||
float:right;
|
||||
width:40%;
|
||||
text-align:right;
|
||||
float:center;
|
||||
text-align:center;
|
||||
color:#FFF;
|
||||
margin-right:10px;
|
||||
}
|
||||
#footer p#copyright img {
|
||||
margin-right:10px;
|
||||
margin-top:10px;
|
||||
}
|
||||
#footer p#copyright img { }
|
||||
|
||||
#user_footer {
|
||||
width:70%;
|
||||
float:left;
|
||||
@ -360,15 +369,13 @@ div#alphabet ul li.letters a:hover {
|
||||
margin-top:-6px;
|
||||
padding-top:11px;
|
||||
padding-bottom:8px;
|
||||
border-right:solid 1px #6AF364;
|
||||
border-left:solid 1px #6AF364;
|
||||
border-bottom:solid 4px #000;
|
||||
background-color:#000;
|
||||
color:#FFF;
|
||||
background-color:#CCC;
|
||||
color:#000;
|
||||
border-bottom:solid 4px #CCC;
|
||||
}
|
||||
#navigation ul li.CurrentSection a:hover {
|
||||
background-color:#228A22;
|
||||
border-bottom:solid 4px #228A22;
|
||||
background-color:#000;
|
||||
color:#FFF;
|
||||
}
|
||||
#subnavigation ul li.CurrentSection a {
|
||||
border-width:0 0 1px 0;
|
||||
@ -603,6 +610,7 @@ table.individuallist tbody tr td.ColumnPartner a:hover {
|
||||
#Sources { }
|
||||
#Sources table.infolist tbody tr td.ColumnRowLabel {
|
||||
padding-bottom:0;
|
||||
background-color:#FFF;
|
||||
}
|
||||
#Sources table.infolist tbody tr td.ColumnName {
|
||||
padding:0;
|
||||
@ -610,7 +618,6 @@ table.individuallist tbody tr td.ColumnPartner a:hover {
|
||||
#Sources table.infolist tbody tr td.ColumnName a {
|
||||
font-size:.9em;
|
||||
padding:.1em 10px .3em 10px;
|
||||
background-color:#FFF;
|
||||
}
|
||||
#Sources table.infolist tbody tr td.ColumnName a:hover {
|
||||
background-color:#C1B398;
|
||||
@ -997,7 +1004,7 @@ div#narrative {
|
||||
/* Subsections : Source References
|
||||
----------------------------------------------------- */
|
||||
div#sourcerefs {
|
||||
height:2.5cm;
|
||||
height:2.64cm;
|
||||
overflow:auto;
|
||||
}
|
||||
div#sourcerefs ol {
|
||||
|
@ -100,7 +100,8 @@ from gen.proxy import PrivateProxyDb, LivingProxyDb
|
||||
from gen.lib.eventroletype import EventRoleType
|
||||
from libhtmlconst import _CHARACTER_SETS, _CC, _COPY_OPTIONS
|
||||
|
||||
# import HTML Class
|
||||
# import HTML Class from
|
||||
# src/plugins/lib/libhtml.py
|
||||
from libhtml import Html
|
||||
|
||||
# import styled notes from
|
||||
@ -119,12 +120,7 @@ _NARRATIVESCREEN = 'narrative-screen.css'
|
||||
_NARRATIVEPRINT = 'narrative-print.css'
|
||||
|
||||
# variables for alphabet_navigation()
|
||||
_PERSON = 0
|
||||
_PLACE = 1
|
||||
|
||||
# sort_birth_order()
|
||||
_FAMILY = 0
|
||||
_PARENTS = 1
|
||||
_PERSON, _PLACE = 0, 1
|
||||
|
||||
# Web page filename extensions
|
||||
_WEB_EXT = ['.html', '.htm', '.shtml', '.php', '.php3', '.cgi']
|
||||
@ -271,17 +267,20 @@ class BasePage(object):
|
||||
#
|
||||
# ---------------------------------------------------------------------------------------
|
||||
|
||||
def mywriter(self, page, of):
|
||||
def mywriter(self, htmlinstance, of):
|
||||
"""
|
||||
This function is simply to make the web page look pretty and readable
|
||||
It is not for the browser, but for us, humans
|
||||
Will format, write, and close the file
|
||||
|
||||
of -- open file that is being written to
|
||||
htmlinstance -- web page created with libhtml
|
||||
src/plugins/lib/libhtml.py
|
||||
"""
|
||||
|
||||
page.write(lambda line: of.write(line + '\n'))
|
||||
htmlinstance.write(lambda line: of.write(line + '\n'))
|
||||
|
||||
# closes the file
|
||||
self.report.close_file(of)
|
||||
|
||||
|
||||
def get_copyright_license(self, copyright, up=False):
|
||||
"""
|
||||
will return either the text or image of the copyright license
|
||||
@ -332,13 +331,21 @@ class BasePage(object):
|
||||
name.set_display_as(name_format)
|
||||
return _nd.display_name(name)
|
||||
|
||||
def write_footer(self):
|
||||
def write_footer(self, counter, hyper=False):
|
||||
"""
|
||||
Will create and display the footer section of each page...
|
||||
"""
|
||||
db = self.report.database
|
||||
|
||||
footer = Html('div', id='footer')
|
||||
|
||||
# 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)
|
||||
@ -397,7 +404,7 @@ class BasePage(object):
|
||||
# return footer to its caller
|
||||
return footer
|
||||
|
||||
def write_header(self, title):
|
||||
def write_header(self, title, hyper=False):
|
||||
"""
|
||||
Note. 'title' is used as currentsection in the navigation links and
|
||||
as part of the header title.
|
||||
@ -458,6 +465,13 @@ 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)
|
||||
@ -934,8 +948,11 @@ 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'))
|
||||
indlistpage, body = self.write_header(_('Individuals'), hyper=True)
|
||||
|
||||
# begin Individuals division
|
||||
with Html('div', class_='content', id='Individuals') as section:
|
||||
@ -965,27 +982,22 @@ class IndividualListPage(BasePage):
|
||||
trow += Html('th', _('Surname'), class_='ColumnSurname') + (
|
||||
Html('th', _('Name'), class_='ColumnName', inline=True)
|
||||
)
|
||||
column_count = 2
|
||||
|
||||
# table header -- show birth column
|
||||
if showbirth:
|
||||
trow += Html('th', _('Birth'), class_='ColumnBirth', inline=True)
|
||||
column_count += 1
|
||||
|
||||
# table header -- show death column
|
||||
if showdeath:
|
||||
trow += Html('th', _('Death'), class_='ColumnDeath', inline=True)
|
||||
column_count += 1
|
||||
|
||||
# table header -- show partmer column
|
||||
if showpartner:
|
||||
trow += Html('th', _('Partner'), class_='ColumnPartner', inline=True)
|
||||
column_count += 1
|
||||
|
||||
# table header -- show parents column
|
||||
if showparents:
|
||||
trow += Html('th', _('Parents'), class_='ColumnParents', inline=True)
|
||||
column_count += 1
|
||||
|
||||
# begin table body
|
||||
tbody = Html('tbody')
|
||||
@ -1113,11 +1125,10 @@ class IndividualListPage(BasePage):
|
||||
|
||||
# create clear line for proper styling
|
||||
# create footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter, hyper=True)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(indlistpage, of)
|
||||
|
||||
class SurnamePage(BasePage):
|
||||
@ -1271,14 +1282,12 @@ class SurnamePage(BasePage):
|
||||
# add surnames table
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter=0)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(surnamepage, of)
|
||||
|
||||
|
||||
class PlaceListPage(BasePage):
|
||||
|
||||
def __init__(self, report, title, place_handles, src_list):
|
||||
@ -1286,8 +1295,11 @@ 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'))
|
||||
placelistpage, body = self.write_header(_('Places'), hyper=True)
|
||||
|
||||
# begin places division
|
||||
with Html('div', class_='content', id='Places') as section:
|
||||
@ -1357,11 +1369,10 @@ class PlaceListPage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter, hyper=True)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(placelistpage, of)
|
||||
|
||||
class PlacePage(BasePage):
|
||||
@ -1457,11 +1468,10 @@ class PlacePage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter=0)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(placepage, of)
|
||||
|
||||
class MediaPage(BasePage):
|
||||
@ -1556,7 +1566,7 @@ class MediaPage(BasePage):
|
||||
|
||||
self.copy_thumbnail(handle, photo)
|
||||
self.page_title = photo.get_description()
|
||||
media, body = self.write_header("%s - %s" % (_('Gallery'), self.page_title))
|
||||
mediapage, body = self.write_header("%s - %s" % (_('Gallery'), self.page_title))
|
||||
|
||||
# begin GalleryDetail division
|
||||
gallerydetail = Html('div', class_='content', id='GalleryDetail')
|
||||
@ -1747,12 +1757,11 @@ class MediaPage(BasePage):
|
||||
body += (gallerydetail, fullclear)
|
||||
|
||||
# add footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter=0)
|
||||
body += footer
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(media, of)
|
||||
self.mywriter(mediapage, of)
|
||||
|
||||
def gallery_nav_link(self, handle, name, up=False):
|
||||
|
||||
@ -1852,12 +1861,15 @@ 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'))
|
||||
surnamelist, body = self.write_header(_('Surnames'), hyper=True)
|
||||
else:
|
||||
of = self.report.create_file("surnames_count")
|
||||
surnamelist, body = self.write_header(_('Surnames by person count'))
|
||||
surnamelist, body = self.write_header(_('Surnames by person count'), hyper=True)
|
||||
|
||||
# begin surnames division
|
||||
with Html('div', class_='content', id='surnames') as section:
|
||||
@ -1960,11 +1972,10 @@ class SurnameListPage(BasePage):
|
||||
# create footer section
|
||||
# add clearline for proper styling
|
||||
# bring all body pieces together
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter, hyper=True)
|
||||
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):
|
||||
@ -2014,11 +2025,10 @@ class IntroductionPage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# create footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter=0)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(intropage, of)
|
||||
|
||||
class HomePage(BasePage):
|
||||
@ -2058,11 +2068,10 @@ class HomePage(BasePage):
|
||||
|
||||
# create clear line for proper styling
|
||||
# create footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter=0)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(homepage, of)
|
||||
|
||||
class SourceListPage(BasePage):
|
||||
@ -2071,8 +2080,11 @@ 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'))
|
||||
sourcelistpage, body = self.write_header(_('Sources'), hyper=True)
|
||||
|
||||
# begin source list division
|
||||
with Html('div', class_='content', id='sources') as section:
|
||||
@ -2121,11 +2133,10 @@ class SourceListPage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter=0, hyper=True)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(sourcelistpage, of)
|
||||
|
||||
class SourcePage(BasePage):
|
||||
@ -2193,11 +2204,10 @@ class SourcePage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter=0)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(sourcepage, of)
|
||||
|
||||
class MediaListPage(BasePage):
|
||||
@ -2206,8 +2216,11 @@ class MediaListPage(BasePage):
|
||||
BasePage.__init__(self, report, title)
|
||||
db = report.database
|
||||
|
||||
# add bottom and top links
|
||||
counter = len(self.report.photo_list)
|
||||
|
||||
of = self.report.create_file("gallery")
|
||||
gallery, body = self.write_header(_('Gallery'))
|
||||
medialistpage, body = self.write_header(_('Gallery'), hyper=True)
|
||||
|
||||
# begin gallery division
|
||||
with Html('div', class_='content', id='Gallery') as section:
|
||||
@ -2221,16 +2234,20 @@ class MediaListPage(BasePage):
|
||||
# begin gallery table and table head
|
||||
with Html('table', class_='infolist gallerylist') as table:
|
||||
section += table
|
||||
with Html('thead') as thead:
|
||||
|
||||
# begin table head
|
||||
thead = Html('thead')
|
||||
table += thead
|
||||
with Html('tr') as trow:
|
||||
|
||||
trow = Html('tr') + (
|
||||
Html('th', ' ', class_='ColumnRowLabel', inline=True),
|
||||
Html('th', _('Name'), class_='ColumnName', inline=True),
|
||||
Html('th', _('Date'), class_='ColumnDate', inline=True)
|
||||
)
|
||||
thead += trow
|
||||
trow += Html('th', ' ', class_='ColumnRowLabel', inline=True)
|
||||
trow += Html('th', _('Name'), class_='ColumnName', inline=True)
|
||||
trow += Html('th', _('Date'), class_='ColumnDate', inline=True)
|
||||
|
||||
# begin table body
|
||||
with Html('tbody') as tbody:
|
||||
tbody = Html('tbody')
|
||||
table += tbody
|
||||
|
||||
index = 1
|
||||
@ -2243,27 +2260,24 @@ class MediaListPage(BasePage):
|
||||
title = media.get_description()
|
||||
if not title:
|
||||
title = "[untitled]"
|
||||
with Html('tr') as trow:
|
||||
|
||||
trow = Html('tr') + (
|
||||
Html('td', index, class_='ColumnRowLabel', inline=True),
|
||||
)
|
||||
tbody += trow
|
||||
with Html('td', index, class_='ColumnRowLabel', inline=True) as tcell:
|
||||
trow += tcell
|
||||
with Html('td', class_='ColumnName') as tcell:
|
||||
trow += tcell
|
||||
hyper = self.media_ref_link(handle, title)
|
||||
tcell += hyper
|
||||
with Html('td', date, class_='ColumnDate', inline=True) as tcell:
|
||||
tcell = Html('td', class_='ColumnName') + \
|
||||
self.media_ref_link(handle, title)
|
||||
trow += tcell
|
||||
trow += Html('td', date, class_='ColumnDate', inline=True)
|
||||
index += 1
|
||||
|
||||
# add footer section
|
||||
# add clearline for proper styling
|
||||
# bring body pieces back together
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter, hyper=True)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(gallery, of)
|
||||
self.mywriter(medialistpage, of)
|
||||
|
||||
def media_ref_link(self, handle, name, up=False):
|
||||
|
||||
@ -2416,11 +2430,10 @@ class DownloadPage(BasePage):
|
||||
|
||||
# clear line for proper styling
|
||||
# create footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter=0)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# close the file
|
||||
self.mywriter(downloadpage, of)
|
||||
|
||||
class ContactPage(BasePage):
|
||||
@ -2488,11 +2501,10 @@ class ContactPage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# add footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter=0)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for porcessing
|
||||
# and close the file
|
||||
self.mywriter(contactpage, of)
|
||||
|
||||
class IndividualPage(BasePage):
|
||||
@ -2606,11 +2618,10 @@ class IndividualPage(BasePage):
|
||||
|
||||
# add clearline for proper styling
|
||||
# create footer section
|
||||
footer = self.write_footer()
|
||||
footer = self.write_footer(counter=0)
|
||||
body += (fullclear, footer)
|
||||
|
||||
# send page out for processing
|
||||
# and close the file
|
||||
self.mywriter(indivdetpage, of)
|
||||
|
||||
def display_attr_list(self, attrlist=None):
|
||||
@ -3221,12 +3232,12 @@ class IndividualPage(BasePage):
|
||||
db = self.report.database
|
||||
|
||||
# begin parents division
|
||||
sect_parents = Html('div', id='parents', class_='subsection')
|
||||
sect_title = Html('h4', _('Parents'), inline=True)
|
||||
sect_parents += sect_title
|
||||
with Html('div', class_='subsection', id='parents') as section:
|
||||
section += Html('h4', _('Parents'), inline=True)
|
||||
|
||||
# begin parents table
|
||||
parent_table = Html('table', class_='infolist')
|
||||
with Html('table', class_='infolist') as table:
|
||||
section += table
|
||||
|
||||
first = True
|
||||
if parent_list:
|
||||
@ -3247,26 +3258,26 @@ class IndividualPage(BasePage):
|
||||
break
|
||||
|
||||
if not first:
|
||||
trow = Html('tr')
|
||||
tabcol = Html('td', ' ', colspan=2, inline=True)
|
||||
trow += tabcol
|
||||
parent_table += trow
|
||||
trow = Html('tr') +(
|
||||
Html('td', ' ', colspan=2, inline=True)
|
||||
)
|
||||
table += trow
|
||||
else:
|
||||
first = False
|
||||
|
||||
father_handle = family.get_father_handle()
|
||||
if father_handle:
|
||||
trow = Html('tr')
|
||||
table += trow
|
||||
|
||||
tabcol1, tabcol2 = self.display_parent(father_handle, _('Father'), frel)
|
||||
trow += (tabcol1, tabcol2)
|
||||
parent_table += trow
|
||||
mother_handle = family.get_mother_handle()
|
||||
if mother_handle:
|
||||
trow = Html('tr')
|
||||
table += trow
|
||||
tabcol1, tabcol2 = self.display_parent(mother_handle, _('Mother'), mrel)
|
||||
trow += (tabcol1, tabcol2)
|
||||
parent_table += trow
|
||||
|
||||
first = False
|
||||
if len(child_ref_list) > 1:
|
||||
@ -3275,22 +3286,29 @@ class IndividualPage(BasePage):
|
||||
sibling.add(child_handle) # remember that we've already "seen" this child
|
||||
|
||||
# now that we have all natural siblings, display them...
|
||||
if birthorder:
|
||||
sibling = sort_birth_order(db, sibling, key=_PARENTS)
|
||||
|
||||
if len(sibling) > 0:
|
||||
trow = Html('tr')
|
||||
tabcol1 = Html('td', _('Siblings'), class_='ColumnAttribute', inline=True)
|
||||
tabcol2 = Html('td', class_='ColumnValue')
|
||||
if len(sibling):
|
||||
trow = Html('tr') + (
|
||||
Html('td', _('Siblings'), class_='ColumnAttribute', inline=True)
|
||||
)
|
||||
table += trow
|
||||
tcell = Html('td', class_='ColumnValue')
|
||||
trow += tcell
|
||||
ordered = Html('ol')
|
||||
tcell += ordered
|
||||
|
||||
if birthorder:
|
||||
kids = []
|
||||
kids = sorted(add_birthdate(db, sibling))
|
||||
|
||||
for birth_date, child_handle in kids:
|
||||
if child_handle != self.person.handle:
|
||||
ordered += self.display_child_link(child_handle)
|
||||
|
||||
else:
|
||||
|
||||
for child_handle in sibling:
|
||||
if child_handle != self.person.handle:
|
||||
kid_link = self.display_child_link(child_handle)
|
||||
ordered += kid_link
|
||||
tabcol2 += ordered
|
||||
trow += (tabcol1, tabcol2)
|
||||
parent_table += trow
|
||||
ordered += self.display_child_link(child_handle)
|
||||
|
||||
# Also try to identify half-siblings
|
||||
half_siblings = set()
|
||||
@ -3324,26 +3342,32 @@ class IndividualPage(BasePage):
|
||||
# we have a new half sibling
|
||||
half_siblings.add(half_child_handle)
|
||||
|
||||
if birthorder:
|
||||
half_siblings = sort_birth_order(db, half_siblings, key=_PARENTS)
|
||||
|
||||
# now that we have all of the half-siblings, print them out
|
||||
# now that we have all half- siblings, display them...
|
||||
if len(half_siblings):
|
||||
trow = Html('tr')
|
||||
tabcol1 = Html('td', _('Half Siblings'), class_='ColumnAttribute', inline=True)
|
||||
tabcol2 = Html('td', class_='ColumnValue')
|
||||
trow = Html('tr') + (
|
||||
Html('td', _('Half Siblings'), class_='ColumnAttribute', inline=True),
|
||||
)
|
||||
table += trow
|
||||
tcell = Html('td', class_='ColumnValue')
|
||||
trow += tcell
|
||||
ordered = Html('ol')
|
||||
tcell += ordered
|
||||
|
||||
if birthorder:
|
||||
kids = []
|
||||
kids = sorted(add_birthdate(db, half_siblings))
|
||||
|
||||
for birth_date, child_handle in kids:
|
||||
ordered += self.display_child_link(child_handle)
|
||||
|
||||
else:
|
||||
|
||||
for child_handle in half_siblings:
|
||||
kid_link = self.display_child_link(child_handle)
|
||||
ordered += kid_link
|
||||
tabcol2 += ordered
|
||||
trow += (tabcol1, tabcol2)
|
||||
parent_table += trow
|
||||
ordered += self.display_child_link(child_handle)
|
||||
|
||||
# get step-siblings
|
||||
step_siblings = set()
|
||||
if showallsiblings:
|
||||
step_siblings = set()
|
||||
|
||||
# to find the step-siblings, we need to identify
|
||||
# all of the families that can be linked back to
|
||||
@ -3408,28 +3432,31 @@ class IndividualPage(BasePage):
|
||||
# we have a new step sibling
|
||||
step_siblings.add(step_child_handle)
|
||||
|
||||
if birthorder:
|
||||
step_iblings = sort_birth_order(db, step_siblings, key=_PARENTS)
|
||||
|
||||
# now that we have all of the step-siblings, print them out
|
||||
if len(step_siblings) > 0:
|
||||
trow = Html('tr')
|
||||
tabcol1 = Html('td', _('Step Siblings'), class_='ColumnAttribute', inline=True)
|
||||
tabcol2 = Html('td', class_='ColumnValue')
|
||||
# now that we have all step- siblings, display them...
|
||||
if len(step_siblings):
|
||||
trow = Html('tr') + (
|
||||
Html('td', _('Step Siblings'), class_='ColumnAttribute', inline=True)
|
||||
)
|
||||
table += trow
|
||||
tcell = Html('td', class_='ColumnValue')
|
||||
trow += tcell
|
||||
ordered = Html('ol')
|
||||
tcell += ordered
|
||||
|
||||
if birthorder:
|
||||
kids = []
|
||||
kids = sorted(add_birthdate(db, step_siblings))
|
||||
|
||||
for birth_date, child_handle in kids:
|
||||
ordered += self.display_child_link(child_handle)
|
||||
|
||||
else:
|
||||
|
||||
for child_handle in step_siblings:
|
||||
kid_link = self.display_child_link(child_handle)
|
||||
ordered += kid_link
|
||||
tabcol2 += ordered
|
||||
trow += (tabcol1, tabcol2)
|
||||
parent_table += trow
|
||||
ordered += self.display_child_link(child_handle)
|
||||
|
||||
# add table to parent division
|
||||
sect_parents += parent_table
|
||||
|
||||
# return division to its caller
|
||||
return sect_parents
|
||||
# return parents division to its caller
|
||||
return section
|
||||
|
||||
def display_ind_families(self):
|
||||
"""
|
||||
@ -3454,19 +3481,24 @@ class IndividualPage(BasePage):
|
||||
self.display_partner(family, table)
|
||||
childlist = family.get_child_ref_list()
|
||||
if childlist:
|
||||
trow = Html('tr')
|
||||
trow = Html('tr') + (
|
||||
Html('td', ' ', class_='ColumnType', inline=True),
|
||||
Html('td', _('Children'), class_='ColumnAttribute', inline=True)
|
||||
)
|
||||
table += trow
|
||||
tcell1 = Html('td', ' ', class_='ColumnType', inline=True)
|
||||
tcell2 = Html('td', _('Children'), class_='ColumnAttribute', inline=True)
|
||||
tcell3 = Html('td', class_='ColumnValue')
|
||||
trow += (tcell1, tcell2, tcell3)
|
||||
tcell = Html('td', class_='ColumnValue')
|
||||
trow += tcell
|
||||
ordered = Html('ol')
|
||||
tcell3 += ordered
|
||||
tcell += ordered
|
||||
childlist = [child_ref.ref for child_ref in childlist]
|
||||
# TODO. Optionally sort on birthdate
|
||||
|
||||
if self.report.options['birthorder']:
|
||||
childlist = sort_birth_order(db, childlist, key=_FAMILY)
|
||||
kids = []
|
||||
kids = sorted(add_birthdate(db, childlist))
|
||||
|
||||
for birth_date, child_handle in kids:
|
||||
ordered += self.display_child_link(child_handle)
|
||||
else:
|
||||
|
||||
for child_handle in childlist:
|
||||
ordered += self.display_child_link(child_handle)
|
||||
@ -4658,14 +4690,21 @@ def alphabet_navigation(db, handle_list, key):
|
||||
if not sorted_first_letter:
|
||||
return None
|
||||
|
||||
# begin alphabet division and set up table
|
||||
alphabet = Html('div', id='alphabet')
|
||||
alpha_table = Html('table', class_='alphabet')
|
||||
# begin alphabet division
|
||||
with Html('div', id='alphabet') as section:
|
||||
|
||||
# begin alphabet table
|
||||
with Html('table', class_='alphabet infolist') as table:
|
||||
section += table
|
||||
|
||||
num_ltrs = len(sorted_first_letter)
|
||||
if num_ltrs <= 26:
|
||||
trow = Html('tr')
|
||||
table += trow
|
||||
|
||||
unordered = Html('ul')
|
||||
trow += unordered
|
||||
|
||||
for ltr in sorted_first_letter:
|
||||
title_str = _('Surnames') if key == 0 else _('Places')
|
||||
if lang_country == "sv_SE" and ltr == u'V':
|
||||
@ -4679,17 +4718,17 @@ def alphabet_navigation(db, handle_list, key):
|
||||
Html('a', ltr, href='#%s' % ltr, title=title_str)
|
||||
)
|
||||
|
||||
# bring table pieces back together
|
||||
trow += unordered
|
||||
alpha_table += trow
|
||||
else:
|
||||
nrows = (num_ltrs / 26) + 1
|
||||
nrows = (num_ltrs / 28) + 1
|
||||
index = 0
|
||||
for rows in range(0, nrows):
|
||||
trow = Html('tr')
|
||||
table += trow
|
||||
|
||||
unordered = Html('ul')
|
||||
trow += unordered
|
||||
cols = 0
|
||||
while (cols <= 26 and index < num_ltrs):
|
||||
while (cols <= 28 and index < num_ltrs):
|
||||
ltr = sorted_first_letter[index]
|
||||
title_str = _('Surnames') if key == 0 else _('Places')
|
||||
if lang_country == "sv_SE" and letter == u'V':
|
||||
@ -4705,22 +4744,14 @@ def alphabet_navigation(db, handle_list, key):
|
||||
cols += 1
|
||||
index += 1
|
||||
|
||||
# bring table pieces to table row
|
||||
trow += unordered
|
||||
|
||||
# attach table row to table
|
||||
alpha_table += trow
|
||||
|
||||
# close the table
|
||||
alphabet += alpha_table
|
||||
|
||||
# return alphabet navigation to its callers
|
||||
return alphabet
|
||||
return section
|
||||
|
||||
def sort_birth_order(db, childlist, key):
|
||||
def add_birthdate(db, childlist):
|
||||
"""
|
||||
This will sort a list of child handles in birth order
|
||||
"""
|
||||
|
||||
sorted_children = []
|
||||
for child_handle in childlist:
|
||||
child = db.get_person_from_handle(child_handle)
|
||||
@ -4731,36 +4762,33 @@ def sort_birth_order(db, childlist, key):
|
||||
birth_event = db.get_event_from_handle(birth_ref.ref)
|
||||
birth_date = birth_event.get_date_object()
|
||||
if birth_date is not None:
|
||||
if 1423 < birth_date.get_year() <= 2100:
|
||||
year = birth_date.get_year()
|
||||
if year:
|
||||
year = str(year)
|
||||
else:
|
||||
year = 1423
|
||||
if 0 < birth_date.get_month() <= 12:
|
||||
year = str(1001)
|
||||
month = birth_date.get_month()
|
||||
if month:
|
||||
if 0 < month < 10:
|
||||
month = '0' + str(month)
|
||||
else:
|
||||
month = 1
|
||||
if 0 < birth_date.get_day() <= 31:
|
||||
month = str(month)
|
||||
else:
|
||||
month = str(12)
|
||||
day = birth_date.get_day()
|
||||
if day:
|
||||
if 0 < day < 10:
|
||||
day = '0' + str(day)
|
||||
else:
|
||||
day = 1
|
||||
day = str(day)
|
||||
else:
|
||||
year, month, day = 1423, 1, 1
|
||||
date_obj = datetime.date(year, month, day)
|
||||
day = str(31)
|
||||
else:
|
||||
year, month, day = str(1001), str(12), str(31)
|
||||
date_obj = year + month + day
|
||||
sorted_children.append((date_obj, child_handle))
|
||||
|
||||
sorted_children.sort()
|
||||
if key ==_FAMILY:
|
||||
childlist = []
|
||||
else:
|
||||
childlist = set()
|
||||
|
||||
for birth_date, handle in sorted_children:
|
||||
if key == _FAMILY:
|
||||
childlist.append(handle)
|
||||
else:
|
||||
childlist.add(handle)
|
||||
|
||||
return childlist
|
||||
return sorted_children
|
||||
|
||||
# ------------------------------------------
|
||||
#
|
||||
|
Reference in New Issue
Block a user