diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70299f2..80f0309 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: ci on: push: @@ -20,6 +20,13 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ["3.7", "3.8", "3.9", "3.10"] + include: + - os: ubuntu-latest + path: ~/.cache/pip + - os: macos-latest + path: ~/Library/Caches/pip + - os: windows-latest + path: ~\AppData\Local\pip\Cache steps: - uses: actions/checkout@v2 @@ -30,12 +37,10 @@ jobs: - name: Caching pip packages uses: actions/cache@v2 - id: pip-cache # use this to check for `cache-hit` (`steps.pip-cache.outputs.cache-hit != 'true'`) with: - path: ~/.cache/pip + path: ${{ matrix.path }} key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- + restore-keys: ${{ runner.os }}-pip- - name: Install pip dependencies run: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0f271b6..c5a99b3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Publish +name: publish on: release: @@ -24,7 +24,7 @@ jobs: restore-keys: | ${{ runner.os }}-pip- - - name: Install pip dependencies + - name: Installing pip dependencies run: | python -m pip install --upgrade pip python -m pip install -r requirements.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index b69797f..cf581bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,44 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] -### Added - -- - -### Changed +## [v2.0.0] - 16 August 2022 -- +> **Warning** +> I removed all functionalities and modules from older versions in `v2.0.0`. -## [v2.0.0-beta.2] - 09 Jul 2022 - -### Changed - -- :warning: Documentation moved to [wiki](https://github.com/ful1e5/clickgen/wiki) -- ctgen (cli): fixed platform assignment type in '-p/--platform' argument -- windows-writer: fixed slow animation in `.ani` cursors (60jifs(1000ms) -> 2 jifs(33ms)) - -## [v2.0.0-beta.1] - 27 Jun 2022 - -- **:warning: Breaking change**: removed all functionalities and modules from older versions in [v2.0.0]. -- **Deprecated** Docker Image support due to cross-platform compatibility. +> **Warning** +> Docker Image support deprecated due to cross-platform compatibility. ### Added +- Building logs added in `ctgen` - add: python 3.7 support - add: **Windows** and **macOS** support fixed #24 - init: `cursor`, `configparser`, `packer`, `parser` and `writer` module - 'Twitter' and 'Download' links added on PYPI page -- Cursor CLI: `clickgen -h` -- Theme CLI: `ctgen -h` +- Added cursor generator cli: `clickgen -h` +- Added cursor theme generator cli: `ctgen -h` (supports config file) +- Uninstall script added in Windows cursors theme. ### Changed -- Changed docs theme to 'furo' +- `KeyNotFound` Exception fixed while reading cursor configuration in `configparser` module +- ctgen (cli): fixed platform assignment type in '-p/--platform' argument +- windows-writer: fixed slow animation in `.ani` cursors (60jifs(1000ms) -> 2 jifs(33ms)) - chore: updated template variables inside `packer.windows` - make: install all dependencies with `make install_deps` command - chore: directory renamed `examples` -> `samples` -## [v1.2.0] - 26 Mar 2022 +## [v2.0.0-beta.2] - 09 July 2022 + +## [v2.0.0-beta.1] - 27 June 2022 + +## [v1.2.0] - 26 March 2022 ### Added @@ -96,7 +91,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - make-stubgen: generate type interface(.pyi) files without `MODULES` variable - refactor: `scripts` -> `src/clickgen/scripts` -## [v1.1.9] - 22 Mar 2021 +## [v1.1.9] - 22 March 2021 ### Added @@ -115,7 +110,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed #23 packaging issue of `XPackager` - Fixed #22 Inside `util.PNGProvider` -## [v1.1.8] - 24 Jan 2021 +## [v1.1.8] - 24 January 2021 ### Added @@ -135,7 +130,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - GitHub workflow with `matrix` - fixed #12 -## [v1.1.7] - 5 Oct 2020 +## [v1.1.7] - 5 October 2020 ### Added @@ -147,7 +142,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - skip `Pillow` is already installed -## [v1.1.6] - 24 Sept 2020 +## [v1.1.6] - 24 September 2020 ### Changed @@ -203,7 +198,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Windows cursors extension `null` to `.ani` or `.cur` in linker module. -- Restructure **test** 🧪 +- Restructure **test** - Logo **Alignment fix** in `README.md` - CI Pipeline - GitHub workflow name changed @@ -221,7 +216,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - auto-generated **symlinks** based on input configs - `.tar` archive & `directory` as out **package**. -[unreleased]: https://github.com/ful1e5/clickgen/compare/v2.0.0-beta.2...main +[unreleased]: https://github.com/ful1e5/clickgen/compare/v2.0.0...main +[v2.0.0]: https://github.com/ful1e5/clickgen/compare/v2.0.0...v2.0.0-beta.2 [v2.0.0-beta.2]: https://github.com/ful1e5/clickgen/compare/v2.0.0-beta.2...v2.0.0-beta.1 [v2.0.0-beta.1]: https://github.com/ful1e5/clickgen/compare/v2.0.0-beta.1...v1.1.9 [v1.2.0]: https://github.com/ful1e5/clickgen/compare/v1.1.9...v1.2.0 diff --git a/README.md b/README.md index 3d67ee9..ebc9e10 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,25 @@ # Clickgen -[![CI](https://github.com/ful1e5/clickgen/actions/workflows/ci.yml/badge.svg)](https://github.com/ful1e5/clickgen/actions/workflows/ci.yml) -[![Docs](https://readthedocs.org/projects/clickgen/badge/?version=latest)](https://clickgen.readthedocs.io/en/latest/) -[![Code Coverage](https://codecov.io/gh/ful1e5/clickgen/branch/main/graph/badge.svg)](https://codecov.io/gh/ful1e5/clickgen) +[![ci](https://github.com/ful1e5/clickgen/actions/workflows/ci.yml/badge.svg)](https://github.com/ful1e5/clickgen/actions/workflows/ci.yml) +[![code coverage](https://codecov.io/gh/ful1e5/clickgen/branch/main/graph/badge.svg)](https://codecov.io/gh/ful1e5/clickgen) **Clickgen** is cross-platform python library for building **X11** and **Windows** Cursors. Clickgen's core functionality is heavily inspired by **[quantum5/win2xcur](https://github.com/quantum5/win2xcur)** -from `clickgen<=v2.0.0`. +from `clickgen v2.0.0` and onwards. + +##### Become Sponsor + +This library is funded by the community. I appreciate all these wonderful people who patronize and sponsoring me. + +Visit the [GitHub Sponsor](https://github.com/sponsors/ful1e5) page to become a partner. +DM me on [Twitter](https://twitter.com/ful1e5) if your company would like to sponsor this library, +I will gladly look into it and embed your logo in the README. + +##### Sponsors + + + +Be you first. ## Notices @@ -25,8 +38,9 @@ from `clickgen<=v2.0.0`. pip3 install clickgen ``` -:warning: Distributions' packages are not affiliated with clickgen developers. -If you encounter any issues with the incorrect installation, you should contact the package maintainer first. +> **Note** +> Distributions' packages are not affiliated with clickgen developers. +> If you encounter any issues with the incorrect installation, you should contact the package maintainer first. ### Arch Linux @@ -53,8 +67,6 @@ clickgen samples/pngs/wait-001.png samples/pngs/wait-001.png -d 3 -x 10 -y 10 -s #### Windows Formats (.cur and .ani) -**WORK IN PROGRESS!** - To build [ponter.png](https://github.com/ful1e5/clickgen/blob/main/samples/pngs/pointer.png) file to Windows Format (`.cur`): diff --git a/requirements.dev.txt b/requirements.dev.txt index 0d45701..a1c5fae 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1,4 +1,4 @@ -wheel>=0.37.1 +wheel>=0.37.1 flake8>=4.0.1 tox>=3.25.0 pytest>=7.1.2 diff --git a/samples/sample.toml b/samples/sample.toml index cc0890c..3e807e2 100644 --- a/samples/sample.toml +++ b/samples/sample.toml @@ -1,17 +1,17 @@ [theme] -name = "Sample" -comment = "This is sample cursor theme" -website = "https://www.example.com/" +name = 'Sample' +comment = 'This is sample cursor theme' +website = 'https://www.example.com/' [config] -bitmaps_dir = "pngs" -out_dir = "out" -platforms = ['x11','windows'] +bitmaps_dir = 'pngs' +out_dir = 'out' +platforms = ['x11', 'windows'] x11_sizes = [21, 24, 28, 32, 40, 48, 56, 64, 72, 80, 88, 96] win_size = 32 - [cursors] + [cursors.fallback_settings] x_hotspot = 100 y_hotspot = 100 diff --git a/setup.cfg b/setup.cfg index c845363..8b73855 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,19 +11,19 @@ keywords = cursor, xcursor, windows, linux project_urls = Source = https://github.com/ful1e5/clickgen Download = https://pypi.org/project/clickgen/#files - Documentation = https://clickgen.readthedocs.io/en/latest/ Bug Tracker = https://github.com/ful1e5/clickgen/issues Changelog = https://github.com/ful1e5/clickgen/blob/main/CHANGELOG.md Funding = https://github.com/sponsors/ful1e5 Twitter = https://twitter.com/ful1e5 classifiers = - Development Status :: 4 - Beta + Development Status :: 5 - Production/Stable License :: OSI Approved :: MIT License Programming Language :: C Programming Language :: Python :: 3 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Multimedia :: Graphics Topic :: System :: Operating System diff --git a/src/clickgen/__init__.py b/src/clickgen/__init__.py index 024cc45..27433f0 100644 --- a/src/clickgen/__init__.py +++ b/src/clickgen/__init__.py @@ -1,4 +1,4 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -__version__ = "2.0.0.beta2" +__version__ = "2.0.0" diff --git a/src/clickgen/configparser.py b/src/clickgen/configparser.py index 6b09125..1a03335 100644 --- a/src/clickgen/configparser.py +++ b/src/clickgen/configparser.py @@ -92,7 +92,7 @@ def get_value_with_fallback(key: str, deflt: T) -> T: # Because all cursors don't have windows configuration win_cursor: Union[bytes, None] = None win_cursor_name: Union[str, None] = None - if v["win_name"]: + if "win_name" in v: win_blob = open_blob(blobs, hotspot, [config.win_size], win_delay) ext, win_cursor = to_win(win_blob.frames) win_cursor_name = v["win_name"] + ext @@ -101,7 +101,7 @@ def get_value_with_fallback(key: str, deflt: T) -> T: CursorSection( x11_cursor=x11_cursor, x11_cursor_name=v["x11_name"], - x11_symlinks=v["x11_symlinks"], + x11_symlinks=v.get("x11_symlinks", []), win_cursor=win_cursor, win_cursor_name=win_cursor_name, ) diff --git a/src/clickgen/scripts/ctgen.py b/src/clickgen/scripts/ctgen.py index 0f570bf..185decf 100644 --- a/src/clickgen/scripts/ctgen.py +++ b/src/clickgen/scripts/ctgen.py @@ -51,7 +51,7 @@ def cwd(path) -> Generator[None, None, None]: def main() -> None: # noqa: C901 parser = argparse.ArgumentParser( prog="ctgen", - description="The hassle-free cursor theme generator", + description="ctgen: Cursor Theme GENerator.", ) parser.add_argument( @@ -67,7 +67,7 @@ def main() -> None: # noqa: C901 dest="name", type=str, default=None, - help="Force name of cursor theme.", + help="Force rename cursor theme name.", ) parser.add_argument( @@ -76,7 +76,7 @@ def main() -> None: # noqa: C901 dest="comment", type=str, default=None, - help="Force comment of cursor theme.", + help="Force rename comment of cursor theme.", ) parser.add_argument( @@ -85,7 +85,7 @@ def main() -> None: # noqa: C901 dest="website", type=str, default=None, - help="Force website of cursor theme.", + help="Force rename website url of cursor theme.", ) parser.add_argument( @@ -99,7 +99,7 @@ def main() -> None: # noqa: C901 "-o", "--out-dir", type=str, - help="Force output directory location.", + help="Change output directory.", ) parser.add_argument( @@ -109,7 +109,9 @@ def main() -> None: # noqa: C901 nargs="+", default=None, type=int, - help="Force pixel-size for cursors.", + help=""" Change cursor size. + Multiple sizes are assigned to XCursor + while one size will be assigned to Windows.""", ) parser.add_argument( @@ -117,11 +119,10 @@ def main() -> None: # noqa: C901 "--platforms", choices=["windows", "x11"], default=None, - help="Force platform cursor theme.", + help="Change Platform for output cursors.", ) parser.add_argument( - "-v", "--version", action="version", version=f"%(prog)s {clickgen.__version__}", # type: ignore @@ -147,31 +148,49 @@ def process(file: Path) -> None: config = cfg.config cursors = cfg.cursors + # Display Theme Info + print(f"- Cursor Theme Name: {theme.name}") + print(f"- Comment: {theme.comment}") + print(f"- Platform Compliblity: {config.platforms}\n") + # Generating XCursor if "x11" in config.platforms: + print("Generating XCursors ...'") + x11_out_dir = config.out_dir / theme.name / "cursors" x11_out_dir.mkdir(parents=True, exist_ok=True) for c in cursors: + print(f"- Bitmaping XCursor '{c.x11_cursor_name}'") x_cursor = x11_out_dir / c.x11_cursor_name x_cursor.write_bytes(c.x11_cursor) # Creating symlinks with cwd(x11_out_dir): for link in c.x11_symlinks: + print( + f" Linking XCursor '{link}' with '{c.x11_cursor_name}'" + ) os.symlink(x_cursor.name, link) + print("Generating XCursors ... DONE\n") pack_x11(x11_out_dir.parent, theme.name, theme.comment) # Generating Windows cursors if "windows" in config.platforms: + print("Generating Windows Cursors ...") + win_out_dir = config.out_dir / f"{theme.name}-Windows" win_out_dir.mkdir(parents=True, exist_ok=True) for c in cursors: if c.win_cursor and c.win_cursor_name: + print( + f"- Bitmaping Windows Cursor '{c.win_cursor_name}' from '{c.x11_cursor_name}'" + ) win_cursor = win_out_dir / c.win_cursor_name win_cursor.write_bytes(c.win_cursor) + print("Generating Windows Cursors ... DONE\n") try: pack_win(win_out_dir, theme.name, theme.comment, theme.website) except Exception: