ED_LRR/ed_lrr_gui/config.py

60 lines
1.8 KiB
Python

import pathlib
from collections import namedtuple
import profig
import appdirs
import os
config_dir = pathlib.Path(appdirs.user_config_dir("ED_LRR", ""))
config_dir.mkdir(parents=True, exist_ok=True)
config_file = config_dir / "config.ini"
config_file.touch()
cfg = profig.Config(str(config_file), strict=True)
cfg.init(
"history.bodies_url",
["https://www.edsm.net/dump/bodies.json"],
"path_list",
comment="history of bodies.json urls",
)
cfg.init(
"history.systems_url",
["https://www.edsm.net/dump/systemsWithCoordinates.json"],
"path_list",
comment="history of systems.json urls",
)
cfg.init(
"history.bodies_path",
[os.path.join(config_dir, "data", "bodies.json")],
"path_list",
comment="history of bodies.json download paths",
)
cfg.init(
"history.systems_path",
[os.path.join(config_dir, "data", "systemsWithCoordinates.json")],
"path_list",
comment="history of systems.json download paths",
)
cfg.init(
"history.stars_csv_path",
[os.path.join(config_dir, "data", "stars.csv")],
"path_list",
comment="history of paths for stars.csv",
)
cfg.init("route.range", 7.56, comment="jump range")
cfg.init("route.primary", False, comment="only route through primary stars")
cfg.init("route.mode", "bfs", comment="routing mode")
cfg.init(
"route.prune.min_improvement",
10.0,
comment="path needs to improve by at least (jump_range*min_improvement) in route.prune.steps",
)
cfg.init("route.prune.steps", 5, comment="number of steps before path gets pruned")
cfg.init("route.greediness", 0.5, comment="A* greediness")
cfg.init("folders.data_dir", os.path.join(config_dir, "data"), comment="Data directory")
cfg.init("GUI.theme", "dark", comment="GUI theme to use")
cfg.sync()