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

Anne Mulhern amulhern at redhat.com
Fri Sep 26 14:30:33 UTC 2014

----- Original Message -----
From: "Chris Lumens" <clumens at redhat.com>
To: anaconda-patches at lists.fedorahosted.org
Sent: Friday, September 26, 2014 10:17:25 AM
Subject: [PATCH] If the network is disabled,	also disable the network part of the source spoke.

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.

Could you get rid of the parenthetical expression? Nobody's going to come and fix
it when the default case changes to network up.

+        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.

Could you get rid of the very last line of this comment? I know that's what the bug
is about, but the code is about all stale messages, not just network related ones.

+            self.clear_info()
             NormalSpoke.on_back_clicked(self, button)
     def on_chooser_clicked(self, button):

anaconda-patches mailing list
anaconda-patches at lists.fedorahosted.org

A few inline comments, otherwise Ack.

- mulhern

More information about the anaconda-patches mailing list