Builder init

This commit is contained in:
ful1e5 2021-01-27 13:01:28 +05:30
parent 656d1cc604
commit 13b9861f04
11 changed files with 0 additions and 282 deletions

0
Makefile Normal file
View file

View file

@ -1,19 +0,0 @@
import json
import log
from clickgen import build_cursor_theme
from config import name, sizes, delay, bitmaps_dir, temp_folder
from helper import init_build, pack_it
def build() -> None:
init_build()
with open('./hotspots.json', 'r') as hotspot_file:
hotspots = json.loads(hotspot_file.read())
build_cursor_theme(name, image_dir=bitmaps_dir,
cursor_sizes=sizes, out_path=temp_folder, hotspots=hotspots, archive=False, delay=delay)
pack_it()
if __name__ == "__main__":
build()

0
builder/setup.py Normal file
View file

0
builder/src/__init__.py Normal file
View file

0
builder/src/configure.py Normal file
View file

0
builder/src/generator.py Normal file
View file

View file

@ -1,46 +0,0 @@
import tempfile
import json
# Build Config
delay = 50
name = "macOSBigSur"
sizes = [22, 24, 28, 32, 40, 48, 56, 64, 72, 80, 88, 96]
bitmaps_dir = "./bitmaps"
package_dir = "./themes"
temp_folder = tempfile.mkdtemp()
# Cleanup Configs
x11_out = name
win_out = name + "_Windows"
# getting author name
with open("./package.json") as f:
data = json.loads(f.read())
author = data["author"]
# Windows Cursors Config
windows_cursors = {
"right_ptr.cur": "Alternate.cur",
"wait.ani": "Busy.ani",
"crosshair.cur": "Cross.cur",
"left_ptr.cur": "Default.cur",
"bd_double_arrow.cur": "Diagonal_1.cur",
"fd_double_arrow.cur": "Diagonal_2.cur",
"pencil.cur": "Handwriting.cur",
"dnd-ask.cur": "Help.cur",
"sb_h_double_arrow.cur": "Horizontal.cur",
"hand2.cur": "Link.cur",
"hand1.cur": "Move.cur",
"xterm.cur": "Text.cur",
"circle.cur": "Unavailiable.cur",
"sb_v_double_arrow.cur": "Vertical.cur",
"left_ptr_watch.ani": "Work.ani",
}
# Windows install.inf file content
with open("./scripts/windows.inf") as f:
data = f.read()
window_install_inf_content = data.replace(
"<inject_theme_name>", name + " Cursors"
).replace("<inject_author_name>", author)

View file

@ -1,61 +0,0 @@
import shutil
import json
import sys
from config import name, temp_folder, bitmaps_dir, win_out, x11_out, window_install_inf_content, windows_cursors, package_dir
from os import path, listdir, rename, remove
x11_out_dir = path.join(package_dir, x11_out)
win_out_dir = path.join(package_dir, win_out)
def window_bundle() -> None:
# Remove & Rename cursors
# If Key found => Rename else Remove
for cursor in listdir(win_out_dir):
old_path = path.join(win_out_dir, cursor)
try:
new_path = path.join(win_out_dir, windows_cursors[cursor])
rename(old_path, new_path)
except KeyError:
remove(old_path)
# creating install.inf file
install_inf_path = path.join(win_out_dir, "install.inf")
with open(install_inf_path, "w") as file:
file.write(window_install_inf_content)
def init_build() -> None:
"""
Print build version.
Remove previously built packages && Check Bitmaps.
"""
with open("./package.json", "r") as package_file:
data = json.loads(package_file.read())
version = data['version']
print("⚡ Apple Cursor Version %s" % version)
# cleanup old packages
if path.exists(package_dir):
shutil.rmtree(package_dir)
# Checking Bitmaps directory
if not path.exists(bitmaps_dir):
print(
"⚠ BITMAPS NOT FOUND.\n\n`yarn install && yarn render` to Generates Bitmaps")
sys.exit(1)
def pack_it() -> None:
"""
Create Crisp 📦 Packages for Windows & X11 Cursor Theme.
"""
# Rename directory
shutil.move(path.join(temp_folder, name, "x11"), x11_out_dir)
shutil.move(path.join(temp_folder, name, "win"), win_out_dir)
# create install.inf file in Windows Theme
window_bundle()

View file

