now waiting until all ports has shut down
[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
8 class WebcamViewerMenu(ConfigListScreen,Screen):
9     skin = """
10         <screen position="100,100" size="550,400" title="Setup" >
11         <widget name="config" position="0,0" size="550,360" 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(_("Slideshow Time"), config.plugins.pictureviewer.slideshowtime))
20         self.list.append(getConfigListEntry(_("Slideshow Mode"), config.plugins.pictureviewer.slideshowmode))
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)