def gtkui_dependency_check():
'''
This function verifies that the dependencies that are needed by the GTK user interface are met.
'''
print('\tGTK UI dependencies...', end='')
# Check Gtk
try:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import GObject
assert Gtk.get_major_version() >= 3
print(common.console_color('\tOK', 'green'))
except:
print(common.console_color("\tD'oh!", 'red'))
print('You have to install GTK+3 and PyGObject version >= 3.0 to be able to '
'run the GTK user interface.\n'
' - On Debian-based distributions: apt-get install python-gi\n'
' - On Mac: brew install pygobject3')
sys.exit(1)
# Check GtkSourceView
try:
print('\tGtkSourceView3...', end='')
gi.require_version('GtkSource', '3.0')
from gi.repository import GtkSource
print(common.console_color('\tOK', 'green'))
except:
print(common.console_color("\tD'oh!", 'red'))
print('GtkSourceView3 not installed! Install it for your platform:\n'
' - On Debian-based distributions: apt-get install gir1.2-gtksource-3.0')
sys.exit(1)
# Check PyCairo for GTK+.
try:
print('\tPython Cairo bindings...', end='')
gi.require_version('PangoCairo', '1.0')
from gi.repository import PangoCairo
print(common.console_color('\tOK', 'green'))
except:
print(common.console_color("\tD'oh!", 'red'))
print('Python Cairo bindings for GObject not installed! Install them for your platform:\n'
' - On Debian-based distributions: apt-get install python-gi-cairo')
sys.exit(1)
评论列表
文章目录