summaryrefslogtreecommitdiff
path: root/gi/overrides/Gtk.py
diff options
context:
space:
mode:
Diffstat (limited to 'gi/overrides/Gtk.py')
-rw-r--r--gi/overrides/Gtk.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 31d1362..55d139e 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -759,7 +759,11 @@ class TreeModel(Gtk.TreeModel):
else:
raise ValueError('Expected an integer for column %i but got %s' % (column, type(value)))
elif type_ == GObject.TYPE_BOOLEAN:
- if isinstance(value, (int, long)):
+ cmp_classes = [int]
+ if sys.version_info < (3, 0):
+ cmp_classes.append(long)
+
+ if isinstance(value, tuple(cmp_classes)):
value = bool(value)
else:
raise ValueError('Expected a bool for column %i but got %s' % (column, type(value)))
@@ -775,6 +779,16 @@ class TreeModel(Gtk.TreeModel):
elif type_ == GObject.TYPE_UCHAR:
value_container.set_uchar(value)
value = value_container
+ elif type_ == GObject.TYPE_UNICHAR:
+ cmp_classes = [str]
+ if sys.version_info < (3, 0):
+ cmp_classes.append(unicode)
+
+ if isinstance(value, tuple(cmp_classes)):
+ value = ord(value[0])
+
+ value_container.set_uint(value)
+ value = value_container
elif type_ == GObject.TYPE_UINT:
value_container.set_uint(value)
value = value_container
@@ -1218,6 +1232,15 @@ _Gtk_main_quit = Gtk.main_quit
def main_quit(*args):
_Gtk_main_quit()
+_Gtk_stock_lookup = Gtk.stock_lookup
+@override(Gtk.stock_lookup)
+def stock_lookup(*args):
+ success, item = _Gtk_stock_lookup(*args)
+ if not success:
+ return None
+
+ return item
+
initialized, argv = Gtk.init_check(sys.argv)
sys.argv = list(argv)
if not initialized: