Skip to content

Commit ce7c8d0

Browse files
committed
compatible with inkscape 1.0
1 parent 41dd058 commit ce7c8d0

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

svgo-inkscape.inx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@
9191
<output>
9292
<extension>.svg</extension>
9393
<mimetype>image/svg+xml</mimetype>
94-
<_filetypename>Optimized with svgo (*.svg)</_filetypename>
95-
<_filetypetooltip>Scalable Vector Graphics</_filetypetooltip>
94+
<filetypename translatable="no">Optimized with svgo (*.svg)</filetypename>
95+
<filetypetooltip translatable="no">Scalable Vector Graphics</filetypetooltip>
9696
</output>
9797
<script>
98-
<command reldir="extensions" interpreter="python">./svgo-inkscape/svgo.inkscape.py</command>
98+
<command location="inx" reldir="extensions" interpreter="python">./svgo-inkscape/svgo.inkscape.py</command>
9999
</script>
100100
</inkscape-extension>

svgo-inkscape/svgo.inkscape.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,32 @@ class SvgoInkscape (inkex.Effect):
4646
def __init__(self):
4747
inkex.Effect.__init__(self)
4848

49-
self.OptionParser.add_option("--tabs",
50-
action="store", type="string",
49+
self.arg_parser.add_argument("--tabs",
50+
type=str,
5151
dest="tab")
5252

5353
for key in options:
54-
self.OptionParser.add_option("--" + key, type="inkbool",
55-
action="store", dest=key, default=options[key])
54+
self.arg_parser.add_argument("--" + key, type=inkex.Boolean,
55+
dest=key, default=options[key])
5656

5757
def getCommand(self, name, option):
5858
return " --"+ name + " " + str(option).lower()
5959

6060
def effect(self):
61-
command = "./node/bin/node svgo.js --file=" + self.args[0]
61+
command = "./node/bin/node svgo.js --file=" + self.options.input_file
6262

6363
optionsDict = self.options.__dict__
6464

6565
for key in options:
6666
command += self.getCommand(key, optionsDict[key])
6767

68-
result = os.popen(command).read()
68+
p = os.popen(command)
69+
result = p.read()
70+
p.close()
6971

7072
sys.stdout.write(result)
7173
sys.stdout.close()
7274

7375
if __name__ == '__main__':
7476
e = SvgoInkscape()
75-
e.affect(output=False)
77+
e.run()

0 commit comments

Comments
 (0)