def importModules(buildDir, srcDir): # Be very careful when you change this code, it's # fragile and the order is really significant # ltihooks sys.path.insert(0, srcDir) # atk, pango sys.path.insert(0, buildDir) # _gtk, keysyms, glade sys.path.insert(0, os.path.join(buildDir, 'gtk')) sys.argv.append('--g-fatal-warnings') import ltihooks atk = importModule('atk', buildDir) pango = importModule('pango', buildDir) gtk = importModule('gtk', buildDir, 'gtk') gdk = importModule('gtk.gdk', buildDir, '_gdk.la') # gtk/__init__.py removes the ltihooks, readd them import gtk ltihooks.install() glade = importModule('gtk.glade', buildDir) ltihooks.uninstall() del ltihooks globals().update(locals()) os.environ['PYGTK_USE_GIL_STATE_API'] = '' gobject.threads_init()
ver = getattr(_gobject, 'pygobject_version', ()) if ver < (2, 11, 1): raise ImportError( "PyGTK requires PyGObject 2.11.1 or higher, but %s was found" % (ver, )) if 'gtk._gtk' in sys.modules: _gtk = sys.modules['gtk._gtk'] else: from gtk import _gtk import gdk if ltihooks: ltihooks.uninstall() del ltihooks from gtk._lazyutils import LazyNamespace, LazyModule from gtk.deprecation import _Deprecated, _DeprecatedConstant def _init(): import sys sys_path = sys.path[:] _gtk.init_check() # init_check calls PySys_SetArgv which calls sys.path.insert(0, ''), # which causes problems for pychecker, restore it if modified.
import gobject as _gobject ver = getattr(_gobject, "pygobject_version", ()) if ver < (2, 11, 1): raise ImportError("PyGTK requires PyGObject 2.11.1 or higher, but %s was found" % (ver,)) if "gtk._gtk" in sys.modules: _gtk = sys.modules["gtk._gtk"] else: from gtk import _gtk import gdk if ltihooks: try: ltihooks.uninstall() del ltihooks except: pass from gtk._lazyutils import LazyNamespace, LazyModule from gtk.deprecation import _Deprecated, _DeprecatedConstant def _init(): import sys try: sys_path = sys.path[:] try: