refactor(modules): improve exception handling and simplify service usage

Enhancements
- Replace bare `except:` with `except Exception:` in multiple modules- Cast step calculation to `int` for consistent type
- Simplify `get_battery_icon_file` to return a string directly
- Use `get_todo_service()` instead of module-level `todo_service` throughout todo widget
- Remove unused `"zen": "zen-browser"` mapping entry

Bug Fixes
- Prevent bare exception swallowing by catching `Exception` explicitly
- Ensure proper cleanup of timer IDs and other resources
- Delete unused modules/osdd components

New Features
- None
This commit is contained in:
sankalp committed 2026-03-23 23:34:03 +05:45
1 parent 34cfb2f49e
commit ef4065bc1f
34 files changed
+682 -519

No files matched your search

+3 -3
View File
@@ -170,7 +170,7 @@ class ExpandableNotificationGroup(Box):
def _get_notification_pixbuf_for_group(self, cached_notification):
"""Get notification pixbuf using cached image key - fallback to app icon"""
notification = cached_notification._notification
notification_id = getattr(notification, "id", None)
getattr(notification, "id", None)
# First try to get cached notification image using stored cache key
if (
@@ -447,7 +447,7 @@ class NotificationCenterWidget(NotificationWidget):
def _get_notification_pixbuf(self, notification):
"""Get notification pixbuf using cached image key - fallback to app icon"""
notification_id = getattr(notification, "id", None)
getattr(notification, "id", None)
# First try to get cached notification image using stored cache key
if self.cache_metadata:
@@ -689,7 +689,7 @@ class NotificationCenter(Window):
rebuild_count = 0
for cached_notification in notification_service.cached_notifications:
app_name = cached_notification._notification.app_name
notification_id = getattr(cached_notification._notification, "id", None)
getattr(cached_notification._notification, "id", None)
# Skip ignored apps during rebuild
if app_name in data.NOTIFICATION_IGNORED_APPS_HISTORY: