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