Merge remote-tracking branch 'origin/master' into master
[enigma2-plugins.git] / webcamviewer / src / WebcamViewConfig.py
1 from Screens.Screen import Screen
2 from Components.ConfigList import ConfigListScreen
3 from Components.Label import Label
4 from Components.config import config, getConfigListEntry
5 from Components.ActionMap import ActionMap
6
7 class WebcamViewerMenu(ConfigListScreen,Screen):
8         skin = """
9                 <screen position="100,100" size="550,400" title="Setup" >
10                 <widget name="config" position="0,0" size="550,360" scrollbarMode="showOnDemand" />
11                 <widget name="buttonred" position="10,360" size="100,40" backgroundColor="red" valign="center" halign="center" zPosition="2"  foregroundColor="white" font="Regular;18"/> 
12                 <widget name="buttongreen" position="120,360" size="100,40" backgroundColor="green" valign="center" halign="center" zPosition="2"  foregroundColor="white" font="Regular;18"/> 
13                 </screen>"""
14         def __init__(self, session, args = 0):
15                 Screen.__init__(self, session)
16                 self.list = []
17                 self.list.append(getConfigListEntry(_("Slideshow Time"), config.plugins.pictureviewer.slideshowtime))
18                 self.list.append(getConfigListEntry(_("Slideshow Mode"), config.plugins.pictureviewer.slideshowmode))
19                 self.list.append(getConfigListEntry(_("stop Service on Start"), config.plugins.pictureviewer.stopserviceonstart))
20                 
21                 ConfigListScreen.__init__(self, self.list)
22                 self["buttonred"] = Label(_("cancel"))
23                 self["buttongreen"] = Label(_("ok"))
24                 self["setupActions"] = ActionMap(["SetupActions"],
25                 {
26                         "green": self.save,
27                         "red": self.cancel,
28                         "save": self.save,
29                         "cancel": self.cancel,
30                         "ok": self.save,
31                 }, -2)
32
33         def save(self):
34                 print "saving"
35                 for x in self["config"].list:
36                         x[1].save()
37                 self.close(True,self.session)
38
39         def cancel(self):
40                 print "cancel"
41                 for x in self["config"].list:
42                         x[1].cancel()
43                 self.close(False,self.session)
44