NarrativeWeb is now complete unless there are bugs. Style sheet has been updated to match current changes.

svn: r13123
This commit is contained in:
Rob G. Healey 2009-08-27 13:21:55 +00:00
parent 483e745903
commit 0ac7dc7a96
2 changed files with 145 additions and 137 deletions

View File

@ -36,7 +36,7 @@ brown darkest #453619
brown dark #542 brown dark #542
brown light #C1B398 brown light #C1B398
gray #696969 gray #696969
green #6AF364 green #6AF364, #5D835F
green lighter #D8F3D6 green lighter #D8F3D6
===== Ancestor Graph Color Scheme ===== ===== Ancestor Graph Color Scheme =====
@ -87,6 +87,7 @@ img {
background:none; background:none;
} }
.content { .content {
overflow: auto;
width:965px; width:965px;
margin:0 auto; margin:0 auto;
padding-bottom:.5em; padding-bottom:.5em;
@ -191,19 +192,28 @@ span.preposition {
color:#000; color:#000;
} }
/* NarrativeWeb
------------------------------------------------------ */
body#NarrativeWeb {
font-family: Arial, sans, sans-serif, Helvetica;
}
/* Header /* Header
----------------------------------------------------- */ ----------------------------------------------------- */
#header { #header {
overflow: auto;
width:100%;
height: 2cm;
margin:0; margin:0;
height:1.5cm;
padding:0 0 .9em 0; padding:0 0 .9em 0;
background-color:#453619; background-color: #542;
border-bottom:solid 2px #6AF364; border-bottom:solid 8px #5D835F;
} }
#SiteTitle { #SiteTitle {
color:#FFF;
margin:0; margin:0;
padding:.5em 0 0 20px; padding:.5em 0 0 20px;
font-size: 36px;
color:#FFF;
font-style:italic; font-style:italic;
} }
p#user_header { p#user_header {
@ -217,16 +227,16 @@ p#user_header {
/* Footer /* Footer
----------------------------------------------------- */ ----------------------------------------------------- */
#footer { #footer {
overflow: auto;
width: 100%;
height: 1.5cm;
clear:both; clear:both;
height:1.5cm;
width:100%;
font-size:12px; font-size:12px;
line-height:130%; color:#FFF;
font-family:sans-serif; margin:0 auto;
margin:0;
padding:0; padding:0;
background-color:#453619; background-color: #542;
border-top:solid 2px #6AF364; border-top:solid 8px #5D835F;
} }
#footer a, #footer a:visited { #footer a, #footer a:visited {
text-decoration:none; text-decoration:none;
@ -246,16 +256,16 @@ p#user_header {
width:60%; width:60%;
text-align:left; text-align:left;
margin-left:10px; margin-left:10px;
color:#FFF;
} }
#footer p#copyright { #footer p#copyright {
float:right; float:right;
text-align:right; text-align:right;
color:#FFF; color:#FFF;
margin-top:10px; margin: 10px 10px 0px 0px;
} }
#footer p#copyright img { #footer p#copyright img {
float:right; float:right;
margin-right: 10px;
} }
#user_footer { #user_footer {
width:70%; width:70%;
@ -601,42 +611,51 @@ table.individuallist tbody tr td.ColumnPartner a:hover {
/* Events /* Events
----------------------------------------------------- */ ----------------------------------------------------- */
div#eventlist ( ) div#EventList (
font-size:10px;
table.eventlist { color:#000;
font-family:Arial, sans, sans-serif, Helvetica;
)
div#EventList table.eventlist {
margin: .5cm 0 .5cm 0; margin: .5cm 0 .5cm 0;
width: 100%; width: 965px;
} }
table.eventlist tbody tr { div#EventList table.eventlist thead tr th {
font-weight:bold;
text-transform:uppercase;
border:solid 1px #5D835F;
}
div#EventList table.eventlist tbody tr {
border-bottom:solid 1px #000; border-bottom:solid 1px #000;
} }
table.eventlist tbody tr td { div#EventList table.eventlist tbody tr td {
background-color:#D8F3D6; background-color:#D8F3D6;
} }
table.eventlist tbody tr td.ColumnEventType { div#EventList table.eventlist tbody tr td.ColumnType {
display:block;
padding:4px 20px 4px 20px;
background-color:#FFF;
width:15%;
}
table.eventlist tbody tr td.ColumnDate {
width:15%;0
}
table.eventlist tbody tr td.ColumnPlace {
display:block;
padding: 4px 10px 4px 10px;
background-color:#FFF;
width:60%;
}
table.eventlist tbody tr td.ColumnDescription {
width:10^;
}
table.eventlist tbody tr td.ColumnPerson {
display:block; display:block;
padding:10px 20px 10px 20px; padding:10px 20px 10px 20px;
background-color:#FFF; background-color:#FFF;
width:70%; width: 35%;
}
div#EventList table.eventlist tbody tr td.ColumnDate {
width: 22%;
}
div#EventList table.eventlist tbody tr td.ColumnDescription {
width: 20%;
}
div#EventList table.eventlist tbody tr td.ColumnName {
display:block;
padding:10px 20px 10px 20px;
background-color:#FFF;
width: 75%;
}
div#EventDetail {
font-size:10px;
color:#000;
font-family:Arial, sans, sans-serif, Helvetica;
}
div#EventDetail h3 {
font-size: 40px;
} }
/* Gallery /* Gallery

View File

@ -124,7 +124,7 @@ from libhtmlbackend import HtmlBackend
AHEAD = _('Attributes') AHEAD = _('Attributes')
DHEAD = _('Date') DHEAD = _('Date')
DESCRHEAD = _('Description') DESCRHEAD = _('Description')
EHEAD = _('EventType') EHEAD = _('Type')
NHEAD = _('Notes') NHEAD = _('Notes')
PHEAD = _('Place') PHEAD = _('Place')
SHEAD = _('Sources') SHEAD = _('Sources')
@ -1882,14 +1882,10 @@ class PlacePage(BasePage):
class EventListPage(BasePage): class EventListPage(BasePage):
def __init__(self, report, title, event_list, event_types): def __init__(self, report, title, event_dict):
BasePage.__init__(self, report, title)
db = report.database db = report.database
BasePage.__init__(self, report, event_list[0][0], event_list[0][1])
# get down to just the types and remove its occurences
keys = sorted(event_types, key=locale.strxfrm)
of = self.report.create_file("events") of = self.report.create_file("events")
eventslistpage, body = self.write_header(_('Events')) eventslistpage, body = self.write_header(_('Events'))
@ -1918,17 +1914,15 @@ class EventListPage(BasePage):
thead += trow thead += trow
for (label, colclass) in [ for (label, colclass) in [
(EHEAD, 'EventType'), (EHEAD, 'Type'),
(DHEAD, 'Date'), (DHEAD, 'Date'),
(PHEAD, 'Place'),
(DESCRHEAD, 'Description'), (DESCRHEAD, 'Description'),
(_('Person'), 'Person') ]: (_('Person'), 'Person') ]:
trow += Html('th', label, class_ = 'Column%s' % colclass, inline = True) trow += Html('th', label, class_ = 'Column%s' % colclass, inline = True)
# send the entire events list # send entire events dictionary
# table body is started in here table += self.write_event_rows(event_dict)
table += self.write_event_row(event_list)
# and clearline for proper styling # and clearline for proper styling
# and footer section # and footer section
@ -1939,62 +1933,57 @@ class EventListPage(BasePage):
# and close the file # and close the file
self.mywriter(eventslistpage, of) self.mywriter(eventslistpage, of)
def write_event_row(self, event_data_list): def write_event_rows(self, event_dict):
""" """
display the event row display the event row for class EventListPage()
""" """
db = self.report.database db = self.report.database
# begin table body # begin table body
tbody = Html('tbody') tbody = Html('tbody')
# unwrap event list for (sort_name, person, event_list) in event_dict:
for sort_name, evt_type, sort_date, event, evt_ref, person in event_data_list:
# Event/ Type # get person's hyperlink
evt_name = str(event.get_type())
if evt_ref.get_role() == EventRoleType.PRIMARY:
eventtype = u"%(evt_name)s" % locals()
else:
evt_role = evt_ref.get_role()
eventtype = u"%(evt_name)s (%(evt_role)s)" % locals()
event_hyper = self.event_link(eventtype, evt_ref.ref, event.gramps_id)
# get place hyperlink
place_handle = event.get_place_handle()
place = db.get_place_from_handle(place_handle)
place_hyper = None
if place:
place_name = ReportUtils.place_name(db, place_handle)
place_hyper = self.place_link(place_handle, place_name,
place.gramps_id, False)
url = self.report.build_url_fname_html(person.handle, 'ppl', self.up) url = self.report.build_url_fname_html(person.handle, 'ppl', self.up)
person_hyper = self.person_link(url, person, True, person.gramps_id) person_hyper = self.person_link(url, person, True, person.gramps_id)
# begin table row first = True
trow = Html('tr') for (evt_type, sort_date, event, evt_ref) in event_list:
tbody += trow
for (colclass, data) in [ # event hyperlink
['EventType', event_hyper], event_hyper = self.event_link(evt_type, evt_ref.ref, event.gramps_id)
['Date', _dd.display(event.get_date_object() )],
['Place', place_hyper],
['Description', event.get_description()],
['Person', person_hyper] ]:
data = data or ' ' # begin table row
trow += Html('td', data, class_='Column%s' % colclass, inline=True) trow = Html('tr')
tbody += trow
# return events table body to its callers if first:
trow.attr = 'class="BeginName"'
for (colclass, data) in [
['Type', event_hyper],
['Date', _dd.display(event.get_date_object() )],
['Description', event.get_description()] ]:
data = data or ' '
# conditional statement for inline=True or False
samerow = True if (data == ' ' or colclass == 'Date') else False
trow += Html('td', data, class_='Column%s' % colclass, inline=samerow)
if first:
trow += Html('td', person_hyper, class_='ColumnName')
else:
trow += Html('td', ' ', class_='ColumnName', inline=True)
first = False
# return events table body to its caller
return tbody return tbody
class EventPage(BasePage): class EventPage(BasePage):
def __init__(self, report, title, evt_type, event, evt_ref, person):
def __init__(self, report, evt_type, event, evt_ref, person): BasePage.__init__(self, report, '%s - %s' % (title, evt_type))
BasePage.__init__(self, report, evt_type, event.gramps_id)
db = report.database db = report.database
of = self.report.create_file(evt_ref.ref, 'evt') of = self.report.create_file(evt_ref.ref, 'evt')
@ -2009,7 +1998,7 @@ class EventPage(BasePage):
eventdetail += Html('h3', '%s of %s' % (evt_type, self.get_name(person)), inline=True) eventdetail += Html('h3', '%s of %s' % (evt_type, self.get_name(person)), inline=True)
# begin event detail table # begin event detail table
with Html('table', class_='infolist eventdetail') as table: with Html('table', class_='infolist eventlist') as table:
eventdetail += table eventdetail += table
# get event data # get event data
@ -2028,11 +2017,11 @@ class EventPage(BasePage):
table += trow table += trow
url = self.report.build_url_fname_html(person.handle, 'ppl', self.up) url = self.report.build_url_fname_html(person.handle, 'ppl', self.up)
hyper = self.person_link(url, person, True, person.gramps_id) person_hyper = self.person_link(url, person, True, person.gramps_id)
trow = Html('tr') + ( trow = Html('tr') + (
Html('td', _('Person'), class_='ColumnAttribute', inline=True), Html('td', _('Person'), class_='ColumnAttribute', inline=True),
Html('td', hyper, class_='ColumnValue', inline=True) Html('td', person_hyper, class_='ColumnValue', inline=True)
) )
table += trow table += trow
@ -2691,7 +2680,7 @@ class SourceListPage(BasePage):
thead += trow thead += trow
for (label, colclass) in [ for (label, colclass) in [
(None, 'RowLabel'), (None, 'RowLabel'),
(_('Name'), 'Name') ]: (_('Name'), 'Name') ]:
label = label or ' ' label = label or ' '
@ -4270,12 +4259,12 @@ class IndividualPage(BasePage):
trow = Html('tr') trow = Html('tr')
for (label, colclass) in [ for (label, colclass) in [
(EHEAD, 'EventType'), (EHEAD, 'Type'),
(DHEAD, 'Date'), (DHEAD, 'Date'),
(PHEAD, 'Place'), (PHEAD, 'Place'),
(DESCRHEAD, 'Description'), (DESCRHEAD, 'Description'),
(SHEAD, 'Sources'), (SHEAD, 'Sources'),
(NHEAD, 'Note') ]: (NHEAD, 'Notes') ]:
trow += Html('th', label, class_ = 'Column%s' % colclass, inline = True) trow += Html('th', label, class_ = 'Column%s' % colclass, inline = True)
@ -4850,16 +4839,20 @@ class NavWebReport(Report):
def event_pages(self, ind_list): def event_pages(self, ind_list):
""" """
a dump of all the events sorted by EventType, gramps_id, a dump of all the events sorted by person's surname, and event type,
and a description if one? then by date if needed...
""" """
db = self.database db = self.database
# a dictionary for event information
event_dict = []
event_list = []
event_types = {}
for person_handle in ind_list: for person_handle in ind_list:
person = db.get_person_from_handle(person_handle) person = db.get_person_from_handle(person_handle)
# begin events list for each person
event_list = []
# get sort name for sorting later # get sort name for sorting later
last_name = person.get_primary_name().get_surname() last_name = person.get_primary_name().get_surname()
first_name = person.get_primary_name().get_first_name() first_name = person.get_primary_name().get_first_name()
@ -4874,21 +4867,15 @@ class NavWebReport(Report):
# get event type # get event type
evt_type = self.get_event_type(event, evt_ref) evt_type = self.get_event_type(event, evt_ref)
# get sot date as year/month/day or 0/0/0 # get sot date as year/month/day or 0000/00/00
event_date = event.get_date_object() event_date = event.get_date_object()
year = str(event_date.get_year() ) or str(0) year = event_date.get_year() or 0
month = str(event_date.get_month() ) or str(0) month = event_date.get_month() or 0
day = str(event_date.get_day() ) or str(0) day = event_date.get_day() or 0
sort_date = '/'.join([year, month, day]) sort_date = '%04d/%02d/%02d' % (year, month, day)
info = [sort_name, evt_type, sort_date, event, evt_ref, person]
event_list.append(info)
# get a list of the different event type in this database # add event data
if evt_type in event_types: event_list.append([evt_type, sort_date, event, evt_ref])
event_types[evt_type] += 1
else:
event_types[evt_type] = 1
for evt_ref in person.get_primary_event_ref_list(): for evt_ref in person.get_primary_event_ref_list():
event = db.get_event_from_handle(evt_ref.ref) event = db.get_event_from_handle(evt_ref.ref)
@ -4896,36 +4883,38 @@ class NavWebReport(Report):
# get event type # get event type
evt_type = self.get_event_type(event, evt_ref) evt_type = self.get_event_type(event, evt_ref)
# get sot date as year/month/day or 0/0/0 # get sot date as year/month/day or 0000/00/00
event_date = event.get_date_object() event_date = event.get_date_object()
year = str(event_date.get_year() ) or str(0) year = event_date.get_year() or 0
month = str(event_date.get_month() ) or str(0) month = event_date.get_month() or 0
day = str(event_date.get_day() ) or str(0) day = event_date.get_day() or 0
sort_date = '/'.join([year, month, day]) sort_date = '%04d/%02d/%02d' % (year, month, day)
info = [sort_name, evt_type, sort_date, event, evt_ref, person]
event_list.append(info)
# get a list of the different event type in this database # add event data
if evt_type in event_types: event_list.append([evt_type, sort_date, event, evt_ref])
event_types[evt_type] += 1
else: # sort the list of an individual's events
event_types[evt_type] = 1 event_list.sort()
# combine person and their events together
event_dict.append([sort_name, person, event_list])
# sort the events dictionary
event_dict.sort()
# set progress meter pass # set progress meter pass
self.progress.set_pass(_('Creating event pages'), len(event_list)) self.progress.set_pass(_('Creating event pages'), len(event_dict))
# sort the events by type
event_list.sort()
# send all data to the events list page # send all data to the events list page
EventListPage(self, self.title, event_list, event_types) EventListPage(self, self.title, event_dict)
for sort_name, evt_type, sort_date, event, evt_ref, person in event_list: for (sort_name, person, event_list) in event_dict:
self.progress.step()
# create individual event page for evt_type, sort_date, event, evt_ref in event_list:
EventPage(self, evt_type, event, evt_ref, person) self.progress.step()
# create individual event page
EventPage(self, self.title, evt_type, event, evt_ref, person)
def gallery_pages(self, source_list): def gallery_pages(self, source_list):
import gc import gc