mirror of
https://github.com/jdejaegh/irm-kmi-ha.git
synced 2025-06-27 03:35:56 +02:00
commit
efac0f4fcd
5 changed files with 20 additions and 5 deletions
6
custom_components/irm_kmi/font_fallback.py
Normal file
6
custom_components/irm_kmi/font_fallback.py
Normal file
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
||||||
"pytz==2023.3.post1",
|
"pytz==2023.3.post1",
|
||||||
"svgwrite==1.4.3"
|
"svgwrite==1.4.3"
|
||||||
],
|
],
|
||||||
"version": "0.2.3"
|
"version": "0.2.4"
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import copy
|
import copy
|
||||||
|
import logging
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
|
@ -10,7 +11,9 @@ from svgwrite.animate import Animate
|
||||||
|
|
||||||
from custom_components.irm_kmi.data import (AnimationFrameData,
|
from custom_components.irm_kmi.data import (AnimationFrameData,
|
||||||
RadarAnimationData)
|
RadarAnimationData)
|
||||||
|
from custom_components.irm_kmi.font_fallback import font_data
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
class RainGraph:
|
class RainGraph:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
|
@ -85,7 +88,13 @@ class RainGraph:
|
||||||
|
|
||||||
def draw_svg_frame(self):
|
def draw_svg_frame(self):
|
||||||
"""Create the global area to draw the other items"""
|
"""Create the global area to draw the other items"""
|
||||||
self._dwg.embed_font(name="Roboto Medium", filename='custom_components/irm_kmi/resources/roboto_medium.ttf')
|
try:
|
||||||
|
self._dwg.embed_font(name="Roboto Medium", filename='custom_components/irm_kmi/resources/roboto_medium.ttf')
|
||||||
|
except FileNotFoundError as err:
|
||||||
|
# Workaround for some cases where the font file cannot be opened. The font_data contains the strings
|
||||||
|
# that must be embedded as a stylesheet for the roboto_medium.ttf font
|
||||||
|
_LOGGER.warning(f'Could not find font {err}. Loading it using the fallback file.')
|
||||||
|
self._dwg.embed_stylesheet(font_data)
|
||||||
self._dwg.embed_stylesheet("""
|
self._dwg.embed_stylesheet("""
|
||||||
.roboto {
|
.roboto {
|
||||||
font-family: "Roboto Medium";
|
font-family: "Roboto Medium";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
aiohttp==3.9.3
|
aiohttp==3.9.3
|
||||||
async_timeout==4.0.3
|
async_timeout==4.0.3
|
||||||
homeassistant==2024.2.1
|
homeassistant==2024.3.3
|
||||||
voluptuous==0.13.1
|
voluptuous==0.13.1
|
||||||
pytz==2023.3.post1
|
pytz==2023.3.post1
|
||||||
svgwrite==1.4.3
|
svgwrite==1.4.3
|
|
@ -1,5 +1,5 @@
|
||||||
homeassistant==2024.2.1
|
homeassistant==2024.3.3
|
||||||
pytest
|
pytest
|
||||||
pytest_homeassistant_custom_component==0.13.100
|
pytest_homeassistant_custom_component==0.13.109
|
||||||
freezegun
|
freezegun
|
||||||
isort
|
isort
|
Loading…
Add table
Reference in a new issue