From 1251b6ae80f221e38ea837863792981cc6ff3309 Mon Sep 17 00:00:00 2001 From: Kaalleen Date: Sun, 23 Mar 2025 13:18:20 +0100 Subject: [PATCH] install thread palettes -> addons (thread palettes and symbols) --- addons/symbols/inkstitch-motif-library.svg | 745 +++++++++++++++++++++ bin/build-distribution-archives | 4 +- lib/extensions/install.py | 51 +- templates/install.xml | 25 +- 4 files changed, 809 insertions(+), 16 deletions(-) create mode 100644 addons/symbols/inkstitch-motif-library.svg diff --git a/addons/symbols/inkstitch-motif-library.svg b/addons/symbols/inkstitch-motif-library.svg new file mode 100644 index 000000000..a32df7852 --- /dev/null +++ b/addons/symbols/inkstitch-motif-library.svg @@ -0,0 +1,745 @@ + + + +Ink/Stitch - Motif Library 10.13.03Ink/Stitch - Motif Library 1Gus VisserStitch 1Stitch 1Stitch 2Stitch 2Stitch 3Stitch 3Stitch 4Stitch 4Stitch 5Stitch 5Stitch 6Stitch 6Stitch 7Stitch 7Stitch 8Stitch 8Stitch 9Stitch 9Stitch 10Stitch 10Stitch 11Stitch 11Stitch 12Stitch 12Stitch 13Stitch 13Stitch 14Stitch 14Stitch 15Stitch 15Stitch 16Stitch 16Stitch 17Stitch 17Stitch 18Stitch 18Stitch 19Stitch 19Stitch 20Stitch 20Stitch 21Stitch 21Stitch 22Stitch 22Stitch 23Stitch 23Stitch 24Stitch 24Stitch 25Stitch 25Stitch 26Stitch 26Stitch 27Stitch 27Stitch 28Stitch 28Stitch 29Stitch 29Stitch 30Stitch 30Stitch 31Stitch 31Stitch 32Stitch 32Stitch 33Stitch 33Stitch 34Stitch 34Stitch 35Stitch 35StitchStitchStitch 37Stitch 37Stitch 38Stitch 38Stitch 39Stitch 39Stitch 40Stitch 40Stitch 41Stitch 41Stitch 42Stitch 42Stitch 43Stitch 43Stitch 44Stitch 44Stitch 45Stitch 45Stitch 46Stitch 46Stitch 47Stitch 47Stitch 48Stitch 48Stitch 49Stitch 49Stitch 50Stitch 50Stitch 51Stitch 51Stitch 52Stitch 52Stitch 53Stitch 53Stitch 54Stitch 54Stitch 55Stitch 55Stitch 56Stitch 56Stitch 57Stitch 57Stitch 58Stitch 58 diff --git a/bin/build-distribution-archives b/bin/build-distribution-archives index 34085f3a1..26ec26e3b 100644 --- a/bin/build-distribution-archives +++ b/bin/build-distribution-archives @@ -4,7 +4,7 @@ ARCH="$(uname -m)" mkdir artifacts if [ "$BUILD" = "osx" ]; then - cp -a icons locales print LICENSE VERSION palettes symbols fonts tiles dbus inx dist/inkstitch.app/Contents/Resources + cp -a addons icons locales print LICENSE VERSION palettes symbols fonts tiles dbus inx dist/inkstitch.app/Contents/Resources # adding version to Info.plist plutil -replace CFBundleShortVersionString -string ${VERSION} dist/inkstitch.app/Contents/Info.plist rm -rf dist/inkstitch/ @@ -92,7 +92,7 @@ if [ "$BUILD" = "osx" ]; then 7z a ../artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.zip * cd .. else - cp -a palettes symbols fonts tiles dbus inx LICENSE VERSION dist/inkstitch + cp -a addons palettes symbols fonts tiles dbus inx LICENSE VERSION dist/inkstitch cp -a icons locales print dist/inkstitch/bin fi diff --git a/lib/extensions/install.py b/lib/extensions/install.py index 501694ed0..187769357 100644 --- a/lib/extensions/install.py +++ b/lib/extensions/install.py @@ -1,31 +1,64 @@ # Authors: see git history # -# Copyright (c) 2010 Authors +# Copyright (c) 2025 Authors # Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. -from .base import InkstitchExtension import os import sys from glob import glob -from ..utils import get_bundled_dir, guess_inkscape_config_path -from inkex import errormsg + +from inkex import Boolean, errormsg + from ..i18n import _ +from ..utils import get_bundled_dir, guess_inkscape_config_path +from .base import InkstitchExtension class Install(InkstitchExtension): def __init__(self, *args, **kwargs): InkstitchExtension.__init__(self, *args, **kwargs) + self.arg_parser.add_argument("--notebook") + self.arg_parser.add_argument("--install-palettes", type=Boolean, default=False, dest="install_palettes") + self.arg_parser.add_argument("--install-symbol-libraries", type=Boolean, default=False, dest="install_symbol_libraries") + + self.inkscape_config_path = guess_inkscape_config_path() + self.install_resources = get_bundled_dir('addons') def effect(self): - path = os.path.join(guess_inkscape_config_path(), 'palettes') + installation_success = [] + if self.options.install_palettes: + installation_success.append(self.install_palettes()) + if self.options.install_symbol_libraries: + installation_success.append(self.install_symbol_libraries()) + if all(installation_success): + self.install_success_message() + + def install_palettes(self): + path = os.path.join(self.inkscape_config_path, 'palettes') + # palettes are also used otherwise, so they have their own location src_dir = get_bundled_dir('palettes') try: copy_files(glob(os.path.join(src_dir, "*")), path) - errormsg(_("Successfully installed color palettes for Inkscape.\n\n" - "Please restart Inkscape.")) + return True except IOError: - errormsg(_("Could not install color palettes. Please file an issue on " - "https://github.com/inkstitch/inkstitch/issues")) + self.install_error_message(_("Could not install color palettes. Please file an issue on")) + return False + + def install_symbol_libraries(self): + path = os.path.join(self.inkscape_config_path, 'symbols') + src_dir = os.path.join(self.install_resources, 'symbols') + try: + copy_files(glob(os.path.join(src_dir, "*")), path) + return True + except IOError: + self.install_error_message(_("Could not install color palettes. Please file an issue on")) + return False + + def install_success_message(self): + errormsg(_("Successfully installed Addons.\n\nPlease restart Inkscape.")) + + def install_error_message(self, text): + errormsg(text + "https://github.com/inkstitch/inkstitch/issues") if sys.platform == "win32": diff --git a/templates/install.xml b/templates/install.xml index 1ceb8a934..f9ade6918 100644 --- a/templates/install.xml +++ b/templates/install.xml @@ -1,16 +1,31 @@ - Install thread color palettes for Inkscape + Install Addons for Inkscape org.{{ id_inkstitch }}.install install + + + + true + true + + + + + + + + + + all {{ icon_path }}inx/color_management.svg - Installs color palettes for various thread brands into Inkscape + Installs color palettes or a symbol library for motif stitches into Inkscape - - - +