Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
d9277816
Commit
d9277816
authored
16 years ago
by
Brendan Taylor
Browse files
Options
Downloads
Patches
Plain Diff
log latex output instead of dumping it straight to stdout
parent
898bc7c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/latex.py
+12
-3
12 additions, 3 deletions
src/common/latex.py
with
12 additions
and
3 deletions
src/common/latex.py
+
12
−
3
View file @
d9277816
...
...
@@ -30,7 +30,10 @@
import
os
import
random
from
tempfile
import
gettempdir
from
subprocess
import
Popen
from
subprocess
import
Popen
,
PIPE
import
logging
log
=
logging
.
getLogger
(
'
gajim.c.latex
'
)
import
gajim
from
exceptions
import
LatexError
...
...
@@ -72,12 +75,14 @@ def write_latex(filename, str_):
file_
.
close
()
# a wrapper for Popen so that no window gets opened on Windows
# (i think this is the reason we're using Popen rather than just system())
# stdout goes to a pipe so that it can be read
def
popen_nt_friendly
(
command
):
if
os
.
name
==
'
nt
'
:
# CREATE_NO_WINDOW
return
Popen
(
command
,
creationflags
=
0x08000000
,
cwd
=
gettempdir
())
return
Popen
(
command
,
creationflags
=
0x08000000
,
cwd
=
gettempdir
()
,
stdout
=
PIPE
)
else
:
return
Popen
(
command
,
cwd
=
gettempdir
())
return
Popen
(
command
,
cwd
=
gettempdir
()
,
stdout
=
PIPE
)
def
check_for_latex_support
():
'''
check is latex is available and if it can create a picture.
'''
...
...
@@ -110,6 +115,8 @@ def latex_to_image(str_):
try
:
p
=
popen_nt_friendly
([
'
latex
'
,
'
--interaction=nonstopmode
'
,
tmpfile
+
'
.tex
'
])
out
=
p
.
communicate
()[
0
]
log
.
info
(
out
)
exitcode
=
p
.
wait
()
except
Exception
,
e
:
exitcode
=
_
(
'
Error executing
"
%(command)s
"
: %(error)s
'
)
%
{
...
...
@@ -123,6 +130,8 @@ def latex_to_image(str_):
p
=
popen_nt_friendly
([
'
dvipng
'
,
'
-bg
'
,
'
rgb 1.0 1.0 1.0
'
,
'
-T
'
,
'
tight
'
,
'
-D
'
,
latex_png_dpi
,
tmpfile
+
'
.dvi
'
,
'
-o
'
,
tmpfile
+
'
.png
'
])
out
=
p
.
communicate
()[
0
]
log
.
info
(
out
)
exitcode
=
p
.
wait
()
except
Exception
,
e
:
exitcode
=
_
(
'
Error executing
"
%(command)s
"
: %(error)s
'
)
%
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment