From 4730f744ba6b2dbe31a8869dcbd7dcd6235d82ad Mon Sep 17 00:00:00 2001 From: "Rob G. Healey" Date: Thu, 12 Feb 2009 07:56:51 +0000 Subject: [PATCH] Moved CreatorInfo from write_footer() back to write_header(). Removed maximum calendars years, and fixed display_year_nav(). svn: r11972 --- src/plugins/webreport/NarrativeWeb.py | 28 +++--- src/plugins/webreport/WebCal.py | 128 +++++++++++++------------- 2 files changed, 77 insertions(+), 79 deletions(-) diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index 2839179ee..82f6e08d0 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -295,7 +295,7 @@ class BasePage: sorted_first_letter.sort(locale.strcoll) num_ltrs = len(sorted_first_letter) - if num_ltrs <= 25: + if num_ltrs <= 26: of.write('\t\n') else: - nrows = (num_ltrs / 25) + nrows = (num_ltrs / 26) index = 0 for rows in range(0, nrows): of.write('\t\n') - return of def write_footer(self, of): @@ -337,13 +336,6 @@ class BasePage: msg = _('Generated by ' 'GRAMPS on %(date)s') % {'date' : value} - if self.report.options['linkhome']: - home_person = self.report.database.get_default_person() - if home_person: - home_person_url = self.report.build_url_fname_html(home_person.handle, 'ppl', self.up) - home_person_name = home_person.get_primary_name().get_regular_name() - msg += _('
for %s') % (home_person_url, home_person_name) - of.write('\t

%s

\n' % msg) copy_nr = self.report.copyright @@ -417,9 +409,17 @@ class BasePage: header = self.report.options['headernote'] if header: note = self.report.database.get_note_from_gramps_id(header) - of.write('\t

') - of.write(note.get()) - of.write('

\n') + of.write('\t

%s

\n' % note.get()) + + linkhome = self.report.options['linkhome'] + if linkhome: + home_person = self.report.database.get_default_person() + if home_person: + home_person_url = self.report.build_url_fname_html(home_person.handle, 'ppl', self.up) + home_person_name = home_person.get_primary_name().get_regular_name() + msg = _('Created for %s') % (home_person_url, home_person_name) + of.write('\t

%s

\n' % msg) + of.write('\n') # Begin Navigation Menu diff --git a/src/plugins/webreport/WebCal.py b/src/plugins/webreport/WebCal.py index cbb2bfba7..d134fe4f2 100644 --- a/src/plugins/webreport/WebCal.py +++ b/src/plugins/webreport/WebCal.py @@ -431,47 +431,50 @@ class WebCalReport(Report): currentsection = proper styling of this navigation bar """ - of.write('\n') def calendar_common(self, of, nr_up, year, currentsection, title, use_home=False): """ @@ -910,17 +913,11 @@ class WebCalReport(Report): # Copy all files for the calendars being created self.copy_calendar_files() - # create calendars with multiple years up to twenty-five years - # navigation bar length will only support twenty-five years at any given time if self.multiyear: - # Clip to max 25 years - if ((self.end_year - self.start_year + 1) > 25): - self.end_year = self.start_year + 25 - 1 - for cal_year in range(self.start_year, (self.end_year + 1)): # generate progress pass for year ???? - self.progress.set_pass(_('Creating year %d calendars') % cal_year, '') + self.progress.set_pass(_('Creating year %d calendars') % cal_year, 1) # initialize the holidays dict to fill: self.holidays = {} @@ -946,9 +943,6 @@ class WebCalReport(Report): if self.country != 0: self.__get_holidays(cal_year) - # generate progress pass for single year - #self.progress.set_pass(_('Creating calendars'), 12) - # create "WebCal" calendar pages self.web_cal(cal_year) @@ -1482,36 +1476,40 @@ def get_day_list(event_date, holiday_list, bday_anniv_list): # number of years married, ex: 10 nyears = event_date.get_year() - date.get_year() - # number of years for birthday, ex: 10 years - age_str = event_date - date - age_str.format(precision=1) + # no negative years + # years have to be at least zero + if nyears > -1: - # a birthday - if event == 'Birthday': + # number of years for birthday, ex: 10 years + age_str = event_date - date + age_str.format(precision=1) - if nyears == 0: - txt_str = _('%(person)s, birth') % { - 'person' : text} - else: - txt_str = _('%(person)s, %(age)s old') % { - 'person' : text, 'age' : age_str} + # a birthday + if event == 'Birthday': - # an anniversary - elif event == 'Anniversary': + if nyears == 0: + txt_str = _('%(person)s, birth') % { + 'person' : text} + else: + txt_str = _('%(person)s, %(age)s old') % { + 'person' : text, 'age' : age_str} - if nyears == 0: - txt_str = _('%(couple)s, wedding') % { + # an anniversary + elif event == 'Anniversary': + + if nyears == 0: + txt_str = _('%(couple)s, wedding') % { 'couple' : text} - else: - txt_str = (ngettext('%(couple)s, %(years)d' - ' year anniversary', - '%(couple)s, %(years)d' - ' year anniversary', nyears) - % {'couple' : text, 'years' : nyears}) - txt_str = '%s' % txt_str + else: + txt_str = (ngettext('%(couple)s, %(years)d' + ' year anniversary', + '%(couple)s, %(years)d' + ' year anniversary', nyears) + % {'couple' : text, 'years' : nyears}) + txt_str = '%s' % txt_str - if txt_str is not None: - day_list.append((nyears, date, txt_str, event)) + if txt_str is not None: + day_list.append((nyears, date, txt_str, event)) # sort them based on number of years # holidays will always be on top of day