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