Show More
@@ -88,7 +88,7 b' class NbConvertApp(BaseIPythonApplication):' | |||||
88 |
|
88 | |||
89 | def _classes_default(self): |
|
89 | def _classes_default(self): | |
90 | classes = [NbConvertBase, ProfileDir] |
|
90 | classes = [NbConvertBase, ProfileDir] | |
91 | for pkg in (exporters, preprocessors, writers): |
|
91 | for pkg in (exporters, preprocessors, writers, postprocessors): | |
92 | for name in dir(pkg): |
|
92 | for name in dir(pkg): | |
93 | cls = getattr(pkg, name) |
|
93 | cls = getattr(pkg, name) | |
94 | if isinstance(cls, type) and issubclass(cls, Configurable): |
|
94 | if isinstance(cls, type) and issubclass(cls, Configurable): |
@@ -45,7 +45,7 b' class PDFPostProcessor(PostProcessorBase):' | |||||
45 | config=True, help=""" |
|
45 | config=True, help=""" | |
46 | Filename extensions of temp files to remove after running. |
|
46 | Filename extensions of temp files to remove after running. | |
47 | """) |
|
47 | """) | |
48 |
pdf_open = Bool( |
|
48 | pdf_open = Bool(False, config=True, help=""" | |
49 | Whether or not to open the pdf after the compile call. |
|
49 | Whether or not to open the pdf after the compile call. | |
50 | """) |
|
50 | """) | |
51 |
|
51 | |||
@@ -117,14 +117,14 b' class PDFPostProcessor(PostProcessorBase):' | |||||
117 | except OSError: |
|
117 | except OSError: | |
118 | pass |
|
118 | pass | |
119 |
|
119 | |||
120 | def open_pdf(self,filename): |
|
120 | def open_pdf(self, filename): | |
121 | filepath = filename+'.pdf' |
|
121 | """Open the pdf in the default viewer.""" | |
122 | if sys.platform.startswith('darwin'): |
|
122 | if sys.platform.startswith('darwin'): | |
123 |
subprocess.call(('open', file |
|
123 | subprocess.call(('open', filename)) | |
124 | elif os.name == 'nt': |
|
124 | elif os.name == 'nt': | |
125 |
os.startfile(file |
|
125 | os.startfile(filename) | |
126 | elif os.name == 'posix': |
|
126 | elif os.name == 'posix': | |
127 |
subprocess.call(('xdg-open', file |
|
127 | subprocess.call(('xdg-open', filename)) | |
128 | return |
|
128 | return | |
129 |
|
129 | |||
130 | def postprocess(self, filename): |
|
130 | def postprocess(self, filename): | |
@@ -143,7 +143,7 b' class PDFPostProcessor(PostProcessorBase):' | |||||
143 | if os.path.isfile(filename+'.pdf'): |
|
143 | if os.path.isfile(filename+'.pdf'): | |
144 | self.log.info('PDF successfully created') |
|
144 | self.log.info('PDF successfully created') | |
145 | if self.pdf_open: |
|
145 | if self.pdf_open: | |
146 | self.open_pdf(filename) |
|
|||
147 | self.log.info('Viewer called') |
|
146 | self.log.info('Viewer called') | |
|
147 | self.open_pdf(filename+'.pdf') | |||
148 | return |
|
148 | return | |
149 |
|
149 |
General Comments 0
You need to be logged in to leave comments.
Login now