diff --git a/src/utils/functions.py b/src/utils/functions.py index 0ad0521..077e5e9 100644 --- a/src/utils/functions.py +++ b/src/utils/functions.py @@ -1,7 +1,5 @@ import ctypes import html -import json -import os import subprocess import threading from typing import Dict, NamedTuple, Optional, TypeVar @@ -60,38 +58,6 @@ def thread(target, *args, **kwargs) -> threading.Thread: return th -def run_in_thread(func): - """ - Decorator to run the decorated function in a thread. - """ - - def wrapper(*args, **kwargs): - return thread(func, *args, **kwargs) - - return wrapper - - -def write_json_file(data: Dict, path: str): - try: - with open(path, "w") as f: - json.dump(data, f, indent=4, ensure_ascii=False) - except Exception as e: - logger.warning(f"Failed to write json: {e}") - - -def read_json_file(file_path: str) -> Optional[Dict]: - if not os.path.exists(file_path): - logger.error(f"JSON file {file_path} does not exist.") - return None - - with open(file_path, "r") as file: - try: - return json.load(file) - except json.JSONDecodeError as e: - logger.error(f"Failed to read JSON file {file_path}: {e}") - return None - - def get_wifi_icon_for_strength(strength: int) -> str: """ Get the appropriate WiFi icon based on signal strength. @@ -228,13 +194,6 @@ def find_process_pid(process_name: str, timeout: float | None = None) -> list[st return [] -def toggle_command(command: str, full_command: str): - if is_process_running(command): - kill_process(command) - else: - spawn_detached(full_command.split(" ")) - - # --- Binary lookup --- diff --git a/src/utils/utils.py b/src/utils/utils.py index ccf9a15..b90a021 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -2,32 +2,8 @@ from pathlib import Path from typing import Literal from fabric.utils import Gdk, bulk_connect, exec_shell_command_async -from fabric.widgets.scale import Scale from fabric.widgets.svg import Svg -from shared.widgets.animator import Animator - - -class AnimatedScale(Scale): - def __init__(self, **kwargs): - super().__init__(**kwargs) - self.animator = None - - def animate_value(self, value: float): - if not self.animator: - self.animator = Animator( - bezier_curve=(0.34, 1.56, 0.64, 1.0), - duration=0.8, - min_value=self.min_value, - max_value=self.value, - tick_widget=self, - notify_value=lambda p, *_: self.set_value(p.value), - ) - self.animator.pause() - self.animator.min_value = self.value - self.animator.max_value = value - self.animator.play() - # Function to set up cursor hover def setup_cursor_hover(