[pygobject/invoke-rewrite] [gtk-overrides] allow the message_type keyword to be used for MessageDialogs



commit 7c589c0c1de1a786e00685afd5292b6fb1f93ed3
Author: John (J5) Palmieri <johnp redhat com>
Date:   Tue Jun 28 13:08:49 2011 -0400

    [gtk-overrides] allow the message_type keyword to be used for MessageDialogs
    
     * for pygtk compat we use the type keyword for message type but we prefer
       the use of message_type because it is more descriptive and does not clash
       with a python reserved word
     * if you passed message_type into a MessageDialog constructor you would get
       an error because we also convert type to message_type when calling the
       parent constructor
     * this patch looks to see if message_type was passed in as a keyword and
       assigns it to type while removing message_type from the keywords dict
       to avoid name clashing

 gi/overrides/Gtk.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index e8e7592..7a8c173 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -408,6 +408,11 @@ class MessageDialog(Gtk.MessageDialog, Dialog):
 
         if message_format != None:
             kwds['text'] = message_format
+
+        # type keyword is used for backwards compat with PyGTK
+        if 'message_type' in kwds:
+            type = kwds.pop('message_type')
+
         Gtk.MessageDialog.__init__(self,
                                    _buttons_property=buttons,
                                    message_type=type,



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