From c575aeda96d389de29389c9e6e46395e1b938244 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Sun, 10 Apr 2022 10:10:50 +0200 Subject: palette to text (#1619) --- lib/extensions/generate_palette.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/extensions/generate_palette.py') diff --git a/lib/extensions/generate_palette.py b/lib/extensions/generate_palette.py index 4255cfba..280be90f 100644 --- a/lib/extensions/generate_palette.py +++ b/lib/extensions/generate_palette.py @@ -4,7 +4,6 @@ # Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. import os -import sys import inkex @@ -30,29 +29,29 @@ class GeneratePalette(InkstitchExtension): if not brand: inkex.errormsg(_("Please specify a name for your color palette.")) - sys.exit() + return if path: if not os.path.isdir(path): inkex.errormsg(_("Unkown directory path.")) - sys.exit() + return else: path = os.path.join(guess_inkscape_config_path(), 'palettes') if not os.path.isdir(path): inkex.errormsg(_("Ink/Stitch cannot find your palette folder automatically. Please enter the path manually.")) - sys.exit() + return - elements = self.svg.selected.rendering_order() + elements = self.svg.selection.rendering_order() if not elements: inkex.errormsg(_("No element selected.\n\nPlease select at least one text element with a fill color.")) - sys.exit() + return colors = self._get_color_from_elements(elements) if not colors: inkex.errormsg(_("We couldn't find any fill colors on your text elements. Please read the instructions on our website.")) - sys.exit() + return colors = ['GIMP Palette', color_palette_name, '\nColumns: 4', '\n# RGB Value\t Color Name Number'] + colors -- cgit v1.2.3