From 3c4deee414ad8c37cfdc55ce2de7d4fbd49af017 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Fri, 25 Apr 2008 13:53:02 -1000 Subject: Preserve 'set the hostname' setting when going Next/Back (#443414) Better fix for #408921. Using network.overrideDHCPhostname to set the default behavior of requiring users to set a hostname. If the user changed that to 'use DHCP', clicked Next, then clicked Back, the network configuration screen would be back at manual for the hostname. Fixed that by honoring overrideDHCPhostname. Also took the opportunity to make overrideDHCPhostname a boolean since that's how we are using it. --- iw/network_gui.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'iw/network_gui.py') diff --git a/iw/network_gui.py b/iw/network_gui.py index 0fdfa0977..95a6c1e5e 100644 --- a/iw/network_gui.py +++ b/iw/network_gui.py @@ -46,7 +46,7 @@ class NetworkWindow(InstallWindow): if not rc: raise gui.StayOnScreen - override = 0 + override = False if self.hostnameManual.get_active(): hname = string.strip(self.hostnameEntry.get_text()) neterrors = network.sanityCheckHostname(hname) @@ -60,10 +60,10 @@ class NetworkWindow(InstallWindow): raise gui.StayOnScreen newHostname = hname - override = 1 + override = True else: newHostname = "localhost.localdomain" - override = 0 + override = False # FIXME: This is a temporary solution until the UI is reworked. Since # we do dual IPv4/IPv6 stacks, we could have IPv4 on DHCP and static @@ -120,10 +120,13 @@ class NetworkWindow(InstallWindow): return None def setHostOptionsSensitivity(self): - # force users to pick a hostname (#408921) self.hostnameUseDHCP.set_sensitive(1) self.hostnameManual.set_sensitive(1) - self.hostnameManual.set_active(1) + + if self.network.overrideDHCPhostname: + self.hostnameManual.set_active(1) + else: + self.hostnameUseDHCP.set_active(1) # FIXME: ipTable should allow for default gateways for IPv4 and IPv6 # Disable ipTable (gateway and dns entry fields) if we have no devices @@ -347,8 +350,7 @@ class NetworkWindow(InstallWindow): self.setHostOptionsSensitivity() return - - + def setupDevices(self): devnames = self.devices.keys() devnames.sort() @@ -406,11 +408,11 @@ class NetworkWindow(InstallWindow): return self.ethdevices def hostnameUseDHCPCB(self, widget, data): - self.network.overrideDHCPhostname = 0 + self.network.overrideDHCPhostname = False self.hostnameEntry.set_sensitive(not widget.get_active()) def hostnameManualCB(self, widget, data): - self.network.overrideDHCPhostname = 1 + self.network.overrideDHCPhostname = True if widget.get_active(): self.hostnameEntry.grab_focus() @@ -493,7 +495,6 @@ class NetworkWindow(InstallWindow): frame.set_shadow_type(gtk.SHADOW_NONE) box.pack_start(frame, False, False) - self.setHostOptionsSensitivity() self.ipTable = gtk.Table(len(global_options), 2) -- cgit