Added Vertical and Horizontal Navigation Menus back into NarrativeWeb. Added State, Country, and Lat & Long to the PlacesListPage.

svn: r14490
This commit is contained in:
Rob G. Healey
2010-02-25 22:28:03 +00:00
parent 5d2c817048
commit d3a1cae6ae
4 changed files with 1654 additions and 133 deletions

View File

@@ -942,8 +942,8 @@ class BasePage(object):
fname = "/".join(["styles", _NARRATIVESCREEN])
url2 = self.report.build_url_fname(fname, None, self.up)
# link to Navigation stylesheet
fname = "/".join(["styles", "Web_Alphabet-Vertical.css"])
# Link to Navigation stylesheet
fname = "/".join(["styles", "Web_Navigation-Menus.css"])
url5 = self.report.build_url_fname(fname, None, self.up)
# Link to _NARRATIVEPRINT stylesheet
@@ -957,9 +957,12 @@ class BasePage(object):
# create stylesheet and favicon links
links = [Html("link", href = url4, type = "image/x-icon", rel = "shortcut icon"),
Html("link", href = url1, type = "text/css", media = "screen", rel = "stylesheet"),
Html("link", href = url2, type = "text/css", media = "screen", rel = "stylesheet"),
Html("link", href = url3, type = "text/css", media = 'print', rel = "stylesheet")
]
Html("link", href = url2, type = "text/css", media = "screen", rel = "stylesheet") ]
if self.report.css in ["Web_Basic-Blue.css", "Web_Visually.css"]:
links += Html("link", href= url5, type= "text/css", media="screen", rel="stylesheet")
links += Html("link", href = url3, type = "text/css", media = 'print', rel = "stylesheet")
# add additional meta and link tags
head += meta
@@ -2140,14 +2143,16 @@ class PlaceListPage(BasePage):
thead = Html("thead")
table += thead
trow = Html("tr") + (
Html("th", _("Letter"), class_ = "ColumnLetter", inline = True),
Html("th", _("Place name | Name"), class_ = "ColumnName", inline = True),
Html("th", _("State"), class_ = "ColumnState", inline = True),
Html("th", _("Country"), class_ = "ColumnCtry", inline = True),
Html("th", _("Latitude/ Longitude"), class_ = "ColumnCoordinates", inline = True)
)
trow = Html("tr")
thead += trow
trow.extend( Html("th", label, class_ = "Column" + colclass, inline = True)
for label, colclass in [
[_("Letter"), "Letter"],
[_("Place Name | Name"), "Name"],
[_("State"), "State"],
[_("Country"), "Country"],
[_("Latitude/ Longitude"), "Coordinates"] ]
)
sort = Sort.Sort(db)
handle_list = sorted(place_handles, key = sort.by_place_title_key)
@@ -2160,12 +2165,9 @@ class PlaceListPage(BasePage):
for handle in handle_list:
place = db.get_place_from_handle(handle)
place_title = ReportUtils.place_name(db, handle)
if not place_title:
continue
ml = place.get_main_location()
letter = first_letter(place_title)
ml = place.get_main_location()
trow = Html("tr")
tbody += trow
@@ -2184,12 +2186,13 @@ class PlaceListPage(BasePage):
trow += Html("td", self.place_link(place.handle, place_title, place.gramps_id),
class_ = "ColumnName")
trow.extend( Html("td", data, class_ = "Column" + colclass, inline = True)
for (colclass, data) in [
["State", ml.state],
["Country", ml.country],
["Coordinates", place.lat + "," + place.long] ]
if data or " " )
trow.extend( Html("td", data, class_ = "Column" + colclass, inline = True)
for colclass, data in [
["State", ml.state],
["Country", ml.country],
["Coordinates", (place.lat + ", " + place.long)] ]
if data or " "
)
# add clearline for proper styling
# add footer section
@@ -4918,6 +4921,7 @@ class NavWebReport(Report):
self.target_path = self.options['target']
self.ext = self.options['ext']
self.css = self.options['css']
self.navigation = self.options["navigation"]
self.title = self.options['title']
self.inc_gallery = self.options['gallery']
@@ -5129,9 +5133,13 @@ class NavWebReport(Report):
fname = os.path.join(const.DATA_DIR, self.css)
self.copy_file(fname, _NARRATIVESCREEN, "styles")
# copy Navigation stylesheet
fname = os.path.join(const.DATA_DIR, "Web_Alphabet-Vertical.css")
self.copy_file(fname, "Web_Alphabet-Vertical.css", "styles")
# copy Navigation Menu Layout if Blue or Visually is being used
if self.css == "Web_Basic-Blue.css" or "Web_Visually.css":
if self.navigation == "Horizontal":
fname = os.path.join(const.DATA_DIR, "Web_Alphabet-Horizontal.css")
else:
fname = os.path.join(const.DATA_DIR, "Web_Alphabet-Vertical.css")
self.copy_file(fname, "Web_Navigation-Menus.css", "styles")
# copy printer stylesheet
fname = os.path.join(const.DATA_DIR, "Web_Print-Default.css")
@@ -5665,11 +5673,24 @@ class NavWebOptions(MenuReportOptions):
cright.set_help( _("The copyright to be used for the web files"))
menu.add_option(category_name, "cright", cright)
css = EnumeratedListOption(_('StyleSheet'), CSS_FILES[0][1])
self.__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 page'))
menu.add_option(category_name, "css", css)
self.__css.add_item(style[1], style[0])
self.__css.set_help( _('The stylesheet to be used for the web pages'))
menu.add_option(category_name, "css", self.__css)
self.__css.connect("value-changed", self.__stylesheet_changed)
_NAVIGATION_OPTS = [
["Horizontal", _("Horizontal -- No Change")],
["Vertical", _("Vertical")]
]
self.__navigation = EnumeratedListOption(_("Navigation Layout"), _NAVIGATION_OPTS[0][1])
for layout in _NAVIGATION_OPTS:
self.__navigation.add_item(layout[1], layout[0])
self.__navigation.set_help(_("Choose which layout for the Navigation Menus."))
menu.add_option(category_name, "navigation", self.__navigation)
self.__stylesheet_changed()
self.__graph = BooleanOption(_("Include ancestor graph"), True)
self.__graph.set_help(_('Whether to include an ancestor graph '
@@ -5919,6 +5940,17 @@ class NavWebOptions(MenuReportOptions):
# The rest don't
self.__pid.set_available(False)
def __stylesheet_changed(self):
"""
Handles the changing nature of the stylesheet
"""
css_opts = self.__css.get_value()
if css_opts in ["Web_Basic-Blue.css", "Web_Visually.css"]:
self.__navigation.set_available(True)
else:
self.__navigation.set_available(False)
def __graph_changed(self):
"""
Handle enabling or disabling the ancestor graph