Professor Zoom strikes back
[enigma2-plugins.git] / webinterface / src / WebIfConfig.py
1 Version = '$Header$';\r
2 \r
3 from enigma import *\r
4 from Screens.Screen import Screen\r
5 from Components.config import config, getConfigListEntry\r
6 from Components.ConfigList import *\r
7 from Components.Label import Label\r
8 from Components.ActionMap import ActionMap\r
9         \r
10 class WebIfConfigScreen(ConfigListScreen,Screen):\r
11     skin = """\r
12         <screen position="100,100" size="550,400" title="Webinterface Setup" >\r
13         <widget name="config" position="0,0" size="550,360" scrollbarMode="showOnDemand" />\r
14         <widget name="buttonred" position="10,360" size="100,40" backgroundColor="red" valign="center" halign="center" zPosition="2"  foregroundColor="white" font="Regular;18"/> \r
15         <widget name="buttongreen" position="120,360" size="100,40" backgroundColor="green" valign="center" halign="center" zPosition="2"  foregroundColor="white" font="Regular;18"/> \r
16         </screen>"""\r
17     def __init__(self, session, args = 0):\r
18         self.session = session\r
19         Screen.__init__(self, session)\r
20         self.list = []\r
21         self.list.append(getConfigListEntry(_("start Webinterface"), config.plugins.Webinterface.enable))\r
22         self.list.append(getConfigListEntry(_("use Authorization"), config.plugins.Webinterface.useauth))\r
23         self.list.append(getConfigListEntry(_("use Port"), config.plugins.Webinterface.port))\r
24         self.list.append(getConfigListEntry(_("enable /hdd"), config.plugins.Webinterface.includehdd))\r
25         self.list.append(getConfigListEntry(_("write debug-file"), config.plugins.Webinterface.debug))\r
26         ConfigListScreen.__init__(self, self.list)\r
27         self["buttonred"] = Label(_("cancel"))\r
28         self["buttongreen"] = Label(_("ok"))\r
29         self["setupActions"] = ActionMap(["SetupActions"],\r
30         {\r
31             "green": self.save,\r
32             "red": self.cancel,\r
33             "save": self.save,\r
34             "cancel": self.cancel,\r
35             "ok": self.save,\r
36         }, -2)\r
37 \r
38     def save(self):\r
39         print "saving"\r
40         for x in self["config"].list:\r
41             x[1].save()\r
42         self.close(True,self.session)\r
43 \r
44     def cancel(self):\r
45         print "cancel"\r
46         for x in self["config"].list:\r
47             x[1].cancel()\r
48         self.close(False,self.session)\r