Show More
@@ -29,9 +29,7 b' from .convertfigures import ConvertFiguresTransformer' | |||||
29 | # Constants |
|
29 | # Constants | |
30 | #----------------------------------------------------------------------------- |
|
30 | #----------------------------------------------------------------------------- | |
31 |
|
31 | |||
32 | INKSCAPE_COMMAND = 'inkscape --without-gui --export-pdf="{to_filename}" "{from_filename}"' |
|
32 | INKSCAPE_APP = '/Applications/Inkscape.app/Contents/Resources/bin/inkscape' | |
33 | INKSCAPE_OSX_COMMAND = '/Applications/Inkscape.app/Contents/Resources/bin/inkscape --without-gui --export-pdf="{to_filename}" "{from_filename}"' |
|
|||
34 |
|
||||
35 |
|
33 | |||
36 | #----------------------------------------------------------------------------- |
|
34 | #----------------------------------------------------------------------------- | |
37 | # Classes |
|
35 | # Classes | |
@@ -44,6 +42,7 b' class SVG2PDFTransformer(ConvertFiguresTransformer):' | |||||
44 |
|
42 | |||
45 | from_format = Unicode('svg', config=True, help='Format the converter accepts') |
|
43 | from_format = Unicode('svg', config=True, help='Format the converter accepts') | |
46 | to_format = Unicode('pdf', config=False, help='Format the converter writes') |
|
44 | to_format = Unicode('pdf', config=False, help='Format the converter writes') | |
|
45 | ||||
47 | command = Unicode(config=True, |
|
46 | command = Unicode(config=True, | |
48 | help="""The command to use for converting SVG to PDF |
|
47 | help="""The command to use for converting SVG to PDF | |
49 |
|
48 | |||
@@ -55,13 +54,15 b' class SVG2PDFTransformer(ConvertFiguresTransformer):' | |||||
55 | """) |
|
54 | """) | |
56 |
|
55 | |||
57 | def _command_default(self): |
|
56 | def _command_default(self): | |
|
57 | return self.inkscape + \ | |||
|
58 | ' --without-gui --export-pdf="{to_filename}" "{from_filename}"' | |||
|
59 | ||||
|
60 | inkscape = Unicode(config=True, help="The path to Inkscape, if necessary") | |||
|
61 | def _inkscape_default(self): | |||
58 | if sys.platform == "darwin": |
|
62 | if sys.platform == "darwin": | |
59 | return INKSCAPE_OSX_COMMAND |
|
63 | if os.path.isfile(INKSCAPE_APP): | |
60 | elif sys.platform == "win32": |
|
64 | return INKSCAPE_APP | |
61 | # windows not yet supported |
|
65 | return "inkscape" | |
62 | return "" |
|
|||
63 | else: |
|
|||
64 | return INKSCAPE_COMMAND |
|
|||
65 |
|
66 | |||
66 |
|
67 | |||
67 | def convert_figure(self, data_format, data): |
|
68 | def convert_figure(self, data_format, data): |
General Comments 0
You need to be logged in to leave comments.
Login now