src/plugins/NavWebPage.py: various fixes. Doesn't work yet.

svn: r6240
This commit is contained in:
Brian Matherly 2006-03-31 05:37:41 +00:00
parent 8149c252b3
commit be7400586e
2 changed files with 27 additions and 23 deletions

View File

@ -5,6 +5,7 @@
2006-03-30 Brian Matherly <pez4brian@users.sourceforge.net> 2006-03-30 Brian Matherly <pez4brian@users.sourceforge.net>
* src/plugins/GraphViz.py: import const * src/plugins/GraphViz.py: import const
* src/plugins/DecendReport.py: use full dates instead of just year. * src/plugins/DecendReport.py: use full dates instead of just year.
* src/plugins/NavWebPage.py: various fixes. Doesn't work yet.
2006-03-30 Don Allingham <don@gramps-project.org> 2006-03-30 Don Allingham <don@gramps-project.org>
* src/Editors/_EditFamily.py: add surname guessing back in * src/Editors/_EditFamily.py: add surname guessing back in

View File

@ -595,10 +595,10 @@ class IndividualListPage(BasePage):
if person.handle in restrict_list: if person.handle in restrict_list:
of.write(_('restricted')) of.write(_('restricted'))
else: else:
birth_handle = person.get_birth_handle() birth_ref = person.get_birth_ref()
if birth_handle: if birth_ref:
birth = db.get_event_from_handle(birth_handle) birth = db.get_event_from_handle(birth_ref.ref)
of.write(birth.get_date()) of.write(_dd.display(birth.get_date_object()))
of.write('</td></tr>\n') of.write('</td></tr>\n')
first = False first = False
@ -1652,7 +1652,8 @@ class IndividualPage(BasePage):
# Names [and their sources] # Names [and their sources]
for name in [self.person.get_primary_name(),]+self.person.get_alternate_names(): for name in [self.person.get_primary_name(),]+self.person.get_alternate_names():
pname = name_nameof(name,self.exclude_private) pname = name_nameof(name,self.exclude_private)
of.write('<tr><td class="field">%s</td>\n' % _(name.get_type())) type = Utils.format_name_type( name.get_type() )
of.write('<tr><td class="field">%s</td>\n' % _(type))
of.write('<td class="data">%s' % pname) of.write('<td class="data">%s' % pname)
if not self.restrict: if not self.restrict:
nshl = [] nshl = []
@ -1690,10 +1691,13 @@ class IndividualPage(BasePage):
of.write('</tr>\n</table>\n</div>\n') of.write('</tr>\n</table>\n</div>\n')
def display_ind_events(self,of): def display_ind_events(self,of):
all_events = [handle for handle in [self.person.get_birth_handle(), birth_ref = self.person.get_birth_ref()
self.person.get_death_handle()] death_ref = self.person.get_death_ref()
if handle] + self.person.get_event_list() evt_ref_list = self.person.get_event_ref_list()
if not all_events or self.restrict:
if not birth_ref and not death_ref and not evt_ref_list:
return
if self.restrict:
return return
of.write('<div id="events">\n') of.write('<div id="events">\n')
@ -1701,24 +1705,22 @@ class IndividualPage(BasePage):
of.write('<table class="infolist">\n') of.write('<table class="infolist">\n')
# Birth # Birth
handle = self.person.get_birth_handle()
if handle: if birth_ref:
event = self.db.get_event_from_handle(handle) event = self.db.get_event_from_handle(birth_ref.ref)
of.write('<tr><td class="field">%s</td>\n' % _('Birth')) of.write('<tr><td class="field">%s</td>\n' % _('Birth'))
of.write('<td class="data">%s</td>\n' % self.format_event(event)) of.write('<td class="data">%s</td>\n' % self.format_event(event))
of.write('</tr>\n') of.write('</tr>\n')
# Death # Death
handle = self.person.get_death_handle() if death_ref:
if handle: event = self.db.get_event_from_handle(death_ref.ref)
event = self.db.get_event_from_handle(handle)
of.write('<tr><td class="field">%s</td>\n' % _('Death')) of.write('<tr><td class="field">%s</td>\n' % _('Death'))
of.write('<td class="data">%s</td>\n' % self.format_event(event)) of.write('<td class="data">%s</td>\n' % self.format_event(event))
of.write('</tr>\n') of.write('</tr>\n')
for event_id in self.person.get_event_list(): for event_ref in evt_ref_list:
event = self.db.get_event_from_handle(event_id) event = self.db.get_event_from_handle(evt_ref.ref)
of.write('<tr><td class="field">%s</td>\n' % _(event.get_name())) of.write('<tr><td class="field">%s</td>\n' % _(event.get_name()))
of.write('<td class="data">\n') of.write('<td class="data">\n')
of.write(self.format_event(event)) of.write(self.format_event(event))
@ -2119,11 +2121,11 @@ class WebReport(Report.Report):
# Copy the Creative Commons icon if the a Creative Commons # Copy the Creative Commons icon if the a Creative Commons
# license is requested # license is requested
if 0 < self.copyright < 7: if 0 < self.copyright < 7:
from_path = os.path.join(const.dataDir,"somerights20.gif") from_path = os.path.join(const.image_dir,"somerights20.gif")
to_path = os.path.join("images","somerights20.gif") to_path = os.path.join("images","somerights20.gif")
self.store_file(archive,self.target_path,from_path,to_path) self.store_file(archive,self.target_path,from_path,to_path)
from_path = os.path.join(const.dataDir,"document.png") from_path = os.path.join(const.image_dir,"document.png")
to_path = os.path.join("images","document.png") to_path = os.path.join("images","document.png")
self.store_file(archive,self.target_path,from_path,to_path) self.store_file(archive,self.target_path,from_path,to_path)
@ -2193,10 +2195,10 @@ class WebReport(Report.Report):
Copy the CSS file to the destination. Copy the CSS file to the destination.
""" """
if archive: if archive:
fname = os.path.join(const.dataDir,css_file) fname = os.path.join(const.data_dir,css_file)
archive.add(fname,_NARRATIVE) archive.add(fname,_NARRATIVE)
else: else:
shutil.copyfile(os.path.join(const.dataDir,css_file), shutil.copyfile(os.path.join(const.data_dir,css_file),
os.path.join(html_dir,_NARRATIVE)) os.path.join(html_dir,_NARRATIVE))
def person_pages(self, ind_list, restrict_list, place_list, source_list, archive): def person_pages(self, ind_list, restrict_list, place_list, source_list, archive):
@ -2740,7 +2742,8 @@ def sort_people(db,handle_list):
node = cursor.first() node = cursor.first()
while node: while node:
if node[0] in flist: if node[0] in flist:
primary_name = node[1][_NAME_COL] primary_name = RelLib.Name()
primary_name.unserialize(node[1][_NAME_COL])
if primary_name.private: if primary_name.private:
surname = _('Private') surname = _('Private')
sortnames[node[0]] = _('Private') sortnames[node[0]] = _('Private')