##// END OF EJS Templates
prevent popup windows during execution of latex_to_png_dvipng
Pieter Eendebak -
Show More
@@ -144,6 +144,13 b" def latex_to_png_dvipng(s, wrap, color='Black', scale=1.0):"
144 find_cmd('dvipng')
144 find_cmd('dvipng')
145 except FindCmdError:
145 except FindCmdError:
146 return None
146 return None
147
148 startupinfo = None
149 if os.name == 'nt':
150 # prevent popup-windows
151 startupinfo = subprocess.STARTUPINFO()
152 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
153
147 try:
154 try:
148 workdir = Path(tempfile.mkdtemp())
155 workdir = Path(tempfile.mkdtemp())
149 tmpfile = workdir.joinpath("tmp.tex")
156 tmpfile = workdir.joinpath("tmp.tex")
@@ -156,7 +163,7 b" def latex_to_png_dvipng(s, wrap, color='Black', scale=1.0):"
156 with open(os.devnull, 'wb') as devnull:
163 with open(os.devnull, 'wb') as devnull:
157 subprocess.check_call(
164 subprocess.check_call(
158 ["latex", "-halt-on-error", "-interaction", "batchmode", tmpfile],
165 ["latex", "-halt-on-error", "-interaction", "batchmode", tmpfile],
159 cwd=workdir, stdout=devnull, stderr=devnull)
166 cwd=workdir, stdout=devnull, stderr=devnull, startupinfo=startupinfo)
160
167
161 resolution = round(150*scale)
168 resolution = round(150*scale)
162 subprocess.check_call(
169 subprocess.check_call(
@@ -179,6 +186,7 b" def latex_to_png_dvipng(s, wrap, color='Black', scale=1.0):"
179 cwd=workdir,
186 cwd=workdir,
180 stdout=devnull,
187 stdout=devnull,
181 stderr=devnull,
188 stderr=devnull,
189 startupinfo=startupinfo
182 )
190 )
183
191
184 with outfile.open("rb") as f:
192 with outfile.open("rb") as f:
General Comments 0
You need to be logged in to leave comments. Login now