mirror of
https://github.com/jdejaegh/irm-kmi-ha.git
synced 2025-06-26 19:35:40 +02:00
Compare commits
3 commits
7f9cca4960
...
be30c160f4
Author | SHA1 | Date | |
---|---|---|---|
be30c160f4 | |||
9064326860 | |||
ea23f0da2c |
5 changed files with 1969 additions and 10 deletions
|
@ -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'}
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
"svgwrite==1.4.3",
|
||||
"aiofile==3.9.0"
|
||||
],
|
||||
"version": "0.2.30"
|
||||
"version": "0.2.31"
|
||||
}
|
|
@ -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";
|
||||
|
|
1961
custom_components/irm_kmi/roboto.py
Normal file
1961
custom_components/irm_kmi/roboto.py
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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}"
|
||||
|
|
Loading…
Add table
Reference in a new issue