Compare commits

...

8 Commits

Author SHA1 Message Date
612b1889d8 update for 3.2.2 release
svn: r15284
2010-04-25 07:35:35 +00:00
07e2fc2dd4 translation update
svn: r15282
2010-04-25 01:16:01 +00:00
76ced42747 3877: 'alive' and incomplet date
svn: r15279
2010-04-24 18:58:56 +00:00
e06ba873f3 Translation updates.
svn: r15278
2010-04-24 11:04:09 +00:00
db67f8de2a Bug 3873: Narrative web site crashes when both living and private filters are active
svn: r15276
2010-04-23 18:40:27 +00:00
32d363fb7f bump next version string to 3.2.2
svn: r15275
2010-04-23 10:34:15 +00:00
2465b88422 bump next version string to 3.2.2
svn: r15266
2010-04-22 08:09:39 +00:00
8cea9a51eb revert last change of Rob for Braille, breaks 3.2
svn: r15263
2010-04-22 07:30:53 +00:00
9 changed files with 2224 additions and 2038 deletions

5
NEWS
View File

@ -1,3 +1,8 @@
Version 3.2.2 -- the "Mea navis aëricumbens anguillis abundat" release.
* This release is a quick fix to a problem introduced by NarrativeWeb in the previous release.
* Also includes a few small fixes and translation updates to hr and it.
* See the release notes from the 3.2.1 release for the full list of changes and translation updates.
Version 3.2.1 -- the "One of those men is my father" release.
* Many bug fixes:
-> fixed missing icons

View File

@ -5,7 +5,7 @@ dnl May need to run automake && aclocal first
AC_PREREQ(2.57)
dnl NOTE: arg to macro below becomes the "VERSION"
AC_INIT(gramps, 3.2.1, [gramps-bugs@lists.sourceforge.net])
AC_INIT(gramps, 3.2.2, [gramps-bugs@lists.sourceforge.net])
AC_CONFIG_SRCDIR(configure.in)
AM_INIT_AUTOMAKE([1.6.3 foreign])

1671
po/hr.po

File diff suppressed because it is too large Load Diff

1656
po/it.po

File diff suppressed because it is too large Load Diff

View File

