[PATCH 1/2] Change Proxy Add Button to Ok

Brian C. Lane bcl at redhat.com
Fri Apr 11 00:08:38 UTC 2014


Add doesn't really reflect how the dialog works, and after the recent
changes there was no way to clear the proxy setting. So rename it to Ok
and leave it sensitive when proxy is disabled. When leaving the dialog
with the proxy disabled it will set the url to "".
---
 pyanaconda/ui/gui/spokes/source.glade |  8 ++++----
 pyanaconda/ui/gui/spokes/source.py    | 36 +++++++++++++++++------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/source.glade b/pyanaconda/ui/gui/spokes/source.glade
index b5862b8..85300b7 100644
--- a/pyanaconda/ui/gui/spokes/source.glade
+++ b/pyanaconda/ui/gui/spokes/source.glade
@@ -237,13 +237,13 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="proxyAddButton">
-                <property name="label" translatable="yes" context="GUI|Software Source|Proxy Dialog">_Add</property>
+              <object class="GtkButton" id="proxyOkButton">
+                <property name="label" translatable="yes" context="GUI|Software Source|Proxy Dialog">_Ok</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_underline">True</property>
-                <signal name="clicked" handler="on_proxy_add_clicked" swapped="no"/>
+                <signal name="clicked" handler="on_proxy_ok_clicked" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -466,7 +466,7 @@
     </child>
     <action-widgets>
       <action-widget response="0">proxyCancelButton</action-widget>
-      <action-widget response="0">proxyAddButton</action-widget>
+      <action-widget response="0">proxyOkButton</action-widget>
     </action-widgets>
   </object>
   <object class="GtkListStore" id="repoStore">
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 5d13366..cc64ddb 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -84,7 +84,7 @@ class ProxyDialog(GUIObject, GUIDialogInputCheckHandler):
         self._proxyURLEntry = self.builder.get_object("proxyURLEntry")
         self._proxyUsernameEntry = self.builder.get_object("proxyUsernameEntry")
         self._proxyPasswordEntry = self.builder.get_object("proxyPasswordEntry")
-        self._proxyAddButton = self.builder.get_object("proxyAddButton")
+        self._proxyOkButton = self.builder.get_object("proxyOkButton")
 
         self._proxyValidate = self.add_check(self._proxyURLEntry, self._validateProxy)
         self._proxyValidate.update_check_status()
@@ -109,36 +109,36 @@ class ProxyDialog(GUIObject, GUIDialogInputCheckHandler):
         GUIDialogInputCheckHandler.set_status(self, inputcheck)
 
         # Change the sensitivity of the Add button
-        self._proxyAddButton.set_sensitive(inputcheck.check_status == InputCheck.CHECK_OK)
+        self._proxyOkButton.set_sensitive(inputcheck.check_status == InputCheck.CHECK_OK)
 
     def on_proxy_cancel_clicked(self, *args):
         self.window.destroy()
 
-    def on_proxy_add_clicked(self, *args):
-        url = self._proxyURLEntry.get_text()
+    def on_proxy_ok_clicked(self, *args):
+        if self._proxyCheck.get_active():
+            url = self._proxyURLEntry.get_text()
 
-        if self._authCheck.get_active():
-            username = self._proxyUsernameEntry.get_text()
-            password = self._proxyPasswordEntry.get_text()
-        else:
-            username = None
-            password = None
+            if self._authCheck.get_active():
+                username = self._proxyUsernameEntry.get_text()
+                password = self._proxyPasswordEntry.get_text()
+            else:
+                username = None
+                password = None
 
-        proxy = ProxyString(url=url, username=username, password=password)
-        self.proxyUrl = proxy.url
+            proxy = ProxyString(url=url, username=username, password=password)
+            self.proxyUrl = proxy.url
+        else:
+            self.proxyUrl = ""
 
         self.window.destroy()
 
     def on_proxy_enable_toggled(self, button, *args):
         self._proxyInfoBox.set_sensitive(button.get_active())
 
-        # If disabling, set the add button to insensitve: there's nothing to
-        # add so the user can cancel to exit instead. If enabling, use
-        # the input check status to set the sensitivity
-        if not button.get_active():
-            self._proxyAddButton.set_sensitive(False)
-        else:
+        if button.get_active():
             self.set_status(self._proxyValidate)
+        else:
+            self._proxyOkButton.set_sensitive(True)
 
     def on_proxy_auth_toggled(self, button, *args):
         self._proxyAuthBox.set_sensitive(button.get_active())
-- 
1.9.0



More information about the anaconda-patches mailing list