chore: refactor imports and adopt new utils utilities
This commit is contained in:
65 files changed
+221
-266
No files matched your search
@@ -12,7 +12,7 @@ from services.bluetooth import BluetoothClient, BluetoothDevice
|
||||
from shared.widgets.smooth_switch import SmoothSwitch
|
||||
from shared.window.animated_scrollwindow import AnimatedScrollable
|
||||
from utils.functions import spawn_detached
|
||||
from utils.utils import svg_file
|
||||
from utils.gtk_utils import svg_file
|
||||
|
||||
|
||||
def get_battery_icon_file(
|
||||
|
||||
@@ -11,7 +11,7 @@ from fabric.widgets.stack import Stack
|
||||
from fabric.widgets.wayland import WaylandWindow as Window
|
||||
|
||||
from services.mpris import PlayerManager, PlayerService
|
||||
from utils.utils import svg_file
|
||||
from utils.gtk_utils import svg_file
|
||||
from window.controlcenter.player import (
|
||||
PLAYER_FALLBACK_ART,
|
||||
apply_player_art,
|
||||
@@ -416,7 +416,7 @@ class PlayerBox(Box):
|
||||
|
||||
initial_status = str(self.player.playback_status).lower()
|
||||
icon_file = (
|
||||
"player/play.svg" if initial_status == "paused" else "player/Pause.svg"
|
||||
"player/play.svg" if initial_status == "paused" else "player/pause.svg"
|
||||
)
|
||||
self.play_pause_icon = svg_file(icon_file, size=22)
|
||||
self.play_pause_button = Button(
|
||||
@@ -433,7 +433,7 @@ class PlayerBox(Box):
|
||||
)
|
||||
self.prev_button = Button(
|
||||
name="macos-control-button",
|
||||
child=svg_file("player/Rewind.svg", size=22),
|
||||
child=svg_file("player/rewind.svg", size=22),
|
||||
style_classes=["control-buttons"],
|
||||
on_clicked=self._on_player_prev,
|
||||
)
|
||||
@@ -638,7 +638,7 @@ class PlayerBox(Box):
|
||||
try:
|
||||
status = str(self.player.playback_status).lower()
|
||||
self.play_pause_icon.dynamic_file(
|
||||
"player/play.svg" if status == "paused" else "player/Pause.svg"
|
||||
"player/play.svg" if status == "paused" else "player/pause.svg"
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"An error occurred: {e}")
|
||||
@@ -651,7 +651,7 @@ class PlayerBox(Box):
|
||||
self._last_notified_status = current_status
|
||||
|
||||
icon_file = (
|
||||
"player/play.svg" if current_status == "paused" else "player/Pause.svg"
|
||||
"player/play.svg" if current_status == "paused" else "player/pause.svg"
|
||||
)
|
||||
if hasattr(self, "play_pause_icon"):
|
||||
self.play_pause_icon.dynamic_file(icon_file)
|
||||
@@ -659,7 +659,7 @@ class PlayerBox(Box):
|
||||
# Fallback if play_pause_icon isn't available
|
||||
import os
|
||||
|
||||
from utils.utils import get_relative_path
|
||||
from utils.gtk_utils import get_relative_path
|
||||
|
||||
self.play_pause_button.get_child().set_from_file(
|
||||
os.path.join(get_relative_path("assets/icons/"), icon_file)
|
||||
|
||||
@@ -11,8 +11,8 @@ from services.inhibit import get_inhibit_service
|
||||
from services.network import NetworkClient
|
||||
from shared.widgets.flat_scale import FlatScale
|
||||
from shared.window.applet_window import AppletWindow
|
||||
from utils.gtk_utils import svg_file
|
||||
from utils.roam import audio_service, modus_service
|
||||
from utils.utils import svg_file
|
||||
from window.controlcenter.bluetooth import (
|
||||
BluetoothConnections,
|
||||
set_bluetooth_enabled_with_fallback,
|
||||
|
||||
@@ -6,7 +6,7 @@ from services.modus import (
|
||||
is_night_light_active,
|
||||
toggle_night_light,
|
||||
)
|
||||
from utils.utils import svg_file
|
||||
from utils.gtk_utils import svg_file
|
||||
|
||||
|
||||
def create_night_light_widget(control_center):
|
||||
|
||||
@@ -193,12 +193,9 @@ class PerAppVolumeControl(Box):
|
||||
|
||||
def _populate_apps(self):
|
||||
"""Populate the widget with current audio applications"""
|
||||
# Clear and DESTROY existing widgets to prevent memory leaks
|
||||
for child in list(self.apps_container.get_children()):
|
||||
try:
|
||||
child.destroy()
|
||||
except Exception as e:
|
||||
logger.error(f"An error occurred: {e}")
|
||||
from utils.functions import clear_children
|
||||
|
||||
clear_children(self.apps_container)
|
||||
self.apps_container.children = []
|
||||
self._app_widgets.clear()
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from fabric.widgets.stack import Stack
|
||||
|
||||
import shared.data as data
|
||||
from services.mpris import PlayerManager, PlayerService
|
||||
from utils.utils import svg_file
|
||||
from utils.gtk_utils import svg_file
|
||||
|
||||
CACHE_DIR = f"{data.CACHE_DIR}/media"
|
||||
PLAYER_FALLBACK_ART = get_relative_path("../../assets/icons/music.svg")
|
||||
@@ -357,7 +357,7 @@ class PlayerBox(Box):
|
||||
|
||||
initial_status = str(self.player.playback_status).lower()
|
||||
icon_file = (
|
||||
"player/play.svg" if initial_status == "paused" else "player/Pause.svg"
|
||||
"player/play.svg" if initial_status == "paused" else "player/pause.svg"
|
||||
)
|
||||
self.play_pause_icon = svg_file(icon_file, size=22)
|
||||
self.play_pause_button = Button(
|
||||
@@ -538,7 +538,7 @@ class PlayerBox(Box):
|
||||
try:
|
||||
status = str(self.player.playback_status).lower()
|
||||
self.play_pause_icon.dynamic_file(
|
||||
"player/play.svg" if status == "paused" else "player/Pause.svg"
|
||||
"player/play.svg" if status == "paused" else "player/pause.svg"
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"An error occurred: {e}")
|
||||
@@ -553,7 +553,7 @@ class PlayerBox(Box):
|
||||
self._last_notified_status = current_status
|
||||
|
||||
self.play_pause_icon.dynamic_file(
|
||||
"player/play.svg" if current_status == "paused" else "player/Pause.svg"
|
||||
"player/play.svg" if current_status == "paused" else "player/pause.svg"
|
||||
)
|
||||
if self.player_stack:
|
||||
self.player_stack.on_player_playback_changed(self, current_status)
|
||||
|
||||
@@ -15,7 +15,7 @@ from utils.functions import (
|
||||
get_wifi_icon_for_strength,
|
||||
spawn_detached,
|
||||
)
|
||||
from utils.utils import svg_file
|
||||
from utils.gtk_utils import svg_file
|
||||
|
||||
|
||||
class WifiNetworkSlot(Box):
|
||||
|
||||
Reference in new issue
Block a user