refactor(modules): simplify SVG asset handling across modules
Enhancements: - Add optimized night‑variant detection for weather icons using a predefined list - Replace `Svg` usage with direct `svg_file` calls throughout the todo widget, removing redundant relative‑path logic - Update dock and battery modules to load assets via direct paths, eliminating unnecessary `get_relative_path` calls- Introduce `WEATHER_CACHE_TIMEOUT` constant and tidy up unused imports (`WEATHER_EMOJI_MAP` removed) - Minor formatting and structural clean‑ups that improve code readability Bug Fixes: - Remove dead import of `WEATHER_EMOJI_MAP` and unused constant `WEATHER_EMOJI_MAP` - Correct syntax of `condition_em` initialization to avoid potential rendering issues New Features: - None.
This commit is contained in:
10 files changed
+60
-79
No files matched your search
@@ -1,7 +1,6 @@
|
||||
import math
|
||||
from fabric.audio import Audio
|
||||
from fabric.utils import get_relative_path
|
||||
from fabric.widgets.svg import Svg
|
||||
from utils.utils import svg_file
|
||||
from fabric.widgets.scale import ScaleMark
|
||||
from .animated_scale import AnimatedScale
|
||||
from .base import BaseOSDContainer
|
||||
@@ -17,8 +16,8 @@ class AudioOSDContainer(BaseOSDContainer):
|
||||
self._connect_specific_signals()
|
||||
|
||||
def _setup_specific_components(self):
|
||||
self.osd_window_image = Svg(
|
||||
get_relative_path("../../../config/assets/icons/volume/audio-volume.svg"),
|
||||
self.osd_window_image = svg_file(
|
||||
"volume/audio-volume.svg",
|
||||
size=(100, 100),
|
||||
name="osd-image",
|
||||
h_align="center",
|
||||
@@ -87,11 +86,7 @@ class AudioOSDContainer(BaseOSDContainer):
|
||||
0 if display_volume == 0 else min(int(math.ceil(display_volume / 33)), 3)
|
||||
)
|
||||
|
||||
self.osd_window_image.set_from_file(
|
||||
get_relative_path(
|
||||
f"../../../config/assets/icons/volume/audio-volume-{level}.svg"
|
||||
)
|
||||
)
|
||||
self.osd_window_image.set_from_file(f"volume/audio-volume-{level}.svg")
|
||||
|
||||
if muted or volume == 0:
|
||||
self.scale.add_style_class("muted")
|
||||
|
||||
Reference in new issue
Block a user