Skip to content

Commit

Permalink
🔀 Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ful1e5 committed Mar 22, 2021
2 parents 62449c9 + 1cdabe9 commit 63e493e
Show file tree
Hide file tree
Showing 39 changed files with 1,053 additions and 556 deletions.
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
8 changes: 3 additions & 5 deletions .github/workflows/app-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,14 @@ jobs:
run: sudo apt install libx11-dev libxcursor-dev libpng-dev
continue-on-error: false

- name: Cache pip dependencies
- 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:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install pip dependencies
run: |
Expand Down
32 changes: 23 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [1.1.9] - 22 Mar 2021

### Added

- Couple of **linting** problem fixes
- **Bitmap** and **CursorsAlias** memember access outside the context manager
- Check `make` command in `setup.py`
- Better typing experience
- Configure readthedocs with `sphinx`
- Added **docs** badge in `README.md`

### Changed

- Fixed Pillow vulnerabilities by bumped it to `8.1.1`
- python caching updated in `app-ci.yml`
- `Literal` typing removed from `clickgen.util` & `clickgen.core`
- Fixed #23 packaging issue of `XPackager`
- Fixed #22 Inside `util.PNGProvider`

## [1.1.8] - 24 Jan 2021

### Added
Expand Down Expand Up @@ -113,13 +132,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**.

