This commit is contained in:
Auric Vente 2024-07-27 01:12:28 -06:00
parent 554ccfb114
commit 436b5273e5
6 changed files with 30 additions and 1 deletions

View File

@ -169,3 +169,13 @@ Show the score on triumph or hits instead of the total of each
Default: False
Action: store_true
---
### mono
Use a monospace font
Default: False
Action: store_true

View File

@ -27,6 +27,7 @@ class Args:
slow_minutes: float = 0.0
argdoc: bool = False
score: bool = False
mono: bool = False
@staticmethod
def prepare() -> None:
@ -58,6 +59,7 @@ class Args:
"slow_minutes",
"argdoc",
"score",
"mono",
]
for n_item in normals:

View File

@ -172,3 +172,9 @@ class ArgSpec:
action="store_true",
info="Show the score on triumph or hits instead of the total of each",
)
ArgSpec.add_argument(
"mono",
action="store_true",
info="Use a monospace font",
)

View File

@ -31,6 +31,7 @@ class Config:
info_separator: str = " - "
font_path: Path
emoji_font_path: Path
mono_font_path: Path
triumph_color: tuple[int, int, int] = (255, 255, 0)
hit_color: tuple[int, int, int] = (255, 0, 77)
triumph_icon: str = "😀"
@ -97,6 +98,7 @@ class Config:
Config.terminated_image_path = Config.here / "img" / "terminated.jpg"
Config.font_path = Config.here / "fonts" / "NotoSans-Regular.ttf"
Config.emoji_font_path = Config.here / "fonts" / "NotoEmoji-Regular.ttf"
Config.mono_font_path = Config.here / "fonts" / "NotoSansMono-Regular.ttf"
Config.song_path = Config.here / "audio" / "March of the Cyber Ants.mp3"
Config.logo_path = Config.here / "img" / "logo_3.jpg"
Config.arguments_path = Config.here / ".." / "arguments.md"

Binary file not shown.

View File

@ -118,6 +118,7 @@ class Window:
info: QPushButton
font: str
emoji_font: str
mono_font: str
player: QMediaPlayer
audio: QAudioOutput
filter: QLineEdit
@ -156,6 +157,7 @@ class Window:
def set_style() -> None:
font_id = QFontDatabase.addApplicationFont(str(Config.font_path))
emoji_font_id = QFontDatabase.addApplicationFont(str(Config.emoji_font_path))
mono_font_id = QFontDatabase.addApplicationFont(str(Config.mono_font_path))
if font_id != -1:
Window.font = QFontDatabase.applicationFontFamilies(font_id)[0]
@ -163,6 +165,9 @@ class Window:
if emoji_font_id != -1:
Window.emoji_font = QFontDatabase.applicationFontFamilies(emoji_font_id)[0]
if mono_font_id != -1:
Window.mono_font = QFontDatabase.applicationFontFamilies(mono_font_id)[0]
style = f"""
QWidget {{
@ -255,7 +260,11 @@ class Window:
""".strip()
Window.app.setStyleSheet(style)
Window.app.setFont(Window.font)
if Args.mono:
Window.app.setFont(Window.mono_font)
else:
Window.app.setFont(Window.font)
@staticmethod
def add_buttons() -> None: