[pygobject] pygtkcompat: Correctly set flags
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] pygtkcompat: Correctly set flags
- Date: Mon, 14 May 2012 11:30:14 +0000 (UTC)
commit 88babe7377402f6e6f912a8b83615aab848eae81
Author: Jose Rostagno <joserostagno vijona com ar>
Date: Fri May 11 19:08:47 2012 -0300
pygtkcompat: Correctly set flags
https://bugzilla.gnome.org/show_bug.cgi?id=675911
Signed-off-by: Martin Pitt <martinpitt gnome org>
gi/pygtkcompat.py | 5 ++---
tests/test_pygtkcompat.py | 1 +
2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gi/pygtkcompat.py b/gi/pygtkcompat.py
index dd0c01f..9359219 100644
--- a/gi/pygtkcompat.py
+++ b/gi/pygtkcompat.py
@@ -71,9 +71,8 @@ def _install_enums(module, dest=None, strip=''):
try:
if issubclass(obj, GObject.GFlags):
for value, flag in obj.__flags_values__.items():
- for name in flag.value_names:
- name = name.replace(modname + '_', '')
- setattr(dest, name, flag)
+ name = flag.value_names[-1].replace(modname + '_', '')
+ setattr(dest, name, flag)
except TypeError:
continue
diff --git a/tests/test_pygtkcompat.py b/tests/test_pygtkcompat.py
index 76f7609..245ee67 100644
--- a/tests/test_pygtkcompat.py
+++ b/tests/test_pygtkcompat.py
@@ -47,6 +47,7 @@ class TestGTKCompat(unittest.TestCase):
def testFlags(self):
self.assertEqual(gtk.EXPAND, Gtk.AttachOptions.EXPAND)
+ self.assertEqual(gtk.gdk.SHIFT_MASK, Gdk.ModifierType.SHIFT_MASK)
def testKeysyms(self):
import gtk.keysyms
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]