From 0986c8f2dbd54d89e4f528620423f7b9f4f0f16b Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 5 Nov 2017 00:44:57 +0000 Subject: allow specification of output file for standalone processing --- embroider.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'embroider.py') diff --git a/embroider.py b/embroider.py index 09b89d13..f9c5d147 100644 --- a/embroider.py +++ b/embroider.py @@ -1806,6 +1806,10 @@ class Embroider(inkex.Effect): action="store", type="string", dest="path", default=".", help="Directory in which to store output file") + self.OptionParser.add_option("-F", "--output-file", + action="store", type="string", + dest="output_file", default=".", + help="Output filename.") self.OptionParser.add_option("-b", "--max-backups", action="store", type="int", dest="max_backups", default=5, @@ -1825,9 +1829,12 @@ class Embroider(inkex.Effect): self.elements.extend(cls(node, self.options) for cls in classes) def get_output_path(self): - svg_filename = self.document.getroot().get(inkex.addNS('docname', 'sodipodi')) - csv_filename = svg_filename.replace('.svg', '.csv') - output_path = os.path.join(self.options.path, csv_filename) + if self.options.output_file: + output_path = os.path.join(self.options.path, self.options.output_file) + else: + svg_filename = self.document.getroot().get(inkex.addNS('docname', 'sodipodi'), "embroidery.svg") + csv_filename = svg_filename.replace('.svg', '.csv') + output_path = os.path.join(self.options.path, csv_filename) def add_suffix(path, suffix): if suffix > 0: -- cgit v1.2.3