From dc8d9f86f2221a5fb153358cdc8450c53fd0162c Mon Sep 17 00:00:00 2001 From: Howard DaCosta Date: Wed, 17 Nov 2021 18:11:03 -0500 Subject: [PATCH] added new commands --- __init__.py | 4 +++- combine_grids.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++ combine_grids.xml | 17 ++++++++++++++++ create_grid.xml | 4 +++- sensor_grid.xml | 7 ++++--- 5 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 combine_grids.py create mode 100644 combine_grids.xml diff --git a/__init__.py b/__init__.py index fd3dff0..38fddf6 100644 --- a/__init__.py +++ b/__init__.py @@ -37,6 +37,7 @@ from .stitch_plan_preview import StitchPlanPreview from .zip import Zip from .sensor_grid import SensorGrid from .create_grid import CreateGrid +from .combine_grids import CombineGrids __all__ = extensions = [StitchPlanPreview, Install, Params, @@ -69,4 +70,5 @@ __all__ = extensions = [StitchPlanPreview, DuplicateParams, EmbroiderSettings, SensorGrid, - CreateGrid] + CreateGrid, + CombineGrids] diff --git a/combine_grids.py b/combine_grids.py new file mode 100644 index 0000000..88f2771 --- /dev/null +++ b/combine_grids.py @@ -0,0 +1,49 @@ +from .base import InkstitchExtension +import json +import os +import sys +from base64 import b64decode +from argparse import ArgumentParser, REMAINDER + +import appdirs +import inkex +from inkex import Line, Rectangle, Path +import wx +import wx.adv +from lxml import etree + +from ..elements import nodes_to_elements +from ..gui import PresetsPanel, SimulatorPreview, info_dialog +from ..i18n import _ +from ..lettering import Font, FontError +from ..svg import get_correction_transform +from ..svg.tags import (INKSCAPE_LABEL, INKSTITCH_LETTERING, SVG_GROUP_TAG, + SVG_PATH_TAG) +from ..utils import DotDict, cache, get_bundled_dir, get_resource_dir +from .commands import CommandsExtension +from .lettering_custom_font_dir import get_custom_font_dir + + +class CombineGrids(InkstitchExtension): + COMMANDS = ["combine_grids"] + def __init__(self, *args, **kwargs): + self.cancelled = False + InkstitchExtension.__init__(self, *args, **kwargs) + for command in self.COMMANDS: + self.arg_parser.add_argument("--%s" % command, type=inkex.Boolean) + def cancel(self): + self.cancelled = True + def effect(self): + pass + + + +if __name__ == '__main__': + inkex.errormsg(sys.argv[1:]) + parser = ArgumentParser() + parser.add_argument("--horizontal_wires") + parser.add_argument("--vertical_wires") + parser.add_argument('args', nargs=REMAINDER) + args, _ = parser.parse_known_args() + inkex.errormsg("args:{}".format(args)) + CombineGrids(args.horizontal_wires, args.vertical_wires).run() \ No newline at end of file diff --git a/combine_grids.xml b/combine_grids.xml new file mode 100644 index 0000000..4a7be1e --- /dev/null +++ b/combine_grids.xml @@ -0,0 +1,17 @@ + + + Combine Grids + org.inkstitch.combine_grids + combine_grids + + all + + + + + + + + diff --git a/create_grid.xml b/create_grid.xml index e1d4578..c979749 100644 --- a/create_grid.xml +++ b/create_grid.xml @@ -2,11 +2,13 @@ Create Grid org.inkstitch.create_grid + create_grid all - + +