diff options
-rw-r--r-- | iw/network_gui.py | 33 | ||||
-rw-r--r-- | textw/network_text.py | 31 |
2 files changed, 51 insertions, 13 deletions
diff --git a/iw/network_gui.py b/iw/network_gui.py index c0653549b..520d2b0e2 100644 --- a/iw/network_gui.py +++ b/iw/network_gui.py @@ -17,7 +17,7 @@ import string import gtk import gobject from iw_gui import * -from isys import * +import isys import gui from rhpl.translate import _, N_ import network @@ -228,12 +228,18 @@ class NetworkWindow(InstallWindow): options = [(_("_IP Address"), "ipaddr"), (_("Net_mask"), "netmask")] + devopts = [] + if (network.isPtpDev(dev)): newopt = (_("_Point to Point (IP)"), "remip") options.append(newopt) + + if (isys.isWireless(dev)): + newopt = [(_("_ESSID"), "essid"), + (_("Encryption _Key"), "wepkey")] + devopts.extend(newopt) ipTable = gtk.Table(len(options), 2) - iptable = None DHCPcb.connect("toggled", self.DHCPtoggled, (self.devices[dev], ipTable)) # go ahead and set up DHCP on the first device DHCPcb.set_active(bootproto == 'DHCP') @@ -253,6 +259,23 @@ class NetworkWindow(InstallWindow): devbox.pack_start(ipTable, gtk.FALSE, gtk.FALSE, 6) devbox.set_border_width(6) + deventrys = {} + devTable = gtk.Table(len(devopts), 2) + for t in range(len(devopts)): + label = gtk.Label("%s:" %(devopts[t][0],)) + label.set_alignment(0.0, 0.5) + label.set_property("use-underline", gtk.TRUE) + devTable.attach(label, 0, 1, t, t+1, gtk.FILL, 0, 10) + + entry = gtk.Entry() + entry.set_text(self.devices[dev].get(devopts[t][1])) + deventrys[t] = entry + label.set_mnemonic_widget(entry) + devTable.attach(entry, 1, 2, t, t+1, 0, gtk.FILL|gtk.EXPAND) + + if len(devopts) > 0: + devbox.pack_start(devTable, gtk.FALSE, gtk.FALSE, 6) + framelab = _("Configure %s") % (dev,) descr = self.devices[dev].get("desc") if descr is not None and len(descr) > 0: @@ -309,7 +332,7 @@ class NetworkWindow(InstallWindow): continue try: - (net, bc) = inet_calcNetBroad (tmpvals[0], tmpvals[1]) + (net, bc) = isys.inet_calcNetBroad (tmpvals[0], tmpvals[1]) except: self.handleBroadCastError() valsgood = 0 @@ -326,6 +349,10 @@ class NetworkWindow(InstallWindow): self.devices[dev].set(('ONBOOT', onboot)) model.set_value(iter, 0, onboot == 'yes') model.set_value(iter, 2, self.createIPRepr(self.devices[dev])) + + for t in range(len(devopts)): + self.devices[dev].set((devopts[t][1], deventrys[t].get_text())) + editWin.destroy() self.setIPTableSensitivity() diff --git a/textw/network_text.py b/textw/network_text.py index 0f3ec8a92..3b8a20f03 100644 --- a/textw/network_text.py +++ b/textw/network_text.py @@ -39,7 +39,7 @@ class NetworkDeviceWindow: else: sense = FLAGS_RESET - for n in self.entries.values(): + for n in self.dhcpentries.values(): n.setFlags (FLAG_DISABLED, sense) def calcNM(self): @@ -65,12 +65,17 @@ class NetworkDeviceWindow: if not boot: boot = "dhcp" - options = [(_("IP Address"), "ipaddr"), - (_("Netmask"), "netmask")] + options = [(_("IP Address"), "ipaddr", 1), + (_("Netmask"), "netmask", 1)] if (isPtpDev(dev.info["DEVICE"])): - newopt = (_("Point to Point (IP)"), "remip") + newopt = (_("Point to Point (IP)"), "remip", 1) options.append(newopt) + if isys.isWireless(dev.info["DEVICE"]): + wireopt = [(_("ESSID"), "essid", 0), + (_("Encryption Key"), "key", 0)] + options.extend(wireopt) + descr = dev.get("desc") if descr is not None and len(descr) > 0: toprows = 2 @@ -112,7 +117,8 @@ class NetworkDeviceWindow: row = currow self.entries = {} - for (name, opt) in options: + self.dhcpentries = {} + for (name, opt, dhcpdep) in options: botgrid.setField(Label(name), 0, row, anchorLeft = 1) entry = Entry (16) @@ -120,6 +126,8 @@ class NetworkDeviceWindow: botgrid.setField(entry, 1, row, padding = (1, 0, 0, 0)) self.entries[opt] = entry + if dhcpdep: + self.dhcpentries[opt] = entry row = row + 1 self.dhcpCb.setCallback(self.setsensitive) @@ -170,14 +178,17 @@ class NetworkDeviceWindow: bc = "" dev.set(("bootproto", "static")) - - for val in self.entries.keys(): - if self.entries[val].value(): - dev.set((val, self.entries[val].value())) - if bc and net: dev.set(("broadcast", bc), ("network", net)) + for val in self.entries.keys(): + if ((self.dhcpCb.selected() != 0) and + self.dhcpentries.has_key(val)): + continue + if self.entries[val].value(): + dev.set((val, self.entries[val].value())) + + break screen.popWindow() |