Compare commits

..

3 commits

5 changed files with 1969 additions and 10 deletions

View file

@ -161,7 +161,7 @@ IRM_KMI_NAME: Final = {
WEEKDAYS = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
USER_AGENT: Final = 'github.com/jdejaegh/irm-kmi-ha 0.2.30'
USER_AGENT: Final = 'github.com/jdejaegh/irm-kmi-ha 0.2.31'
CURRENT_WEATHER_SENSORS: Final = {'temperature', 'wind_speed', 'wind_gust_speed', 'wind_bearing', 'uv_index',
'pressure'}

View file

@ -12,5 +12,5 @@
"svgwrite==1.4.3",
"aiofile==3.9.0"
],
"version": "0.2.30"
"version": "0.2.31"
}

View file

@ -12,10 +12,12 @@ from aiofile import async_open
from homeassistant.util import dt
from svgwrite import Drawing
from svgwrite.animate import Animate
from svgwrite.container import FONT_TEMPLATE
from svgwrite.utils import font_mimetype
from .api import IrmKmiApiClient
from .radar_data import AnimationFrameData, RadarAnimationData
from .roboto import roboto_b64
_LOGGER = logging.getLogger(__name__)
@ -149,15 +151,11 @@ class RainGraph:
async def draw_svg_frame(self):
"""Create the global area to draw the other items"""
font_file = os.path.join(self._config_dir, 'custom_components/irm_kmi/resources/roboto_medium.ttf')
_LOGGER.debug(f"Opening font file at {font_file}")
mimetype = "application/x-font-ttf"
async with async_open(font_file, 'rb') as font:
data = await font.read()
content = FONT_TEMPLATE.format(name="Roboto Medium", data=f"data:{mimetype};charset=utf-8;base64,{roboto_b64}")
self._dwg.embed_stylesheet(content)
# Need to use the private class method as the public one does not offer an async call
# As this is run in the main loop, we cannot afford a blocking open() call
self._dwg._embed_font_data("Roboto Medium", data, font_mimetype(font_file))
self._dwg.embed_stylesheet("""
.roboto {
font-family: "Roboto Medium";

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
[tool.bumpver]
current_version = "0.2.30"
current_version = "0.2.31"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "bump version {old_version} -> {new_version}"
tag_message = "{new_version}"