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