📦 Absolute paths and refactoring

This commit is contained in:
ful1e5 2021-02-24 19:02:56 +05:30
parent d5be4ddb49
commit b533b221df
2 changed files with 10 additions and 9 deletions

View file

@ -55,6 +55,7 @@ def get_config(bitmaps_dir, **kwargs) -> Dict[str, Any]:
x_sizes.append(to_tuple(size))
png_provider = PNGProvider(bitmaps_dir)
config: Dict[str, Any] = {}
for key, item in X_CURSORS_CFG.items():
@ -63,12 +64,13 @@ def get_config(bitmaps_dir, **kwargs) -> Dict[str, Any]:
hotspot: Tuple[int, int] = (x_hot, y_hot)
delay: int = int(item.get("delay", X_DELAY))
png = png_provider.get(key)
if not png:
pngs = png_provider.get(key)
if not pngs:
raise FileNotFoundError(f"{key} not found in {bitmaps_dir}")
data = {
"png": png,
"png": pngs,
"x_sizes": x_sizes,
"hotspot": hotspot,
"delay": delay,

View file

@ -94,7 +94,7 @@ parser.add_argument(
# Preparing build
args = parser.parse_args()
bitmaps_dir = Path(args.png_dir)
bitmaps_dir = Path(args.png_dir).absolute()
comments = {
"Bibata-Modern-Classic": "Dark & Rounded-edge Bibata",
@ -106,20 +106,19 @@ comments = {
}
for theme in bitmaps_dir.iterdir():
name: str = theme.stem
print(f"=> Building {name}")
name = theme.name
x_out_dir = Path(args.out_dir) / name
win_out_dir = Path(args.out_dir) / f"{name}-Windows"
config = get_config(
theme,
theme.absolute(),
x_sizes=args.xsizes,
win_canvas_size=args.win_canvas_size,
win_size=args.win_size,
)
info = Info(name=name, comment=comments[name])
info = Info(name=name, comment=comments.get(name, f"{name} Cursors"))
if args.platform == "unix":
xbuild(config, x_out_dir, info)