Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor icon installation by simplifying hook #50

Merged
merged 3 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
- Now using `nox` for testing.
- Build script has been moved from inside the package to the root of the repository.
- Added link to MIT license in all SVG files and split the license and Refactoring UI Inc. copyright information into separate lines.
- Icon registration has been simplified to just getting a list of the icon files under the `heroicons` template directory.

### Removed

- Dropped support for Python 3.7.
- Removed all build scripts and related methods from package.
- Removed `icons.py` and associated tests.

## [0.1.3]

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ exclude_lines = [
"if TYPE_CHECKING:",
'def __str__\(self\)\s?\-?\>?\s?\w*\:'
]
fail_under = 60

[tool.coverage.run]
branch = true
Expand Down
41 changes: 0 additions & 41 deletions src/wagtail_heroicons/icons.py

This file was deleted.

13 changes: 5 additions & 8 deletions src/wagtail_heroicons/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
from __future__ import annotations

try:
from wagtail import hooks
except ImportError:
from wagtail.core import hooks
from pathlib import Path

from .icons import Heroicon
from wagtail import hooks


@hooks.register("register_icons")
def register_icons(icons):
for icon in Heroicon.get_icons():
icons.append(str(icon.path))
return icons
template_dir = Path(__file__).parent / "templates" / "heroicons"
heroicons = [file.stem for file in template_dir.glob("*.svg")]
return icons + heroicons
9 changes: 0 additions & 9 deletions tests/test_icons.py

This file was deleted.