Compare commits

..

No commits in common. "be30c160f4e53141122564a286e7525451c585f5" and "7f9cca49603dce0ee07c1c65679c682cb528204e" have entirely different histories.

5 changed files with 10 additions and 1969 deletions

View file

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

View file

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

View file

@ -12,12 +12,10 @@ from aiofile import async_open
from homeassistant.util import dt from homeassistant.util import dt
from svgwrite import Drawing from svgwrite import Drawing
from svgwrite.animate import Animate from svgwrite.animate import Animate
from svgwrite.container import FONT_TEMPLATE
from svgwrite.utils import font_mimetype from svgwrite.utils import font_mimetype
from .api import IrmKmiApiClient from .api import IrmKmiApiClient
from .radar_data import AnimationFrameData, RadarAnimationData from .radar_data import AnimationFrameData, RadarAnimationData
from .roboto import roboto_b64
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -151,11 +149,15 @@ class RainGraph:
async def draw_svg_frame(self): async def draw_svg_frame(self):
"""Create the global area to draw the other items""" """Create the global area to draw the other items"""
mimetype = "application/x-font-ttf" 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}")
content = FONT_TEMPLATE.format(name="Roboto Medium", data=f"data:{mimetype};charset=utf-8;base64,{roboto_b64}") async with async_open(font_file, 'rb') as font:
self._dwg.embed_stylesheet(content) data = await font.read()
# 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(""" self._dwg.embed_stylesheet("""
.roboto { .roboto {
font-family: "Roboto Medium"; font-family: "Roboto Medium";

File diff suppressed because it is too large Load diff

View file

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