mirror of
https://github.com/ful1e5/apple_cursor.git
synced 2025-05-14 15:15:02 -04:00
Merge branch 'dev'
This commit is contained in:
commit
16a68880c0
17 changed files with 248 additions and 232 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -1,9 +1,9 @@
|
|||
########## Custom
|
||||
# --------------------------------------------- Custom
|
||||
bitmaps
|
||||
themes
|
||||
builder/files.txt
|
||||
bin
|
||||
|
||||
########## Python
|
||||
# --------------------------------------------- Python
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
|
@ -136,7 +136,7 @@ dmypy.json
|
|||
.pyre/
|
||||
|
||||
|
||||
######### Node
|
||||
# --------------------------------------------- Nodejs
|
||||
|
||||
# Logs
|
||||
logs
|
||||
|
@ -253,4 +253,4 @@ dist
|
|||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
.pnp.*
|
||||
|
|
79
CHANGELOG.md
79
CHANGELOG.md
|
@ -7,7 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [unreleased]
|
||||
|
||||
## [1.1.4] - 4 Apr 2021
|
||||
## [v1.1.6] - 13 Aug 2021
|
||||
|
||||
### Added
|
||||
|
||||
- Support button inside PLING.bbcode product page
|
||||
- `make prepare` command for preparing bibata binaries
|
||||
- `pyrightconfig.json` init
|
||||
|
||||
### Changed
|
||||
|
||||
- Removed **clean** target from `builder/Makefile`
|
||||
- Compact code inside `builder/*`
|
||||
- Remove `setup.py`
|
||||
- Builder code moved to `src`
|
||||
- Import `src` module directly inside `build.py`
|
||||
- `Makefile` build commands re-arrange with groups
|
||||
- `crosshair` cursors border added fixed #59
|
||||
|
||||
## [v1.1.5] - 21 Jun 2021
|
||||
|
||||
### Added
|
||||
|
||||
- Setup target updated inside `builder/Makefile`
|
||||
|
||||
### Changed
|
||||
|
||||
- `applbuild` modules relative imports
|
||||
- Removed `setup.py` from `builder/`
|
||||
|
||||
## [v1.1.4] - 4 Apr 2021
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -29,7 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Add Shadows / Drop Shadows to arrow cursor fixed #45 (check 29ab657)
|
||||
- Fixed Windows HiDPi issue #43 (check 7b49e34)
|
||||
|
||||
## [1.1.3] - 21 Feb 2021
|
||||
## [v1.1.3] - 21 Feb 2021
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -39,7 +68,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- Preview with shadows cursors
|
||||
|
||||
## [1.1.2] - 15 Feb 2021
|
||||
## [v1.1.2] - 15 Feb 2021
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -50,13 +79,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Dynamic make install
|
||||
- #39 Corner resize cursors are inverted fixed
|
||||
|
||||
## [1.1.1] - 9 Feb 2021
|
||||
## [v1.1.1] - 9 Feb 2021
|
||||
|
||||
### Changed
|
||||
|
||||
- Cursor is not in expected position fixed #37
|
||||
|
||||
## [1.1.0] - 7 Feb 2021
|
||||
## [v1.1.0] - 7 Feb 2021
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -74,7 +103,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Windows cursors are renamed
|
||||
- cursor's config moved to `builder/applbuild/constants.py`
|
||||
|
||||
## [1.0.6] - 1 Nov 2020
|
||||
## [v1.0.6] - 1 Nov 2020
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -87,7 +116,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Removed npm scripts & documentation (`yon` package removed)
|
||||
- npm dependencies got upgraded (**dependabot** 🤖 security warning)
|
||||
|
||||
## [1.0.6] - 1 Nov 2020
|
||||
## [v1.0.6] - 1 Nov 2020
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -102,7 +131,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Cursor **preview** updated
|
||||
- `hand2` lines fixed.(from pling.com @peotincelogy)
|
||||
|
||||
## [1.0.5] - 23 Oct 2020
|
||||
## [v1.0.5] - 23 Oct 2020
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -115,7 +144,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Windows **wrong resize** cursor fix.
|
||||
- README.md docs & Table of Content refactor.
|
||||
|
||||
## [1.0.4] - 25 Sept 2020
|
||||
## [v1.0.4] - 25 Sept 2020
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -123,7 +152,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- fix wrong implementation vertical resize cursor in **KDE**
|
||||
- Compressed files in `build` **GitHub Action**
|
||||
|
||||
## [1.0.3] - 30 August 2020
|
||||
## [v1.0.3] - 30 August 2020
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -146,7 +175,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- New `utils` for **Frames Save**
|
||||
- **OCS** Install support **as default** for Linux users
|
||||
|
||||
## [1.0.2] - 10 August 2020
|
||||
## [v1.0.2] - 10 August 2020
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -166,7 +195,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- **install.sh** and **windows.inf**(automated installation files) added in `scripts` directory.
|
||||
- Table Of Content in `README.md`([476c64a](https://github.com/ful1e5/apple_cursor/commit/476c64afda50ec48c576b566ce729b575608c529#diff-04c6e90faac2675aa89e2176d2eec7d8))
|
||||
|
||||
## [1.0.1-beta] - 3 August 2020
|
||||
## [v1.0.1-beta] - 3 August 2020
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -175,7 +204,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Build size fix **65x65** to **64x64**. ([1120d17](https://github.com/ful1e5/apple_cursor/commit/1120d176636baff2aac1838ba316b4f420be7ca7))
|
||||
- [Pling](https://www.pling.com/p/1408466/) product page Docs at `PLING.bbcode`.
|
||||
|
||||
## [1.0.0-alpha1] - 31 July 2020
|
||||
## [v1.0.0-alpha1] - 31 July 2020
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -184,15 +213,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- CI/CD Pipelines
|
||||
|
||||
[unreleased]: https://github.com/ful1e5/apple_cursor/compare/v1.1.4...main
|
||||
[1.1.4]: https://github.com/ful1e5/apple_cursor/compare/v1.1.3...v1.1.4
|
||||
[1.1.3]: https://github.com/ful1e5/apple_cursor/compare/v1.1.2...v1.1.3
|
||||
[1.1.2]: https://github.com/ful1e5/apple_cursor/compare/v1.1.1...v1.1.2
|
||||
[1.1.1]: https://github.com/ful1e5/apple_cursor/compare/v1.1.0...v1.1.1
|
||||
[1.1.0]: https://github.com/ful1e5/apple_cursor/compare/v1.0.6...v1.1.0
|
||||
[1.0.6]: https://github.com/ful1e5/apple_cursor/compare/1.0.5...v1.0.6
|
||||
[1.0.5]: https://github.com/ful1e5/apple_cursor/compare/1.0.4...v1.0.5
|
||||
[1.0.4]: https://github.com/ful1e5/apple_cursor/compare/1.0.3...1.0.4
|
||||
[1.0.3]: https://github.com/ful1e5/apple_cursor/compare/1.0.2...1.0.3
|
||||
[1.0.2]: https://github.com/ful1e5/apple_cursor/compare/1.0.1-beta...1.0.2
|
||||
[1.0.1-beta]: https://github.com/ful1e5/apple_cursor/compare/1.0.0-alpha1...1.0.1-beta
|
||||
[1.0.0-alpha1]: https://github.com/ful1e5/apple_cursor/tree/1.0.0-alpha1
|
||||
[v1.1.4]: https://github.com/ful1e5/apple_cursor/compare/v1.1.3...v1.1.4
|
||||
[v1.1.3]: https://github.com/ful1e5/apple_cursor/compare/v1.1.2...v1.1.3
|
||||
[v1.1.2]: https://github.com/ful1e5/apple_cursor/compare/v1.1.1...v1.1.2
|
||||
[v1.1.1]: https://github.com/ful1e5/apple_cursor/compare/v1.1.0...v1.1.1
|
||||
[v1.1.0]: https://github.com/ful1e5/apple_cursor/compare/v1.0.6...v1.1.0
|
||||
[v1.0.6]: https://github.com/ful1e5/apple_cursor/compare/1.0.5...v1.0.6
|
||||
[v1.0.5]: https://github.com/ful1e5/apple_cursor/compare/1.0.4...v1.0.5
|
||||
[v1.0.4]: https://github.com/ful1e5/apple_cursor/compare/1.0.3...1.0.4
|
||||
[v1.0.3]: https://github.com/ful1e5/apple_cursor/compare/1.0.2...1.0.3
|
||||
[v1.0.2]: https://github.com/ful1e5/apple_cursor/compare/1.0.1-beta...1.0.2
|
||||
[v1.0.1-beta]: https://github.com/ful1e5/apple_cursor/compare/1.0.0-alpha1...1.0.1-beta
|
||||
[v1.0.0-alpha1]: https://github.com/ful1e5/apple_cursor/tree/1.0.0-alpha1
|
||||
|
|
18
Makefile
18
Makefile
|
@ -8,15 +8,14 @@ render: bitmapper svg
|
|||
@cd bitmapper && $(MAKE)
|
||||
|
||||
build: bitmaps
|
||||
@cd builder && make build && make clean
|
||||
@cd builder && make build
|
||||
|
||||
|
||||
unix: clean render bitmaps
|
||||
@cd builder && make build_unix && make clean
|
||||
@cd builder && make build_unix
|
||||
|
||||
windows: clean render bitmaps
|
||||
@cd builder && make build_windows && make clean
|
||||
|
||||
@cd builder && make build_windows
|
||||
|
||||
|
||||
# Installation
|
||||
|
@ -53,3 +52,14 @@ uninstall:
|
|||
@fi
|
||||
|
||||
reinstall: uninstall install
|
||||
|
||||
BIN_DIR = ../bin
|
||||
prepare: bitmaps themes
|
||||
# Bitmaps
|
||||
@rm -rf bin && mkdir bin
|
||||
@cd bitmaps && zip -r $(BIN_DIR)/bitmaps.zip * && cd ..
|
||||
# Themes
|
||||
@cd themes
|
||||
@tar -czvf $(BIN_DIR)/macOSBigSur.tar.gz macOSBigSur
|
||||
@zip -r $(BIN_DIR)/macOSBigSur_Windows.zip macOSBigSur_Windows
|
||||
@cd ..
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
[i]Release Notification[/i] at [b][url=https://twitter.com/ful1e5]Twitter[/url][/b](@ful1e5)
|
||||
For [i]Customizing Size[/i] check [b][url=https://github.com/ful1e5/apple_cursor#manual-build]README.md[/url][/b]
|
||||
|
||||
[b] Support Creator[/b]
|
||||
|
||||
[url=https://www.buymeacoffee.com/Nt7Wg4V][img]https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png[/img][/url]
|
||||
|
||||
|
||||
[b]Linux/X11 installation[/b]
|
||||
Get the latest stable Linux release from the [b][url=https://www.pling.com/p/1408466/#files-panel]Pling[/url][/b]. Unpack the [b].tar.gz[/b] file and follow these [b]commands[/b].
|
||||
|
||||
|
@ -38,4 +43,4 @@ Get the latest stable Linux release from the [b][url=https://www.pling.com/p/140
|
|||
[/list]
|
||||
|
||||
[b]License & Terms[/b]
|
||||
'[b]macOS Big Sur[/b]' Cursor Theme is available under the terms of the [b]GPL-3.0[/b] license.
|
||||
'[b]macOS Big Sur[/b]' Cursor Theme is available under the terms of the [b]GPL-3.0[/b] license.
|
||||
|
|
|
@ -134,7 +134,7 @@ sudo mv macOSBigSur /usr/share/icons/
|
|||
<!-- Preview -->
|
||||
|
||||
<p align="center">
|
||||
<img title="macOS Big Sur" src="https://i.imgur.com/6BLMieI.png">
|
||||
<img title="macOS Big Sur" src="https://imgur.com/7QYBFiK.png">
|
||||
</br>
|
||||
<sub>macOSBigSur Cursors 🍎</sub>
|
||||
</p>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "apple_cursor_bitmapper",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.6",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"render": "yarn ts-node src/index.ts"
|
||||
|
|
|
@ -8,18 +8,8 @@ X_SIZES ?=22 24 28 32 40 48 56 64 72 80 88 96
|
|||
WIN_CANVAS_SIZE ?= 32
|
||||
WIN_SIZE ?= 24
|
||||
|
||||
clean:
|
||||
@rm -rf applbuild.egg-info build dist
|
||||
@find -iname "*.pyc" -delete
|
||||
|
||||
# Removing setup.py package files if installed
|
||||
@if [ -f "files.txt" ]; then
|
||||
@xargs rm -rf < files.txt
|
||||
@rm -rf files.txt
|
||||
@fi
|
||||
|
||||
setup: clean setup.py
|
||||
@python3 setup.py install --user --record files.txt
|
||||
setup: clean
|
||||
@python3 -m pip install clickgen --user
|
||||
|
||||
build: setup build.py
|
||||
@python3 build.py --xsizes $(X_SIZES) --win-size $(WIN_SIZE) --win-canvas-size $(WIN_CANVAS_SIZE)
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
|
||||
from applbuild.constants import AUTHOR, COMMENT, THEME_NAME, URL
|
||||
from applbuild.symlinks import add_missing_xcursor
|
||||
from clickgen.builders import WindowsCursor, XCursor
|
||||
from clickgen.core import CursorAlias
|
||||
from clickgen.packagers import WindowsPackager, XPackager
|
||||
|
||||
|
||||
def xbuild(
|
||||
config: Dict[str, Dict[str, Any]],
|
||||
x_out_dir: Path,
|
||||
) -> None:
|
||||
"""Build `macOSBigSur` cursor theme for only `X11`(UNIX) platform.
|
||||
|
||||
:param config: `macOSBigSur` configuration.
|
||||
:type config: Dict[str, Dict[str, Any]]
|
||||
|
||||
:param x_out_dir: Path to the output directory, \
|
||||
Where the `X11` cursor theme package will\
|
||||
generate. It also creates a directory if not exists.
|
||||
:type x_out_dir: Path
|
||||
"""
|
||||
|
||||
for _, item in config.items():
|
||||
png = item["png"]
|
||||
hotspot = item["hotspot"]
|
||||
x_sizes = item["x_sizes"]
|
||||
delay = item["delay"]
|
||||
|
||||
with CursorAlias.from_bitmap(png, hotspot) as alias:
|
||||
x_cfg = alias.create(x_sizes, delay)
|
||||
print(f"Building '{x_cfg.stem}' XCursor...")
|
||||
XCursor.create(x_cfg, x_out_dir)
|
||||
|
||||
add_missing_xcursor(x_out_dir / "cursors")
|
||||
XPackager(x_out_dir, THEME_NAME, COMMENT)
|
||||
|
||||
|
||||
def wbuild(config: Dict[str, Dict[str, Any]], win_out_dir: Path) -> None:
|
||||
"""Build `macOSBigSur` cursor theme for only `Windows` platforms.
|
||||
|
||||
:param config: `macOSBigSur` configuration.
|
||||
:type config: Dict[str, Dict[str, Any]]
|
||||
|
||||
:param win_out_dir: Path to the output directory, \
|
||||
Where the `Windows` cursor theme package will\
|
||||
generate. It also creates a directory if not exists.
|
||||
:type win_out_dir: Path
|
||||
"""
|
||||
|
||||
for _, item in config.items():
|
||||
png = item["png"]
|
||||
hotspot = item["hotspot"]
|
||||
x_sizes = item["x_sizes"]
|
||||
delay = item["delay"]
|
||||
|
||||
with CursorAlias.from_bitmap(png, hotspot) as alias:
|
||||
alias.create(x_sizes, delay)
|
||||
|
||||
if item.get("win_key"):
|
||||
position = item["position"]
|
||||
win_size = item["win_size"]
|
||||
win_key = item["win_key"]
|
||||
canvas_size = item["canvas_size"]
|
||||
win_delay = item["win_delay"]
|
||||
|
||||
win_cfg = alias.reproduce(
|
||||
win_size, canvas_size, position, delay=win_delay
|
||||
).rename(win_key)
|
||||
print(f"Building '{win_cfg.stem}' Windows Cursor...")
|
||||
WindowsCursor.create(win_cfg, win_out_dir)
|
||||
|
||||
WindowsPackager(win_out_dir, THEME_NAME, COMMENT, AUTHOR, URL)
|
||||
|
||||
|
||||
def build(
|
||||
config: Dict[str, Dict[str, Any]], x_out_dir: Path, win_out_dir: Path
|
||||
) -> None:
|
||||
"""Build `macOSBigSur` cursor theme for `X11` & `Windows` platforms.
|
||||
|
||||
:param config: `macOSBigSur` configuration.
|
||||
:type config: Dict[str, Dict[str, Any]]
|
||||
|
||||
:param x_out_dir: Path to the output directory, \
|
||||
Where the `X11` cursor theme package will\
|
||||
generate. It also creates a directory if not exists.
|
||||
:type x_out_dir: Path
|
||||
|
||||
:param win_out_dir: Path to the output directory, \
|
||||
Where the `Windows` cursor theme package will\
|
||||
generate. It also creates a directory if not exists.
|
||||
:type win_out_dir: Path
|
||||
"""
|
||||
|
||||
def win_build(item: Dict[str, Any], alias: CursorAlias) -> None:
|
||||
position = item["position"]
|
||||
win_size = item["win_size"]
|
||||
win_key = item["win_key"]
|
||||
canvas_size = item["canvas_size"]
|
||||
win_delay = item["win_delay"]
|
||||
|
||||
win_cfg = alias.reproduce(
|
||||
win_size, canvas_size, position, delay=win_delay
|
||||
).rename(win_key)
|
||||
print(f"Building '{win_cfg.stem}' Windows Cursor...")
|
||||
WindowsCursor.create(win_cfg, win_out_dir)
|
||||
|
||||
for _, item in config.items():
|
||||
png = item["png"]
|
||||
hotspot = item["hotspot"]
|
||||
x_sizes = item["x_sizes"]
|
||||
delay = item["delay"]
|
||||
|
||||
with CursorAlias.from_bitmap(png, hotspot) as alias:
|
||||
x_cfg = alias.create(x_sizes, delay)
|
||||
print(f"Building '{x_cfg.stem}' XCursor...")
|
||||
XCursor.create(x_cfg, x_out_dir)
|
||||
|
||||
if item.get("win_key"):
|
||||
win_build(item, alias)
|
||||
|
||||
add_missing_xcursor(x_out_dir / "cursors")
|
||||
XPackager(x_out_dir, THEME_NAME, COMMENT)
|
||||
|
||||
WindowsPackager(win_out_dir, THEME_NAME, COMMENT, AUTHOR, URL)
|
|
@ -4,8 +4,8 @@
|
|||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
from applbuild.configure import get_config
|
||||
from applbuild.generator import build, wbuild, xbuild
|
||||
from src.configure import get_config
|
||||
from src.generator import build, wbuild, xbuild
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="apple_builder",
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name="applbuild",
|
||||
version="1.1.4",
|
||||
description="Generate 'macOSBigSur' cursor theme from PNGs file",
|
||||
url="https://github.com/ful1e5/apple_cursor",
|
||||
packages=["applbuild"],
|
||||
package_dir={"applbuild": "applbuild"},
|
||||
author="Kaiz Khatri",
|
||||
author_email="kaizmandhu@gamil.com",
|
||||
install_requires=["clickgen==1.1.9"],
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
],
|
||||
python_requires=">=3.8",
|
||||
zip_safe=True,
|
||||
)
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Tuple, TypeVar, Union
|
||||
from typing import Any, Dict, Tuple, TypeVar
|
||||
|
||||
from applbuild.constants import WIN_CURSORS_CFG, WIN_DELAY, X_CURSORS_CFG, X_DELAY
|
||||
from clickgen.util import PNGProvider
|
||||
|
||||
from .constants import WIN_CURSORS_CFG, WIN_DELAY, X_CURSORS_CFG, X_DELAY
|
||||
|
||||
X = TypeVar("X")
|
||||
|
||||
|
||||
|
@ -14,29 +14,31 @@ def to_tuple(x: X) -> Tuple[X, X]:
|
|||
return (x, x)
|
||||
|
||||
|
||||
def get_config(bitmaps_dir: Union[str, Path], **kwargs) -> Dict[str, Any]:
|
||||
"""Return configuration of `macOSBigSur` pointers.
|
||||
def get_config(bitmaps_dir, **kwargs) -> Dict[str, Any]:
|
||||
"""Return configuration of `GoogleDot` pointers.
|
||||
|
||||
:param bitmaps_dir: Path to .png file's directory.
|
||||
:type bitmaps_dir: Union[str, Path]
|
||||
:type bitmaps_dir: ``str`` or ``pathlib.Path``
|
||||
|
||||
:param x_sizes: List of pixel-sizes for xcursors.
|
||||
:type x_sizes: List[int]
|
||||
:param **kwargs:
|
||||
See below
|
||||
|
||||
:param win_canvas_size: Windows cursor's canvas pixel-size.
|
||||
:type win_canvas_size: int
|
||||
|
||||
:param win_size: Pixel-size for Windows cursor.
|
||||
:type win_size: int
|
||||
:Keyword Arguments:
|
||||
* *x_sizes* (``List[int]``) --
|
||||
List of pixel-sizes for xcursors.
|
||||
* *win_canvas_size* (``int``) --
|
||||
Windows cursor's canvas pixel-size.
|
||||
* *win_size* (``int``) --
|
||||
Pixel-size for Windows cursor.
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
get_config(
|
||||
"./bitmaps",
|
||||
x_sizes=[(24, 24), (32, 32)],
|
||||
win_canvas_size=(32, 32),
|
||||
win_size=(24, 24),
|
||||
bitmaps_dir="./bitmaps",
|
||||
x_sizes=[24, 28, 32],
|
||||
win_canvas_size=32,
|
||||
win_size=24,
|
||||
)
|
||||
```
|
||||
"""
|
||||
|
@ -49,6 +51,7 @@ def get_config(bitmaps_dir: Union[str, Path], **kwargs) -> Dict[str, Any]:
|
|||
for size in raw_x_sizes:
|
||||
x_sizes.append(to_tuple(size))
|
||||
|
||||
png_provider = PNGProvider(bitmaps_dir)
|
||||
config: Dict[str, Any] = {}
|
||||
|
||||
for key, item in X_CURSORS_CFG.items():
|
||||
|
@ -57,13 +60,12 @@ def get_config(bitmaps_dir: Union[str, Path], **kwargs) -> Dict[str, Any]:
|
|||
hotspot: Tuple[int, int] = (x_hot, y_hot)
|
||||
|
||||
delay: int = int(item.get("delay", X_DELAY))
|
||||
pngs = PNGProvider(bitmaps_dir).get(key)
|
||||
|
||||
if not pngs:
|
||||
raise FileNotFoundError(f"{key} not found in {bitmaps_dir}")
|
||||
png = png_provider.get(key)
|
||||
if not png:
|
||||
raise FileNotFoundError(f"{key} not found")
|
||||
|
||||
data = {
|
||||
"png": pngs,
|
||||
"png": png,
|
||||
"x_sizes": x_sizes,
|
||||
"hotspot": hotspot,
|
||||
"delay": delay,
|
||||
|
@ -94,7 +96,6 @@ def get_config(bitmaps_dir: Union[str, Path], **kwargs) -> Dict[str, Any]:
|
|||
"win_size": win_size,
|
||||
"win_delay": win_delay,
|
||||
}
|
||||
|
||||
else:
|
||||
config[key] = data
|
||||
|
120
builder/src/generator.py
Normal file
120
builder/src/generator.py
Normal file
|
@ -0,0 +1,120 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""This module provides build methods for ``macOSBigSur``."""
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
|
||||
from clickgen.builders import WindowsCursor, XCursor
|
||||
from clickgen.core import CursorAlias
|
||||
from clickgen.packagers import WindowsPackager, XPackager
|
||||
|
||||
from .constants import AUTHOR, COMMENT, THEME_NAME, URL
|
||||
from .symlinks import add_missing_xcursor
|
||||
|
||||
|
||||
def xbuild(config: Dict[str, Dict[str, Any]], x_out_dir: Path) -> None:
|
||||
"""Build `macOSBigSur` cursor theme for only `X11`(UNIX) platform.
|
||||
|
||||
:param config: `macOSBigSur` configuration.
|
||||
:type config: Dict
|
||||
|
||||
:param x_out_dir: Path to the output directory,\
|
||||
Where the `X11` cursor theme package will generate.\
|
||||
It also creates a directory if not exists.
|
||||
:type x_out_dir: Path
|
||||
|
||||
:param info: Content theme name & comment
|
||||
:type info: Info
|
||||
"""
|
||||
|
||||
for _, item in config.items():
|
||||
with CursorAlias.from_bitmap(item["png"], item["hotspot"]) as alias:
|
||||
x_cfg = alias.create(item["x_sizes"], item["delay"])
|
||||
|
||||
print(f"Building '{x_cfg.stem}' XCursor...")
|
||||
XCursor.create(x_cfg, x_out_dir)
|
||||
|
||||
add_missing_xcursor(x_out_dir / "cursors")
|
||||
XPackager(x_out_dir, THEME_NAME, COMMENT)
|
||||
|
||||
|
||||
def wbuild(config: Dict[str, Dict[str, Any]], win_out_dir: Path) -> None:
|
||||
"""Build `macOSBigSur` cursor theme for only `Windows` platforms.
|
||||
|
||||
:param config: `macOSBigSur` configuration.
|
||||
:type config: Dict
|
||||
|
||||
:param win_out_dir: Path to the output directory,\
|
||||
Where the `Windows` cursor theme package will generate.\
|
||||
It also creates a directory if not exists.
|
||||
:type win_out_dir: Path
|
||||
|
||||
:param info: Content theme name & comment
|
||||
:type info: Info
|
||||
"""
|
||||
|
||||
for _, item in config.items():
|
||||
with CursorAlias.from_bitmap(item["png"], item["hotspot"]) as alias:
|
||||
alias.create(item["x_sizes"], item["delay"])
|
||||
|
||||
if item.get("win_key"):
|
||||
win_cfg = alias.reproduce(
|
||||
size=item["win_size"],
|
||||
canvas_size=item["canvas_size"],
|
||||
position=item["position"],
|
||||
delay=item["win_delay"],
|
||||
).rename(item["win_key"])
|
||||
|
||||
print(f"Building '{win_cfg.stem}' Windows Cursor...")
|
||||
WindowsCursor.create(win_cfg, win_out_dir)
|
||||
|
||||
WindowsPackager(win_out_dir, THEME_NAME, COMMENT, AUTHOR, URL)
|
||||
|
||||
|
||||
def build(
|
||||
config: Dict[str, Dict[str, Any]], x_out_dir: Path, win_out_dir: Path
|
||||
) -> None:
|
||||
"""Build `macOSBigSur` cursor theme for `X11` & `Windows` platforms.
|
||||
|
||||
:param config: `macOSBigSur` configuration.
|
||||
:type config: Dict
|
||||
|
||||
:param x_out_dir: Path to the output directory,\
|
||||
Where the `X11` cursor theme package will generate.\
|
||||
It also creates a directory if not exists.
|
||||
:type x_out_dir: Path
|
||||
|
||||
:param win_out_dir: Path to the output directory,\
|
||||
Where the `Windows` cursor theme package will generate.\
|
||||
It also creates a directory if not exists.
|
||||
:type win_out_dir: Path
|
||||
|
||||
:param info: Content theme name & comment
|
||||
:type info: Info
|
||||
"""
|
||||
|
||||
for _, item in config.items():
|
||||
|
||||
with CursorAlias.from_bitmap(item["png"], item["hotspot"]) as alias:
|
||||
x_cfg = alias.create(item["x_sizes"], item["delay"])
|
||||
|
||||
print(f"Building '{x_cfg.stem}' XCursor...")
|
||||
XCursor.create(x_cfg, x_out_dir)
|
||||
|
||||
if item.get("win_key"):
|
||||
win_cfg = alias.reproduce(
|
||||
size=item["win_size"],
|
||||
canvas_size=item["canvas_size"],
|
||||
position=item["position"],
|
||||
delay=item["win_delay"],
|
||||
).rename(item["win_key"])
|
||||
|
||||
print(f"Building '{win_cfg.stem}' Windows Cursor...")
|
||||
WindowsCursor.create(win_cfg, win_out_dir)
|
||||
|
||||
add_missing_xcursor(x_out_dir / "cursors")
|
||||
XPackager(x_out_dir, THEME_NAME, COMMENT)
|
||||
|
||||
WindowsPackager(win_out_dir, THEME_NAME, COMMENT, AUTHOR, URL)
|
|
@ -12,7 +12,7 @@ def add_missing_xcursor(directory: Union[str, Path]) -> None:
|
|||
"""Add missing `XCursor` to the Unix cursor package.
|
||||
|
||||
:param directory: directory where XCursors are available.
|
||||
:type directory: Union[str, Path]
|
||||
:type directory: ``str`` or ``pathlib.Path``
|
||||
"""
|
||||
|
||||
symlinks: List[Dict[str, Union[str, List[str]]]] = [
|
12
pyrightconfig.json
Normal file
12
pyrightconfig.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"include": ["builder"],
|
||||
"exclude": ["**/node_modules", "**/__pycache__"],
|
||||
|
||||
"reportMissingImports": true,
|
||||
"reportMissingTypeStubs": false,
|
||||
|
||||
"pythonVersion": "3.9",
|
||||
"pythonPlatform": "Linux",
|
||||
|
||||
"executionEnvironments": [{ "root": "builder" }]
|
||||
}
|
|
@ -17,11 +17,12 @@
|
|||
<g opacity="0.85" filter="url(#filter4_d)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M96 180H103V104H96V180Z" fill="black"/>
|
||||
</g>
|
||||
<path opacity="0.85" d="M16.5 104V106.5H19H93.5V180V182.5H96H103H105.5V180V106.5H179H181.5V104V97V94.5H179H105.5V20V17.5H103H96H93.5V20V94.5H19H16.5V97V104ZM98.5 101.5V99.5H100.5V101.5H98.5Z" stroke="white" stroke-width="5"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_d" x="36" y="46" width="122" height="122" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="-2" dy="7"/>
|
||||
<feGaussianBlur stdDeviation="10"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.7 0"/>
|
||||
|
@ -30,7 +31,7 @@
|
|||
</filter>
|
||||
<filter id="filter1_d" x="-3" y="84" width="117" height="47" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="-2" dy="7"/>
|
||||
<feGaussianBlur stdDeviation="10"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.7 0"/>
|
||||
|
@ -39,7 +40,7 @@
|
|||
</filter>
|
||||
<filter id="filter2_d" x="81" y="84" width="116" height="47" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="-2" dy="7"/>
|
||||
<feGaussianBlur stdDeviation="10"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.7 0"/>
|
||||
|
@ -48,7 +49,7 @@
|
|||
</filter>
|
||||
<filter id="filter3_d" x="74" y="7" width="47" height="117" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="-2" dy="7"/>
|
||||
<feGaussianBlur stdDeviation="10"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.7 0"/>
|
||||
|
@ -57,7 +58,7 @@
|
|||
</filter>
|
||||
<filter id="filter4_d" x="74" y="91" width="47" height="116" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="-2" dy="7"/>
|
||||
<feGaussianBlur stdDeviation="10"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.7 0"/>
|
||||
|
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.8 KiB |
Loading…
Add table
Add a link
Reference in a new issue