Workaround to suppress gtk bogus warning regarding non-string items in sys.argv, error reported upstream as gnome (pygtk) #637877
svn: r16313
This commit is contained in:
parent
320cbb0308
commit
87873dbf22
@ -33,6 +33,7 @@ perform a translation on import, eg gtk.
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import platform
|
import platform
|
||||||
|
import sys
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -100,12 +101,17 @@ def has_display():
|
|||||||
Tests to see if Python is currently running with gtk and
|
Tests to see if Python is currently running with gtk and
|
||||||
windowing system is Mac OS-X's "quartz".
|
windowing system is Mac OS-X's "quartz".
|
||||||
"""
|
"""
|
||||||
|
# FIXME: currently, gtk.init_check() requires all strings
|
||||||
|
# in argv, and we might have unicode.
|
||||||
|
temp, sys.argv = sys.argv, sys.argv[:1]
|
||||||
try:
|
try:
|
||||||
import gtk
|
import gtk
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
gtk.init_check()
|
gtk.init_check()
|
||||||
|
sys.argv = temp
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
|
sys.argv = temp
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user