@ -824,8 +824,8 @@ def probably_alive(person, db,
# no evidence, must consider alive
return (True, None, None, _("no evidence"), None)
# must have est dates from here:
# SPECIAL CASE: Today:
if current_date.match(gen.lib.date.Today(), "=="):
# SPECIAL CASE: Today and Future:
if current_date.match(gen.lib.date.Today(), ">="):
if person.get_death_ref():
# if death in the future: (impossible, unless guess)
# if return_range:

View File

@ -42,10 +42,10 @@ from gettext import gettext as _
#-------------------------------------------------------------------------
PROGRAM_NAME = "Gramps"
if "@VERSIONSTRING@" == "@" + "VERSIONSTRING" + "@":
VERSION = "3.2.1"
VERSION = "3.2.2"
else:
VERSION = "@VERSIONSTRING@"
VERSION_TUPLE = (3, 2, 1)
VERSION_TUPLE = (3, 2, 2)
#-------------------------------------------------------------------------
#

View File

@ -179,7 +179,7 @@ class PrivateProxyDb(ProxyDbBase):
If no such Source exists, None is returned.
"""
source = self.db.get_source_from_gramps_id(val)
if not source.get_privacy():
if source and not source.get_privacy():
return sanitize_source(self.db, source)
return None
@ -419,10 +419,10 @@ def copy_media_ref_list(db, original_obj, clean_obj):
@returns: Nothing
"""
for media_ref in original_obj.get_media_list():
if not media_ref.get_privacy():
if media_ref and not media_ref.get_privacy():
handle = media_ref.get_reference_handle()
media_object = db.get_object_from_handle(handle)
if not media_object.get_privacy():
if media_object and not media_object.get_privacy():
clean_obj.add_media_reference(sanitize_media_ref(db, media_ref))
def copy_source_ref_list(db, original_obj, clean_obj):
@ -439,10 +439,10 @@ def copy_source_ref_list(db, original_obj, clean_obj):
@returns: Nothing
"""
for ref in original_obj.get_source_references():
if not ref.get_privacy():
if ref and not ref.get_privacy():
handle = ref.get_reference_handle()
source = db.get_source_from_handle(handle)
if not source.get_privacy():
if source and not source.get_privacy():
clean_obj.add_source_reference(sanitize_source_ref(db, ref))
def copy_notes(db, original_obj, clean_obj):
@ -460,7 +460,7 @@ def copy_notes(db, original_obj, clean_obj):
"""
for note_handle in original_obj.get_note_list():
note = db.get_note_from_handle(note_handle)
if not note.get_privacy():
if note and not note.get_privacy():
clean_obj.add_note(note_handle)
def copy_associations(db, original_obj, clean_obj):
@ -498,7 +498,7 @@ def copy_attributes(db, original_obj, clean_obj):
@returns: Nothing
"""
for attribute in original_obj.get_attribute_list():
if not attribute.get_privacy():
if attribute and not attribute.get_privacy():
new_attribute = Attribute()
new_attribute.set_type(attribute.get_type())
new_attribute.set_value(attribute.get_value())
@ -520,7 +520,7 @@ def copy_urls(db, original_obj, clean_obj):
@returns: Nothing
"""
for url in original_obj.get_url_list():
if not url.get_privacy():
if url and not url.get_privacy():
clean_obj.add_url(url)
def copy_lds_ords(db, original_obj, clean_obj):
@ -537,7 +537,7 @@ def copy_lds_ords(db, original_obj, clean_obj):
@returns: Nothing
"""
for lds_ord in original_obj.get_lds_ord_list():
if not lds_ord.get_privacy():
if lds_ord and not lds_ord.get_privacy():
clean_obj.add_lds_ord(sanitize_lds_ord(db, lds_ord))
def copy_addresses(db, original_obj, clean_obj):
@ -554,7 +554,7 @@ def copy_addresses(db, original_obj, clean_obj):
@returns: Nothing
"""
for address in original_obj.get_address_list():
if not address.get_privacy():
if address and not address.get_privacy():
clean_obj.add_address(sanitize_address(db, address))
def sanitize_lds_ord(db, lds_ord):
@ -761,7 +761,7 @@ def sanitize_person(db, person):
# copy Family reference list
for handle in person.get_family_handle_list():
family = db.get_family_from_handle(handle)
if not family.get_privacy():
if family and not family.get_privacy():
new_person.add_family_handle(handle)
# copy Family reference list
@ -771,13 +771,14 @@ def sanitize_person(db, person):
continue
child_ref_list = family.get_child_ref_list()
for child_ref in child_ref_list:
if child_ref.get_reference_handle() == person.get_handle():
if (child_ref and
child_ref.get_reference_handle() == person.get_handle()):
if not child_ref.get_privacy():
new_person.add_parent_family_handle(handle)
break
for name in person.get_alternate_names():
if not name.get_privacy():
if name and not name.get_privacy():
new_person.add_alternate_name(sanitize_name(db, name))
# set complete flag
@ -843,10 +844,10 @@ def sanitize_source(db, source):
new_source.set_data_map(source.get_data_map())
for repo_ref in source.get_reporef_list():
if not repo_ref.get_privacy():
if repo_ref and not repo_ref.get_privacy():
handle = repo_ref.get_reference_handle()
repo = db.get_repository_from_handle(handle)
if not repo.get_privacy():
if repo and not repo.get_privacy():
new_source.add_repo_reference(RepoRef(repo_ref))
copy_media_ref_list(db, source, new_source)
@ -980,7 +981,7 @@ def sanitize_family(db, family):
father_handle = family.get_father_handle()
if father_handle:
father = db.get_person_from_handle(father_handle)
if not father.get_privacy():
if father and not father.get_privacy():
new_family.set_father_handle(father_handle)
# Copy the mother handle.

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,10 @@
# encoding: utf-8
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007 Thom Sturgill
# Copyright (C) 2007 Thom Sturgill
# Copyright (C) 2007-2009 Brian G. Matherly
# Copyright (C) 2008-2010 Rob G. Healey <robhealey1@gmail.com>
# Copyright (C) 2008 Jason Simanek
# Copyright (C) 2008-2009 Rob G. Healey <robhealey1@gmail.com>
# Copyright (C) 2008 Jason Simanek
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -26,9 +25,14 @@
"""
Web Calendar generator.
Refactoring. This is an ongoing job until this plugin is in a better shape.
"""
from __future__ import with_statement
#------------------------------------------------------------------------
#
# python modules
#
#------------------------------------------------------------------------
import os, codecs, shutil, re
import datetime, calendar
@ -37,15 +41,19 @@ from gen.ggettext import ngettext
from itertools import imap
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".WebPage")
#------------------------------------------------------------------------
#
# GRAMPS module
#
#------------------------------------------------------------------------
import gen.lib
from gen.lib import date, Date, Name, Person, NameType, EventType
import const
import constfunc
from ReportBase import Report, ReportUtils, MenuReportOptions, CSS_FILES
@ -59,6 +67,7 @@ from gui.utils import ProgressMeter
from DateHandler import displayer as _dd
from gen.display.name import displayer as _nd
from DateHandler import displayer as _dd
import libholiday
from libhtml import Html
@ -67,6 +76,7 @@ from libhtmlconst import _CHARACTER_SETS, _CC, _COPY_OPTIONS
# import styled notes from
# src/plugins/lib/libhtmlbackend.py
from libhtmlbackend import HtmlBackend
import Utils
#------------------------------------------------------------------------
#
# constants
@ -141,7 +151,7 @@ class WebCalReport(Report):
self.email = researcher.email
# set to today's date
self.today = gen.lib.date.Today()
self.today = date.Today()
self.warn_dir = True # Only give warning once.
@ -270,11 +280,11 @@ class WebCalReport(Report):
if month > 0:
try:
event_date = gen.lib.Date(year, month, day)
event_date = Date(year, month, day)
except ValueError:
event_date = gen.lib.Date.EMPTY
event_date = Date.EMPTY
else:
event_date = gen.lib.Date.EMPTY # Incomplete date....
event_date = Date.EMPTY # Incomplete date....
day_list.append((text, event, event_date))
month_dict[day] = day_list
@ -319,11 +329,6 @@ class WebCalReport(Report):
fname = os.path.join(const.DATA_DIR, self.css)
self.copy_file(fname, _CALENDARSCREEN, "styles")
# copy Navigation Menu Layout if Blue or Visually is being used
if self.css == "Web_Basic-Blue.css" or "Web_Visually.css":
fname = os.path.join(const.DATA_DIR, "Web_Navigation-Horizontal.css")
self.copy_file(fname, "Web_Navigation-Menus.css", "styles")
# copy print stylesheet
fname = os.path.join(const.DATA_DIR, "Web_Print-Default.css")
self.copy_file(fname, _CALENDARPRINT, "styles")
@ -384,7 +389,7 @@ class WebCalReport(Report):
# ---------------------------------------------------------------------------------------
# Beginning of Calendar Creation
# ---------------------------------------------------------------------------------------
def write_header(self, nr_up, title, body_id = None, add_print = True):
def write_header(self, nr_up, body_id, title, add_print=True):
"""
This creates the header for the Calendars
'nr_up' - number of directory levels up, started from current page, to the
@ -405,10 +410,6 @@ class WebCalReport(Report):
page, head, body = Html.page(title, self.encoding, xmllang)
# add body id tag if not None
if body_id is not None:
body.attr = "id = '%(idtag)s'" % { 'idtag' : body_id }
# GRAMPS favicon
fname1 = os.path.join(subdirs, "images", "favicon.ico")
@ -421,25 +422,24 @@ class WebCalReport(Report):
)
# links for GRAMPS favicon and stylesheets
links = Html("link", rel='shortcut icon', href=fname1, type = "image/x-icon") + (
Html("link",rel="stylesheet", href=fname2, type="text/css", media= "screen", indent = False)
links = Html("link", rel='shortcut icon', href=fname1,
type = "image/x-icon") + (
Html("link",rel="stylesheet", href=fname2, type="text/css", media= "screen",
indent = False)
)
# add printer stylesheet to webcalendar() and one_day() only
if add_print:
fname = os.path.join(subdirs, "styles", _CALENDARPRINT)
links += Html("link",rel="stylesheet", href=fname,type="text/css", media="print", indent = False)
# add horizontal menu if css == Blue or Visually because there is no menus
if self.css in ["Web_Basic-Blue.css", "Web_Visually.css"]:
# Link to Navigation Menus stylesheet
fname = os.path.join(subdirs, "styles", "Web_Navigation-Menus.css")
links.extend( Html("link", href = fname, type = "text/css", media = "screen", rel = "stylesheet") )
links += Html("link",rel="stylesheet", href=fname,type="text/css", media="print",
indent = False)
# add meta tags and links to head section
head += (meta, links)
# replace standard body element with custom one
body.attr = 'id="%s"' % body_id
# start header division section
header = Html("div", id="header") + (
@ -500,11 +500,10 @@ class WebCalReport(Report):
# Figure out if we need <li class="CurrentSection"> or just plain <li>
cs = str(cal_year) == currentsection and 'class="CurrentSection"' or ''
unordered += Html("li", attr = cs, inline = True) + (
unordered += Html("li", attr=cs, inline = True) + (
# create hyperlink
Html("a", str(cal_year), href = url, title = _("Sub Navigation Menu Item: "
"Year %04d" % cal_year), inline = True)
Html("a", str(cal_year), href = url, title = "Year %04d" % cal_year, inline = True)
)
# return yearnav to its caller
@ -529,9 +528,7 @@ class WebCalReport(Report):
# An optional link to a home page
navs.append((self.home_link, _('html|Home'), add_home))
navs.extend(
(month, month, True) for month in range(1,13)
)
navs.extend((month, month, True) for month in range(1,13))
# Add a link for year_glance() if requested
navs.append(('fullyearlinked', _('Year Glance'), self.fullyear))
@ -573,7 +570,7 @@ class WebCalReport(Report):
unordered += Html("li", attr = cs, inline = True) + (
# create hyperlink
Html("a", nav_text, href = url, title = _("Main Navigation Menu Item: %s" % url_fname), inline = True)
Html("a", nav_text, href = url, title=url_fname, inline = True)
)
# return monthnav to its caller
@ -730,7 +727,7 @@ class WebCalReport(Report):
bday_anniv_list = self.calendar.get(month, {}).get(thisday.day, [])
# date is an instance because of subtracting abilities in date.py
event_date = gen.lib.Date(thisday.year, thisday.month, thisday.day)
event_date = Date(thisday.year, thisday.month, thisday.day)
# get events for this day
day_list = get_day_list(event_date, holiday_list, bday_anniv_list)
@ -779,8 +776,8 @@ class WebCalReport(Report):
tcell += unordered
for nyears, date, text, event in day_list:
unordered += Html("li", text, inline = False
if event == 'Anniversary' else True)
unordered += Html("li", text, inline = False if event == 'Anniversary'
else True)
# no events for this day
else:
@ -842,12 +839,13 @@ class WebCalReport(Report):
for month in range(1, 13):
# Name the file, and create it
cal_fname = get_full_month_name(month)
of = self.create_file(cal_fname, str(year))
# Add xml, doctype, meta and stylesheets
# body has already been added to webcal already once
webcal, body = self.write_header(nr_up, self.title_text)
webcal, body = self.write_header(nr_up, 'WebCal', self.title_text)
# create Year Navigation menu
if (self.multiyear and ((self.end_year - self.start_year) > 0)):
@ -903,6 +901,7 @@ class WebCalReport(Report):
# generate progress pass for "Year At A Glance"
self.progress.set_pass(_('Creating Year At A Glance calendar'), 12)
# Name the file, and create it
of = self.create_file('fullyearlinked', str(year))
# page title
@ -910,7 +909,7 @@ class WebCalReport(Report):
# Create page header
# body has already been added to yearglance already once
yearglance, body = self.write_header(nr_up, title, "fullyearlinked", False)
yearglance, body = self.write_header(nr_up, 'fullyearlinked', title, False)
# create Year Navigation menu
if (self.multiyear and ((self.end_year - self.start_year) > 0)):
@ -972,13 +971,14 @@ class WebCalReport(Report):
year = event_date.get_year()
month = event_date.get_month()
# Name the file, and crate it (see code in calendar_build)
od = self.create_file(fname_date, str(year))
# page title
title = _('One Day Within A Year')
# create page header
oneday, body = self.write_header(nr_up, title, "OneDay")
oneday, body = self.write_header(nr_up, 'OneDay', title)
# create Year Navigation menu
if (self.multiyear and ((self.end_year - self.start_year) > 0)):
@ -1063,19 +1063,19 @@ class WebCalReport(Report):
married_name = None
names = [primary_name] + person.get_alternate_names()
for name in names:
if int(name.get_type()) == gen.lib.NameType.MARRIED:
if int(name.get_type()) == NameType.MARRIED:
married_name = name
break
# Now, decide which to use:
if maiden_name is not None:
if married_name is not None:
name = gen.lib.Name(married_name)
name = Name(married_name)
else:
name = gen.lib.Name(primary_name)
name = Name(primary_name)
name.set_surname(maiden_name)
else:
name = gen.lib.Name(primary_name)
name = Name(primary_name)
name.set_display_as(self.name_format)
return _nd.display_name(name)
@ -1099,13 +1099,14 @@ class WebCalReport(Report):
family_list = person.get_family_handle_list()
birth_ref = person.get_birth_ref()
birth_date = gen.lib.Date.EMPTY
birth_date = Date.EMPTY
if birth_ref:
birth_event = db.get_event_from_handle(birth_ref.ref)
birth_date = birth_event.get_date_object()
# determine birthday information???
if (self.birthday and birth_date is not gen.lib.Date.EMPTY and birth_date.is_valid()):
if (self.birthday and birth_date is not Date.EMPTY
and birth_date.is_valid()):
year = birth_date.get_year() or this_year
month = birth_date.get_month()
@ -1113,11 +1114,11 @@ class WebCalReport(Report):
# date to figure if someone is still alive
# current year of calendar, month nd day is their birth month and birth day
prob_alive_date = gen.lib.Date(this_year, month, day)
prob_alive_date = Date(this_year, month, day)
# add some things to handle maiden name:
father_surname = None # husband, actually
if person.gender == gen.lib.Person.FEMALE:
if person.gender == Person.FEMALE:
# get husband's last name:
if self.maiden_name in ['spouse_first', 'spouse_last']:
@ -1133,8 +1134,7 @@ class WebCalReport(Report):
if father_handle:
father = db.get_person_from_handle(father_handle)
if father is not None:
father_surname = _get_regular_surname(person.gender,
father.get_primary_name())
father_surname = _get_regular_surname(person.gender, father.primary_name)
short_name = self.get_name(person, father_surname)
alive = probably_alive(person, db, prob_alive_date)
if (self.alive and alive) or not self.alive:
@ -1168,13 +1168,13 @@ class WebCalReport(Report):
marriage_event = get_marriage_event(db, fam)
if marriage_event:
event_date = marriage_event.get_date_object()
if event_date is not gen.lib.Date.EMPTY and event_date.is_valid():
if event_date is not Date.EMPTY and event_date.is_valid():
year = event_date.get_year()
month = event_date.get_month()
day = event_date.get_day()
# date to figure if someone is still alive
prob_alive_date = gen.lib.Date(this_year, month, day)
prob_alive_date = Date(this_year, month, day)
if self.link_to_narweb:
spouse_name = Html("a", spouse_name,
@ -1209,8 +1209,7 @@ class WebCalReport(Report):
# Display date as user set in preferences
msg = _('Generated by <a href="http://gramps-project.org">'
'Gramps</a> on %(date)s') % {'date' : _dd.display(
gen.lib.date.Today())}
'Gramps</a> on %(date)s') % {'date' : _dd.display(date.Today())}
footer += Html("p", msg, id = 'createdate')
copy_nr = self.copy
@ -1385,7 +1384,7 @@ class WebCalOptions(MenuReportOptions):
css = EnumeratedListOption(_('StyleSheet'), CSS_FILES[0][1])
for style in CSS_FILES:
css.add_item(style[1], style[0])
css.set_help( _('The stylesheet to be used for the web pages'))
css.set_help( _('The Style Sheet to be used for the web page'))
menu.add_option(category_name, "css", css)
def __add_content_options(self, menu):
@ -1395,7 +1394,7 @@ class WebCalOptions(MenuReportOptions):
category_name = _("Content Options")
# set to today's date for use in menu, etc.
today = gen.lib.date.Today()
today = date.Today()
self.__multiyear = BooleanOption(_('Create multiple year calendars'), False)
self.__multiyear.set_help(_('Whether to create Multiple year calendars or not.'))
@ -1609,7 +1608,7 @@ def _get_regular_surname(sex, name):
prefix = name.get_surname_prefix()
if prefix:
surname = prefix + " " + surname
if sex is not gen.lib.Person.FEMALE:
if sex is not Person.FEMALE:
suffix = name.get_suffix()
if suffix:
surname = surname + ", " + suffix
@ -1701,7 +1700,7 @@ def get_day_list(event_date, holiday_list, bday_anniv_list):
# birthday/ anniversary on this day
# Date.EMPTY signifies an incomplete date for an event. See add_day_item()
bday_anniv_list = [(t, e, d) for t, e, d in bday_anniv_list
if d != gen.lib.Date.EMPTY]
if d != Date.EMPTY]
# number of years have to be at least zero
bday_anniv_list = [(t, e, d) for t, e, d in bday_anniv_list