fix check of presence of X server. Fixes #3481

This commit is contained in:
Yann Leboulanger 2007-10-21 09:40:09 +00:00
parent bbb7f5b0d4
commit d6aa63cd1c
1 changed files with 11 additions and 6 deletions

View File

@ -113,6 +113,17 @@ del config_path
common.configpaths.gajimpaths.init_profile(profile)
del profile
# PyGTK2.10+ only throws a warning
import warnings
warnings.filterwarnings('error', module='gtk')
try:
import gtk
except Warning, msg:
if str(msg) == 'could not open display':
print >> sys.stderr, _('Gajim needs X server to run. Quiting...')
sys.exit()
warnings.resetwarnings()
import message_control
from chat_control import ChatControlBase
@ -134,12 +145,6 @@ if os.name == 'posix': # dl module is Unix Only
except:
pass
try:
import gtk
except RuntimeError, msg:
if str(msg) == 'could not open display':
print >> sys.stderr, _('Gajim needs X server to run. Quiting...')
sys.exit()
pritext = ''
if gtk.pygtk_version < (2, 8, 0):
pritext = _('Gajim needs PyGTK 2.8 or above')