<<<<<<< HEAD
[unreleased]: https://github.com/ful1e5/clickgen/compare/v1.1.8...main
[1.1.8]: https://github.com/ful1e5/clickgen/compare/v1.1.7...v1.1.8
[1.1.7]: https://github.com/ful1e5/clickgen/compare/1.1.6...v1.1.7
[1.1.6]: https://github.com/ful1e5/clickgen/compare/1.1.5-beta...1.1.6
[1.1.5-beta]: https://github.com/ful1e5/clickgen/compare/1.1.4-alpha...1.1.5-beta
[1.1.4-beta]: https://github.com/ful1e5/clickgen/compare/1.1.3-alpha...1.1.4-beta
[1.1.3-alpha]: https://github.com/ful1e5/clickgen/compare/1.1.2-alpha...1.1.3-alpha
[1.1.2-alpha]: https://github.com/ful1e5/clickgen/compare/1.1.1-alpha...1.1.2-alpha
[1.1.1-alpha]: https://github.com/ful1e5/clickgen/compare/1.1.0-alpha...1.1.1-alpha
[1.1.0-alpha]: https://github.com/ful1e5/clickgen/releases/tag/1.1.0-alpha
=======
[unreleased]: https://github.com/ful1e5/clickgen/compare/v1.1.9...main
[1.1.9]: https://github.com/ful1e5/clickgen/compare/v1.1.8...v1.1.9
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[![CI](https://github.com/ful1e5/clickgen/workflows/CI/badge.svg)](https://github.com/ful1e5/clickgen/actions)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/pytype)](https://pypi.org/project/clickgen/#files)
[![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)
[![CodeFactor](https://www.codefactor.io/repository/github/ful1e5/clickgen/badge/main)](https://www.codefactor.io/repository/github/ful1e5/clickgen/overview/main)

# Clickgen

The hustle free cursor building toolbox 🧰
The hassle-free cursor building toolbox 🧰

**clickgen** is _API_ for building **X11** and **Windows** Cursors from `.png` files. clickgen is using `anicursorgen` and `xcursorgen` _under the hood_.

Expand Down Expand Up @@ -106,7 +107,6 @@ with CursorAlias.from_bitmap(png=["all-scroll-01.png", "all-scroll-02.png"], hot

```


### create a static `Windows Cursor` (.cur)

```python
Expand All @@ -131,4 +131,4 @@ with CursorAlias.from_bitmap(png=["all-scroll-01.png", "all-scroll-02.png"], hot
win_cfg = alias.create(sizes=(24, 24))
WindowsCursor.create(alias_file=win_cfg, out_dir=Path("."))

```
```
15 changes: 8 additions & 7 deletions clickgen/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ctypes import CDLL
from pathlib import Path
from struct import pack
from typing import Any, List, Literal, NamedTuple, Tuple
from typing import Any, List, NamedTuple, Tuple

from PIL import Image, ImageFilter

Expand All @@ -33,7 +33,7 @@ class XCursor:

# main function ctypes define
_lib_location: Path = Path(clickgen_pkg_root[0]) / "xcursorgen.so"
_lib: CDLL = CDLL(_lib_location)
_lib: CDLL = CDLL(str(_lib_location.absolute()))
_LP_c_char = ctypes.POINTER(ctypes.c_char)
_LP_LP_c_char = ctypes.POINTER(_LP_c_char)
_lib.main.argtypes = (ctypes.c_int, _LP_LP_c_char)
Expand Down Expand Up @@ -72,9 +72,9 @@ def generate(self) -> None:
argv: List[str] = [
"xcursorgen",
"-p", # prefix args for xcursorgen (do not remove)
self.prefix.absolute(), # prefix args for xcursorgen (do not remove)
self.config_file.absolute(), # cursor's config/alias file
self.out.absolute(), # xcursor/output path
str(self.prefix.absolute()), # prefix args for xcursorgen (do not remove)
str(self.config_file.absolute()), # cursor's config/alias file
str(self.out.absolute()), # xcursor/output path
]

kwargs: ctypes.pointer[ctypes.c_char] = self.gen_argv_ctypes(argv)
Expand Down Expand Up @@ -196,7 +196,8 @@ def make_framesets(frames: Frames) -> Frames:
sizes = set()

# This assumes that frames are sorted
size = counter = 0
size: int = 0
counter: int = 0
for i, frame in enumerate(frames):

if size == 0 or frame[0] != size:
Expand Down Expand Up @@ -326,7 +327,7 @@ def shadowize(shadow: Image, orig: Image, color: Color) -> None:
int(color[3] * (o_px[3] / 255.0)),
)

def create_shadow(self, orig: Image) -> Tuple[Literal[0], Any]:
def create_shadow(self, orig: Image) -> Tuple[int, Any]:
blur_px = orig.size[0] / 100.0 * self.args.blur
right_px = int(orig.size[0] / 100.0 * self.args.right_shift)
down_px = int(orig.size[1] / 100.0 * self.args.down_shift)
Expand Down
15 changes: 6 additions & 9 deletions clickgen/builders.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import io
from pathlib import Path
from typing import Any, List, Literal, NamedTuple, Tuple

from PIL import Image
from pathlib import Path
from typing import Any, List, NamedTuple, Tuple

Frame = Tuple[int, int, int, str, int]
Frames = List[Frame]
Expand Down Expand Up @@ -32,9 +31,7 @@ class WindowsCursor:
prefix: Path
out_dir: Path
out: Path
def __init__(
self, config_dir: Path, out_dir: Path, args: AnicursorgenArgs
) -> None: ...
def __init__(self, config_dir: Path, out_dir: Path, args: AnicursorgenArgs) -> None: ...
def get_frames(self) -> Frames: ...
@staticmethod
def frames_have_animation(frames: Frames) -> bool: ...
Expand All @@ -45,12 +42,12 @@ class WindowsCursor:
def make_ani(self, frames: Frames, out_buffer: io.BufferedWriter) -> None: ...
@staticmethod
def shadowize(shadow: Image, orig: Image, color: Color) -> None: ...
def create_shadow(self, orig: Image) -> Tuple[Literal[0], Any]: ...
def create_shadow(self, orig: Image) -> Tuple[int, Any]: ...
@staticmethod
def write_png(out: io.BufferedWriter, frame_png: Image) -> None: ...
@staticmethod
def write_cur(out: io.BufferedWriter, frame: Frame, frame_png: Image) -> None: ...
def make_cur(self, frames: Frames, animated: bool = ...) -> io.BytesIO: ...
def make_cur(self, frames: Frames, animated: bool=...) -> io.BytesIO: ...
def generate(self) -> None: ...
@classmethod
def create(cls: Any, alias_file: Path, out_dir: Path, args: Any = ...) -> Path: ...
def create(cls: Any, alias_file: Path, out_dir: Path, args: Any=...) -> Path: ...
Loading

0 comments on commit 63e493e

Please sign in to comment.