[PATCH] Allow NFS addon repos (#985080)

David Shea dshea at redhat.com
Wed Jun 18 20:16:50 UTC 2014


Also un-translatable the other instance of "nfs" in the glade file
because it's not, really.
---
 pyanaconda/ui/gui/spokes/source.glade |  6 ++++--
 pyanaconda/ui/gui/spokes/source.py    | 23 +++++++++++++++++++++--
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/source.glade b/pyanaconda/ui/gui/spokes/source.glade
index 38e4d16..3d803e4 100644
--- a/pyanaconda/ui/gui/spokes/source.glade
+++ b/pyanaconda/ui/gui/spokes/source.glade
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.1 -->
+<!-- Generated with glade 3.18.3 -->
 <interface>
   <requires lib="gtk+" version="3.0"/>
   <requires lib="AnacondaWidgets" version="1.0"/>
@@ -739,7 +739,7 @@
                               <item id="http">http://</item>
                               <item id="https">https://</item>
                               <item id="ftp">ftp://</item>
-                              <item id="nfs" translatable="yes">nfs</item>
+                              <item id="nfs">nfs</item>
                               <item id="Closest mirror" translatable="yes">Closest mirror</item>
                             </items>
                             <signal name="changed" handler="on_protocol_changed" swapped="no"/>
@@ -1178,7 +1178,9 @@
                               <item id="http">http://</item>
                               <item id="https">https://</item>
                               <item id="ftp">ftp://</item>
+                              <item id="nfs">nfs</item>
                             </items>
+                            <signal name="changed" handler="on_repoProtocolComboBox_changed" swapped="no"/>
                             <signal name="changed" handler="on_repoUrl_changed" swapped="no"/>
                           </object>
                           <packing>
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index f2e4d07..17fcec8 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -40,7 +40,7 @@ from pyanaconda.ui.gui.spokes import NormalSpoke
 from pyanaconda.ui.categories.software import SoftwareCategory
 from pyanaconda.ui.gui.utils import enlightbox, fire_gtk_action
 from pyanaconda.iutil import ProxyString, ProxyStringError, cmp_obj_attrs
-from pyanaconda.ui.gui.utils import gtk_call_once, really_hide, really_show
+from pyanaconda.ui.gui.utils import gtk_call_once, really_hide, really_show, fancy_set_sensitive
 from pyanaconda.threads import threadMgr, AnacondaThread
 from pyanaconda.packaging import PayloadError, MetadataError, PackagePayload
 from pyanaconda.regexes import REPO_NAME_VALID, URL_PARSE, HOSTNAME_PATTERN_WITHOUT_ANCHORS
@@ -68,7 +68,8 @@ REPO_OBJ = 2
 
 REPO_PROTO = {PROTOCOL_HTTP:  "http://",
               PROTOCOL_HTTPS: "https://",
-              PROTOCOL_FTP:   "ftp://"
+              PROTOCOL_FTP:   "ftp://",
+              PROTOCOL_NFS:   "nfs://"
               }
 
 def _validateProxy(proxy_string, username_set, password_set):
@@ -976,6 +977,10 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler):
         return InputCheck.CHECK_OK
 
     def _checkRepoProxy(self, inputcheck):
+        # If nfs is selected as the protocol, skip the proxy check
+        if self._repoProtocolComboBox.get_active_id() == PROTOCOL_NFS:
+            return InputCheck.CHECK_OK
+
         # Empty proxies are OK, as long as the username and password are empty too
         proxy_string = self.get_input(inputcheck.input_obj).strip()
         username_set = self._repoProxyUsernameEntry.is_sensitive() and self._repoProxyUsernameEntry.get_text().strip()
@@ -1393,3 +1398,17 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler):
         self._repoNameChecks[repo] = InputCheckHandler.add_check(self, self._repoNameEntry, self._checkRepoName, Gtk.TreeRowReference.new(model, path))
         self._repoURLChecks[repo] = InputCheckHandler.add_check(self, self._repoUrlEntry, self._checkRepoURL, Gtk.TreeRowReference.new(model, path))
         self._repoProxyChecks[repo] = InputCheckHandler.add_check(self, self._repoProxyUrlEntry, self._checkRepoProxy, Gtk.TreeRowReference.new(model, path))
+
+    def on_repoProtocolComboBox_changed(self, combobox, user_data=None):
+        # Set the mirrorlist and proxy fields sensitivity depending on whether NFS was selected
+        sensitive = not(self._repoProtocolComboBox.get_active_id() == PROTOCOL_NFS)
+        fancy_set_sensitive(self._repoMirrorlistCheckbox, sensitive)
+        fancy_set_sensitive(self._repoProxyUrlEntry, sensitive)
+        fancy_set_sensitive(self._repoProxyUsernameEntry, sensitive)
+        fancy_set_sensitive(self._repoProxyPasswordEntry, sensitive)
+
+        # Re-run the proxy check
+        itr = self._repoSelection.get_selected()[1]
+        if itr:
+            repo = self._repoStore[itr][REPO_OBJ]
+            self._repoProxyChecks[repo].update_check_status()
-- 
2.0.0



More information about the anaconda-patches mailing list