Better score for pylint
This commit is contained in:
parent
95a0216287
commit
4e2f98da02
@ -752,7 +752,6 @@ class BasePage: # pylint: disable=C1001
|
|||||||
if latitude and longitude:
|
if latitude and longitude:
|
||||||
latitude, longitude = conv_lat_lon(latitude, longitude, "D.D8")
|
latitude, longitude = conv_lat_lon(latitude, longitude, "D.D8")
|
||||||
if latitude is not None:
|
if latitude is not None:
|
||||||
etype = event.get_type()
|
|
||||||
place_lat_long.append([latitude, longitude, placetitle,
|
place_lat_long.append([latitude, longitude, placetitle,
|
||||||
place_handle, event])
|
place_handle, event])
|
||||||
|
|
||||||
@ -1431,7 +1430,7 @@ class BasePage: # pylint: disable=C1001
|
|||||||
already_done = False
|
already_done = False
|
||||||
for css_fn in ("UsEr_", "Basic", "Mainz", "Nebraska"):
|
for css_fn in ("UsEr_", "Basic", "Mainz", "Nebraska"):
|
||||||
if css_fn in css_f and not already_done:
|
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"])
|
fname = "/".join(["css", css_f + ".css"])
|
||||||
urlx = self.report.build_url_fname(fname, None,
|
urlx = self.report.build_url_fname(fname, None,
|
||||||
self.uplink)
|
self.uplink)
|
||||||
@ -2992,4 +2991,3 @@ class BasePage: # pylint: disable=C1001
|
|||||||
|
|
||||||
# closes the file
|
# closes the file
|
||||||
self.report.close_file(output_file, sio, date)
|
self.report.close_file(output_file, sio, date)
|
||||||
|
|
||||||
|
@ -1017,7 +1017,7 @@ class NavWebReport(Report):
|
|||||||
fname = CSS[css_f]["filename"]
|
fname = CSS[css_f]["filename"]
|
||||||
# add images for this css
|
# add images for this css
|
||||||
imgs += CSS[css_f]["images"]
|
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")
|
self.copy_file(fname, css_f + ".css", "css")
|
||||||
|
|
||||||
# copy screen style sheet
|
# copy screen style sheet
|
||||||
@ -1695,13 +1695,15 @@ class NavWebOptions(MenuReportOptions):
|
|||||||
cright.set_help(_("The copyright to be used for the web files"))
|
cright.set_help(_("The copyright to be used for the web files"))
|
||||||
addopt("cright", cright)
|
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(
|
for (dummy_fname, gid) in sorted(
|
||||||
[(CSS[key]["translation"], CSS[key]["id"])
|
[(CSS[key]["translation"], CSS[key]["id"])
|
||||||
for key in list(CSS.keys())]):
|
for key in list(CSS.keys())]):
|
||||||
if CSS[gid]["user"]:
|
if CSS[gid]["user"]:
|
||||||
self.__css.add_item(CSS[gid]["id"], CSS[gid]["translation"])
|
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)
|
addopt("css", self.__css)
|
||||||
self.__css.connect("value-changed", self.__stylesheet_changed)
|
self.__css.connect("value-changed", self.__stylesheet_changed)
|
||||||
|
|
||||||
|
@ -58,115 +58,115 @@ def load_on_reg(dbstate, uistate, plugin):
|
|||||||
|
|
||||||
# default style sheet in the options
|
# default style sheet in the options
|
||||||
# Basic Ash style sheet
|
# Basic Ash style sheet
|
||||||
["Basic-Ash", 1, _("Basic-Ash"),
|
["Basic-Ash", 1, _("Basic-Ash"),
|
||||||
path_css('Web_Basic-Ash.css'), None, [], [] ],
|
path_css('Web_Basic-Ash.css'), None, [], []],
|
||||||
|
|
||||||
# Basic Blue style sheet with navigation menus
|
# Basic Blue style sheet with navigation menus
|
||||||
["Basic-Blue", 1, _("Basic-Blue"),
|
["Basic-Blue", 1, _("Basic-Blue"),
|
||||||
path_css('Web_Basic-Blue.css'), None, [], [] ],
|
path_css('Web_Basic-Blue.css'), None, [], []],
|
||||||
|
|
||||||
# Basic Cypress style sheet
|
# Basic Cypress style sheet
|
||||||
["Basic-Cypress", 1, _("Basic-Cypress"),
|
["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 style sheet
|
||||||
["Basic-Lilac", 1, _("Basic-Lilac"),
|
["Basic-Lilac", 1, _("Basic-Lilac"),
|
||||||
path_css('Web_Basic-Lilac.css'), None, [], [] ],
|
path_css('Web_Basic-Lilac.css'), None, [], []],
|
||||||
|
|
||||||
# basic Peach style sheet
|
# basic Peach style sheet
|
||||||
["Basic-Peach", 1, _("Basic-Peach"),
|
["Basic-Peach", 1, _("Basic-Peach"),
|
||||||
path_css('Web_Basic-Peach.css'), None, [], [] ],
|
path_css('Web_Basic-Peach.css'), None, [], []],
|
||||||
|
|
||||||
# basic Spruce style sheet
|
# basic Spruce style sheet
|
||||||
["Basic-Spruce", 1, _("Basic-Spruce"),
|
["Basic-Spruce", 1, _("Basic-Spruce"),
|
||||||
path_css('Web_Basic-Spruce.css'), None, [], [] ],
|
path_css('Web_Basic-Spruce.css'), None, [], []],
|
||||||
|
|
||||||
# Mainz style sheet with its images
|
# Mainz style sheet with its images
|
||||||
["Mainz", 1, _("Mainz"),
|
["Mainz", 1, _("Mainz"),
|
||||||
path_css('Web_Mainz.css'), None,
|
path_css('Web_Mainz.css'), None,
|
||||||
[path_img("Web_Mainz_Bkgd.png"),
|
[path_img("Web_Mainz_Bkgd.png"),
|
||||||
path_img("Web_Mainz_Header.png"),
|
path_img("Web_Mainz_Header.png"),
|
||||||
path_img("Web_Mainz_Mid.png"),
|
path_img("Web_Mainz_Mid.png"),
|
||||||
path_img("Web_Mainz_MidLight.png")], [] ],
|
path_img("Web_Mainz_MidLight.png")], []],
|
||||||
|
|
||||||
# Nebraska style sheet
|
# Nebraska style sheet
|
||||||
["Nebraska", 1, _("Nebraska"),
|
["Nebraska", 1, _("Nebraska"),
|
||||||
path_css('Web_Nebraska.css'), None, [], [] ],
|
path_css('Web_Nebraska.css'), None, [], []],
|
||||||
|
|
||||||
# Visually Impaired style sheet with its navigation menus
|
# Visually Impaired style sheet with its navigation menus
|
||||||
["Visually Impaired", 1, _("Visually Impaired"),
|
["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
|
# ancestor tree style sheet and its images
|
||||||
["ancestortree", 0, "ancestortree",
|
["ancestortree", 0, "ancestortree",
|
||||||
path_css("ancestortree.css"), None,
|
path_css("ancestortree.css"), None,
|
||||||
[path_img("Web_Gender_Female.png"),
|
[path_img("Web_Gender_Female.png"),
|
||||||
path_img("Web_Gender_Male.png")], [] ],
|
path_img("Web_Gender_Male.png")], []],
|
||||||
|
|
||||||
# media reference regions style sheet
|
# media reference regions style sheet
|
||||||
["behaviour", 0, "Behaviour",
|
["behaviour", 0, "Behaviour",
|
||||||
path_css('behaviour.css'), None, [], [] ],
|
path_css('behaviour.css'), None, [], []],
|
||||||
|
|
||||||
# NarrativeMap stylesheet/ image for NarrativeWeb place maps
|
# NarrativeMap stylesheet/ image for NarrativeWeb place maps
|
||||||
["NarrativeMaps", 0, "",
|
["NarrativeMaps", 0, "",
|
||||||
path_css("narrative-maps.css"), None, [], [] ],
|
path_css("narrative-maps.css"), None, [], []],
|
||||||
|
|
||||||
# default printer style sheet
|
# default printer style sheet
|
||||||
["Print-Default", 0, "Print-Default",
|
["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 Navigation Menus Style Sheet
|
||||||
["Horizontal-Menus", 0, "Horizontal Menus",
|
["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 Navigation Menus Style Sheet
|
||||||
["Vertical-Menus", 0, "Vertical Menus",
|
["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
|
# WebKit/ Html5/ CSS3 Fade Navigation Menus Style Sheet
|
||||||
["Fade-Menus", 0, "Fade In/ Out Menus",
|
["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
|
# WebKit/ Html5/ CSS3 Animated Drop Down Style Sheet
|
||||||
["Animated DropDown", 0, "Animated DropDown",
|
["Animated DropDown", 0, "Animated DropDown",
|
||||||
path_css("Web_Citations-Animated.css"), None, [],
|
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...
|
# Source Page Citations Referents Outline Style sheet...
|
||||||
["Outline", 0, "Outline Citations",
|
["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
|
# WebKit/ Html5/ CSS3 Drop Down Navigation Menus Style Sheet
|
||||||
["DropDown-Menus", 0, "Drop Down Menus",
|
["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 option
|
||||||
["No style sheet",1, _("No style sheet"), [], None, [], [] ],
|
["No style sheet", 1, _("No style sheet"), [], None, [], []],
|
||||||
|
|
||||||
# Document image
|
# Document image
|
||||||
["Document", 0, "Document",
|
["Document", 0, "Document",
|
||||||
os.path.join(IMAGE_DIR, "document.png"), None, [], [] ],
|
os.path.join(IMAGE_DIR, "document.png"), None, [], []],
|
||||||
|
|
||||||
# blank
|
# blank
|
||||||
["Blank", 0, "Blank",
|
["Blank", 0, "Blank",
|
||||||
path_img("blank.gif"), None, [], [] ],
|
path_img("blank.gif"), None, [], []],
|
||||||
|
|
||||||
# all other images for use in NarrativeWeb
|
# all other images for use in NarrativeWeb
|
||||||
['All Images', 0, 'All Images', None, None,
|
['All Images', 0, 'All Images', None, None,
|
||||||
[path_img("blank.gif"),
|
[path_img("blank.gif"),
|
||||||
os.path.join(IMAGE_DIR, "document.png")], [] ],
|
os.path.join(IMAGE_DIR, "document.png")], []],
|
||||||
|
|
||||||
# Gramps Fav icon #2
|
# Gramps Fav icon #2
|
||||||
["favicon2", 0, "FavIcon2",
|
["favicon2", 0, "FavIcon2",
|
||||||
path_img("favicon2.ico"), None, [], [] ],
|
path_img("favicon2.ico"), None, [], []],
|
||||||
|
|
||||||
# copyright image
|
# copyright image
|
||||||
['Copyright', 0, 'Copyright',
|
['Copyright', 0, 'Copyright',
|
||||||
path_img("somerights20.gif"), None, [], [] ],
|
path_img("somerights20.gif"), None, [], []],
|
||||||
|
|
||||||
# marker icon for openstreetmap
|
# marker icon for openstreetmap
|
||||||
['marker', 0, 'marker',
|
['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 we add css user files, we must restart gramps to use them.
|
||||||
if os.path.exists(USER_CSS):
|
if os.path.exists(USER_CSS):
|
||||||
@ -175,13 +175,15 @@ def load_on_reg(dbstate, uistate, plugin):
|
|||||||
if cssfile.endswith(".css"):
|
if cssfile.endswith(".css"):
|
||||||
css_f = cssfile.replace('.css', '')
|
css_f = cssfile.replace('.css', '')
|
||||||
CSS_FILES.append(["UsEr_" + css_f, 1, css_f,
|
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),
|
looking_for_urls_in_user_css(cssfile),
|
||||||
[] ])
|
[]])
|
||||||
return CSS_FILES
|
return CSS_FILES
|
||||||
|
|
||||||
def looking_for_urls_in_user_css(css_file):
|
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 = []
|
images = []
|
||||||
cssfile = os.path.join(USER_CSS, css_file)
|
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:
|
if "url" in line:
|
||||||
url = re.match(r".*url\((.*)\)", line)
|
url = re.match(r".*url\((.*)\)", line)
|
||||||
if url.group(1)[0:3] != "http":
|
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)
|
img = os.path.join(USER_CSS, img)
|
||||||
if img not in images:
|
if img not in images:
|
||||||
images.append('%s' % img)
|
images.append('%s' % img)
|
||||||
@ -207,7 +209,7 @@ def process_list(data):
|
|||||||
for row in data:
|
for row in data:
|
||||||
file = row[3]
|
file = row[3]
|
||||||
if file:
|
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?
|
# is there a override file in the VERSION_DIR/webstuff?
|
||||||
# eg, ~/.gramps/gramps34/webstuff/Web_Nebraska.css
|
# eg, ~/.gramps/gramps34/webstuff/Web_Nebraska.css
|
||||||
# if so, replace this one:
|
# if so, replace this one:
|
||||||
|
Loading…
Reference in New Issue
Block a user