[themes] Do not automatically download symbols.json

In order to use symbol files, symbol.json needs to be created manually
now.

Also, remove symbol usage from the prepackaged themes to avoid
breakage.

fixes #216
This commit is contained in:
Tobias Witek 2018-01-03 15:58:57 +01:00
parent 1a507ec0cd
commit 13d27d4b81
2 changed files with 13 additions and 16 deletions

View file

@ -61,20 +61,17 @@ class Theme(object):
except Exception: except Exception:
pass pass
try: try:
if not os.path.exists("{}/symbols.json".format(path)): if os.path.exists("{}/symbols.json".format(path)):
data = yaml.load(requests.get("https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml").text) data = json.load(io.open("{}/symbols.json".format(path)))
with io.open("{}/symbols.json".format(path), "w") as f: self._symbols = {}
json.dump(data, f) for icon in data["icons"]:
data = json.load(io.open("{}/symbols.json".format(path))) code = int(icon["unicode"], 16)
self._symbols = {} try:
for icon in data["icons"]: code = unichr(code)
code = int(icon["unicode"], 16) except Exception:
try: code = chr(code)
code = unichr(code) self._symbols["${{{}}}".format(icon["id"])] = code
except Exception: self._symbols["${{{}}}".format(icon["name"])] = code
code = chr(code)
self._symbols["${{{}}}".format(icon["id"])] = code
self._symbols["${{{}}}".format(icon["name"])] = code
except Exception as e: except Exception as e:
logging.error("failed to load symbols: {}".format(str(e))) logging.error("failed to load symbols: {}".format(str(e)))

View file

@ -3,8 +3,8 @@
"separator": "", "padding": " ", "separator": "", "padding": " ",
"unknown": { "prefix": "" } "unknown": { "prefix": "" }
}, },
"date": { "prefix": "${calendar}" }, "date": { "prefix": "" },
"time": { "prefix": "${clock-o}" }, "time": { "prefix": "" },
"datetime": { "prefix": "" }, "datetime": { "prefix": "" },
"memory": { "prefix": "" }, "memory": { "prefix": "" },
"cpu": { "prefix": "" }, "cpu": { "prefix": "" },