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: dict[str, str]
separator_color: str = "rgb(120, 120, 120)"
color_on: str = "#00ff11"
color_off: str = "#ff0004"
@staticmethod
def prepare() -> None:

View File

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

View File

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