[PATCH] If the network is disabled, also disable the network part of the source spoke.

Chris Lumens clumens at redhat.com
Fri Sep 26 14:17:25 UTC 2014

Otherwise, the user could be put into a confusing situation where they have
a network source entered, but the displayed error messages do not help the user
figure out that there's no network connection.  For RHEL this is especially bad
since no network is the default.

Resolves: rhbz#1072453
 pyanaconda/ui/gui/spokes/source.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 7a72785..5df5ce7 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -42,6 +42,7 @@ from pyanaconda.ui.gui.utils import gtk_call_once, really_hide, really_show
 from pyanaconda.threads import threadMgr, AnacondaThread
 from pyanaconda.packaging import PackagePayload, payloadMgr
 from pyanaconda import constants
+from pyanaconda import nm
 from blivet.util import get_mount_device, get_mount_paths
@@ -692,6 +693,14 @@ class SourceSpoke(NormalSpoke):
         # Set up the default state of UI elements.
+        # Make these sensitive now in case the network has been brought up since
+        # a previous visit when they were insensitive.  Later, we'll worry about
+        # the various conditions that could cause these widgets to be marked as
+        # insensitive.
+        self._networkButton.set_sensitive(True)
+        self._networkBox.set_sensitive(True)
         if self.data.method.method == "url":
@@ -761,6 +770,15 @@ class SourceSpoke(NormalSpoke):
             # that condition here too.
+        # If there's no network up (which is the default case), disable all the
+        # network-related stuff.
+        if not nm.nm_is_connected():
+            self._networkButton.set_sensitive(False)
+            self._networkBox.set_sensitive(False)
+            self.clear_info()
+            self.set_warning(_("You need to configure the network to use a network installation source."))
     def showable(self):
         return isinstance(self.payload, PackagePayload)
@@ -806,6 +824,10 @@ class SourceSpoke(NormalSpoke):
         if len(ui_repo_names) != len(frozenset(ui_repo_names)):
+            # Clear any error message on the bottom of the screen so that on
+            # the next visit to this spoke, the user doesn't see a stale message
+            # about no network being up.
+            self.clear_info()
             NormalSpoke.on_back_clicked(self, button)
     def on_chooser_clicked(self, button):

More information about the anaconda-patches mailing list