[nebm51] don't open a console window under windows when runnin latex. Fixes #4519

This commit is contained in:
Yann Leboulanger 2008-11-24 09:38:28 +00:00
parent 5e6d15837c
commit 0c6b1a391b
2 changed files with 39 additions and 16 deletions

View file

@ -157,8 +157,8 @@ class TextViewImage(gtk.Image):
class ConversationTextview: class ConversationTextview:
'''Class for the conversation textview (where user reads already said messages) '''Class for the conversation textview (where user reads already said
for chat/groupchat windows''' messages) for chat/groupchat windows'''
FOCUS_OUT_LINE_PIXBUF = gtk.gdk.pixbuf_new_from_file(os.path.join( FOCUS_OUT_LINE_PIXBUF = gtk.gdk.pixbuf_new_from_file(os.path.join(
gajim.DATA_DIR, 'pixmaps', 'muc_separator.png')) gajim.DATA_DIR, 'pixmaps', 'muc_separator.png'))
@ -276,7 +276,8 @@ class ConversationTextview:
self.tagSthAtSth = buffer.create_tag('sth_at_sth') self.tagSthAtSth = buffer.create_tag('sth_at_sth')
self.tagSthAtSth.set_property('foreground', color) self.tagSthAtSth.set_property('foreground', color)
self.tagSthAtSth.set_property('underline', pango.UNDERLINE_SINGLE) self.tagSthAtSth.set_property('underline', pango.UNDERLINE_SINGLE)
id = self.tagSthAtSth.connect('event', self.hyperlink_handler, 'sth_at_sth') id = self.tagSthAtSth.connect('event', self.hyperlink_handler,
'sth_at_sth')
self.handlers[id] = self.tagSthAtSth self.handlers[id] = self.tagSthAtSth
tag = buffer.create_tag('bold') tag = buffer.create_tag('bold')
@ -1002,8 +1003,13 @@ class ConversationTextview:
file.close() file.close()
try: try:
p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'], if os.name == 'nt':
cwd=gettempdir()) # CREATE_NO_WINDOW
p = Popen(['latex', '--interaction=nonstopmode',
tmpfile + '.tex'], creationflags=0x08000000, cwd=gettempdir())
else:
p = Popen(['latex', '--interaction=nonstopmode',
tmpfile + '.tex'], cwd=gettempdir())
exitcode = p.wait() exitcode = p.wait()
except Exception, e: except Exception, e:
exitcode = _('Error executing "%(command)s": %(error)s') % { exitcode = _('Error executing "%(command)s": %(error)s') % {
@ -1013,15 +1019,20 @@ class ConversationTextview:
if exitcode == 0: if exitcode == 0:
latex_png_dpi = gajim.config.get('latex_png_dpi') latex_png_dpi = gajim.config.get('latex_png_dpi')
try: try:
p = Popen(['dvipng', '-bg', 'rgb 1.0 1.0 1.0', '-T', 'tight', '-D', if os.name == 'nt':
latex_png_dpi, tmpfile + '.dvi', '-o', tmpfile + '.png'], # CREATE_NO_WINDOW
cwd=gettempdir()) p = Popen(['dvipng', '-bg', 'rgb 1.0 1.0 1.0', '-T', 'tight',
'-D', latex_png_dpi, tmpfile + '.dvi', '-o',
tmpfile + '.png'], creationflags=0x08000000, cwd=gettempdir())
else:
p = Popen(['dvipng', '-bg', 'rgb 1.0 1.0 1.0', '-T', 'tight',
'-D', latex_png_dpi, tmpfile + '.dvi', '-o',
tmpfile + '.png'], cwd=gettempdir())
exitcode = p.wait() exitcode = p.wait()
except Exception, e: except Exception, e:
exitcode = _('Error executing "%(command)s": %(error)s') % { exitcode = _('Error executing "%(command)s": %(error)s') % {
'command': 'dvipng -bg rgb 1.0 1.0 1.0 -T tight -D %s %s.dvi -o %s.png' %\ 'command': 'dvipng -bg rgb 1.0 1.0 1.0 -T tight -D %s %s.dvi -o '
(latex_png_dpi, tmpfile, tmpfile), '%s.png' % (latex_png_dpi, tmpfile, tmpfile), 'error': str(e)}
'error': str(e)}
extensions = ['.tex', '.log', '.aux', '.dvi'] extensions = ['.tex', '.log', '.aux', '.dvi']
for ext in extensions: for ext in extensions:
@ -1136,7 +1147,8 @@ class ConversationTextview:
imagepath = self.latex_to_image(special_text) imagepath = self.latex_to_image(special_text)
except LatexError, e: except LatexError, e:
# print the error after the line has been written # print the error after the line has been written
gobject.idle_add(self.print_conversation_line, str(e), '', 'info', '', None) gobject.idle_add(self.print_conversation_line, str(e), '', 'info',
'', None)
imagepath = None imagepath = None
end_iter = buffer.get_end_iter() end_iter = buffer.get_end_iter()
anchor = buffer.create_child_anchor(end_iter) anchor = buffer.create_child_anchor(end_iter)

View file

@ -277,6 +277,11 @@ class FeaturesWindow:
file.flush() file.flush()
file.close() file.close()
try: try:
if os.name == 'nt':
# CREATE_NO_WINDOW
p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
creationflags=0x08000000, cwd=gettempdir())
else:
p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'], p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
cwd=gettempdir()) cwd=gettempdir())
exitcode = p.wait() exitcode = p.wait()
@ -284,6 +289,12 @@ class FeaturesWindow:
exitcode = 1 exitcode = 1
if exitcode == 0: if exitcode == 0:
try: try:
if os.name == 'nt':
# CREATE_NO_WINDOW
p = Popen(['dvipng', '-bg', 'white', '-T', 'tight',
creationflags=0x08000000, tmpfile + '.dvi', '-o',
tmpfile + '.png'], cwd=gettempdir())
else:
p = Popen(['dvipng', '-bg', 'white', '-T', 'tight', p = Popen(['dvipng', '-bg', 'white', '-T', 'tight',
tmpfile + '.dvi', '-o', tmpfile + '.png'], cwd=gettempdir()) tmpfile + '.dvi', '-o', tmpfile + '.png'], cwd=gettempdir())
exitcode = p.wait() exitcode = p.wait()