mirror of
https://github.com/ful1e5/apple_cursor.git
synced 2025-05-17 08:35:03 -04:00
🖼️ cursor's default size in 'build.py'
This commit is contained in:
parent
c776ae7aef
commit
05ce070192
3 changed files with 31 additions and 46 deletions
|
@ -2,19 +2,18 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Tuple, Union
|
from typing import Any, Dict, List, Tuple, TypeVar, Union
|
||||||
|
|
||||||
from clickgen.util import LikePath, PNGProvider
|
from clickgen.util import LikePath, PNGProvider
|
||||||
|
|
||||||
from applbuild.constants import (
|
from applbuild.constants import WIN_CURSORS_CFG, WIN_DELAY, X_CURSORS_CFG, X_DELAY
|
||||||
WIN_CANVAS_SIZE,
|
|
||||||
WIN_CURSORS_CFG,
|
|
||||||
WIN_DELAY,
|
X = TypeVar("X")
|
||||||
WIN_SIZE,
|
|
||||||
X_CURSORS_CFG,
|
|
||||||
X_DELAY,
|
def to_tuple(x: X) -> Tuple[X, X]:
|
||||||
X_SIZES,
|
return (x, x)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def get_config(bitmaps_dir: LikePath, **kwargs) -> Dict[str, Any]:
|
def get_config(bitmaps_dir: LikePath, **kwargs) -> Dict[str, Any]:
|
||||||
|
@ -27,11 +26,11 @@ def get_config(bitmaps_dir: LikePath, **kwargs) -> Dict[str, Any]:
|
||||||
|
|
||||||
Keywords Args:
|
Keywords Args:
|
||||||
|
|
||||||
:x_sizes: (List[Size] | Size) List of sizes or single size for xcursors.
|
:x_sizes: (List[int]) List of pixel-sizes for xcursors.
|
||||||
|
|
||||||
:win_canvas_size: (Size) Windows cursor's canvas size.
|
:win_canvas_size: (int) Windows cursor's canvas pixel-size.
|
||||||
|
|
||||||
:win_size: (Size) Size for Windows cursor.
|
:win_size: (int) Pixel-size for Windows cursor.
|
||||||
|
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
@ -41,15 +40,13 @@ def get_config(bitmaps_dir: LikePath, **kwargs) -> Dict[str, Any]:
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if kwargs.get("x_sizes"):
|
w_size = to_tuple(kwargs.pop("win_size"))
|
||||||
x_sizes = kwargs.pop("x_sizes")
|
w_canvas_size = to_tuple(kwargs.pop("win_canvas_size"))
|
||||||
else:
|
x = kwargs.pop("x_sizes")
|
||||||
x_sizes = X_SIZES
|
|
||||||
|
|
||||||
if kwargs.get("win_size"):
|
x_sizes = []
|
||||||
w_size = kwargs.pop("win_size")
|
for s in x:
|
||||||
else:
|
x_sizes.append(to_tuple(s))
|
||||||
w_size = WIN_SIZE
|
|
||||||
|
|
||||||
png = PNGProvider(bitmaps_dir)
|
png = PNGProvider(bitmaps_dir)
|
||||||
config: Dict[str, Any] = {}
|
config: Dict[str, Any] = {}
|
||||||
|
@ -77,7 +74,7 @@ def get_config(bitmaps_dir: LikePath, **kwargs) -> Dict[str, Any]:
|
||||||
position = win_data.get("position", "center")
|
position = win_data.get("position", "center")
|
||||||
win_delay: int = win_data.get("delay", WIN_DELAY)
|
win_delay: int = win_data.get("delay", WIN_DELAY)
|
||||||
|
|
||||||
canvas_size: Tuple[int, int] = win_data.get("canvas_size", WIN_CANVAS_SIZE)
|
canvas_size: Tuple[int, int] = win_data.get("canvas_size", w_canvas_size)
|
||||||
win_size: Tuple[int, int] = win_data.get("size", w_size)
|
win_size: Tuple[int, int] = win_data.get("size", w_size)
|
||||||
|
|
||||||
# Because provided cursor size is bigger than cursor's canvas.
|
# Because provided cursor size is bigger than cursor's canvas.
|
||||||
|
|
|
@ -11,26 +11,10 @@ URL = "https://github.com/ful1e5/apple_cursor"
|
||||||
|
|
||||||
# XCursor
|
# XCursor
|
||||||
X_DELAY: int = 10
|
X_DELAY: int = 10
|
||||||
X_SIZES: List[Tuple[int, int]] = [
|
|
||||||
(22, 22),
|
|
||||||
(24, 24),
|
|
||||||
(28, 28),
|
|
||||||
(32, 32),
|
|
||||||
(40, 40),
|
|
||||||
(48, 48),
|
|
||||||
(56, 56),
|
|
||||||
(64, 64),
|
|
||||||
(72, 72),
|
|
||||||
(80, 80),
|
|
||||||
(88, 88),
|
|
||||||
(96, 96),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# Windows Cursor
|
# Windows Cursor
|
||||||
WIN_DELAY = 1
|
WIN_DELAY = 1
|
||||||
WIN_CANVAS_SIZE = (32, 32)
|
|
||||||
WIN_SIZE = (24, 24)
|
|
||||||
|
|
||||||
X_CURSORS_CFG: Dict[str, Dict[str, int]] = {
|
X_CURSORS_CFG: Dict[str, Dict[str, int]] = {
|
||||||
##########
|
##########
|
||||||
|
@ -108,5 +92,5 @@ WIN_CURSORS_CFG: Dict[str, Dict[str, str]] = {
|
||||||
############
|
############
|
||||||
# Note: Animated cursors don't need frame numbers.
|
# Note: Animated cursors don't need frame numbers.
|
||||||
"left_ptr_watch": {"to": "Work", "position": "top_left"},
|
"left_ptr_watch": {"to": "Work", "position": "top_left"},
|
||||||
"wait": {"to": "Busy", "size": WIN_CANVAS_SIZE},
|
"wait": {"to": "Busy"},
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from applbuild.configure import get_config
|
|
||||||
|
|
||||||
|
from applbuild.configure import get_config
|
||||||
from applbuild.generator import build, wbuild, xbuild
|
from applbuild.generator import build, wbuild, xbuild
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
|
@ -49,7 +49,7 @@ parser.add_argument(
|
||||||
"-xs",
|
"-xs",
|
||||||
"--xsizes",
|
"--xsizes",
|
||||||
dest="xsizes",
|
dest="xsizes",
|
||||||
metavar="SIZE",
|
metavar="INT",
|
||||||
nargs="+",
|
nargs="+",
|
||||||
default=[
|
default=[
|
||||||
22,
|
22,
|
||||||
|
@ -74,7 +74,7 @@ parser.add_argument(
|
||||||
"-ws",
|
"-ws",
|
||||||
"--win-size",
|
"--win-size",
|
||||||
dest="win_size",
|
dest="win_size",
|
||||||
metavar="SIZE",
|
metavar="INT",
|
||||||
default=24,
|
default=24,
|
||||||
type=int,
|
type=int,
|
||||||
help="Set pixel-size for Windows cursors. (default: %(default)s)",
|
help="Set pixel-size for Windows cursors. (default: %(default)s)",
|
||||||
|
@ -84,8 +84,8 @@ parser.add_argument(
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-wcs",
|
"-wcs",
|
||||||
"--win-canvas-size",
|
"--win-canvas-size",
|
||||||
dest="win_sizes",
|
dest="win_canvas_size",
|
||||||
metavar="SIZE",
|
metavar="INT",
|
||||||
default=32,
|
default=32,
|
||||||
type=int,
|
type=int,
|
||||||
help="Set pixel-size for Windows cursor's canvas. (default: %(default)s)",
|
help="Set pixel-size for Windows cursor's canvas. (default: %(default)s)",
|
||||||
|
@ -99,8 +99,12 @@ bitmaps_dir = Path(args.png_dir)
|
||||||
x_out_dir = Path(args.out_dir) / "macOSBigSur"
|
x_out_dir = Path(args.out_dir) / "macOSBigSur"
|
||||||
win_out_dir = Path(args.out_dir) / "macOSBigSur_Windows"
|
win_out_dir = Path(args.out_dir) / "macOSBigSur_Windows"
|
||||||
|
|
||||||
|
config = get_config(
|
||||||
config = get_config(bitmaps_dir)
|
bitmaps_dir,
|
||||||
|
x_sizes=args.xsizes,
|
||||||
|
win_canvas_size=args.win_canvas_size,
|
||||||
|
win_size=args.win_size,
|
||||||
|
)
|
||||||
|
|
||||||
if args.platform == "unix":
|
if args.platform == "unix":
|
||||||
xbuild(config, x_out_dir)
|
xbuild(config, x_out_dir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue