[pygobject/invoke-rewrite] [overrides] deprecate the use of type keyword MessageDialog constructor



commit c167a9345b01c070bd5a84b4a4b3a53baf9e217d
Author: John (J5) Palmieri <johnp redhat com>
Date:   Fri Jul 8 11:24:09 2011 -0400

    [overrides] deprecate the use of type keyword MessageDialog constructor
    
    * pygtk used type to determine the "type" of message dialog to display but we
      use the proper property name "message_type" since we should not be
      overriding a reserved word
    * to keep compat with pygtk we check the kwds hash for the key 'type' and
      assign it to message_type while throwing a deprecation warning
    * also add a deprication warning when trying to use the depricated NO_SEPARATOR
      flag

 gi/overrides/Gtk.py |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 6dddc9a..5e08647 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -377,7 +377,8 @@ class Dialog(Gtk.Dialog, Container):
             if flags & Gtk.DialogFlags.NO_SEPARATOR:
                 self.set_has_separator(False)
         except AttributeError:
-            pass
+            import warnings
+            warnings.warn("Gtk.DialogFlags.NO_SEPARATOR has been depricated since Gtk+-3.0", DeprecationWarning)
 
         if buttons is not None:
             self.add_buttons(*buttons)
@@ -413,7 +414,7 @@ class MessageDialog(Gtk.MessageDialog, Dialog):
     def __init__(self,
                  parent=None,
                  flags=0,
-                 type=Gtk.MessageType.INFO,
+                 message_type=Gtk.MessageType.INFO,
                  buttons=Gtk.ButtonsType.NONE,
                  message_format=None,
                  **kwds):
@@ -422,12 +423,14 @@ class MessageDialog(Gtk.MessageDialog, Dialog):
             kwds['text'] = message_format
 
         # type keyword is used for backwards compat with PyGTK
-        if 'message_type' in kwds:
-            type = kwds.pop('message_type')
+        if 'type' in kwds:
+            import warnings
+            warnings.warn("The use of the keyword type as a parameter of the Gtk.MessageDialog constructor has been depricated. Please use message_type instead.", DeprecationWarning)
+            message_type = kwds.pop('type')
 
         Gtk.MessageDialog.__init__(self,
                                    _buttons_property=buttons,
-                                   message_type=type,
+                                   message_type=message_type,
                                    **kwds)
         Dialog.__init__(self, parent=parent, flags=flags)
 



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