add ConfigScreen to Pluginmenu
[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="20,10" size="460,350" scrollbarMode="showOnDemand" />
12         <widget name="buttonred" position="10,360" size="100,40" backgroundColor="red" valign="center" halign="center" zPosition="2"  foregroundColor="white" font="Regular;18"/> 
13         <widget name="buttongreen" position="120,360" size="100,40" backgroundColor="green" valign="center" halign="center" zPosition="2"  foregroundColor="white" font="Regular;18"/> 
14         </screen>"""
15     def __init__(self, session, args = 0):
16         self.session = session
17         Screen.__init__(self, session)
18         self.list = []
19         self.list.append(getConfigListEntry(_("start Webinterface"), config.plugins.Webinterface.enable))
20         self.list.append(getConfigListEntry(_("use Port"), config.plugins.Webinterface.port))
21         ConfigListScreen.__init__(self, self.list)
22         self["buttonred"] = Label(_("cancel"))
23         self["buttongreen"] = Label(_("ok"))
24
25         self["setupActions"] = ActionMap(["SetupActions"],
26         {
27             "green": self.save,
28             "red": self.cancel,
29             "save": self.save,
30             "cancel": self.cancel,
31             "ok": self.save,
32         }, -2)
33
34
35     def save(self):
36         print "saving"
37         for x in self["config"].list:
38             x[1].save()
39         self.close()
40
41     def cancel(self):
42         print "cancel"
43         for x in self["config"].list:
44             x[1].cancel()
45         self.close()