[pygobject] Add an override for Gdk.color_parse()



commit 5b1c875269b7979caae97e84919a690a34d92f29
Author: Johan Dahlin <jdahlin litl com>
Date:   Mon Jun 27 00:36:20 2011 -0300

    Add an override for Gdk.color_parse()
    
    Change Gdk.color_parse() to not return a tuple, instead just
    return the created color or None if it wasn't possible to parse
    the name into a color.
    
    This keeps compatibility with PyGTK but breaks the current API.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=653462

 gi/overrides/Gdk.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
index 7b86e1f..3485689 100644
--- a/gi/overrides/Gdk.py
+++ b/gi/overrides/Gdk.py
@@ -284,6 +284,14 @@ class Cursor(Gdk.Cursor):
 Cursor = override(Cursor)
 __all__.append('Cursor')
 
+_Gdk_color_parse = Gdk.color_parse
+ override(Gdk.color_parse)
+def color_parse(color):
+    success, color = _Gdk_color_parse(color)
+    if not success:
+        return None
+    return color
+
 import sys
 
 initialized, argv = Gdk.init_check(sys.argv)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]