1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.ConfigList import ConfigList
4 from Components.config import config
5 from Components.config import getConfigListEntry
6 from Components.Network import iNetwork
8 class NetworkSetup(Screen):
9 def __init__(self, session):
10 Screen.__init__(self, session)
12 self["actions"] = ActionMap(["SetupActions"],
15 "cancel": self.keyCancel,
17 "right": self.keyRight,
31 self["config"] = ConfigList(self.list)
34 def createSetup(self):
37 self.list.append(getConfigListEntry("Use DHCP", config.network.dhcp))
38 if (config.network.dhcp.value == 0):
39 self.list.append(getConfigListEntry("IP Address", config.network.ip))
40 self.list.append(getConfigListEntry("Netmask", config.network.netmask))
41 self.list.append(getConfigListEntry("Gateway", config.network.gateway))
42 self.list.append(getConfigListEntry("Nameserver", config.network.dns))
44 self["config"].list = self.list
45 self["config"].l.setList(self.list)
48 print self["config"].getCurrent()
49 if self["config"].getCurrent()[0] == "Use DHCP":
53 self["config"].handleKey(config.key["prevElement"])
57 self["config"].handleKey(config.key["nextElement"])
60 def keyNumberGlobal(self, number):
61 print "You pressed number " + str(number)
62 if (self["config"].getCurrent()[1].parent.enabled == True):
63 self["config"].handleKey(config.key[str(number)])
66 self.keyNumberGlobal(1)
68 self.keyNumberGlobal(2)
70 self.keyNumberGlobal(3)
72 self.keyNumberGlobal(4)
74 self.keyNumberGlobal(5)
76 self.keyNumberGlobal(6)
78 self.keyNumberGlobal(7)
80 self.keyNumberGlobal(8)
82 self.keyNumberGlobal(9)
84 self.keyNumberGlobal(0)
87 #for x in self["config"].list:
90 iNetwork.writeNetworkConfig()
91 iNetwork.activateNetworkConfig()
95 for x in self["config"].list: