-
Notifications
You must be signed in to change notification settings - Fork 6
/
genin.py
executable file
·106 lines (99 loc) · 2.96 KB
/
genin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# The hotspots dictionary was generated by running the following command in the
# source directory [1] ../adwaita-icon-theme/src/cursors/pngs/
#
# $ grep ^24 *.in | sed -r 's/^([^:].*)\.in:24 ([0-9]+) ([0-9]+).*/"\1": [\2, \3],/' | sort | uniq
#
# [1]: https://github.com/GNOME/adwaita-icon-theme/tree/mainline/src/cursors/pngs
import sys
HOTSPOTS = {
"all-scroll": [11, 11],
"bd_double_arrow": [11, 11],
"bottom_left_corner": [10, 15],
"bottom_right_corner": [15, 15],
"bottom_side": [13, 18],
"bottom_tee": [12, 19],
"circle": [4, 4],
"context-menu": [4, 4],
"copy": [4, 4],
"cross": [11, 11],
"crossed_circle": [12, 12],
"crosshair": [11, 11],
"dnd-ask": [9, 9],
"dnd-copy": [9, 9],
"dnd-link": [9, 9],
"dnd-move": [9, 9],
"dnd-no-drop": [9, 9],
"dnd-none": [12, 11],
"dotbox": [11, 11],
"fd_double_arrow": [11, 11],
"grabbing": [12, 11],
"hand1": [11, 7],
"hand2": [8, 5],
"left_ptr": [4, 4],
"left_side": [6, 13],
"left_tee": [6, 12],
"link": [4, 4],
"ll_angle": [4, 19],
"lr_angle": [20, 19],
"move": [12, 11],
"pencil": [7, 21],
"plus": [10, 11],
"pointer-move": [4, 4],
"question_arrow": [12, 21],
"right_ptr": [21, 4],
"right_side": [19, 13],
"right_tee": [20, 12],
"sb_down_arrow": [12, 19],
"sb_h_double_arrow": [12, 12],
"sb_left_arrow": [6, 12],
"sb_right_arrow": [19, 12],
"sb_up_arrow": [12, 3],
"sb_v_double_arrow": [12, 13],
"tcross": [12, 12],
"top_left_corner": [10, 10],
"top_right_corner": [15, 10],
"top_side": [13, 6],
"top_tee": [12, 5],
"ul_angle": [4, 5],
"ur_angle": [20, 5],
"vertical-text": [12, 11],
"X_cursor": [12, 12],
"xterm": [11, 12],
"zoom-in": [11, 10],
"zoom-out": [11, 10],
}
HOTSPOTS_ANIMATED = {
"watch": [11, 11, 16],
"left_ptr_watch": [4, 3, 16],
}
if len(sys.argv) > 1:
SIZES = [int(size) for size in sys.argv[1:]]
else:
SIZES = range(24, 96 + 1, 6)
for name, hs in HOTSPOTS_ANIMATED.items():
with open(name + ".in", "w") as fd:
for size in SIZES:
for i in range(1, 60 + 1):
fd.write(
"{size} {xhot} {yhot} png/{size}x{size}/{name}_{i:04d}.png {ms}\n".format(
size=size,
xhot=round(hs[0] / 24 * size),
yhot=round(hs[1] / 24 * size),
name=name,
i=i,
ms=hs[2],
)
)
for name, hs in HOTSPOTS.items():
with open(name + ".in", "w") as fd:
for size in SIZES:
fd.write(
"{size} {xhot} {yhot} png/{size}x{size}/{name}.png\n".format(
size=size,
xhot=round(hs[0] / 24 * size),
yhot=round(hs[1] / 24 * size),
name=name,
)
)