diff options
author | Jeremy Katz <katzj@redhat.com> | 2006-09-12 17:26:55 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2006-09-12 17:26:55 +0000 |
commit | c298ef78560c3b3613e80eecf555397c374b2e4b (patch) | |
tree | 43eb0a9bbca3b6b68d710b3e115d16649a0959e2 | |
parent | 64e5226208e810b89f8da1fb890faf492029f1bd (diff) | |
download | anaconda-c298ef78560c3b3613e80eecf555397c374b2e4b.tar.gz anaconda-c298ef78560c3b3613e80eecf555397c374b2e4b.tar.xz anaconda-c298ef78560c3b3613e80eecf555397c374b2e4b.zip |
* iw/netconfig_dialog.py: Actually bring up the network
appropriately, add some UI tweaks
* ui/netconfig.glade: Center the dialog. Hide ipv6 bits for now
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | iw/netconfig_dialog.py | 71 | ||||
-rw-r--r-- | ui/netconfig.glade | 4 |
3 files changed, 82 insertions, 8 deletions
@@ -1,5 +1,20 @@ 2006-09-12 Jeremy Katz <katzj@redhat.com> + * iw/netconfig_dialog.py: Actually bring up the network + appropriately, add some UI tweaks + * ui/netconfig.glade: Center the dialog. Hide ipv6 bits for now + + * iw/autopart_type.py (PartitionTypeWindow.addIscsiDrive): Support + bringing up the network as needed. + * iw/task_gui.py (TaskWindow._addRepo): Bring up the network as needed + + * isys/isys.c (doDhcpNetDevice): Rename to be dhcp instead of + pump. Prefer DHCPv4 for now + * isys/isys.py (dhcpNetDevice): Rename pumpNetDevice to this, + leave pumpNetDevice stub + + * isys/Makefile (nltest): Fix build of test program + * gui.py (addFrame): Make it so that you can just show() the window instead of having to show_all -- this lets you have hidden widgets in a dialog that's been addFrame()'d diff --git a/iw/netconfig_dialog.py b/iw/netconfig_dialog.py index f74c4aad6..82d62e1e6 100644 --- a/iw/netconfig_dialog.py +++ b/iw/netconfig_dialog.py @@ -15,11 +15,13 @@ import gtk import gobject +import gui from rhpl.translate import _, N_ import gui import network +import isys class NetworkConfigurator: def __init__(self, network): @@ -28,6 +30,7 @@ class NetworkConfigurator: self.window = w self.network = network self.xml = xml + self.rc = gtk.RESPONSE_CANCEL self._setSizeGroup() self._connectSignals() @@ -120,12 +123,25 @@ class NetworkConfigurator: combo.set_active_iter(i) def run(self): + gui.addFrame(self.window) self.window.show() gtk.main() + return self.rc + + def destroy(self): + self.window.destroy() + + def _handleIPError(self, field, errmsg): + d = gtk.MessageDialog(_("Error With Data"), 0, gtk.MESSAGE_ERROR, + gtk.BUTTONS_OK, + _("An error occurred converting the value " + "entered for \"%s\":\n%s") %(field, errmsg)) + d.run() + d.destroy() def _cancel(self, *args): gtk.main_quit() - return False + self.rc = gtk.RESPONSE_CANCEL def _ok(self, *args): combo = self.xml.get_widget("interfaceCombo") @@ -135,16 +151,59 @@ class NetworkConfigurator: # FIXME: need to do input validation if self.xml.get_widget("dhcpCheckbutton").get_active(): - print "going to do dhcp on %s" %(netdev,) + self.window.hide() + w = gui.WaitWindow(_("Dynamic IP"), + _("Sending request for IP information " + "for %s...") %(netdev.get("device"))) + r = isys.dhcpNetDevice(netdev.get("device")) + w.pop() + if r is not None: + self.rc = gtk.RESPONSE_OK else: ipv4addr = self.xml.get_widget("ipv4AddressEntry").get_text() ipv4nm = self.xml.get_widget("ipv4NetmaskEntry").get_text() gateway = self.xml.get_widget("gatewayEntry").get_text() ns = self.xml.get_widget("nameserverEntry").get_text() + + try: + network.sanityCheckIPString(ipv4addr) + except network.IPError, msg: + self._handleIPError(_("IP Address"), msg) + return + + try: + network.sanityCheckIPString(ipv4nm) + except network.IPError, msg: + self._handleIPError(_("Netmask"), msg) + return + + try: + network.sanityCheckIPString(gateway) + except network.IPError, msg: + self._handleIPError(_("Gateway"), msg) + return + + try: + if ns: + network.sanityCheckIPString(ns) + except network.IPError, msg: + self._handleIPError(_("Nameserver"), msg) + return + + + try: + isys.configNetDevice(netdev.get("device"), + ipv4addr, ipv4nm, gateway) + except Exception, e: + log.error("Error configuring network device: %s" %(e,)) + self.rc = gtk.RESPONSE_OK + if ns: + f = open("/etc/resolv.conf", "w") + f.write("nameserver %s\n" %(ns,)) + f.close() + isys.resetResolv() + isys.setResolvRetry(1) - print "going to bring up %s as %s/%s, gateway %s, ns %s" %(netdev, ipv4addr, ipv4nm, gateway, ns) - # FIXME: ... and actually bring up the interface :) - gtk.main_quit() @@ -152,7 +211,7 @@ class NetworkConfigurator: def main(): net = network.Network() d = NetworkConfigurator(net) - d.run() + ret = d.run() if __name__ == "__main__": diff --git a/ui/netconfig.glade b/ui/netconfig.glade index b73459a62..8c7828c38 100644 --- a/ui/netconfig.glade +++ b/ui/netconfig.glade @@ -5,6 +5,7 @@ <property name="default_height">250</property> <property name="default_width">440</property> <property name="title" context="yes" translatable="yes">Enable network interface</property> + <property name="window_position">center</property> <child> <widget class="GtkVBox" id="vbox1"> <property name="border_width">18</property> @@ -73,9 +74,9 @@ </child> <child> <widget class="GtkCheckButton" id="ipv6Checkbutton"> + <property name="is_focus">True</property> <property name="label" context="yes" translatable="yes">Enable IPv_6 support</property> <property name="use_underline">True</property> - <property name="visible">True</property> <signal handler="on_ipv6Checkbutton_toggled" name="toggled"/> </widget> <packing> @@ -138,7 +139,6 @@ <widget class="GtkHBox" id="ipv6Box"> <property name="sensitive">False</property> <property name="spacing">6</property> - <property name="visible">True</property> <child> <widget class="GtkLabel" id="ipv6Label"> <property name="label" context="yes" translatable="yes"><b>IPv6 Address:</b></property> |