print startup errors in a gtk.window instead of to std.err

This commit is contained in:
Yann Leboulanger 2005-12-01 17:17:20 +00:00
parent 54e47436e3
commit 892d665a50
1 changed files with 14 additions and 7 deletions

View File

@ -27,6 +27,7 @@ import sys
import os import os
import pygtk import pygtk
from common import exceptions
from common import i18n from common import i18n
i18n.init() i18n.init()
_ = i18n._ _ = i18n._
@ -37,13 +38,13 @@ except RuntimeError, msg:
if str(msg) == 'could not open display': if str(msg) == 'could not open display':
print >> sys.stderr, _('Gajim needs Xserver to run. Quiting...') print >> sys.stderr, _('Gajim needs Xserver to run. Quiting...')
sys.exit() sys.exit()
pritext = ''
if gtk.pygtk_version < (2, 6, 0): if gtk.pygtk_version < (2, 6, 0):
print >> sys.stderr, _('Gajim needs PyGTK 2.6+ to run. Quiting...') pritext = _('Gajim needs PyGTK 2.6+')
sys.exit() sectext = _('Gajim needs PyGTK 2.6+ to run. Quiting...')
elif gtk.gtk_version < (2, 6, 0): elif gtk.gtk_version < (2, 6, 0):
print >> sys.stderr, _('Gajim needs GTK 2.6+ to run. Quiting...') pritext = _('Gajim needs GTK 2.6+')
sys.exit() sectext = _('Gajim needs GTK 2.6+ to run. Quiting...')
try: try:
import gtk.glade # check if user has libglade (in pygtk and in gtk) import gtk.glade # check if user has libglade (in pygtk and in gtk)
@ -53,7 +54,14 @@ except ImportError:
sectext = _('Please remove your current GTK+ runtime and install the latest stable version from %s') % 'http://gladewin32.sourceforge.net' sectext = _('Please remove your current GTK+ runtime and install the latest stable version from %s') % 'http://gladewin32.sourceforge.net'
else: else:
sectext = _('Please make sure that gtk and pygtk have libglade support in your system.') sectext = _('Please make sure that gtk and pygtk have libglade support in your system.')
try:
from common import check_paths
except exceptions.PysqliteNotAvailable, e:
pritext = _('Gajim needs Pysqlite2')
sectext = str(e)
if pritext:
dlg = gtk.MessageDialog(None, dlg = gtk.MessageDialog(None,
gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL, gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL,
gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message_format = pritext) gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message_format = pritext)
@ -63,7 +71,6 @@ except ImportError:
dlg.destroy() dlg.destroy()
sys.exit() sys.exit()
from common import check_paths
check_paths.check_and_possibly_create_paths() check_paths.check_and_possibly_create_paths()
path = os.getcwd() path = os.getcwd()