diff --git a/novelwriter/assets/icons/font_awesome.icons b/novelwriter/assets/icons/font_awesome.icons
index 847cba7d..a216a561 100644
--- a/novelwriter/assets/icons/font_awesome.icons
+++ b/novelwriter/assets/icons/font_awesome.icons
@@ -3,7 +3,7 @@
# Meta
meta:name = Font Awesome 6
meta:author = Fonticons Inc
-meta:license = Font Awesome Free License
+meta:license = CC BY 4.0
# Icons
icon:alert_error =
diff --git a/pkgutils.py b/pkgutils.py
index 36433327..ce350dbb 100755
--- a/pkgutils.py
+++ b/pkgutils.py
@@ -35,7 +35,8 @@ import zipfile
from pathlib import Path
-from utils.icon_themes import processFontAwesome, processMaterialIcons, processRemix
+import utils.binary_dist
+import utils.icon_themes
CURR_DIR = Path(__file__).parent
SETUP_DIR = CURR_DIR / "setup"
@@ -325,90 +326,6 @@ def buildSampleZip(args: argparse.Namespace | None = None) -> None:
return
-##
-# Import Translations (import-i18n)
-##
-
-def buildIconTheme(args: argparse.Namespace) -> None:
- """Build icon themes."""
- print("")
- print("Build Icon Themes")
- print("=================")
- print("")
-
- workDir = Path(args.sources).absolute()
- if not workDir.is_dir():
- print(f"Source directory not found: {workDir}")
- sys.exit(1)
-
- iconsDir = CURR_DIR / "novelwriter" / "assets" / "icons"
-
- style = args.style
- if style in ("all", "material"):
- processMaterialIcons(workDir, iconsDir, {
- "material_rounded_thin": {
- "name": "Material Symbols - Rounded Thin",
- "style": "rounded",
- "filled": False,
- "weight": 200,
- },
- "material_rounded_normal": {
- "name": "Material Symbols - Rounded Medium",
- "style": "rounded",
- "filled": False,
- "weight": 400,
- },
- "material_rounded_bold": {
- "name": "Material Symbols - Rounded Bold",
- "style": "rounded",
- "filled": False,
- "weight": 600,
- },
- "material_filled_thin": {
- "name": "Material Symbols - Filled Thin",
- "style": "rounded",
- "filled": True,
- "weight": 200,
- },
- "material_filled_normal": {
- "name": "Material Symbols - Filled Medium",
- "style": "rounded",
- "filled": True,
- "weight": 400,
- },
- "material_filled_bold": {
- "name": "Material Symbols - Filled Bold",
- "style": "rounded",
- "filled": True,
- "weight": 600,
- },
- })
-
- if style in ("all", "fa"):
- processFontAwesome(workDir, iconsDir, {
- "font_awesome": {
- "name": "Font Awesome 6",
- },
- })
-
- if style in ("all", "remix"):
- processRemix(workDir, iconsDir, {
- "remix_outline": {
- "name": "Remix Icon - Outline",
- "filled": False,
- },
- "remix_filled": {
- "name": "Remix Icon - Filled",
- "filled": True,
- },
- })
-
- print("Done")
- print("")
-
- return
-
-
##
# Import Translations (import-i18n)
##
@@ -1487,9 +1404,9 @@ if __name__ == "__main__":
cmdIcons = parsers.add_parser(
"icons", help="Build icon theme files from source."
)
- cmdIcons.add_argument("sources", help="Working directory for sources.")
- cmdIcons.add_argument("style", help="What icon style to build.")
- cmdIcons.set_defaults(func=buildIconTheme)
+ cmdIcons.add_argument("--sources", help="Working directory for sources.")
+ cmdIcons.add_argument("--style", help="What icon style to build.")
+ cmdIcons.set_defaults(func=utils.icon_themes.main)
# Import Translations
cmdImportTS = parsers.add_parser(
diff --git a/utils/icon_themes.py b/utils/icon_themes.py
index 8b9b5249..681956c6 100644
--- a/utils/icon_themes.py
+++ b/utils/icon_themes.py
@@ -20,12 +20,16 @@ along with this program. If not, see .
"""
from __future__ import annotations
+import argparse
import json
import subprocess
+import sys
from pathlib import Path
from xml.etree import ElementTree as ET
+from utils.common import ROOT_DIR
+
UTILS = Path(__file__).parent
ET.register_namespace("", "http://www.w3.org/2000/svg")
ICONS = [
@@ -140,7 +144,7 @@ ICONS = [
def _loadMap(name: str) -> dict[str, str]:
"""Load a theme map file."""
- data = json.loads((UTILS / f"{name}.json").read_text(encoding="utf-8"))
+ data = json.loads((UTILS / "icon_themes" / f"{name}.json").read_text(encoding="utf-8"))
icons = {}
for key in ICONS:
if icon := data.get(key, ""):
@@ -311,3 +315,83 @@ def processRemix(workDir: Path, iconsDir: Path, jobs: dict) -> None:
print("")
return
+
+
+def main(args: argparse.Namespace) -> None:
+ """Build icon themes entry point."""
+ print("")
+ print("Build Icon Themes")
+ print("=================")
+ print("")
+
+ workDir = Path(args.sources).absolute()
+ if not workDir.is_dir():
+ print(f"Source directory not found: {workDir}")
+ sys.exit(1)
+
+ iconsDir = ROOT_DIR / "novelwriter" / "assets" / "icons"
+
+ style = args.style
+ if style in ("all", "material"):
+ processMaterialIcons(workDir, iconsDir, {
+ "material_rounded_thin": {
+ "name": "Material Symbols - Rounded Thin",
+ "style": "rounded",
+ "filled": False,
+ "weight": 200,
+ },
+ "material_rounded_normal": {
+ "name": "Material Symbols - Rounded Medium",
+ "style": "rounded",
+ "filled": False,
+ "weight": 400,
+ },
+ "material_rounded_bold": {
+ "name": "Material Symbols - Rounded Bold",
+ "style": "rounded",
+ "filled": False,
+ "weight": 600,
+ },
+ "material_filled_thin": {
+ "name": "Material Symbols - Filled Thin",
+ "style": "rounded",
+ "filled": True,
+ "weight": 200,
+ },
+ "material_filled_normal": {
+ "name": "Material Symbols - Filled Medium",
+ "style": "rounded",
+ "filled": True,
+ "weight": 400,
+ },
+ "material_filled_bold": {
+ "name": "Material Symbols - Filled Bold",
+ "style": "rounded",
+ "filled": True,
+ "weight": 600,
+ },
+ })
+
+ if style in ("all", "fa"):
+ processFontAwesome(workDir, iconsDir, {
+ "font_awesome": {
+ "name": "Font Awesome 6",
+ },
+ })
+
+ if style in ("all", "remix"):
+ processRemix(workDir, iconsDir, {
+ "remix_outline": {
+ "name": "Remix Icon - Outline",
+ "filled": False,
+ },
+ "remix_filled": {
+ "name": "Remix Icon - Filled",
+ "filled": True,
+ },
+ })
+
+ print("Done")
+ print("")
+
+ return
diff --git a/utils/font_awesome.json b/utils/icon_themes/font_awesome.json
similarity index 100%
rename from utils/font_awesome.json
rename to utils/icon_themes/font_awesome.json
diff --git a/utils/material_symbols.json b/utils/icon_themes/material_symbols.json
similarity index 100%
rename from utils/material_symbols.json
rename to utils/icon_themes/material_symbols.json
diff --git a/utils/remix.json b/utils/icon_themes/remix.json
similarity index 100%
rename from utils/remix.json
rename to utils/icon_themes/remix.json