-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
29 lines (25 loc) · 1.01 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from lxml import etree
def is_interactive(args):
"""Assume the SVG is to be interactive unless explicitly stated otherwise.
"""
if args.interactive == "no":
return False
else:
return True
def add_interactive_elements(root, lon_0, current_sea, zoom=True):
if lon_0 == "0":
controls_directory = "../"
else:
controls_directory = "../../"
if not zoom:
controls_directory += "../"
root.attrib["data-current-sea"] = current_sea
root.attrib["data-lon_0"] = lon_0
if not zoom:
root.attrib["data-not-zoomed"] = ""
# id="script_tag" type="text/javascript" xlink:href="controls.js
# xmlns:xlink="http://www.w3.org/1999/xlink"
script_element = etree.SubElement(root, "script")
script_element.attrib["id"] = "script_tag"
script_element.attrib["type"] = "text/javascript"
script_element.attrib["{http://www.w3.org/1999/xlink}href"] = controls_directory + "controls.js"