From 0de286e7a85b6ae2405653dde7582cbecb66df9c Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Sun, 15 Sep 2019 11:54:20 +0200 Subject: [PATCH 1/6] Allow urls for images in user css files --- gramps/plugins/webstuff/webstuff.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/gramps/plugins/webstuff/webstuff.py b/gramps/plugins/webstuff/webstuff.py index 88fbc2ceb..7b7f463ed 100644 --- a/gramps/plugins/webstuff/webstuff.py +++ b/gramps/plugins/webstuff/webstuff.py @@ -23,6 +23,7 @@ # python modules #------------------------------------------------ import os +import re from gramps.gen.const import VERSION_DIR, IMAGE_DIR, DATA_DIR, USER_CSS from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext @@ -171,11 +172,31 @@ def load_on_reg(dbstate, uistate, plugin): if os.path.exists(USER_CSS): list_files = os.listdir(USER_CSS) for cssfile in list_files: - CSS_FILES.append([cssfile, 1, cssfile.replace('.css', ''), - os.path.join(USER_CSS,cssfile), - None, [], [] ]) + if cssfile.endswith(".css"): + CSS_FILES.append([cssfile, 1, cssfile.replace('.css', ''), + os.path.join(USER_CSS,cssfile), None, + looking_for_urls_in_user_css(cssfile), + [] ]) return CSS_FILES +def looking_for_urls_in_user_css(css_file): + """ + """ + images = [] + cssfile = os.path.join(USER_CSS, css_file) + with open(cssfile) as css: + data = css.readlines() + for line in data: + if "url" in line: + url = re.match(r".*url\((.*)\)", line) + if url.group(1)[0:3] != "http": + img = url.group(1).replace("../images/","") + img = os.path.join(USER_CSS, img) + if img not in images: + images.append('%s' % img) + return images + + def process_list(data): """ Gather all of the web resources together, and allow override files From 528852b9b359293a3e1fa71b08e045212f2e080e Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Sun, 15 Sep 2019 21:59:33 +0200 Subject: [PATCH 2/6] Allow alternate stylesheets in pages Useful when you create a site web, you don't need to create a new web when you are testing the stylesheets. The final user can change the stylesheet for the current page. i.e. on Firefox: View -> Page style -> The stylesheet --- gramps/plugins/webreport/basepage.py | 17 ++++++++++++++++- gramps/plugins/webreport/narrativeweb.py | 16 ++++++++++++++-- gramps/plugins/webstuff/webstuff.py | 5 +++-- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/gramps/plugins/webreport/basepage.py b/gramps/plugins/webreport/basepage.py index 3509fbad7..12f384c88 100644 --- a/gramps/plugins/webreport/basepage.py +++ b/gramps/plugins/webreport/basepage.py @@ -1422,8 +1422,23 @@ class BasePage: # pylint: disable=C1001 Html("link", type="text/css", href=url3, media='print', rel="stylesheet", indent=False), Html("link", type="text/css", href=url2, - media="screen", rel="stylesheet", indent=False), + media="screen", title=self._("Default"), + 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(["css", css_f + ".css"]) + urlx = self.report.build_url_fname(fname, None, + self.uplink) + links += Html("link", rel="alternate stylesheet", + title=css_f, indent=False, + media="screen", type="text/css", + href=urlx) # Link to Navigation Menus stylesheet if CSS[self.report.css]["navigation"]: diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py index 682617f09..568eb0916 100644 --- a/gramps/plugins/webreport/narrativeweb.py +++ b/gramps/plugins/webreport/narrativeweb.py @@ -1008,6 +1008,18 @@ class NavWebReport(Report): """ 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 screen style sheet if CSS[self.css]["filename"]: fname = CSS[self.css]["filename"] @@ -1683,13 +1695,13 @@ class NavWebOptions(MenuReportOptions): cright.set_help(_("The copyright to be used for the web files")) addopt("cright", cright) - self.__css = EnumeratedListOption(('StyleSheet'), CSS["default"]["id"]) + self.__css = EnumeratedListOption(('StyleSheet'), CSS["Basic-Ash"]["id"]) for (dummy_fname, gid) in sorted( [(CSS[key]["translation"], CSS[key]["id"]) for key in list(CSS.keys())]): if CSS[gid]["user"]: self.__css.add_item(CSS[gid]["id"], CSS[gid]["translation"]) - self.__css.set_help(_('The stylesheet to be used for the web pages')) + self.__css.set_help(_('The default stylesheet to be used for the pages')) addopt("css", self.__css) self.__css.connect("value-changed", self.__stylesheet_changed) diff --git a/gramps/plugins/webstuff/webstuff.py b/gramps/plugins/webstuff/webstuff.py index 7b7f463ed..194e8de16 100644 --- a/gramps/plugins/webstuff/webstuff.py +++ b/gramps/plugins/webstuff/webstuff.py @@ -58,7 +58,7 @@ def load_on_reg(dbstate, uistate, plugin): # default style sheet in the options # Basic Ash style sheet - ["default", 1, _("Basic-Ash"), + ["Basic-Ash", 1, _("Basic-Ash"), path_css('Web_Basic-Ash.css'), None, [], [] ], # Basic Blue style sheet with navigation menus @@ -173,7 +173,8 @@ def load_on_reg(dbstate, uistate, plugin): list_files = os.listdir(USER_CSS) for cssfile in list_files: if cssfile.endswith(".css"): - CSS_FILES.append([cssfile, 1, cssfile.replace('.css', ''), + css_f = cssfile.replace('.css', '') + CSS_FILES.append(["UsEr_" + css_f, 1, css_f, os.path.join(USER_CSS,cssfile), None, looking_for_urls_in_user_css(cssfile), [] ]) From 17141a05368a33d33ba30e9ac3dfd1f734ff3c51 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Sun, 15 Sep 2019 23:17:43 +0200 Subject: [PATCH 3/6] 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? From 03fb2ff1c2d51fb4c48cda82417090c2910a0334 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Mon, 16 Sep 2019 19:58:38 +0200 Subject: [PATCH 4/6] Incorrect results when divorce event --- gramps/plugins/webreport/webcal.py | 47 ++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/gramps/plugins/webreport/webcal.py b/gramps/plugins/webreport/webcal.py index 5f94a6230..0328cd8dc 100644 --- a/gramps/plugins/webreport/webcal.py +++ b/gramps/plugins/webreport/webcal.py @@ -359,7 +359,7 @@ class WebCalReport(Report): fname = CSS[css_f]["filename"] # add images for this css imgs += CSS[css_f]["images"] - css_f = css_f.replace("UsEr_","") + css_f = css_f.replace("UsEr_", "") self.copy_file(fname, css_f + ".css", "css") # Copy the screen stylesheet @@ -477,7 +477,7 @@ class WebCalReport(Report): 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_","") + css_f = css_f.replace("UsEr_", "") fname = "/".join(subdirs + ["css", css_f + ".css"]) links += Html("link", rel="alternate stylesheet", title=css_f, indent=False, @@ -1415,9 +1415,6 @@ class WebCalReport(Report): text = short_name self.add_day_item(text, year, month, day, 'Death', age_at_death, death_date) - #print('Death date for %s %s/%s/%s' % (short_name, day, - # month, year), - # age_at_death) # add anniversary if requested if self.anniv: @@ -1428,8 +1425,7 @@ class WebCalReport(Report): if father_handle == person.handle: spouse_handle = mother_handle else: - continue # with next person if this was - # the marriage event + spouse_handle = father_handle if spouse_handle: spouse = db.get_person_from_handle(spouse_handle) if spouse: @@ -1473,6 +1469,18 @@ class WebCalReport(Report): wedding_age = first_died - event_date wedding_age = wedding_age.format( dlocale=self.rlocale) + divorce_event = get_divorce_event(db, fam) + if divorce_event: + d_date = divorce_event.get_date_object() + if (d_date is not Date() and + d_date.is_valid()): + d_date = gregorian(d_date) + if d_date != Date(): + w_age = d_date - event_date + w_age = w_age.format( + dlocale=self.rlocale) + wedding_age = w_age + first_died = d_date if self.link_to_narweb: prefx = self.narweb_prefix @@ -1492,8 +1500,8 @@ class WebCalReport(Report): prob_alive_date) if first_died == Date(): first_died = Date(0, 0, 0) - if ((self.alive and alive1 - and alive2) or not self.alive): + if ((self.alive and (alive1 or alive2)) + or not self.alive): spse = self._('%(spouse)s and' ' %(person)s') @@ -2015,14 +2023,29 @@ def get_marriage_event(db, family): for event_ref in family.get_event_ref_list(): event = db.get_event_from_handle(event_ref.ref) - if event.type.is_marriage: + if event.type.is_marriage(): marriage_event = event - elif event.type.is_divorce: - continue + break # return the marriage event or False to it caller return marriage_event +def get_divorce_event(db, family): + """ + divorce will either be the divorce event or False + """ + + divorce_event = False + for event_ref in family.get_event_ref_list(): + + event = db.get_event_from_handle(event_ref.ref) + if event.type.is_divorce(): + divorce_event = event + break + + # return the divorce event or False to it caller + return divorce_event + def get_first_day_of_month(year, month): """ Compute the first day to display for this month. From 95a0216287de135427fcd0ba87eafcb00a1634ce Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Mon, 16 Sep 2019 22:36:58 +0200 Subject: [PATCH 5/6] Duplicate marriage --- gramps/plugins/webreport/webcal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gramps/plugins/webreport/webcal.py b/gramps/plugins/webreport/webcal.py index 0328cd8dc..8e1ee91d3 100644 --- a/gramps/plugins/webreport/webcal.py +++ b/gramps/plugins/webreport/webcal.py @@ -1425,7 +1425,8 @@ class WebCalReport(Report): if father_handle == person.handle: spouse_handle = mother_handle else: - spouse_handle = father_handle + continue # with next person if this was + # the marriage event if spouse_handle: spouse = db.get_person_from_handle(spouse_handle) if spouse: From 4e2f98da02937b12990a356406ba0e8e8019b5af Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Tue, 17 Sep 2019 00:48:20 +0200 Subject: [PATCH 6/6] Better score for pylint --- gramps/plugins/webreport/basepage.py | 4 +- gramps/plugins/webreport/narrativeweb.py | 8 ++- gramps/plugins/webstuff/webstuff.py | 84 ++++++++++++------------ 3 files changed, 49 insertions(+), 47 deletions(-) diff --git a/gramps/plugins/webreport/basepage.py b/gramps/plugins/webreport/basepage.py index 12f384c88..343fdc84c 100644 --- a/gramps/plugins/webreport/basepage.py +++ b/gramps/plugins/webreport/basepage.py @@ -752,7 +752,6 @@ class BasePage: # pylint: disable=C1001 if latitude and longitude: latitude, longitude = conv_lat_lon(latitude, longitude, "D.D8") if latitude is not None: - etype = event.get_type() place_lat_long.append([latitude, longitude, placetitle, place_handle, event]) @@ -1431,7 +1430,7 @@ class BasePage: # pylint: disable=C1001 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_","") + css_f = css_f.replace("UsEr_", "") fname = "/".join(["css", css_f + ".css"]) urlx = self.report.build_url_fname(fname, None, self.uplink) @@ -2992,4 +2991,3 @@ class BasePage: # pylint: disable=C1001 # closes the file self.report.close_file(output_file, sio, date) - diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py index 568eb0916..4afad5eaf 100644 --- a/gramps/plugins/webreport/narrativeweb.py +++ b/gramps/plugins/webreport/narrativeweb.py @@ -1017,7 +1017,7 @@ class NavWebReport(Report): fname = CSS[css_f]["filename"] # add images for this css imgs += CSS[css_f]["images"] - css_f = css_f.replace("UsEr_","") + css_f = css_f.replace("UsEr_", "") self.copy_file(fname, css_f + ".css", "css") # copy screen style sheet @@ -1695,13 +1695,15 @@ class NavWebOptions(MenuReportOptions): cright.set_help(_("The copyright to be used for the web files")) addopt("cright", cright) - self.__css = EnumeratedListOption(('StyleSheet'), CSS["Basic-Ash"]["id"]) + self.__css = EnumeratedListOption(('StyleSheet'), + CSS["Basic-Ash"]["id"]) for (dummy_fname, gid) in sorted( [(CSS[key]["translation"], CSS[key]["id"]) for key in list(CSS.keys())]): if CSS[gid]["user"]: self.__css.add_item(CSS[gid]["id"], CSS[gid]["translation"]) - self.__css.set_help(_('The default stylesheet to be used for the pages')) + self.__css.set_help(_('The default stylesheet to be used for' + ' the pages')) addopt("css", self.__css) self.__css.connect("value-changed", self.__stylesheet_changed) diff --git a/gramps/plugins/webstuff/webstuff.py b/gramps/plugins/webstuff/webstuff.py index 194e8de16..c2819cb4f 100644 --- a/gramps/plugins/webstuff/webstuff.py +++ b/gramps/plugins/webstuff/webstuff.py @@ -58,115 +58,115 @@ def load_on_reg(dbstate, uistate, plugin): # default style sheet in the options # Basic Ash style sheet - ["Basic-Ash", 1, _("Basic-Ash"), - path_css('Web_Basic-Ash.css'), None, [], [] ], + ["Basic-Ash", 1, _("Basic-Ash"), + path_css('Web_Basic-Ash.css'), None, [], []], # Basic Blue style sheet with navigation menus - ["Basic-Blue", 1, _("Basic-Blue"), - path_css('Web_Basic-Blue.css'), None, [], [] ], + ["Basic-Blue", 1, _("Basic-Blue"), + path_css('Web_Basic-Blue.css'), None, [], []], # Basic Cypress style sheet ["Basic-Cypress", 1, _("Basic-Cypress"), - path_css('Web_Basic-Cypress.css'), None, [], [] ], + path_css('Web_Basic-Cypress.css'), None, [], []], # basic Lilac style sheet - ["Basic-Lilac", 1, _("Basic-Lilac"), - path_css('Web_Basic-Lilac.css'), None, [], [] ], + ["Basic-Lilac", 1, _("Basic-Lilac"), + path_css('Web_Basic-Lilac.css'), None, [], []], # basic Peach style sheet - ["Basic-Peach", 1, _("Basic-Peach"), - path_css('Web_Basic-Peach.css'), None, [], [] ], + ["Basic-Peach", 1, _("Basic-Peach"), + path_css('Web_Basic-Peach.css'), None, [], []], # basic Spruce style sheet - ["Basic-Spruce", 1, _("Basic-Spruce"), - path_css('Web_Basic-Spruce.css'), None, [], [] ], + ["Basic-Spruce", 1, _("Basic-Spruce"), + path_css('Web_Basic-Spruce.css'), None, [], []], # Mainz style sheet with its images - ["Mainz", 1, _("Mainz"), - path_css('Web_Mainz.css'), None, + ["Mainz", 1, _("Mainz"), + path_css('Web_Mainz.css'), None, [path_img("Web_Mainz_Bkgd.png"), path_img("Web_Mainz_Header.png"), path_img("Web_Mainz_Mid.png"), - path_img("Web_Mainz_MidLight.png")], [] ], + path_img("Web_Mainz_MidLight.png")], []], # Nebraska style sheet - ["Nebraska", 1, _("Nebraska"), - path_css('Web_Nebraska.css'), None, [], [] ], + ["Nebraska", 1, _("Nebraska"), + path_css('Web_Nebraska.css'), None, [], []], # Visually Impaired style sheet with its navigation menus ["Visually Impaired", 1, _("Visually Impaired"), - path_css('Web_Visually.css'), "narrative-menus.css", [], [] ], + path_css('Web_Visually.css'), "narrative-menus.css", [], []], # ancestor tree style sheet and its images - ["ancestortree", 0, "ancestortree", + ["ancestortree", 0, "ancestortree", path_css("ancestortree.css"), None, [path_img("Web_Gender_Female.png"), - path_img("Web_Gender_Male.png")], [] ], + path_img("Web_Gender_Male.png")], []], # media reference regions style sheet - ["behaviour", 0, "Behaviour", - path_css('behaviour.css'), None, [], [] ], + ["behaviour", 0, "Behaviour", + path_css('behaviour.css'), None, [], []], # NarrativeMap stylesheet/ image for NarrativeWeb place maps - ["NarrativeMaps", 0, "", - path_css("narrative-maps.css"), None, [], [] ], + ["NarrativeMaps", 0, "", + path_css("narrative-maps.css"), None, [], []], # default printer style sheet ["Print-Default", 0, "Print-Default", - path_css('Web_Print-Default.css'), None, [], [] ], + path_css('Web_Print-Default.css'), None, [], []], # Horizontal Navigation Menus Style Sheet ["Horizontal-Menus", 0, "Horizontal Menus", - path_css('Web_Horizontal-Menus.css'), None, [], [] ], + path_css('Web_Horizontal-Menus.css'), None, [], []], # Vertical Navigation Menus Style Sheet ["Vertical-Menus", 0, "Vertical Menus", - path_css('Web_Vertical-Menus.css'), None, [], [] ], + path_css('Web_Vertical-Menus.css'), None, [], []], # WebKit/ Html5/ CSS3 Fade Navigation Menus Style Sheet ["Fade-Menus", 0, "Fade In/ Out Menus", - path_css('Web_Fade-Menus.css'), None, [], [] ], + path_css('Web_Fade-Menus.css'), None, [], []], # WebKit/ Html5/ CSS3 Animated Drop Down Style Sheet ["Animated DropDown", 0, "Animated DropDown", path_css("Web_Citations-Animated.css"), None, [], - "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" ], + "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"], # Source Page Citations Referents Outline Style sheet... ["Outline", 0, "Outline Citations", - path_css("Web_Citations-Outline.css"), None, [], [] ], + path_css("Web_Citations-Outline.css"), None, [], []], # WebKit/ Html5/ CSS3 Drop Down Navigation Menus Style Sheet ["DropDown-Menus", 0, "Drop Down Menus", - path_css("Web_DropDown-Menus.css"), None, [], [] ], + path_css("Web_DropDown-Menus.css"), None, [], []], # no style sheet option - ["No style sheet",1, _("No style sheet"), [], None, [], [] ], + ["No style sheet", 1, _("No style sheet"), [], None, [], []], # Document image ["Document", 0, "Document", - os.path.join(IMAGE_DIR, "document.png"), None, [], [] ], + os.path.join(IMAGE_DIR, "document.png"), None, [], []], # blank ["Blank", 0, "Blank", - path_img("blank.gif"), None, [], [] ], + path_img("blank.gif"), None, [], []], # all other images for use in NarrativeWeb ['All Images', 0, 'All Images', None, None, [path_img("blank.gif"), - os.path.join(IMAGE_DIR, "document.png")], [] ], + os.path.join(IMAGE_DIR, "document.png")], []], # Gramps Fav icon #2 ["favicon2", 0, "FavIcon2", - path_img("favicon2.ico"), None, [], [] ], + path_img("favicon2.ico"), None, [], []], # copyright image ['Copyright', 0, 'Copyright', - path_img("somerights20.gif"), None, [], [] ], + path_img("somerights20.gif"), None, [], []], # marker icon for openstreetmap ['marker', 0, 'marker', - path_img_48x48("gramps-geo-mainmap.png"), None, [], [] ], + path_img_48x48("gramps-geo-mainmap.png"), None, [], []], ] # If we add css user files, we must restart gramps to use them. if os.path.exists(USER_CSS): @@ -175,13 +175,15 @@ def load_on_reg(dbstate, uistate, plugin): if cssfile.endswith(".css"): css_f = cssfile.replace('.css', '') CSS_FILES.append(["UsEr_" + css_f, 1, css_f, - os.path.join(USER_CSS,cssfile), None, + os.path.join(USER_CSS, cssfile), None, looking_for_urls_in_user_css(cssfile), - [] ]) + []]) return CSS_FILES def looking_for_urls_in_user_css(css_file): """ + At each time we find the tag url, we get the content and add it + to the images list. This content must be local. """ images = [] cssfile = os.path.join(USER_CSS, css_file) @@ -191,7 +193,7 @@ def looking_for_urls_in_user_css(css_file): if "url" in line: url = re.match(r".*url\((.*)\)", line) if url.group(1)[0:3] != "http": - img = url.group(1).replace("../images/","") + img = url.group(1).replace("../images/", "") img = os.path.join(USER_CSS, img) if img not in images: images.append('%s' % img) @@ -207,7 +209,7 @@ def process_list(data): for row in data: file = row[3] if file: - path, filename = os.path.split(file) + dummy_path, filename = os.path.split(file) # is there a override file in the VERSION_DIR/webstuff? # eg, ~/.gramps/gramps34/webstuff/Web_Nebraska.css # if so, replace this one: