1 from Screen import Screen
2 from Components.ActionMap import NumberActionMap
3 from Components.ConfigList import ConfigList
4 from Components.config import config
5 from Components.config import getConfigListEntry
6 from Components.Network import iNetwork
7 from Components.Label import Label
9 class NetworkSetup(Screen):
10 def __init__(self, session):
11 Screen.__init__(self, session)
13 self["actions"] = NumberActionMap(["SetupActions"],
16 "cancel": self.keyCancel,
18 "right": self.keyRight,
19 "1": self.keyNumberGlobal,
20 "2": self.keyNumberGlobal,
21 "3": self.keyNumberGlobal,
22 "4": self.keyNumberGlobal,
23 "5": self.keyNumberGlobal,
24 "6": self.keyNumberGlobal,
25 "7": self.keyNumberGlobal,
26 "8": self.keyNumberGlobal,
27 "9": self.keyNumberGlobal,
28 "0": self.keyNumberGlobal
32 self["config"] = ConfigList(self.list)
35 self["introduction"] = Label("Press OK to activate the settings.")
37 def createSetup(self):
40 self.list.append(getConfigListEntry("Use DHCP", config.network.dhcp))
41 if (config.network.dhcp.value == 0):
42 self.list.append(getConfigListEntry("IP Address", config.network.ip))
43 self.list.append(getConfigListEntry("Netmask", config.network.netmask))
44 self.list.append(getConfigListEntry("Gateway", config.network.gateway))
45 self.list.append(getConfigListEntry("Nameserver", config.network.dns))
47 self["config"].list = self.list
48 self["config"].l.setList(self.list)
51 print self["config"].getCurrent()
52 if self["config"].getCurrent()[0] == "Use DHCP":
56 self["config"].handleKey(config.key["prevElement"])
60 self["config"].handleKey(config.key["nextElement"])
63 def keyNumberGlobal(self, number):
64 print "You pressed number " + str(number)
65 if (self["config"].getCurrent()[1].parent.enabled == True):
66 self["config"].handleKey(config.key[str(number)])
69 #for x in self["config"].list:
72 iNetwork.writeNetworkConfig()
73 iNetwork.activateNetworkConfig()
77 for x in self["config"].list:
79 iNetwork.loadNetworkConfig()