From 68ed5a28388a2e70657bb2eb3d3df777bfd4ea5b Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Thu, 22 Aug 2013 22:39:31 +0000 Subject: [PATCH] 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 --- gramps/gen/constfunc.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gramps/gen/constfunc.py b/gramps/gen/constfunc.py index 08b851f05..202eaa5d1 100644 --- a/gramps/gen/constfunc.py +++ b/gramps/gen/constfunc.py @@ -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