From 77f4fc8c2228e5acdb579161307dee181eacbe2f Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 3 Nov 2015 00:20:20 -0800 Subject: [PATCH] Frontend: Add materialdesignicons --- homeassistant/components/frontend/__init__.py | 3 +- .../components/frontend/index.html.template | 2 +- .../components/frontend/mdi_version.py | 2 + .../components/frontend/www_static/mdi.html | 1 + script/update_mdi.py | 92 +++++++++++++++++++ 5 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 homeassistant/components/frontend/mdi_version.py create mode 100644 homeassistant/components/frontend/www_static/mdi.html create mode 100755 script/update_mdi.py diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index a15244ac52f1..d51a7623767d 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -8,7 +8,7 @@ import re import os import logging -from . import version +from . import version, mdi_version import homeassistant.util as util from homeassistant.const import URL_ROOT, HTTP_OK from homeassistant.config import get_default_config_dir @@ -74,6 +74,7 @@ def _handle_get_root(handler, path_match, data): template_html = template_html.replace('{{ app_url }}', app_url) template_html = template_html.replace('{{ auth }}', auth) + template_html = template_html.replace('{{ icons }}', mdi_version.VERSION) handler.wfile.write(template_html.encode("UTF-8")) diff --git a/homeassistant/components/frontend/index.html.template b/homeassistant/components/frontend/index.html.template index 8906e8902a0d..409ea6752dba 100644 --- a/homeassistant/components/frontend/index.html.template +++ b/homeassistant/components/frontend/index.html.template @@ -46,6 +46,6 @@ - + diff --git a/homeassistant/components/frontend/mdi_version.py b/homeassistant/components/frontend/mdi_version.py new file mode 100644 index 000000000000..c9d06a4b3000 --- /dev/null +++ b/homeassistant/components/frontend/mdi_version.py @@ -0,0 +1,2 @@ +""" DO NOT MODIFY. Auto-generated by update_mdi script """ +VERSION = "38EF63D0474411E4B3CF842B2B6CFE1B" diff --git a/homeassistant/components/frontend/www_static/mdi.html b/homeassistant/components/frontend/www_static/mdi.html new file mode 100644 index 000000000000..42212a3a301f --- /dev/null +++ b/homeassistant/components/frontend/www_static/mdi.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/script/update_mdi.py b/script/update_mdi.py new file mode 100755 index 000000000000..f7899be3964a --- /dev/null +++ b/script/update_mdi.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +""" +Downloads the latest Polymer v1 iconset version for materialdesignicons.com +""" + +import os +import re +import requests +import sys + +GETTING_STARTED_URL = ('https://raw.githubusercontent.com/Templarian/' + 'MaterialDesign/master/site/getting-started.savvy') +DOWNLOAD_LINK = re.compile(r'(/api/download/polymer/v1/([A-Z0-9-]{36}))') +START_ICONSET = '