Author: asterix Date: 2007-10-21 11:40:09 +0200 (Sun, 21 Oct 2007) New Revision: 8919
Modified: trunk/src/gajim.py Log: fix check of presence of X server. Fixes #3481
Modified: trunk/src/gajim.py =================================================================== --- trunk/src/gajim.py 2007-10-21 09:28:34 UTC (rev 8918) +++ trunk/src/gajim.py 2007-10-21 09:40:09 UTC (rev 8919) @@ -113,6 +113,17 @@ 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 @@ 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')