This commit is contained in:
Auric Vente 2024-07-22 21:02:11 -06:00
parent 9378b8c27a
commit 7d62509aac
3 changed files with 29 additions and 29 deletions

View File

@ -57,8 +57,6 @@ class Config:
manifest_path: Path manifest_path: Path
manifest: dict[str, str] manifest: dict[str, str]
separator_color: str = "rgb(120, 120, 120)" separator_color: str = "rgb(120, 120, 120)"
color_on: str = "#00ff11"
color_off: str = "#ff0004"
@staticmethod @staticmethod
def prepare() -> None: def prepare() -> None:

View File

@ -9,7 +9,6 @@ from PySide6.QtWidgets import QLabel
from PySide6.QtWidgets import QWidget from PySide6.QtWidgets import QWidget
from PySide6.QtWidgets import QFrame from PySide6.QtWidgets import QFrame
from PySide6.QtWidgets import QMenu from PySide6.QtWidgets import QMenu
from PySide6.QtWidgets import QWidgetAction
from PySide6.QtGui import QCursor # type: ignore from PySide6.QtGui import QCursor # type: ignore
from PySide6.QtGui import QMouseEvent from PySide6.QtGui import QMouseEvent
from PySide6.QtGui import QPixmap from PySide6.QtGui import QPixmap
@ -437,47 +436,54 @@ class Game:
@staticmethod @staticmethod
def menu() -> None: def menu() -> None:
menu = QMenu(Window.root.widget()) menu = QMenu(Window.root.widget())
style = f"""
QMenu::separator {{
background-color: {Config.separator_color};
}}
"""
menu.setStyleSheet(style)
menu.setObjectName("main_menu")
update = QAction("Update") update = QAction("Update")
restart = QAction("Restart") restart = QAction("Restart")
enable_all = QAction("Enable All") enable_all = QAction("Enable All")
disable_all = QAction("Disable All") disable_all = QAction("Disable All")
tag_on = f"<font color='{Config.color_on}'>On</font>" def make(text: str, enabled: bool) -> QAction:
tag_off = f"<font color='{Config.color_off}'>Off</font>" if enabled:
icon = ""
word = "On"
else:
icon = ""
word = "Off"
def make(text: str) -> QWidgetAction: return QAction(f"{icon} {text} {word}")
label = QLabel(text)
label.setTextFormat(Qt.RichText)
label.setContentsMargins(10, 5, 10, 5)
label.setObjectName("menu_label")
widget_action = QWidgetAction(None)
widget_action.setDefaultWidget(label)
return widget_action
if Settings.merge: if Settings.merge:
merge = make(f"Merge: {tag_on}") merge = make("Merge", True)
else: else:
merge = make(f"Merge: {tag_off}") merge = make("Merge", False)
if Settings.score_enabled: if Settings.score_enabled:
score = make(f"Score: {tag_on}") score = make("Score", True)
else: else:
score = make(f"Score: {tag_off}") score = make("Score", False)
if Settings.travel_enabled: if Settings.travel_enabled:
travel = make(f"Travel: {tag_on}") travel = make("Travel", True)
else: else:
travel = make(f"Travel: {tag_off}") travel = make("Travel", False)
if Settings.think_enabled: if Settings.think_enabled:
think = make(f"Think: {tag_on}") think = make("Think", True)
else: else:
think = make(f"Think: {tag_off}") think = make("Think", False)
if Settings.words_enabled: if Settings.words_enabled:
words = make(f"Words: {tag_on}") words = make("Words", True)
else: else:
words = make(f"Words: {tag_off}") words = make("Words", False)
update.triggered.connect(Game.force_update) update.triggered.connect(Game.force_update)
restart.triggered.connect(Game.restart) restart.triggered.connect(Game.restart)

View File

@ -135,7 +135,7 @@ class Window:
QMenu {{ QMenu {{
background-color: {Config.alt_background_color}; background-color: {Config.alt_background_color};
color: {Config.alt_text_color}; color: {Config.alt_text_color};
border: 1px solid {Config.alt_border_color}; border: 2px solid {Config.alt_border_color};
}} }}
QMenu::item:selected {{ QMenu::item:selected {{
@ -146,7 +146,7 @@ class Window:
QDialog {{ QDialog {{
background-color: {Config.alt_background_color}; background-color: {Config.alt_background_color};
color: {Config.alt_text_color}; color: {Config.alt_text_color};
border: 1px solid {Config.alt_border_color}; border: 2px solid {Config.alt_border_color};
}} }}
QDialog QLabel {{ QDialog QLabel {{
@ -209,10 +209,6 @@ class Window:
color: white; color: white;
}} }}
QMenu::separator {{
background-color: {Config.separator_color};
}}
QLabel#menu_label:hover {{ QLabel#menu_label:hover {{
background-color: {Config.alt_hover_background_color}; background-color: {Config.alt_hover_background_color};
}} }}