minor changes
[enigma2-plugins.git] / webinterface / src / WebIfConfig.py
1 from enigma import *
2 from Screens.Screen import Screen
3 from Components.config import config, getConfigListEntry
4 from Components.ConfigList import *
5 from Components.Label import Label
6 from Components.ActionMap import ActionMap
7         
8 class WebIfConfigScreen(ConfigListScreen,Screen):
9     skin = """
10         <screen position="100,100" size="550,400" title="Webinterface Setup" >
11         <widget name="config" position="0,0" size="550,300" scrollbarMode="showOnDemand" />
12         <widget name="label" position="10,300" size="550,60" valign="center" halign="center" foregroundColor="white" font="Regular;18"/> 
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 Port"), config.plugins.Webinterface.port))
22         self.list.append(getConfigListEntry(_("enable /hdd"), config.plugins.Webinterface.includehdd))
23         ConfigListScreen.__init__(self, self.list)
24         self["label"] = Label(_("changes will only affect if you restart Enigma"))
25         self["buttonred"] = Label(_("cancel"))
26         self["buttongreen"] = Label(_("ok"))
27         self["setupActions"] = ActionMap(["SetupActions"],
28         {
29             "green": self.save,
30             "red": self.cancel,
31             "save": self.save,
32             "cancel": self.cancel,
33             "ok": self.save,
34         }, -2)
35
36     def save(self):
37         print "saving"
38         for x in self["config"].list:
39             x[1].save()
40         self.close(True)
41
42     def cancel(self):
43         print "cancel"
44         for x in self["config"].list:
45             x[1].cancel()
46         self.close(False)