remove "tray"

This commit is contained in:
Fengqing Liu
2025-10-19 17:15:28 +11:00
parent d466f46d6f
commit a321da91f8
31 changed files with 3 additions and 262 deletions

View File

@@ -203,7 +203,6 @@ if __name__ == "__main__":
if exit_status != 0:
logger.warning("Application terminated with error - showing error state")
# Application terminated with error
client.gui.tray.change_icon("error")
client.print(_("status", "terminated"))
client.gui.status.update(_("gui", "status", "terminated"))
# notify the user about the closure
@@ -220,13 +219,4 @@ if __name__ == "__main__":
sys.exit(exit_status)
asyncio.run(main())
# try:
# # use lock_file to check if we're not already running
# success, file = lock_file(LOCK_PATH)
# if not success:
# # already running - exit
# sys.exit(3)
# asyncio.run(main())
# finally:
# file.close()

View File

@@ -17,9 +17,7 @@ class SettingsFile(TypedDict):
language: str
dark_mode: bool
games_to_watch: list[str]
autostart_tray: bool
connection_quality: int
tray_notifications: bool
minimum_refresh_interval_minutes: int
@@ -27,10 +25,8 @@ default_settings: SettingsFile = {
"proxy": URL(),
"games_to_watch": [],
"dark_mode": False,
"autostart_tray": False,
"connection_quality": 1,
"language": DEFAULT_LANG,
"tray_notifications": True,
"minimum_refresh_interval_minutes": 30,
}
@@ -38,7 +34,6 @@ default_settings: SettingsFile = {
class Settings:
# from args
log: bool
tray: bool
dump: bool
# args properties
debug_ws: int
@@ -49,9 +44,7 @@ class Settings:
language: str
dark_mode: bool
games_to_watch: list[str]
autostart_tray: bool
connection_quality: int
tray_notifications: bool
minimum_refresh_interval_minutes: int
PASSTHROUGH = ("_settings", "_args", "_altered")

View File

@@ -235,13 +235,11 @@ class Twitch:
if self.settings.dump:
self.close()
continue
self.gui.tray.change_icon("idle")
self.gui.status.update(_("gui", "status", "idle"))
self.stop_watching()
# clear the flag and wait until it's set again
self._state_change.clear()
elif self._state is State.INVENTORY_FETCH:
self.gui.tray.change_icon("maint")
# ensure the websocket is running
await self.websocket.start()
await self.fetch_inventory()
@@ -553,7 +551,6 @@ class Twitch:
self.print(_("status", "no_channel"))
self.change_state(State.IDLE)
elif self._state is State.EXIT:
self.gui.tray.change_icon("pickaxe")
self.gui.status.update(_("gui", "status", "exiting"))
# we've been requested to exit the application
break

View File

@@ -20,7 +20,6 @@ from .translator import (
GUISettingsGeneral,
GUIStatus,
GUITabs,
GUITray,
GUIWebsocket,
LoginMessages,
StatusMessages,
@@ -38,7 +37,6 @@ __all__ = [
"ErrorMessages",
"GUIStatus",
"GUITabs",
"GUITray",
"GUILoginForm",
"GUIWebsocket",
"GUIProgress",

View File

@@ -67,13 +67,6 @@ class GUITabs(TypedDict):
help: str
class GUITray(TypedDict):
notification_title: str
minimize: str
show: str
quit: str
class GUILoginForm(TypedDict):
name: str
labels: str
@@ -161,8 +154,6 @@ class GUIInventory(TypedDict):
class GUISettingsGeneral(TypedDict):
name: str
autostart: str
tray: str
tray_notifications: str
dark_mode: str
priority_mode: str
proxy: str
@@ -202,7 +193,6 @@ class GUIMessages(TypedDict):
output: str
status: GUIStatus
tabs: GUITabs
tray: GUITray
login: GUILoginForm
websocket: GUIWebsocket
progress: GUIProgress
@@ -280,12 +270,6 @@ default_translation: Translation = {
"settings": "Settings",
"help": "Help",
},
"tray": {
"notification_title": "Mined Drop",
"minimize": "Minimize to Tray",
"show": "Show",
"quit": "Quit",
},
"login": {
"name": "Login Form",
"labels": "Status:\nUser ID:",
@@ -363,8 +347,6 @@ default_translation: Translation = {
"general": {
"name": "General",
"autostart": "Autostart: ",
"tray": "Autostart into tray: ",
"tray_notifications": "Tray notifications: ",
"dark_mode": "Dark mode: ",
"priority_mode": "Priority mode: ",
"proxy": "Proxy (requires restart):",

View File

@@ -152,7 +152,6 @@ class BaseDrop:
self._twitch.print(
_("status", "claimed_drop").format(drop=claim_text.replace("\n", " "))
)
self._twitch.gui.tray.notify(claim_text, _("gui", "tray", "notification_title"))
else:
logger.error(f"Drop claim has potentially failed! Drop ID: {self.id}")
return result

View File

@@ -121,7 +121,6 @@ class WatchService:
channel: The channel to start watching
update_status: Whether to print status message and update status bar
"""
self._twitch.gui.tray.change_icon("active")
self._twitch.gui.channels.set_watching(channel)
self._twitch.watching_channel.set(channel)

View File

@@ -71,7 +71,6 @@ class SettingsUpdate(BaseModel):
games_to_watch: list[str] | None = None
dark_mode: bool | None = None
proxy: str | None = None
tray_notifications: bool | None = None
connection_quality: int | None = None
minimum_refresh_interval_minutes: int | None = None

View File

@@ -16,7 +16,6 @@ from src.web.managers.inventory import InventoryManager
from src.web.managers.login import LoginFormManager
from src.web.managers.settings import SettingsManager
from src.web.managers.status import StatusManager, WebsocketStatusManager
from src.web.managers.tray import TrayIconStub
if TYPE_CHECKING:
@@ -53,7 +52,6 @@ class WebGUIManager:
self.channels = ChannelListManager(self._broadcaster, self)
self.inv = InventoryManager(self._broadcaster, ImageCache(self))
self.login = LoginFormManager(self._broadcaster, self)
self.tray = TrayIconStub(self._broadcaster)
self.settings = SettingsManager(self._broadcaster, twitch.settings)
# Selected channel tracking (set by web client)

View File

@@ -10,7 +10,6 @@ This package contains all component managers for the web-based GUI:
- InventoryManager: Drop campaigns and inventory management
- LoginFormManager: Authentication and OAuth flow handling
- SettingsManager: Application settings configuration
- TrayIconStub: System tray stub (browser notifications in web mode)
- ImageCache: Minimal image caching for campaign artwork
"""
@@ -23,7 +22,6 @@ from src.web.managers.inventory import InventoryManager
from src.web.managers.login import LoginData, LoginFormManager
from src.web.managers.settings import SettingsManager
from src.web.managers.status import StatusManager, WebsocketStatusManager
from src.web.managers.tray import TrayIconStub
__all__ = [
@@ -37,6 +35,5 @@ __all__ = [
"LoginFormManager",
"LoginData",
"SettingsManager",
"TrayIconStub",
"ImageCache",
]

View File

@@ -37,7 +37,6 @@ class SettingsManager:
"games_to_watch": list(self._settings.games_to_watch),
"games_available": self._available_games,
"proxy": str(self._settings.proxy),
"tray_notifications": self._settings.tray_notifications,
"connection_quality": self._settings.connection_quality,
"minimum_refresh_interval_minutes": self._settings.minimum_refresh_interval_minutes,
}
@@ -56,8 +55,6 @@ class SettingsManager:
self._settings.connection_quality = settings_data["connection_quality"]
if "proxy" in settings_data:
self._settings.proxy = settings_data["proxy"]
if "tray_notifications" in settings_data:
self._settings.tray_notifications = settings_data["tray_notifications"]
if "minimum_refresh_interval_minutes" in settings_data:
self._settings.minimum_refresh_interval_minutes = settings_data[
"minimum_refresh_interval_minutes"

View File

@@ -1,51 +0,0 @@
"""Tray icon stub for web-based GUI (no system tray in browser)."""
from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from src.web.managers.broadcaster import WebSocketBroadcaster
class TrayIconStub:
"""Stub implementation for system tray icon functionality.
In web mode, traditional system tray operations are not applicable.
This class provides a compatible interface that translates tray
operations into browser notifications and UI indicators.
"""
def __init__(self, broadcaster: WebSocketBroadcaster):
self._broadcaster = broadcaster
def change_icon(self, icon: str):
"""Change tray icon (translated to UI indicator in web mode).
Args:
icon: Icon name/identifier to change to
"""
# Broadcast icon change for potential UI indicators
asyncio.create_task(self._broadcaster.emit("tray_icon_change", {"icon": icon}))
def notify(self, message: str, title: str):
"""Send a system notification (translated to browser notification).
Args:
message: Notification message body
title: Notification title
"""
# Send browser notification
asyncio.create_task(
self._broadcaster.emit("notification", {"title": title, "message": message})
)
def minimize(self):
"""Minimize to tray (no-op in web mode)."""
pass
def restore(self):
"""Restore from tray (no-op in web mode)."""
pass