From ad2ef89450702de4e5eda2cf25dda0244ad772d5 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 4 Aug 2005 04:20:17 +0000 Subject: [PATCH] * src/NavWebPage.py: use new ProgressMeter, add ability to not generate a CSS style sheet. * src/WebPage.py: add deprecation notice svn: r5011 --- gramps2/ChangeLog | 5 +++ gramps2/NEWS | 3 ++ gramps2/src/plugins/NavWebPage.py | 65 ++++++++++++++++--------------- gramps2/src/plugins/WebPage.py | 11 ++++-- 4 files changed, 50 insertions(+), 34 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 4dc113d6f..5d27098a3 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2005-08-03 Don Allingham + * src/NavWebPage.py: use new ProgressMeter, add ability to + not generate a CSS style sheet. + * src/WebPage.py: add deprecation notice + 2005-08-03 Alex Roitman * src/gramps_main.py (undo): Rebuild bookmarks menu on undo. * src/plugins/ChangeNames.py: Add ProgressMeter. diff --git a/gramps2/NEWS b/gramps2/NEWS index d2ea2fdaf..0e85a732c 100644 --- a/gramps2/NEWS +++ b/gramps2/NEWS @@ -1,3 +1,6 @@ +Version 2.0.6 -- the "Just like my dear Papa!" release +* New Narrative Web Page added to create a more complete web site. + Version 2.0.5 -- the "It's certainly uncontaminated by cheese" release * New filters based on personal notes. * New routine for checking and removing corrupted source references in diff --git a/gramps2/src/plugins/NavWebPage.py b/gramps2/src/plugins/NavWebPage.py index b42b27089..972926c0d 100644 --- a/gramps2/src/plugins/NavWebPage.py +++ b/gramps2/src/plugins/NavWebPage.py @@ -76,11 +76,12 @@ _NARRATIVE = "narrative.css" _NAME_COL = 3 _css_files = [ - [_("Modern"), 'main1.css'], - [_("Business"), 'main2.css'], - [_("Certificate"),'main3.css'], - [_("Antique"), 'main4.css'], - [_("Tranquil"), 'main5.css'], + [_("Modern"), 'main1.css'], + [_("Business"), 'main2.css'], + [_("Certificate"), 'main3.css'], + [_("Antique"), 'main4.css'], + [_("Tranquil"), 'main5.css'], + [_("No style sheet"), ''], ] _character_sets = [ @@ -310,8 +311,7 @@ class BasePage: try: (real_path,newpath) = self.copy_media(photo) of.write('
\n') - self.media_link(of,photo_handle,newpath, - photo.get_description(),up=True) + self.media_link(of,photo_handle,newpath,'',up=True) of.write('
\n') except (IOError,OSError),msg: WarningDialog(_("Could not add photo to page"),str(msg)) @@ -1312,7 +1312,8 @@ class IndividualPage(BasePage): def display_ind_general(self,of): self.page_title = self.sort_name - self.display_first_image_as_thumbnail(of, self.db, self.person.get_media_list()) + self.display_first_image_as_thumbnail(of, self.db, + self.person.get_media_list()) of.write('
\n') of.write('

%s

\n' % self.sort_name) @@ -1465,7 +1466,6 @@ class IndividualPage(BasePage): def display_ind_relationships(self,of): family_list = self.person.get_family_handle_list() - if not family_list: return @@ -1697,11 +1697,6 @@ class WebReport(Report.Report): self.use_archive = options.handler.options_dict['NWEBarchive'] self.use_intro = options.handler.options_dict['NWEBintronote'] != u"" - def get_progressbar_data(self): - return (_("Generate HTML reports - GRAMPS"), - '%s' % - _("Creating individual web pages")) - def write_report(self): if not self.use_archive: dir_name = self.target_path @@ -1742,12 +1737,18 @@ class WebReport(Report.Report): image_dir_name) return + progress = Utils.ProgressMeter(_("Generate HTML reports"),'') + ind_list = self.database.get_person_handles(sort_handles=False) + progress.set_pass(_('Filtering'),1) ind_list = self.filter.apply(self.database,ind_list) if not self.exclude_private: new_list = [] + + progress.set_pass(_('Applying privacy filter'),len(ind_list)) for key in ind_list: + progress.step() if not self.database.get_person_from_handle(key).private : new_list.append(key) ind_list = new_list @@ -1756,25 +1757,23 @@ class WebReport(Report.Report): if self.restrict: new_list = [] + progress.set_pass(_('Filtering living people'),len(ind_list)) for key in ind_list: + progress.step() p = self.database.get_person_from_handle(key) if not Utils.probably_alive(p,self.database,years): new_list.append(key) ind_list = new_list - progress_steps = len(ind_list) - if len(ind_list) > 1: - progress_steps = progress_steps+1 - progress_steps = progress_steps+1 - self.progress_bar_setup(float(progress_steps)) - if self.use_archive: import TarFile archive = TarFile.TarFile(self.target_path) else: archive = None - self.write_css(archive,self.target_path,self.css) + if self.css != '': + self.write_css(archive,self.target_path,self.css) + if 1 < self.copyright < 7: from_path = os.path.join(const.dataDir,"somerights20.gif") to_path = os.path.join("images","somerights20.gif") @@ -1802,7 +1801,9 @@ class WebReport(Report.Report): IntroductionPage(self.database, self.title, self.options, archive, photo_list, levels) + progress.set_pass(_('Creating individual pages'),len(ind_list)) for person_handle in ind_list: + progress.step() person = self.database.get_person_from_handle(person_handle) if not self.exclude_private: @@ -1811,7 +1812,6 @@ class WebReport(Report.Report): idoc = IndividualPage(self.database, person, self.title, ind_list, place_list, source_list, self.options, archive, photo_list, levels) - self.progress_bar_step() if len(ind_list) > 1: IndividualListPage(self.database, self.title, ind_list, @@ -1825,33 +1825,33 @@ class WebReport(Report.Report): local_list = sort_people(self.database,ind_list) - self.progress_bar_title(_("Creating surname pages"),len(local_list)) + progress.set_pass(_("Creating surname pages"),len(local_list)) for (surname,handle_list) in local_list: SurnamePage(self.database, surname, handle_list, self.options, archive, photo_list, levels) - self.progress_bar_step() + progress.step() PlaceListPage(self.database, self.title, place_list, source_list,self.options, archive, photo_list, levels) - self.progress_bar_title(_("Creating place pages"),len(place_list)) + progress.set_pass(_("Creating place pages"),len(place_list)) for place in place_list.keys(): PlacePage(self.database, self.title, place, source_list, place_list, self.options, archive, photo_list, levels) - self.progress_bar_step() + progress.step() SourcesPage(self.database,self.title, source_list.keys(), self.options, archive, photo_list, levels) - self.progress_bar_title(_("Creating source pages"),len(source_list)) + progress.set_pass(_("Creating source pages"),len(source_list)) for key in list(source_list): SourcePage(self.database,self.title, key, source_list, self.options, archive, photo_list, levels) - self.progress_bar_step() + progress.step() GalleryPage(self.database, self.title, source_list, self.options, archive, photo_list, levels) @@ -1860,7 +1860,8 @@ class WebReport(Report.Report): total = len(photo_list) index = 1 photo_keys = photo_list.keys() - self.progress_bar_title(_("Creating media pages"),len(photo_keys)) + + progress.set_pass(_("Creating media pages"),len(photo_keys)) for photo_handle in photo_keys: if index == total: @@ -1873,13 +1874,13 @@ class WebReport(Report.Report): (prev, next, index, total), levels) except (IOError,OSError),msg: WarningDialog(_("Missing media object"),str(msg)) - self.progress_bar_step() + progress.step() prev = photo_handle index += 1 if archive: archive.close() - self.progress_bar_done() + progress.close() def write_css(self,archive,html_dir,css_file): if archive: @@ -2422,6 +2423,8 @@ register_report( options_class = cl_report, modes = Report.MODE_GUI | Report.MODE_CLI, translated_name = _("Narrative Web Site"), + author_name="Donald N. Allingham", + author_email="don@gramps-project.org", status=(_("Beta")), description=_("Generates web (HTML) pages for individuals, or a set of individuals."), ) diff --git a/gramps2/src/plugins/WebPage.py b/gramps2/src/plugins/WebPage.py index 68fd1666b..8b698dd04 100644 --- a/gramps2/src/plugins/WebPage.py +++ b/gramps2/src/plugins/WebPage.py @@ -1972,7 +1972,12 @@ register_report( report_class = WebReportDialog, options_class = cl_report, modes = Report.MODE_GUI | Report.MODE_CLI, - translated_name = _("Generate Web Site"), - status=(_("Beta")), - description=_("Generates web (HTML) pages for individuals, or a set of individuals."), + translated_name = _("Generate Web Site (deprecated)"), + author_name="Donald N. Allingham", + author_email="don@gramps-project.org", + status=(_("Deprecated")), + description=_("Generates web (HTML) pages for individuals, " + "or a set of individuals. This report is considered " + "to be deprecated. Please migrate to the new " + "Narrative Web Page generator."), )