7009: endless exception loop starting w/o DISPLAY

constfunc.has_display() was using check_init(),
which, on Gtk3, was happy to initalize even that the display was N/A.
Amended the test with an attempt to actually get the Gdk default display.

svn: r22909
This commit is contained in:
Vassilii Khachaturov 2013-08-22 22:39:31 +00:00
parent 405db681a6
commit 68ed5a2838

View File

@ -132,15 +132,15 @@ def has_display():
temp, sys.argv = sys.argv, sys.argv[:1]
try:
from gi.repository import Gtk
from gi.repository import Gdk
except:
return False
try:
test = Gtk.init_check(temp)
test = Gtk.init_check(temp) and \
Gdk.Display.get_default()
sys.argv = temp
if test:
return True
else:
return False
return bool(test)
except:
sys.argv = temp
return False