1 """Compatibility wrapper to make Python 3's GTK look more like Python 2's version.
5 # Copyright (C) 2012, Thomas Leonard
6 # See the README file for details, or visit http://0install.net.
8 from __future__
import absolute_import
11 if sys
.version_info
[0] > 2:
14 from gi
.repository
import Gdk
as gdk
15 from gi
.repository
.Gdk
import Screen
17 from gi
.repository
.Gtk
import MessageType
, ResponseType
, WindowPosition
, PolicyType
, ShadowType
, WrapMode
18 from gi
.repository
.Gtk
import Dialog
, ScrolledWindow
, TextView
, TreePath
19 from gi
.repository
.Gtk
import Builder
, Menu
20 from gi
.repository
.Gtk
import TreeStore
, TreeViewColumn
, CellRendererText
21 from gi
.repository
.Gtk
import STOCK_CLOSE
22 from gi
.repository
.Gtk
import MenuItem
as GtkMenuItem
24 MESSAGE_ERROR
= MessageType
.ERROR
26 RESPONSE_CANCEL
= ResponseType
.CANCEL
27 RESPONSE_CLOSE
= ResponseType
.CLOSE
28 RESPONSE_HELP
= ResponseType
.HELP
29 RESPONSE_DELETE_EVENT
= ResponseType
.DELETE_EVENT
31 WIN_POS_CENTER
= WindowPosition
.CENTER
32 POLICY_AUTOMATIC
= PolicyType
.AUTOMATIC
33 POLICY_ALWAYS
= PolicyType
.ALWAYS
34 SHADOW_IN
= ShadowType
.IN
35 WRAP_WORD
= WrapMode
.WORD
37 gdk
.screen_width
= Screen
.get_default().get_width
38 gdk
.screen_height
= Screen
.get_default().get_height
40 gdk
.BUTTON_PRESS
= gdk
.EventType
.BUTTON_PRESS
48 return path
.get_depth()
50 def path_parent(path
):
55 from gtk
import * # Python 2
60 def path_parent(path
):