+try:
+ if OS.getenv('TRIPEMON_FORCE_GI'): raise ImportError
+ import pygtk
+ pygtk.require('2.0')
+ import gtk as G
+ import gobject as GO
+ import gtk.gdk as GDK
+ GL = GO
+ GDK.KEY_Escape = G.keysyms.Escape
+ def raise_window(w): w.window.raise_()
+ combo_box_text = G.combo_box_new_text
+ def set_entry_bg(e, c): e.modify_base(G.STATE_NORMAL, c)
+except ImportError:
+ from gi.repository import GObject as GO, GLib as GL, Gtk as G, Gdk as GDK
+ G.WINDOW_TOPLEVEL = G.WindowType.TOPLEVEL
+ G.EXPAND = G.AttachOptions.EXPAND
+ G.SHRINK = G.AttachOptions.SHRINK
+ G.FILL = G.AttachOptions.FILL
+ G.SORT_ASCENDING = G.SortType.ASCENDING
+ G.POLICY_AUTOMATIC = G.PolicyType.AUTOMATIC
+ G.SHADOW_IN = G.ShadowType.IN
+ G.SELECTION_NONE = G.SelectionMode.NONE
+ G.DIALOG_MODAL = G.DialogFlags.MODAL
+ G.RESPONSE_CANCEL = G.ResponseType.CANCEL
+ G.RESPONSE_NONE = G.ResponseType.NONE
+ def raise_window(w): getattr(w.get_window(), 'raise')()
+ combo_box_text = G.ComboBoxText
+ def set_entry_bg(e, c): e.modify_bg(G.StateType.NORMAL, c)