📦 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)) x_sizes.append(to_tuple(size))
png_provider = PNGProvider(bitmaps_dir) png_provider = PNGProvider(bitmaps_dir)
config: Dict[str, Any] = {} config: Dict[str, Any] = {}
for key, item in X_CURSORS_CFG.items(): 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) hotspot: Tuple[int, int] = (x_hot, y_hot)
delay: int = int(item.get("delay", X_DELAY)) delay: int = int(item.get("delay", X_DELAY))
png = png_provider.get(key) pngs = png_provider.get(key)
if not png:
if not pngs:
raise FileNotFoundError(f"{key} not found in {bitmaps_dir}") raise FileNotFoundError(f"{key} not found in {bitmaps_dir}")
data = { data = {
"png": png, "png": pngs,
"x_sizes": x_sizes, "x_sizes": x_sizes,
"hotspot": hotspot, "hotspot": hotspot,
"delay": delay, "delay": delay,

View file

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