cromulant/cromulant/config.py

84 lines
3.0 KiB
Python
Raw Normal View History

2024-07-19 03:08:11 +00:00
from __future__ import annotations
2024-07-18 08:14:03 +00:00
from pathlib import Path
2024-07-19 02:10:08 +00:00
import appdirs # type: ignore
2024-07-18 08:14:03 +00:00
class Config:
2024-07-19 03:08:11 +00:00
title: str = "Cromulant"
2024-07-20 07:07:27 +00:00
program: str = "cromulant"
2024-07-20 03:04:20 +00:00
width: int = 820
2024-07-19 14:06:12 +00:00
height: int = 900
2024-07-19 03:08:11 +00:00
here: Path
2024-07-19 02:10:08 +00:00
ants_json: Path
icon_path: Path
2024-07-19 04:55:49 +00:00
status_image_path: Path
hatched_image_path: Path
terminated_image_path: Path
2024-07-19 02:10:08 +00:00
names_json: Path
2024-07-20 01:38:40 +00:00
background_color: str = "rgb(44, 44, 44)"
2024-07-19 04:55:49 +00:00
text_color: str = "#ffffff"
2024-07-19 05:19:08 +00:00
image_size: int = 80
2024-07-21 07:30:59 +00:00
space_1: int = 18
2024-07-21 12:06:33 +00:00
max_updates: int = 300
2024-07-20 02:30:37 +00:00
loop_delay_fast: int = 1000 * 5
loop_delay_normal: int = 1000 * 60 * 1
loop_delay_slow: int = 1000 * 60 * 5
2024-07-19 06:58:07 +00:00
font_size: int = 20
2024-07-19 07:56:17 +00:00
info_separator: str = " - "
2024-07-19 10:03:56 +00:00
font_path: Path
emoji_font_path: Path
2024-07-19 11:28:49 +00:00
triumph_color: tuple[int, int, int] = (255, 255, 0)
hit_color: tuple[int, int, int] = (255, 0, 77)
triumph_icon: str = "😀"
hit_icon: str = "🎃"
triumph_message: str = "Scored a triumph"
hit_message: str = "Took a hit"
2024-07-19 13:24:57 +00:00
song_path: Path
2024-07-19 14:06:12 +00:00
logo_path: Path
2024-07-20 07:24:28 +00:00
alt_background_color: str = "rgb(33, 33, 33)"
alt_text_color: str = "white"
alt_hover_background_color: str = "rgb(51, 51, 51)"
alt_hover_text_color: str = "white"
alt_border_color: str = "rgb(88, 88, 88)"
2024-07-20 02:17:07 +00:00
message_box_button_hover_background_color: str = "rgb(66, 66, 66)"
message_box_button_hover_text_color: str = "white"
2024-07-20 03:26:22 +00:00
scrollbar_handle_color: str = "rgb(69, 69, 69)"
2024-07-20 08:16:48 +00:00
input_background_color: str = "rgb(111, 111, 111)"
input_text_color: str = "rgb(18, 18, 18)"
2024-07-20 11:29:48 +00:00
input_border_color: str = "rgb(120, 120, 120)"
2024-07-20 08:16:48 +00:00
input_caret_color: str = "rgb(18, 18, 18)"
2024-07-20 10:48:04 +00:00
settings_json: Path
2024-07-20 16:35:28 +00:00
countries_json: Path
2024-07-21 08:39:14 +00:00
filter_width: int = 150
2024-07-21 12:00:22 +00:00
filter_debouncer_delay: int = 200
2024-07-18 08:14:03 +00:00
@staticmethod
def prepare() -> None:
Config.here = Path(__file__).parent
2024-07-19 02:10:08 +00:00
Config.ants_json = Path(appdirs.user_data_dir()) / "cromulant" / "ants.json"
if not Config.ants_json.exists():
Config.ants_json.parent.mkdir(parents=True, exist_ok=True)
Config.ants_json.write_text("[]")
2024-07-20 10:48:04 +00:00
Config.settings_json = (
Path(appdirs.user_config_dir()) / "cromulant" / "settings.json"
)
if not Config.settings_json.exists():
Config.settings_json.parent.mkdir(parents=True, exist_ok=True)
Config.settings_json.write_text("{}")
2024-07-20 16:35:28 +00:00
Config.names_json = Config.here / "data" / "names.json"
Config.countries_json = Config.here / "data" / "countries.json"
2024-07-20 11:59:19 +00:00
Config.icon_path = Config.here / "img" / "icon_1.jpg"
Config.status_image_path = Config.here / "img" / "icon_2.jpg"
Config.terminated_image_path = Config.here / "img" / "icon_3.jpg"
Config.hatched_image_path = Config.here / "img" / "icon_4.jpg"
2024-07-19 10:03:56 +00:00
Config.font_path = Config.here / "fonts" / "NotoSans-Regular.ttf"
Config.emoji_font_path = Config.here / "fonts" / "NotoEmoji-Regular.ttf"
2024-07-19 13:24:57 +00:00
Config.song_path = Config.here / "audio" / "March of the Cyber Ants.mp3"
2024-07-20 01:46:02 +00:00
Config.logo_path = Config.here / "img" / "logo_3.jpg"