style: enforce consistent codestyle via ruff config and auto-fixes

- Configure ruff: isort, pyupgrade, bugbear, flake8 rules
- Auto-fix import sorting, redundant parens, exception chaining
- Remove from __future__ import annotations (Python 3.13+)
- Convert debug print() to logger calls
- Fix typo applicaiton → application in icon_resolver
- Remove bare returns in animator setters
- Move TYPE_CHECKING imports to runtime where used at runtime
This commit is contained in:
sankalp committed 2026-07-12 18:38:13 +05:45
1 parent afd826d0c0
commit 096231bc44
60 files changed
+243 -217

No files matched your search

+1 -2
View File
@@ -1,8 +1,7 @@
from pathlib import Path
import tomlkit
from fabric.utils import GLib, Gio, logger
from fabric.utils import Gio, GLib, logger
from fabric.widgets.box import Box
from fabric.widgets.button import Button
from fabric.widgets.label import Label
@@ -1,5 +1,5 @@
from pathlib import Path
import weakref
from pathlib import Path
from fabric.system_tray.widgets import SystemTrayItem
from fabric.utils import GdkPixbuf, GLib, logger
+1 -1
View File
@@ -5,9 +5,9 @@ from fabric.widgets.button import Button
from fabric.widgets.centerbox import CenterBox
from fabric.widgets.label import Label
from globalmenu.service import get_global_menu_service
from shared.dialogs.about import AboutApp, get_about_window
from shared.window.dropdown import ModusDropdown, dropdown_divider, dropdowns
from globalmenu.service import get_global_menu_service
from utils.app_name_resolver import format_window
from utils.roam import modus_service
from utils.utils import setup_cursor_hover
+1 -1
View File
@@ -435,7 +435,7 @@ class BatteryIndicator(Box):
def update_state(self):
if not self._is_present():
print("[Battery] No battery detected, hiding indicator")
logger.warning("No battery detected, hiding indicator")
self.hide()
return
else:
+7 -7
View File
@@ -5,9 +5,9 @@ from fabric.widgets.box import Box
from fabric.widgets.button import Button
from fabric.widgets.entry import Entry
from fabric.widgets.label import Label
from shared.window.animated_scrollwindow import AnimatedScrollable
from services.todo import get_todo_service
from services.todo import get_todo_service
from shared.window.animated_scrollwindow import AnimatedScrollable
from shared.window.applet_window import AppletWindow
from utils.utils import svg_file
@@ -364,11 +364,11 @@ class TodoListWidget(AppletWindow):
def _on_todo_event(self, event_type, data=None):
"""Handle todo service events via callback"""
if event_type == "todos-changed":
GLib.idle_add(self._refresh_todos)
elif event_type == "todo-added":
GLib.idle_add(self._refresh_todos)
elif event_type == "todo-deleted":
if (
event_type == "todos-changed"
or event_type == "todo-added"
or event_type == "todo-deleted"
):
GLib.idle_add(self._refresh_todos)
elif event_type in ["todo-toggled", "todo-edited", "todo-priority-changed"]:
if data and data["id"] in self.todo_items:
+3 -3
View File
@@ -43,7 +43,7 @@ class Panel(Window):
self.imac = Button(
name="panel-button",
child=svg_file("misc/logo.svg", size=18),
on_clicked=lambda *_: self.globalmenu.show_system_dropdown((self.imac)),
on_clicked=lambda *_: self.globalmenu.show_system_dropdown(self.imac),
)
setup_cursor_hover(self.imac, "pointer")
self.globalmenu.set_imac_button(self.imac)
@@ -313,7 +313,7 @@ class Panel(Window):
self.queue_resize()
def _on_config_changed(self, new_config, old_config):
print("[Panel] Config changed, checking keys...")
logger.debug("Config changed, checking keys...")
keys = {
"imac_button",
"global_menu",
@@ -330,7 +330,7 @@ class Panel(Window):
}
changed_keys = [k for k in keys if new_config.get(k) != old_config.get(k)]
if changed_keys:
print(f"[Panel] Rebuilding due to changes in: {changed_keys}")
logger.debug(f"Rebuilding due to changes in: {changed_keys}")
self._rebuild_layout_from_config(new_config)
self._update_tray_visibility()
+2 -2
View File
@@ -1,8 +1,8 @@
from window.panel.notch.notch import Notch
from window.panel.notch.indicators import (
CapsLockIndicator,
KeyboardLayoutIndicator,
NumLockIndicator,
)
from window.panel.notch.notch import Notch
__all__ = ["Notch", "CapsLockIndicator", "KeyboardLayoutIndicator", "NumLockIndicator"]
__all__ = ["CapsLockIndicator", "KeyboardLayoutIndicator", "Notch", "NumLockIndicator"]
+6 -5
View File
@@ -1,19 +1,20 @@
from fabric.utils import Gdk, Gtk, GLib
from fabric.utils import Gdk, GLib, Gtk
from fabric.widgets.box import Box
from fabric.widgets.centerbox import CenterBox
from fabric.widgets.shapes import Corner
from fabric.widgets.stack import Stack
from services.screencapture import screen_capture_service
from window.panel.notch.recording import RecordingIndicator
from window.panel.notch.player import NotchPlayer
from window.controlcenter.player import get_shared_mpris_manager
from window.panel.notch.indicators import (
CapsLockIndicator,
ChargingIndicator,
KeyboardLayoutIndicator,
MicrophoneIndicator,
NumLockIndicator,
ChargingIndicator,
)
from window.controlcenter.player import get_shared_mpris_manager
from window.panel.notch.player import NotchPlayer
from window.panel.notch.recording import RecordingIndicator
class Notch(Box):
+1 -1
View File
@@ -2,7 +2,7 @@ import math
import os
import time
from fabric.utils import GLib, Gtk, GdkPixbuf
from fabric.utils import GdkPixbuf, GLib, Gtk
from fabric.widgets.box import Box
from fabric.widgets.centerbox import CenterBox