1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.ConfigList import ConfigList, ConfigListScreen
4 from Components.config import config, getConfigListEntry
5 from Components.Network import iNetwork
6 from Components.Label import Label
8 class NetworkSetup(Screen, ConfigListScreen):
9 def __init__(self, session):
10 Screen.__init__(self, session)
12 self["actions"] = ActionMap(["SetupActions"],
15 "cancel": self.cancel,
19 ConfigListScreen.__init__(self, self.list)
22 self["introduction"] = Label(_("Press OK to activate the settings."))
24 def createSetup(self):
27 self.dhcpEntry = getConfigListEntry(_("Use DHCP"), config.network.dhcp)
28 self.list.append(self.dhcpEntry)
29 self.list.append(getConfigListEntry(_('IP Address'), config.network.ip))
30 if not config.network.dhcp.value:
31 self.list.append(getConfigListEntry(_('Netmask'), config.network.netmask))
32 self.list.append(getConfigListEntry(_('Gateway'), config.network.gateway))
33 self.list.append(getConfigListEntry(_('Nameserver'), config.network.dns))
35 self["config"].list = self.list
36 self["config"].l.setList(self.list)
39 print self["config"].getCurrent()
40 if self["config"].getCurrent() == self.dhcpEntry:
44 ConfigListScreen.keyLeft(self)
48 ConfigListScreen.keyRight(self)
52 #for x in self["config"].list:
55 iNetwork.deactivateNetworkConfig()
56 iNetwork.writeNetworkConfig()
57 iNetwork.activateNetworkConfig()
61 for x in self["config"].list:
63 iNetwork.loadNetworkConfig()