[POS-commit] r3976 - kiwi/trunk/kiwi/ui

Henrique Romano henrique at async.com.br
Mon Jul 24 16:29:23 BRT 2006


Author: henrique
Date: Mon Jul 24 16:29:22 2006
New Revision: 3976

Modified:
   kiwi/trunk/kiwi/ui/dialogs.py

Log:
yesno() now accepts a buttons parameter; also, checking for 
buttons=None on messagedialog, so we can map it to gtk.BUTTONS_NONE.
r=jdahlin


Modified: kiwi/trunk/kiwi/ui/dialogs.py
==============================================================================
--- kiwi/trunk/kiwi/ui/dialogs.py	(original)
+++ kiwi/trunk/kiwi/ui/dialogs.py	Mon Jul 24 16:29:22 2006
@@ -167,7 +167,7 @@
         dialog_buttons = buttons
         buttons = []
     else:
-        if type(buttons) != tuple:
+        if buttons is not None and type(buttons) != tuple:
             raise TypeError(
                 "buttons must be a GtkButtonsTypes constant or a tuple")
         dialog_buttons = gtk.BUTTONS_NONE
@@ -177,8 +177,9 @@
 
     d = HIGAlertDialog(parent=parent, flags=gtk.DIALOG_MODAL,
                        type=dialog_type, buttons=dialog_buttons)
-    for text, response in buttons:
-        d.add_buttons(text, response)
+    if buttons:
+        for text, response in buttons:
+            d.add_buttons(text, response)
 
     d.set_primary(short)
 
@@ -221,10 +222,10 @@
     return _simple(gtk.MESSAGE_WARNING, short, long, parent=parent,
                    buttons=buttons, default=default)
 
-def yesno(text, parent=None, default=gtk.RESPONSE_YES):
+def yesno(text, parent=None, default=gtk.RESPONSE_YES,
+          buttons=gtk.BUTTONS_YES_NO):
     return messagedialog(gtk.MESSAGE_WARNING, text, None, parent,
-                         buttons=gtk.BUTTONS_YES_NO,
-                         default=default)
+                         buttons=buttons, default=default)
 
 def open(title='', parent=None, patterns=[], folder=None, filter=None):
     """Displays an open dialog.


More information about the POS-commit mailing list