@ -1,102 +0,0 @@
{
"all_scroll": { "xhot": 100, "yhot": 100 },
"bottom_left_corner": { "xhot": 100, "yhot": 100 },
"fd_double_arrow": { "xhot": 100, "yhot": 100 },
"top_right_corner": { "xhot": 100, "yhot": 100 },
"bottom_right_corner": { "xhot": 100, "yhot": 100 },
"bd_double_arrow": { "xhot": 100, "yhot": 100 },
"top_left_corner": { "xhot": 100, "yhot": 100 },
"bottom_tee": { "xhot": 141, "yhot": 99 },
"center_ptr": { "xhot": 61, "yhot": 100 },
"circle": { "xhot": 47, "yhot": 39 },
"crossed_circle": { "xhot": 47, "yhot": 39 },
"dnd_no_drop": { "xhot": 47, "yhot": 39 },
"context_menu": { "xhot": 61, "yhot": 58 },
"copy": { "xhot": 47, "yhot": 39 },
"dnd_copy": { "xhot": 47, "yhot": 39 },
"cross": { "xhot": 100, "yhot": 100 },
"tcross": { "xhot": 100, "yhot": 100 },
"crosshair": { "xhot": 100, "yhot": 100 },
"dotbox": { "xhot": 100, "yhot": 100 },
"hand1": { "xhot": 94, "yhot": 105 },
"hand2": { "xhot": 66, "yhot": 34 },
"left_ptr": { "xhot": 68, "yhot": 41 },
"left_side": { "xhot": 100, "yhot": 100 },
"right_side": { "xhot": 100, "yhot": 100 },
"left_tee": { "xhot": 100, "yhot": 58 },
"link": { "xhot": 61, "yhot": 105 },
"dnd_link": { "xhot": 61, "yhot": 105 },
"ll_angle": { "xhot": 141, "yhot": 58 },
"lr_angle": { "xhot": 141, "yhot": 138 },
"move": { "xhot": 80, "yhot": 106 },
"dnd_move": { "xhot": 80, "yhot": 106 },
"dnd_none": { "xhot": 80, "yhot": 106 },
"grabbing": { "xhot": 80, "yhot": 106 },
"pointer_move": { "xhot": 80, "yhot": 106 },
"pencil": { "xhot": 141, "yhot": 58 },
"plus": { "xhot": 100, "yhot": 100 },
"question_arrow": { "xhot": 105, "yhot": 105 },
"dnd_ask": { "xhot": 105, "yhot": 105 },
"right_ptr": { "xhot": 61, "yhot": 138 },
"right_tee": { "xhot": 100, "yhot": 138 },
"sb_down_arrow": { "xhot": 133, "yhot": 99 },
"sb_h_double_arrow": { "xhot": 100, "yhot": 100 },
"sb_left_arrow": { "xhot": 100, "yhot": 68 },
"sb_right_arrow": { "xhot": 100, "yhot": 138 },
"sb_up_arrow": { "xhot": 68, "yhot": 99 },
"sb_v_double_arrow": { "xhot": 100, "yhot": 100 },
"top_side": { "xhot": 100, "yhot": 100 },
"bottom_side": { "xhot": 100, "yhot": 100 },
"top_tee": { "xhot": 61, "yhot": 99 },
"ul_angle": { "xhot": 61, "yhot": 65 },
"ur_angle": { "xhot": 61, "yhot": 138 },
"vertical_text": { "xhot": 100, "yhot": 102 },
"wait": { "xhot": 104, "yhot": 105 },
"left_ptr_watch": { "xhot": 104, "yhot": 105 },
"wayland_cursor": { "xhot": 100, "yhot": 100 },
"x_cursor": { "xhot": 100, "yhot": 100 },
"xterm": { "xhot": 97, "yhot": 97 },
"zoom_in": { "xhot": 76, "yhot": 78 },
"zoom_out": { "xhot": 76, "yhot": 78 }
}

View file

@ -1,2 +0,0 @@
clickgen==1.1.7
Pillow==8.0.1

View file

@ -1,52 +0,0 @@
[Version]
signature="$CHICAGO$"
<inject_theme_name> By Kaiz Khatri
https://github.com/ful1e5/apple_cursor
[DefaultInstall]
CopyFiles = Scheme.Cur
AddReg = Scheme.Reg
[DestinationDirs]
Scheme.Cur = 10,"%CUR_DIR%"
[Scheme.Reg]
HKCU,"Control Panel\Cursors\Schemes","%SCHEME_NAME%",,"%10%\%CUR_DIR%\%pointer%,%10%\%CUR_DIR%\%help%,%10%\%CUR_DIR%\%work%,%10%\%CUR_DIR%\%busy%,%10%\%CUR_DIR%\%Cross%,%10%\%CUR_DIR%\%Text%,%10%\%CUR_DIR%\%Hand%,%10%\%CUR_DIR%\%Unavailiable%,%10%\%CUR_DIR%\%Vert%,%10%\%CUR_DIR%\%Horz%,%10%\%CUR_DIR%\%Dgn1%,%10%\%CUR_DIR%\%Dgn2%,%10%\%CUR_DIR%\%move%,%10%\%CUR_DIR%\%alternate%,%10%\%CUR_DIR%\%link%"
; -- Installed files
[Scheme.Cur]
"Default.cur"
"Help.cur"
"Work.ani"
"Busy.ani"
"Cross.cur"
"Text.cur"
"Handwriting.cur"
"Unavailiable.cur"
"Vertical.cur"
"Horizontal.cur"
"Diagonal_1.cur"
"Diagonal_2.cur"
"Move.cur"
"Alternate.cur"
"Link.cur"
[Strings]
CUR_DIR = "Cursors\<inject_theme_name>"
SCHEME_NAME = "<inject_theme_name>"
pointer = "Default.cur"
help = "Help.cur"
work = "Work.ani"
busy = "Busy.ani"
cross = "Cross.cur"
text = "Text.cur"
hand = "Handwriting.cur"
unavailiable = "Unavailiable.cur"
vert = "Vertical.cur"
horz = "Horizontal.cur"
dgn1 = "Diagonal_1.cur"
dgn2 = "Diagonal_2.cur"
move = "Move.cur"
alternate = "Alternate.cur"
link = "Link.cur"