From 41b9c54f0ad1646231a952573e4f54abceac16f6 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 14 Jul 2005 04:21:57 +0000 Subject: [PATCH] * src/data/main*.css: added stylesheets for web page generator * src/data/Makefile.am: add stylesheets svn: r4928 --- gramps2/ChangeLog | 4 +- gramps2/src/data/Makefile.am | 7 +- gramps2/src/data/main1.css | 224 +++++++++++++++++++++++++++++ gramps2/src/data/main2.css | 211 +++++++++++++++++++++++++++ gramps2/src/data/main3.css | 210 +++++++++++++++++++++++++++ gramps2/src/data/main4.css | 230 +++++++++++++++++++++++++++++ gramps2/src/data/main5.css | 231 ++++++++++++++++++++++++++++++ gramps2/src/plugins/NavWebPage.py | 187 ++++++++++++------------ 8 files changed, 1213 insertions(+), 91 deletions(-) create mode 100755 gramps2/src/data/main1.css create mode 100755 gramps2/src/data/main2.css create mode 100755 gramps2/src/data/main3.css create mode 100755 gramps2/src/data/main4.css create mode 100755 gramps2/src/data/main5.css diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 2bb990cfd..2002c169a 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -2,7 +2,9 @@ * src/Sort.py: don't use upper case, let locale.strcoll figure this out (correctly) for us * src/plugins/NavWebPage.py: fix sorting. - + * src/data/main*.css: added stylesheets for web page generator + * src/data/Makefile.am: add stylesheets + 2005-07-13 Alex Roitman * src/GenericFilter.py: Proper test for place in event-based filters; (Rule.set_list): Add assertion to have the correct number diff --git a/gramps2/src/data/Makefile.am b/gramps2/src/data/Makefile.am index d91d4c0e2..3d3b2e0cd 100644 --- a/gramps2/src/data/Makefile.am +++ b/gramps2/src/data/Makefile.am @@ -21,7 +21,12 @@ EXTRA_DIST = \ gramps.applications \ gramps.keys \ gramps.mime \ - gramps.schemas + gramps.schemas \ + main1.css\ + main2.css\ + main3.css\ + main4.css\ + main5.css # Conditionally enable/disable gconf schemas or mime types, # or disable both in a packager mode diff --git a/gramps2/src/data/main1.css b/gramps2/src/data/main1.css new file mode 100755 index 000000000..e702348e8 --- /dev/null +++ b/gramps2/src/data/main1.css @@ -0,0 +1,224 @@ + +/* GRAMPS Cascading Style Sheet */ + +/* Standard Tags {{{1 + */ +BODY { + font-family: "Arial", "Helvetica", sans-serif; + background-color: #ffffff; + +} + +P,BLOCKQUOTE { + font-size: 14px; +} + +DIV { + margin: 2px; + padding: 2px; +} + +TD { + vertical-align: top; +} + +H1 { + font-family: "Verdana", "Bistream Vera Sans", "Arial", "Helvetica", sans-serif; + font-weight: bolder; + font-size: 160%; + margin: 2px; +} +H2 { + font-family: "Verdana", "Bistream Vera Sans", "Arial", "Helvetica", sans-serif; + font-weight: bolder; + font-style: italic; + font-size: 150%; +} +H3 { + font-weight: bold; + margin: 0; + padding-top: 10px; + padding-bottom: 10px; + +} +H4 { + margin-top: 1em; + margin-bottom: 0.3em; + padding-left: 4px; + + +} +H5 { + margin-bottom: 0.5em; +} +H6 { + font-weight: normal; + font-style: italic; + font-size: 100%; + margin-left: 1em; + margin-top: 1.3em; + margin-bottom: 0.8em; +} + +HR { + height: 1px; + width: 100%; + margin: 0; + margin-top: 1px; + margin-bottom: 0; + padding: 0; + border-top: 0; /* Hack: Mozilla work-around to eliminate "groove" */ + border-color: #000; +} + +A:link { + color: #000; + text-decoration: underline; +} +A:visited { + color: #333; + text-decoration: underline; +} +A:hover { + background-color: #eee; + color: #000; + text-decoration: underline; +} +A:active { + background-color: #eee; + color: #000; + text-decoration: none; +} + +/* Custom {{{1 + */ + +.navheader { + padding: 2px; + + margin: 2px; +} +.navtitle { + font-size: 130%; + color: #999; + margin: 3px; + + + +} +.navbyline { + float: right; + font-size: 14px; + margin: 2px; + padding: 2px; + padding-right: 10px; + +} +.nav { + margin: 0; + margin-bottom: 4px; + padding: 1px; + font-size: 12px; + font-weight: bold; + + + +} + + +.summaryarea { + min-height: 100px; + /* Hack: IE Dynamic Expression to set the width */ + height: expression(document.body.clientHeight < 1 ? "100px" : "100px" ); +} + +.portrait { + justify: center; + margin: 5px; + margin-right: 20px; + padding: 3px; + border-color: #000; + border-width: 1px; +} +.snapshot { + float: right; + margin: 5px; + margin-right: 20px; + padding: 3px; +} +.thumbnail { + height: 100px; + border-color: #000; + border-width: 1px; +} + +.leftwrap { + float: left; + margin: 2px; + margin-right: 10px; +} +.rightwrap { + float: right; + margin: 2px; + margin-left: 10px; +} + +TABLE.infolist { + border: 0; + /*width: 100%;*/ + font-size: 14px; + + +} +TD.category { + + padding: 1px; /* Defines spacing between rows */ + padding-right: 3em; + + /*width: 10%;*/ + font-weight: bold; +} +TD.field { + + padding: 1px; /* Defines spacing between rows */ + padding-right: 3em; + /*width: 15%;*/ + +} +TD.data { + + padding: 1px; /* Defines spacing between rows */ + padding-right: 3em; + + + font-weight: bold; + +} + + +.pedigree { + margin: 0; + margin-left: 2em; + padding: 0; + background-color: #eeeeee; + border: 1px; +} +.pedigreeind { + font-size: 14px; + margin: 0; + padding: 2em; + padding-top: 0.25em; + padding-bottom: 0.5em; +} + + +.footer { + margin: 1em; + font-size: 12px; + float: right; +} + + +/* 1}}} + vim:foldmethod=marker +/* diff --git a/gramps2/src/data/main2.css b/gramps2/src/data/main2.css new file mode 100755 index 000000000..65ecab69b --- /dev/null +++ b/gramps2/src/data/main2.css @@ -0,0 +1,211 @@ + +/* GRAMPS Cascading Style Sheet */ + +/* Standard Tags {{{1 + */ +BODY { + font-family: "Arial", "Helvetica", sans-serif; + background-color: #fafaff; + color: #003; +} + +P,BLOCKQUOTE { + font-size: 14px; +} + +DIV { + margin: 2px; + padding: 2px; +} + +TD { + vertical-align: top; +} + +H1 { + font-family: "Verdana", "Bistream Vera Sans", "Arial", "Helvetica", sans-serif; + font-weight: bolder; + font-size: 160%; + margin: 2px; +} +H2 { + font-family: "Verdana", "Bistream Vera Sans", "Arial", "Helvetica", sans-serif; + font-weight: bolder; + font-style: italic; + font-size: 150%; +} +H3 { + font-weight: bold; + margin: 0; + padding-top: 10px; + padding-bottom: 10px; + color: #336; +} +H4 { + margin-top: 1em; + margin-bottom: 0.3em; + padding-left: 4px; + background-color: #667; + color: #fff; +} +H5 { + margin-bottom: 0.5em; +} +H6 { + font-weight: normal; + font-style: italic; + font-size: 100%; + margin-left: 1em; + margin-top: 1.3em; + margin-bottom: 0.8em; +} + +HR { + height: 0; + width: 0; + margin: 0; + margin-top: 1px; + margin-bottom: 1px; + padding: 0; + border-top: 0; /* Hack: Mozilla work-around to eliminate "groove" */ + border-color: #e0e0e9; +} + +A:link { + color: #006; + text-decoration: underline; +} +A:visited { + color: #669; + text-decoration: underline; +} +A:hover { + background-color: #eef; + color: #000; + text-decoration: underline; +} +A:active { + background-color: #eef; + color: #000; + text-decoration: none; +} + +/* Custom {{{1 + */ + +.navheader { + padding: 4px; + background-color: #e0e0e9; + margin: 2px; +} +.navtitle { + font-size: 160%; + color: #669; + margin: 2px; + +} +.navbyline { + float: right; + font-size: 14px; + margin: 2px; + padding: 4px; +} +.nav { + margin: 0; + margin-bottom: 4px; + padding: 0; + font-size: 14px; + font-weight: bold; + + + +} + + +.summaryarea { + min-height: 100px; + /* Hack: IE Dynamic Expression to set the width */ + height: expression(document.body.clientHeight < 1 ? "100px" : "100px" ); +} + +.portrait { + justify: center; + margin: 5px; + margin-right: 20px; + padding: 3px; + border-color: #336; + border-width: 1px; +} +.snapshot { + float: right; + margin: 5px; + margin-right: 20px; + padding: 3px; +} +.thumbnail { + height: 100px; + border-color: #336; + border-width: 1px; +} + +.leftwrap { + float: left; + margin: 2px; + margin-right: 10px; +} +.rightwrap { + float: right; + margin: 2px; + margin-left: 10px; +} + +TABLE.infolist { + border: 0; + /*width: 100%;*/ + font-size: 14px; +} +TD.category { + padding: 3px; /* Defines spacing between rows */ + padding-right: 3em; + /*width: 10%;*/ + font-weight: bold; +} +TD.field { + padding: 3px; /* Defines spacing between rows */ + padding-right: 3em; + /*width: 15%;*/ + +} +TD.data { + padding: 3px; /* Defines spacing between rows */ + padding-right: 3em; + font-weight: bold; +} + + +.pedigree { + margin: 0; + margin-left: 2em; + padding: 0; + background-color: #e0e0e9; + border: 1px; +} +.pedigreeind { + font-size: 14px; + margin: 0; + padding: 2em; + padding-top: 0.25em; + padding-bottom: 0.5em; +} + + +.footer { + margin: 1em; + font-size: 12px; + float: right; +} + + +/* 1}}} + vim:foldmethod=marker +/* diff --git a/gramps2/src/data/main3.css b/gramps2/src/data/main3.css new file mode 100755 index 000000000..4534bbf76 --- /dev/null +++ b/gramps2/src/data/main3.css @@ -0,0 +1,210 @@ + +/* GRAMPS Cascading Style Sheet */ + +/* Standard Tags {{{1 + */ +BODY { + font-family: "Bitstream Vera Serif", "Times New Roman", "Times", serif; + background-color: #fffffd; + +} + +P,BLOCKQUOTE { + font-size: 14px; +} + +DIV { + margin: 2px; + padding: 2px; +} + +TD { + vertical-align: top; +} + +H1 { + font-weight: bolder; + font-size: 160%; + margin: 2px; +} +H2 { + font-weight: bolder; + font-style: italic; + font-size: 150%; +} +H3 { + font-weight: bold; + margin: 0; + padding-left: 2em; + padding-bottom: 10px; + +} +H4 { + margin-top: 1em; + margin-bottom: 0.3em; + padding-left: 2em; + + +} +H5 { + margin-bottom: 0.5em; +} +H6 { + font-weight: normal; + font-style: italic; + font-size: 100%; + margin-left: 1em; + margin-top: 1.3em; + margin-bottom: 0.8em; +} + +HR { + height: 0; + width: 0; + margin: 0; + margin-top: 1px; + margin-bottom: 1px; + padding: 0; + border-top: 1; /* Hack: Mozilla work-around to eliminate "groove" */ + border-color: #ccf; +} + +A:link { + color: #110; + text-decoration: underline; +} +A:visited { + color: #665; + text-decoration: underline; +} +A:hover { + background-color: #eed; + color: #110; + text-decoration: underline; +} +A:active { + background-color: #eee; + color: #110; + text-decoration: none; +} + +/* Custom {{{1 + */ + +.navheader { + padding: 4px; + + margin: 2px; +} +.navtitle { + font-size: 160%; + color: #998; + margin: 2px; + text-align: center; +} +.navbyline { + float: right; + font-size: 14px; + margin: 2px; + padding: 4px; +} +.nav { + margin: 0; + margin-bottom: 4px; + padding: 0px; + font-size: 14px; + font-weight: bold; + text-align: center; + padding: 4px; + background-color: #ddddcc; +} + + +.summaryarea { + min-height: 100px; + /* Hack: IE Dynamic Expression to set the width */ + height: expression(document.body.clientHeight < 1 ? "100px" : "100px" ); +} + +.portrait { + justify: center; + margin: 5px; + margin-right: 20px; + padding: 3px; + border-color: #110; + border-width: 1px; +} +.snapshot { + float: right; + margin: 5px; + margin-right: 20px; + padding: 3px; +} +.thumbnail { + height: 100px; + border-color: #110; + border-width: 1px; +} + +.leftwrap { + float: left; + margin: 2px; + margin-right: 10px; +} +.rightwrap { + float: right; + margin: 2px; + margin-left: 10px; +} + +TABLE.infolist { + border: 0; + /*width: 100%;*/ + font-size: 14px; +} +TD.category { + padding: 4px; /* Defines spacing between rows */ + padding-right: 3em; + /*width: 10%;*/ + font-weight: bold; +} +TD.field { + padding: 4px; /* Defines spacing between rows */ + padding-right: 3em; + /*width: 20%;*/ + background-color: #f6f6f0; +} +TD.data { + padding: 4px; /* Defines spacing between rows */ + padding-right: 3em; + font-weight: bold; +} + + +.pedigree { + margin: 0; + margin-left: 2em; + padding: 0; + background-color: #f6f6f0; + border: 1px; +} +.pedigreeind { + font-size: 14px; + margin: 0; + padding: 2em; + padding-top: 0.25em; + padding-bottom: 0.5em; +} + + +.footer { + margin: 1em; + margin-left: 2em; + font-size: 12px; + /*float: right;*/ +} + + +/* 1}}} + vim:foldmethod=marker +/* diff --git a/gramps2/src/data/main4.css b/gramps2/src/data/main4.css new file mode 100755 index 000000000..ebb6080f8 --- /dev/null +++ b/gramps2/src/data/main4.css @@ -0,0 +1,230 @@ + +/* GRAMPS Cascading Style Sheet */ + +/* Standard Tags {{{1 + */ +BODY { + font-family: "Times New Roman", "Times", serif; + background-color: #fff; + color: #320; + font-size: 16px; + +} + +P,BLOCKQUOTE { +} + +DIV { + margin: 2px; + padding: 2px; +} + +TD { + vertical-align: top; +} + +H1 { + font-family: "Georgia", "Bistream Vera Sans", "Times New Roman", "Times", serif; + font-weight: bolder; + font-size: 160%; + margin: 2px; +} +H2 { + font-family: "Georgia", "Bistream Vera Sans", "Times New Roman", "Times", serif; + font-weight: bolder; + font-style: italic; + font-size: 150%; +} +H3 { + font-weight: bold; + font-size: 130%; + margin: 0; + margin-top: 8px; + /*padding-left: 2em;*/ + padding-bottom: 10px; + +} +H4 { + margin-top: 1em; + margin-bottom: 0; + padding: 0; + /*padding-left: 2em;*/ + font-size: 110%; + +} +H5 { + margin-bottom: 0.5em; +} +H6 { + font-weight: normal; + font-style: italic; + font-size: 100%; + margin-left: 1em; + margin-top: 1.3em; + margin-bottom: 0.8em; +} + +HR { + height: 6px; + width: 100%; + margin: 0; + color: #a97; + + + + padding: 2px; + /*border-top: 0; |+ Hack: Mozilla work-around to eliminate "groove" +|*/ + border-color: #a97; + background-color: #a97; +} + +A:link { + color: #430; + text-decoration: underline; +} +A:visited { + color: #654; + text-decoration: underline; +} +A:hover { + background-color: #f6f0ee; + color: #210; + text-decoration: underline; +} +A:active { + background-color: #f6f0ee; + color: #210; + text-decoration: none; +} + +/* Custom {{{1 + */ + +.navheader { + padding: 4px; + + margin: 0; + +} +.navtitle { + font-size: 160%; + color: #fff; + margin: 0; + padding: 4px; + padding-left: 10px; + background-color: #542; +} +.navbyline { + float: right; + + margin: 2px; + padding: 4px; + padding-right: 10px; + color: #fff; +} +.nav { + margin: 0; + margin-bottom: 4px; + padding: 1px; + font-size: 14px; + font-weight: bold; + + + +} + + +.summaryarea { + min-height: 100px; + /* Hack: IE Dynamic Expression to set the width */ + height: expression(document.body.clientHeight < 1 ? "100px" : "100px" ); +} + +.portrait { + justify: center; + margin: 5px; + margin-right: 20px; + padding: 3px; + border-color: #986; + border-width: 3px; +} +.snapshot { + float: right; + margin: 5px; + margin-right: 20px; + padding: 3px; +} +.thumbnail { + height: 100px; + border-color: #986; + border-width: 3px; +} + +.leftwrap { + float: left; + margin: 2px; + margin-right: 10px; +} +.rightwrap { + float: right; + margin: 2px; + margin-left: 10px; +} + +TABLE.infolist { + border: 0; + padding; 0; + margin: 0; + margin-left: 2em; + margin-top: 8px; +} +TD.category { + margin: 0; + padding: 4px; /* Defines spacing between rows */ + padding-right: 3em; + /*width: 10%;*/ + font-weight: bold; +} +TD.field { + margin: 0; + padding: 4px; /* Defines spacing between rows */ + padding-right: 3em; + /*width: 20%;*/ + +} +TD.data { + margin: 0; + padding: 4px; /* Defines spacing between rows */ + padding-left: 10px; + padding-right: 3em; + font-weight: bold; + background-color: #f0ece6; +} + + +.pedigree { + margin: 0; + margin-left: 2em; + padding: 0; + background-color: #f0ece6; + border: 1px; +} +.pedigreeind { + + margin: 0; + padding: 2em; + padding-top: 0.25em; + padding-bottom: 0.5em; +} + + +.footer { + margin: 1em; + font-size: 12px; + float: right; +} + + +/* 1}}} + vim:foldmethod=marker +/* diff --git a/gramps2/src/data/main5.css b/gramps2/src/data/main5.css new file mode 100755 index 000000000..cc1c9bc90 --- /dev/null +++ b/gramps2/src/data/main5.css @@ -0,0 +1,231 @@ + +/* GRAMPS Cascading Style Sheet */ + +/* Standard Tags {{{1 + */ +BODY { + font-family: "Bistream Vera Sans", "Arial", "Arial", "Helvetica", sans-serif; + text-align: justify; + background-color: #fff; + color: #010; +} + +P,BLOCKQUOTE { + font-size: 14px; + margin-left: 7em; + margin-right: 7em; +} + +DIV { + margin: 2px; + padding: 2px; +} + +TD { + vertical-align: top; +} + +H1 { + font-family: "Verdana", "Bistream Vera Sans", "Arial", "Helvetica", sans-serif; + font-weight: bolder; + font-size: 160%; + margin: 2px; +} +H2 { + font-family: "Verdana", "Bistream Vera Sans", "Arial", "Helvetica", sans-serif; + font-weight: bolder; + font-style: italic; + font-size: 150%; +} +H3 { + font-weight: bold; + margin: 0; + margin-left: 5em; + margin-right: 5em; + padding-top: 10px; + padding-bottom: 10px; + color: #232; +} +H4 { + margin-top: 2em; + margin-bottom: 0.3em; + padding: 5px; + padding-left: 2em; + background-color: #e0e6e0; + color: #232; +} +H5 { + margin-bottom: 0.5em; +} +H6 { + font-weight: normal; + font-style: italic; + font-size: 100%; + margin-left: 1em; + margin-top: 1.3em; + margin-bottom: 0.8em; +} + +HR { + height: 0; + width: 0; + margin: 0; + margin-top: 1px; + margin-bottom: 1px; + padding: 0; + border-top: 0; /* Hack: Mozilla work-around to eliminate "groove" */ + border-color: #e0e6e0; +} + +A:link { + color: #252; + text-decoration: underline; +} +A:visited { + color: #565; + text-decoration: underline; +} +A:hover { + background-color: #eaf0ea; + color: #000; + text-decoration: underline; +} +A:active { + background-color: #eaf0ea; + color: #000; + text-decoration: none; +} + +/* Custom {{{1 + */ + +.navheader { + padding: 4px; + background-color: #e0e6e0; + margin: 2px; +} +.navtitle { + font-size: 160%; + color: #e0e6e0; + margin: 2px; + background-color: #454; + padding: 4px; + padding-left: 3.5em; + +} +.navbyline { + float: right; + font-size: 14px; + margin: 2px; + padding: 0; + padding-top: 1em; + padding-right: 7em; + color: #e0e6e0; +} +.nav { + margin: 0; + margin-bottom: 4px; + padding: 0; + padding-left: 6.5em; + font-size: 14px; + font-weight: bold; + + + +} + + +.summaryarea { + min-height: 100px; + /* Hack: IE Dynamic Expression to set the width */ + height: expression(document.body.clientHeight < 1 ? "100px" : "100px" ); +} + +.portrait { + justify: center; + margin: 5px; + margin-right: 20px; + padding: 3px; + border-color: #363; + border-width: 1px; +} +.snapshot { + float: right; + margin: 5px; + + padding: 3px; + padding-right: 6em; + +} +.thumbnail { + height: 100px; + border-color: #363; + border-width: 1px; +} + +.leftwrap { + float: left; + margin: 5px; + margin-right: 1em; + margin-left: 6em; +} +.rightwrap { + float: right; + margin: 5px; + margin-left: 1em; + margin-right: 6em; +} + +TABLE.infolist { + border: 0; + /*width: 100%;*/ + font-size: 14px; + margin-left: 7em; + margin-right: 7em; +} +TD.category { + padding: 3px; /* Defines spacing between rows */ + padding-right: 3em; + /*width: 10%;*/ + font-weight: bold; +} +TD.field { + padding: 3px; /* Defines spacing between rows */ + padding-right: 3em; + /*width: 15%;*/ + +} +TD.data { + padding: 3px; /* Defines spacing between rows */ + padding-right: 3em; + font-weight: bold; +} + + +.pedigree { + margin: 0; + margin-left: 7em; + padding: 0; + background-color: #e0e6e0; + border: 1px; +} +.pedigreeind { + font-size: 14px; + margin: 0; + padding: 2em; + padding-top: 0.25em; + padding-bottom: 0.5em; +} + + +.footer { + margin: 1em; + font-size: 12px; + text-align: center; +} + + +/* 1}}} + vim:foldmethod=marker +/* + diff --git a/gramps2/src/plugins/NavWebPage.py b/gramps2/src/plugins/NavWebPage.py index 2937891b9..e8fcd0cb7 100644 --- a/gramps2/src/plugins/NavWebPage.py +++ b/gramps2/src/plugins/NavWebPage.py @@ -32,7 +32,9 @@ import time import locale import shutil import codecs +import sets from gettext import gettext as _ +from cStringIO import StringIO #------------------------------------------------------------------------ # @@ -46,7 +48,6 @@ import gtk # GRAMPS module # #------------------------------------------------------------------------ -import os import RelLib import const import GrampsKeys @@ -55,17 +56,29 @@ import Sort import Report import Errors import Utils -from QuestionDialog import ErrorDialog import ReportOptions import BaseDoc +import ReportUtils +from QuestionDialog import ErrorDialog from NameDisplay import displayer as _nd from DateHandler import displayer as _dd -import ReportUtils -import sets +#------------------------------------------------------------------------ +# +# constants +# +#------------------------------------------------------------------------ _NARRATIVE = "narrative.css" _NAME_COL = 3 +_css_files = [ + [_("Style 1"), 'main1.css'], + [_("Style 2"), 'main2.css'], + [_("Style 3"), 'main3.css'], + [_("Style 4"), 'main4.css'], + [_("Style 5"), 'main5.css'], + ] + _character_sets = [ [_('Unicode (recommended)'), 'utf-8'], ['ISO-8859-1', 'iso-8859-1' ], @@ -84,74 +97,9 @@ _character_sets = [ ['koi8_r', 'koi8_r', ], ] - -_css = [ - 'BODY {\nfont-family: "Arial", "Helvetica", sans-serif;', - 'background-color: #fafaff;', - 'color: #003;\n}', - 'P,BLOCKQUOTE {\nfont-size: 14px;\n}', - 'DIV {\nmargin: 2px;\npadding: 2px;\n}', - 'TD {\nvertical-align: top;\n}', - 'H1 {', - 'font-family: "Verdana", "Bistream Vera Sans", "Arial", "Helvetica", sans-serif;', - 'font-weight: bolder;\nfont-size: 160%;\nmargin: 2px;\n}\n', - 'H2 {', - 'font-family: "Verdana", "Bistream Vera Sans", "Arial", "Helvetica", sans-serif;', - 'font-weight: bolder;\nfont-style: italic;\nfont-size: 150%;\n}', - 'H3 {\nfont-weight: bold;\nmargin: 0;\npadding-top: 10px;', - 'padding-bottom: 10px;\ncolor: #336;\n}', - 'H4 {\nmargin-top: 1em;\nmargin-bottom: 0.3em;', - 'padding-left: 4px;\nbackground-color: #667;\ncolor: #fff;\n}', - 'H5 {\nmargin-bottom: 0.5em;\n}', - 'H6 {\nfont-weight: normal;\nfont-style: italic;', - 'font-size: 100%;\nmargin-left: 1em;\nmargin-top: 1.3em;', - 'margin-bottom: 0.8em;\n}', - 'HR {\nheight: 0;\nwidth: 0;\nmargin: 0;\nmargin-top: 1px;', - 'margin-bottom: 1px;\npadding: 0;\nborder-top: 0;', - 'border-color: #e0e0e9;\n}', - 'A:link {\ncolor: #006;\ntext-decoration: underline;\n}', - 'A:visited {\ncolor: #669;\ntext-decoration: underline;\n}', - 'A:hover {\nbackground-color: #eef;\ncolor: #000;', - 'text-decoration: underline;\n}', - 'A:active {\nbackground-color: #eef;\ncolor: #000;\ntext-decoration: none;\n}', - '.navheader {\npadding: 4px;\nbackground-color: #e0e0e9;', - 'margin: 2px;\n}', - '.navtitle {\nfont-size: 160%;\ncolor: #669;\nmargin: 2px;\n}', - '.navbyline {\nfloat: right;\nfont-size: 14px;\nmargin: 2px;', - 'padding: 4px;\n}', - '.nav {\nmargin: 0;\nmargin-bottom: 4px;\npadding: 0;', - 'font-size: 14px;\nfont-weight: bold;\n}', - '.summaryarea {', - 'min-height: 100px;', - 'height: expression(document.body.clientHeight < 1 ? "100px" : "100px" );', - '}', - '.portrait {\njustify: center;\nmargin: 5px;\nmargin-right: 20px;', - 'padding: 3px;\nborder-color: #336;\nborder-width: 1px;\n}', - '.snapshot {\nfloat: right;\nmargin: 5px;\nmargin-right: 20px;', - 'padding: 3px;\n}', - '.thumbnail {\nheight: 100px;\nborder-color: #336;\nborder-width: 1px;\n}', - '.leftwrap {\nfloat: left;\nmargin: 2px;\nmargin-right: 10px;\n}', - '.rightwrap {\nfloat: right;\nmargin: 2px;\nmargin-left: 10px;\n}', - 'TABLE.infolist {\nborder: 0;\nfont-size: 14px;\n}', - 'TD.category {\npadding: 3px;\npadding-right: 3em;', - 'font-weight: bold;\n}', - 'TD.field {\npadding: 3px;\npadding-right: 3em;\n}', - 'TD.data {\npadding: 3px;\npadding-right: 3em;', - 'font-weight: bold;\n}', - '.pedigree {\nmargin: 0;\nmargin-left: 2em;\npadding: 0;', - 'background-color: #e0e0e9;\nborder: 1px;\n}', - '.pedigreeind {\nfont-size: 14px;\nmargin: 0;\npadding: 2em;', - 'padding-top: 0.25em;\npadding-bottom: 0.5em;\n}', - '.footer {\nmargin: 1em;\nfont-size: 12px;\nfloat: right;\n}', - ] - - -from cStringIO import StringIO - class BasePage: def __init__(self, title, options, archive): self.title_str = title - self.inc_contact = options.handler.options_dict['NWEBcontact'] self.inc_download = options.handler.options_dict['NWEBdownload'] self.html_dir = options.handler.options_dict['NWEBod'] self.options = options @@ -159,8 +107,10 @@ class BasePage: self.image_dir = options.handler.options_dict['NWEBimagedir'].strip() self.ext = options.handler.options_dict['NWEBext'] self.encoding = options.handler.options_dict['NWEBencoding'] + self.css = options.handler.options_dict['NWEBcss'] self.noid = options.handler.options_dict['NWEBnoid'] self.use_intro = options.handler.options_dict['NWEBintronote'] != u"" + self.use_contact = options.handler.options_dict['NWEBcontact'] != u"" def copy_media(self,photo): newpath = photo.gramps_id + os.path.splitext(photo.get_path())[1] @@ -243,7 +193,7 @@ class BasePage: of.write(u' %s  \n' % (self.ext,_('Places'))) if self.inc_download: of.write(u' %s  \n' % (self.ext,_('Download'))) - if self.inc_contact: + if self.use_contact: of.write(u' %s  \n' % (self.ext,_('Contact'))) of.write(u' \n') of.write(u' \n') @@ -263,9 +213,8 @@ class IndividualListPage(BasePage): db.get_researcher().get_name()) msg = _("This page contains an index of all the individuals in the " - "database, sorted by their last names. Selecting the GRAMPS " - "ID next to a person's name will take you to that person's " - "individual page.") + "database, sorted by their last names. Selecting person's name " + "will take you to that person's individual page.") of.write(u'

%s

\n' % _('Individuals')) of.write(u'

%s

\n' % msg) @@ -650,8 +599,49 @@ class ContactPage(BasePage): self.display_header(of,_('Contact'), db.get_researcher().get_name()) + of.write(u'
\n') of.write(u'

%s

\n' % _('Contact')) + note_id = options.handler.options_dict['NWEBcontact'] + obj = db.get_object_from_handle(note_id) + mime_type = obj.get_mime_type() + + if mime_type and mime_type.startswith("image"): + try: + newpath = self.copy_media(obj) + of.write(u'
\n') + of.write(u'') + of.write(u'
') + of.write(u'' % newpath) + of.write(u'
\n') + of.write(u'
\n') + except (IOError,OSError),msg: + ErrorDialog(str(msg)) + + r = db.get_researcher() + + of.write(u'
\n') + of.write(u'%s
\n' % r.name) + of.write(u'%s
\n' % r.addr) + of.write(u'%s, %s, %s
\n' % (r.city,r.state,r.postal)) + of.write(u'%s
\n' % r.country) + of.write(u'%s
\n' % r.email) + of.write(u'
\n') + + nobj = obj.get_note_object() + if nobj: + format = nobj.get_format() + text = nobj.get() + + if format: + text = u"
" + u"
".join(text.split("\n")) + else: + text = u"

".join(text.split("\n")) + of.write(u'

%s

\n' % text) + else: + of.write(u'



\n') + self.display_footer(of) self.close_file(of) @@ -1077,6 +1067,7 @@ class WebReport(Report.Report): self.target_path = options_class.handler.options_dict['NWEBod'] self.ext = options_class.handler.options_dict['NWEBext'] self.encoding = options_class.handler.options_dict['NWEBencoding'] + self.css = options_class.handler.options_dict['NWEBcss'] self.id_link = options_class.handler.options_dict['NWEBlinktidx'] self.photos = options_class.handler.options_dict['NWEBimg'] self.restrict = options_class.handler.options_dict['NWEBrestrictinfo'] @@ -1151,7 +1142,7 @@ class WebReport(Report.Report): else: archive = None - self.write_css(archive) + self.write_css(archive,self.target_path,self.css) HomePage(self.database, self.title, self.options_class, archive) if self.inc_contact: @@ -1199,16 +1190,14 @@ class WebReport(Report.Report): archive.close() self.progress_bar_done() - def write_css(self,archive): + def write_css(self,archive,html_dir,css_file): if archive: - f = StringIO() - f.write('\n'.join(_css)) + f = open(os.path.join(const.dataDir,css_file),"r") archive.add_file(_NARRATIVE,time.time(),f) f.close() else: - f = open(os.path.join(self.target_path,_NARRATIVE), "w") - f.write('\n'.join(_css)) - f.close() + shutil.copyfile(os.path.join(const.dataDir,css_file), + os.path.join(html_dir,_NARRATIVE)) def add_styles(self,doc): pass @@ -1240,7 +1229,7 @@ class WebReportOptions(ReportOptions.ReportOptions): 'NWEBcmtxtsi' : 0, 'NWEBlnktoalphabet' : 0, 'NWEBsplita' : 0, - 'NWEBcontact' : 0, + 'NWEBcontact' : '', 'NWEBdownload' : 0, 'NWEBshorttree' : 1, 'NWEBimagedir' : 'images', @@ -1250,6 +1239,7 @@ class WebReportOptions(ReportOptions.ReportOptions): 'NWEBlinktidx' : 1, 'NWEBext' : 'html', 'NWEBencoding' : 'utf-8', + 'NWEBcss' : 'main0.css', 'NWEBtreed' : 3, 'NWEBidxt' : '', 'NWEBintronote' : '', @@ -1310,7 +1300,7 @@ class WebReportOptions(ReportOptions.ReportOptions): ext_msg = _("File extension") sep_alpha_msg = _("Split alphabetical sections to separate pages") tree_msg = _("Include short ancestor tree") - contact_msg = _("Include publisher contact page") + contact_msg = _("Publisher contact/Note ID") download_msg = _("Include download page") self.no_private = gtk.CheckButton(priv_msg) @@ -1322,9 +1312,6 @@ class WebReportOptions(ReportOptions.ReportOptions): self.restrict_living = gtk.CheckButton(restrict_msg) self.restrict_living.set_active(self.options_dict['NWEBrestrictinfo']) - self.inc_contact = gtk.CheckButton(contact_msg) - self.inc_contact.set_active(self.options_dict['NWEBcontact']) - self.inc_download = gtk.CheckButton(download_msg) self.inc_download.set_active(self.options_dict['NWEBdownload']) @@ -1375,10 +1362,21 @@ class WebReportOptions(ReportOptions.ReportOptions): store.append(row=data) self.encoding = GrampsNoteComboBox(store,cset_node) + cset_node = None + cset = self.options_dict['NWEBcss'] + store = gtk.ListStore(str,str) + for data in _css_files: + if data[1] == cset: + cset_node = store.append(row=data) + else: + store.append(row=data) + self.css = GrampsNoteComboBox(store,cset_node) + dialog.add_option(title_msg,self.title) dialog.add_option(imgdir_msg,self.imgdir) dialog.add_option(ext_msg,self.ext) dialog.add_option(_('Character set encoding'),self.encoding) + dialog.add_option(_('Stylesheet'),self.css) title = _("Page Generation") @@ -1414,11 +1412,22 @@ class WebReportOptions(ReportOptions.ReportOptions): store.append(row=data) self.intro_note = GrampsNoteComboBox(store,intro_node) + contact_node = None + self.inc_contact = self.options_dict['NWEBcontact'] + + store = gtk.ListStore(str,str) + for data in media_list: + if data[1] == self.inc_contact: + intro_node = store.append(row=data) + else: + store.append(row=data) + self.contact = GrampsNoteComboBox(store,intro_node) + dialog.add_frame_option(title,_('Home Media/Note ID'), self.home_note) dialog.add_frame_option(title,_('Introduction Media/Note ID'), self.intro_note) - dialog.add_frame_option(title,None,self.inc_contact) + dialog.add_frame_option(title,contact_msg,self.contact) dialog.add_frame_option(title,None,self.inc_download) dialog.add_frame_option(title,None,self.noid) @@ -1437,7 +1446,7 @@ class WebReportOptions(ReportOptions.ReportOptions): self.options_dict['NWEBrestrictinfo'] = int(self.restrict_living.get_active()) self.options_dict['NWEBincpriv'] = int(not self.no_private.get_active()) self.options_dict['NWEBnoid'] = int(self.noid.get_active()) - self.options_dict['NWEBcontact'] = int(self.inc_contact.get_active()) + self.options_dict['NWEBcontact'] = unicode(self.contact.get_handle()) self.options_dict['NWEBdownload'] = int(self.inc_download.get_active()) self.options_dict['NWEBimagedir'] = unicode(self.imgdir.get_text()) self.options_dict['NWEBtitle'] = unicode(self.title.get_text()) @@ -1454,10 +1463,10 @@ class WebReportOptions(ReportOptions.ReportOptions): self.options_dict['NWEBext'] = html_ext self.options_dict['NWEBencoding'] = self.encoding.get_handle() - + self.options_dict['NWEBcss'] = self.css.get_handle() self.options_dict['NWEBidurl'] = unicode(self.linkpath.get_text().strip()) - self.options_dict['NWEBcmtxtsi'] = int(not self.no_comments.get_active()) + if self.no_images.get_active(): photos = 0 elif self.no_living_images.get_active():