cromulant/cromulant/config.py

29 lines
770 B
Python
Raw Normal View History

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:
title = "Cromulant"
width = 800
height = 600
2024-07-19 02:10:08 +00:00
max_ants = 100
2024-07-18 08:14:03 +00:00
here: str
2024-07-19 02:10:08 +00:00
ants_json: Path
icon_path: Path
image_path: Path
names_json: Path
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("[]")
Config.icon_path = Config.here / "img" / "icon_4.jpg"
Config.image_path = Config.here / "img" / "icon_7.jpg"
Config.names_json = Config.here / "data" / "names.json"