move network setup into a dynamic configlist
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 11 Oct 2005 00:04:14 +0000 (00:04 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 11 Oct 2005 00:04:14 +0000 (00:04 +0000)
data/menu.xml
data/skin.xml
lib/python/Screens/Makefile.am
lib/python/Screens/NetworkSetup.py [new file with mode: 0644]

index 009a20daac3f0a008803a4726d33543c0c9cbcab..ca07d84e9a5c63648008b1a662ced1f3501f373d 100644 (file)
@@ -45,7 +45,7 @@
                                <item text="Keyboard"><setup id="keyboard" /></item>
                                <item text="OSD"><setup id="osd" /></item>
                                <item text="LCD"><setup id="lcd" /></item>
-                               <item text="Networksetup"><setup id="network" /></item>
+                               <item text="Networksetup"><screen module="NetworkSetup" screen="NetworkSetup" /></item>
                        </menu>
                        <item text="Common Interface"></item>
                        <item text="Parental Control"><setup id="parental" /></item>
index 8038b3362371ec9e44daffee7cf7a2153961c76d..bf77ed85c1415ad3e43539328cfe246fa4451327 100644 (file)
@@ -64,6 +64,9 @@
                <screen name="ScanSetup" position="100,100" size="500,350" title="Service scan">
                        <widget name="config" position="20,10" size="460,220" />
                </screen>
+               <screen name="NetworkSetup" position="140,125" size="460,280" title="Network Setup">
+                       <widget name="config" position="10,50" size="420,175" />
+               </screen>
                <screen name="PluginBrowser" position="190,125" size="360,250" title="Plugins">
                        <widget name="title" position="10,10" size="280,35" font="Arial;23" />
                        <widget name="pluginlist" position="10,50" size="320,200" />
index 3fc7b3d6a6762adb9af63cad81c33f05413a9d90..462c7943a7fe1a36e308dda44d5920dce78b60fc 100644 (file)
@@ -4,4 +4,4 @@ install_PYTHON = \
        ChannelSelection.py ClockDisplay.py ConfigMenu.py InfoBar.py Menu.py    \
        MessageBox.py ScartLoopThrough.py Screen.py ServiceScan.py TimerEdit.py \
        MovieSelection.py Setup.py About.py HarddiskSetup.py FixedMenu.py \
-       Satconfig.py ScanSetup.py __init__.py
+       Satconfig.py ScanSetup.py NetworkSetup.py __init__.py
diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py
new file mode 100644 (file)
index 0000000..5433058
--- /dev/null
@@ -0,0 +1,57 @@
+from Screen import Screen
+from Components.ActionMap import ActionMap
+from Components.ConfigList import ConfigList
+from Components.config import config
+from Components.config import getConfigListEntry
+
+class NetworkSetup(Screen):
+    def __init__(self, session):
+        Screen.__init__(self, session)
+        
+        self["actions"] = ActionMap(["SetupActions"],
+        {
+            "ok": self.keySave,
+            "cancel": self.keyCancel,
+            "left": self.keyLeft,
+            "right": self.keyRight
+        }, -1)
+
+        self.list = []
+        self["config"] = ConfigList(self.list)
+        self.createSetup()
+        
+    def createSetup(self):
+        self.list = []
+        
+        self.list.append(getConfigListEntry("Use DHCP", config.network.dhcp))
+        if (config.network.dhcp.value == 0):
+            self.list.append(getConfigListEntry("IP Address", config.network.ip))
+            self.list.append(getConfigListEntry("Netmask", config.network.netmask))
+            self.list.append(getConfigListEntry("Gateway", config.network.gateway))
+            self.list.append(getConfigListEntry("Nameserver", config.network.dns))
+        
+        self["config"].list = self.list
+        self["config"].l.setList(self.list)
+        
+    def newConfig(self):
+        print self["config"].getCurrent()
+        if self["config"].getCurrent()[0] == "Use DHCP":
+            self.createSetup()
+
+    def keyLeft(self):
+        self["config"].handleKey(config.key["prevElement"])
+        self.newConfig()
+
+    def keyRight(self):
+        self["config"].handleKey(config.key["nextElement"])
+        self.newConfig()
+
+    def keySave(self):
+        for x in self["config"].list:
+            x[1].save()
+        self.close()
+
+    def keyCancel(self):
+        for x in self["config"].list:
+            x[1].cancel()
+        self.close()        
\ No newline at end of file