From 17141a05368a33d33ba30e9ac3dfd1f734ff3c51 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Sun, 15 Sep 2019 23:17:43 +0200 Subject: [PATCH] Add alternate stylesheets --- gramps/plugins/webreport/webcal.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/gramps/plugins/webreport/webcal.py b/gramps/plugins/webreport/webcal.py index 7b5a703dc..5f94a6230 100644 --- a/gramps/plugins/webreport/webcal.py +++ b/gramps/plugins/webreport/webcal.py @@ -348,6 +348,20 @@ class WebCalReport(Report): """ Copies all the necessary stylesheets and images for these calendars """ + imgs = [] + + # copy all screen style sheet + for css_f in CSS: + already_done = False + for css_fn in ("UsEr_", "Basic", "Mainz", "Nebraska", "Vis"): + if css_fn in css_f and not already_done: + already_done = True + fname = CSS[css_f]["filename"] + # add images for this css + imgs += CSS[css_f]["images"] + css_f = css_f.replace("UsEr_","") + self.copy_file(fname, css_f + ".css", "css") + # Copy the screen stylesheet if self.css and self.css != 'No style sheet': fname = CSS[self.css]["filename"] @@ -364,8 +378,6 @@ class WebCalReport(Report): fname = CSS["Print-Default"]["filename"] self.copy_file(fname, _CALENDARPRINT, "css") - imgs = [] - # Mainz stylesheet graphics # will only be used if Mainz is slected as the stylesheet imgs += CSS[self.css]["images"] @@ -457,7 +469,20 @@ class WebCalReport(Report): links = Html("link", rel='shortcut icon', href=fname1, type="image/x-icon") + ( Html("link", href=fname2, type="text/css", + title=self._("Default"), media="screen", rel="stylesheet", indent=False)) + # create all alternate stylesheets + # Cannot use it on local files (file://) + for css_f in CSS: + already_done = False + for css_fn in ("UsEr_", "Basic", "Mainz", "Nebraska"): + if css_fn in css_f and not already_done: + css_f = css_f.replace("UsEr_","") + fname = "/".join(subdirs + ["css", css_f + ".css"]) + links += Html("link", rel="alternate stylesheet", + title=css_f, indent=False, + media="screen", type="text/css", + href=fname) # add horizontal menu if css == Blue or Visually because # there is no menus?