Mods
This commit is contained in:
parent
c19d429228
commit
e71a91d328
|
@ -28,6 +28,8 @@ class Config:
|
||||||
hatch_burst: int = 3
|
hatch_burst: int = 3
|
||||||
font_size: int = 20
|
font_size: int = 20
|
||||||
info_separator: str = " - "
|
info_separator: str = " - "
|
||||||
|
font_path: Path
|
||||||
|
emoji_font_path: Path
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prepare() -> None:
|
def prepare() -> None:
|
||||||
|
@ -43,3 +45,5 @@ class Config:
|
||||||
Config.hatched_image_path = Config.here / "img" / "icon_7.jpg"
|
Config.hatched_image_path = Config.here / "img" / "icon_7.jpg"
|
||||||
Config.terminated_image_path = Config.here / "img" / "icon_6.jpg"
|
Config.terminated_image_path = Config.here / "img" / "icon_6.jpg"
|
||||||
Config.names_json = Config.here / "data" / "names.json"
|
Config.names_json = Config.here / "data" / "names.json"
|
||||||
|
Config.font_path = Config.here / "fonts" / "NotoSans-Regular.ttf"
|
||||||
|
Config.emoji_font_path = Config.here / "fonts" / "NotoEmoji-Regular.ttf"
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -119,14 +119,14 @@ class Game:
|
||||||
status = ""
|
status = ""
|
||||||
|
|
||||||
if num == 1:
|
if num == 1:
|
||||||
ant.hits += 1
|
|
||||||
status = f"Took a hit ({ant.hits} total)"
|
|
||||||
elif num == 2:
|
|
||||||
ant.triumph += 1
|
ant.triumph += 1
|
||||||
status = f"Scored a triumph ({ant.triumph} total)"
|
status = f"😀 Scored a triumph ({ant.triumph} total)"
|
||||||
|
elif num == 2:
|
||||||
|
ant.hits += 1
|
||||||
|
status = f"🎃 Took a hit ({ant.hits} total)"
|
||||||
elif (num == 3) and (num_ants > 1):
|
elif (num == 3) and (num_ants > 1):
|
||||||
other = Ants.get_other(ant)
|
other = Ants.get_other(ant)
|
||||||
status = f"Is thinking about {other.name}"
|
status = f"🫠 Is thinking about {other.name}"
|
||||||
elif num == 4:
|
elif num == 4:
|
||||||
status = s.simple_sentence()
|
status = s.simple_sentence()
|
||||||
elif num == 5:
|
elif num == 5:
|
||||||
|
@ -188,7 +188,7 @@ class Game:
|
||||||
if triumph:
|
if triumph:
|
||||||
text.append(f"Triumph:{nb}{triumph.name}")
|
text.append(f"Triumph:{nb}{triumph.name}")
|
||||||
|
|
||||||
if hits and (hits.name != triumph.name):
|
if hits and (triumph and (hits.name != triumph.name)):
|
||||||
text.append(f"Hits:{nb}{hits.name}")
|
text.append(f"Hits:{nb}{hits.name}")
|
||||||
|
|
||||||
Window.info.setText(Config.info_separator.join(text))
|
Window.info.setText(Config.info_separator.join(text))
|
||||||
|
|
|
@ -16,7 +16,8 @@ from PySide6.QtWidgets import QComboBox
|
||||||
from PySide6.QtWidgets import QLayout
|
from PySide6.QtWidgets import QLayout
|
||||||
from PySide6.QtWidgets import QSizePolicy
|
from PySide6.QtWidgets import QSizePolicy
|
||||||
from PySide6.QtWidgets import QMessageBox
|
from PySide6.QtWidgets import QMessageBox
|
||||||
from PySide6.QtGui import QMouseEvent # type: ignore
|
from PySide6.QtGui import QFontDatabase # type: ignore
|
||||||
|
from PySide6.QtGui import QMouseEvent
|
||||||
from PySide6.QtGui import QIcon
|
from PySide6.QtGui import QIcon
|
||||||
from PySide6.QtCore import Qt # type: ignore
|
from PySide6.QtCore import Qt # type: ignore
|
||||||
from PySide6.QtCore import Signal
|
from PySide6.QtCore import Signal
|
||||||
|
@ -43,6 +44,8 @@ class Window:
|
||||||
speed: QComboBox
|
speed: QComboBox
|
||||||
scroll_area: QScrollArea
|
scroll_area: QScrollArea
|
||||||
info: SpecialButton
|
info: SpecialButton
|
||||||
|
font: str
|
||||||
|
emoji_font: str
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prepare() -> None:
|
def prepare() -> None:
|
||||||
|
@ -64,9 +67,24 @@ class Window:
|
||||||
Window.window.setCentralWidget(central_widget)
|
Window.window.setCentralWidget(central_widget)
|
||||||
Window.window.setWindowIcon(QIcon(str(Config.icon_path)))
|
Window.window.setWindowIcon(QIcon(str(Config.icon_path)))
|
||||||
|
|
||||||
style = f"QWidget {{ background-color: {Config.background_color}; \
|
font_id = QFontDatabase.addApplicationFont(str(Config.font_path))
|
||||||
color: {Config.text_color}; font-size: {Config.font_size}px}}"
|
emoji_font_id = QFontDatabase.addApplicationFont(str(Config.emoji_font_path))
|
||||||
|
|
||||||
|
if font_id != -1:
|
||||||
|
Window.font = QFontDatabase.applicationFontFamilies(font_id)[0]
|
||||||
|
|
||||||
|
if emoji_font_id != -1:
|
||||||
|
Window.emoji_font = QFontDatabase.applicationFontFamilies(emoji_font_id)[0]
|
||||||
|
|
||||||
|
style = f"""
|
||||||
|
QWidget {{
|
||||||
|
background-color: {Config.background_color};
|
||||||
|
color: {Config.text_color};
|
||||||
|
font-size: {Config.font_size}px;
|
||||||
|
}}
|
||||||
|
""".strip()
|
||||||
|
|
||||||
|
Window.app.setFont(Window.font)
|
||||||
Window.root.setContentsMargins(0, 0, 0, 0)
|
Window.root.setContentsMargins(0, 0, 0, 0)
|
||||||
Window.app.setStyleSheet(style)
|
Window.app.setStyleSheet(style)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue