summaryrefslogtreecommitdiff
path: root/embroider.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2017-11-05 00:44:57 +0000
committerLex Neva <github.com@lexneva.name>2017-11-05 00:44:57 +0000
commit0986c8f2dbd54d89e4f528620423f7b9f4f0f16b (patch)
treecf15f0d39f71f56722a889a6e8424ae077c6276f /embroider.py
parentbd50c08b5db2b5a90c5b01af4eaf7ef0c713d4e4 (diff)
allow specification of output file for standalone processing
Diffstat (limited to 'embroider.py')
-rw-r--r--embroider.py13
1 files changed, 10 insertions, 3 deletions
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: