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

Re: [et-mgmt-tools] [PATCH] virt-manager: remove disambiguity in "free space" dialog



On Mon, Feb 09, 2009 at 08:21:29AM +0000, Mark McLoughlin wrote:
> Hi Guido,
> 
> On Sat, 2009-02-07 at 21:34 +0100, Guido Günther wrote:
> > -                res = self.err.yes_no(_("Not Enough Free Space"), ret[1])
> > +                res = self.err.yes_no(_("Not Enough Free Space"), _("%s. Continue anyway?") % ret[1])
> >                  if not res:
> >                      return False
> 
> See the GNOME HIG:
> 
>   http://library.gnome.org/devel/hig-book/stable/windows-alert.html.en#alert-button-order
> 
> I think what you want here is to change the buttons to Cancel/Continue -
> i.e. a Cancel button and an affirmative verb button.
I've changed this to "Ok/Cancel" in the attached patch. A simple Ok
looks more obvious to me in this case since I'd be unsure to continue
with what (it's not creating wizard in the case of add_hardware) and the
only thing the user has to do is to acknowledge.
 -- Guido
diff -r 565bdc868125 src/virtManager/addhardware.py
--- a/src/virtManager/addhardware.py	Fri Feb 13 13:04:31 2009 +0100
+++ b/src/virtManager/addhardware.py	Fri Feb 13 13:04:40 2009 +0100
@@ -800,7 +800,7 @@
 
             ret = self._dev.is_size_conflict()
             if not ret[0] and ret[1]:
-                res = self.err.yes_no(_("Not Enough Free Space"), ret[1])
+                res = self.err.ok_cancel(_("Not Enough Free Space"), ret[1])
                 if not res:
                     return False
 
diff -r 565bdc868125 src/virtManager/create.py
--- a/src/virtManager/create.py	Fri Feb 13 13:04:31 2009 +0100
+++ b/src/virtManager/create.py	Fri Feb 13 13:04:40 2009 +0100
@@ -1018,7 +1018,7 @@
 
             ret = self._disk.is_size_conflict()
             if not ret[0] and ret[1]:
-                res = self.err.yes_no(_("Not Enough Free Space"), ret[1])
+                res = self.err.ok_cancel(_("Not Enough Free Space"), ret[1])
                 if not res:
                     return False
 
diff -r 565bdc868125 src/virtManager/error.py
--- a/src/virtManager/error.py	Fri Feb 13 13:04:31 2009 +0100
+++ b/src/virtManager/error.py	Fri Feb 13 13:04:40 2009 +0100
@@ -103,17 +103,24 @@
         self.val_err_box.connect("response", response_destroy)
         return False
 
-    def yes_no(self, text1, text2=None):
+
+    def _show_warning(self, buttons, text1, text2):
         message_box = gtk.MessageDialog(self.parent, \
                                         gtk.DIALOG_DESTROY_WITH_PARENT, \
                                         gtk.MESSAGE_WARNING, \
-                                        gtk.BUTTONS_YES_NO, text1)
+                                        buttons, text1)
         if text2 != None:
             message_box.format_secondary_text(text2)
-        if message_box.run()== gtk.RESPONSE_YES:
+        if message_box.run() in [ gtk.RESPONSE_YES, gtk.RESPONSE_OK ]:
             res = True
         else:
             res = False
         message_box.destroy()
         return res
 
+    def yes_no(self, text1, text2=None):
+        return self._show_warning(gtk.BUTTONS_YES_NO, text1, text2)
+
+    def ok_cancel(self, text1, text2=None):
+        return self._show_warning(gtk.BUTTONS_OK_CANCEL, text1, text2)
+

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