ED_LRR/ed_lrr_gui/config.py

47 lines
1.4 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", [], "path_list", comment="history of bodies.json urls")
cfg.init("history.systems_url", [], "path_list", comment="history of systems.json urls")
cfg.init(
"history.bodies_path",
[],
"path_list",
comment="history of bodies.json download paths",
)
cfg.init(
"history.systems_path",
[],
"path_list",
comment="history of systems.json download paths",
)
cfg.init(
"history.stars_csv_path",
[],
"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.sync()