[pygobject/pygobject-3-2] pygtkcompat: Correctly set flags



commit ca8a28793dc46dd62fc2140c400c835781b36cb3
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 c6dafcd..ebdd992 100644
--- a/gi/pygtkcompat.py
+++ b/gi/pygtkcompat.py
@@ -69,9 +69,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 fd0ad85..1c5fb1a 100644
--- a/tests/test_pygtkcompat.py
+++ b/tests/test_pygtkcompat.py
@@ -33,6 +33,7 @@ class TestGTKCompat(unittest.TestCase):
 
     def testFlags(self):
         self.assertEquals(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]