fix Depends (twisted-web)
[enigma2-plugins.git] / emailclient / src / EmailConfig.py
1 from Screens.Screen import Screen
2 from Components.config import config, getConfigListEntry
3 from Components.ConfigList import ConfigListScreen
4 from Components.Label import Label
5 from Components.ActionMap import ActionMap
6        
7 class EmailConfigScreen(ConfigListScreen,Screen):
8     skin = """
9         <screen position="100,100" size="550,400" title="Email 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         <widget name="info" position="240,360" size="100,40" halign="right" 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(_("Username"), config.plugins.emailimap.username))
20         self.list.append(getConfigListEntry(_("Password"), config.plugins.emailimap.password))
21         self.list.append(getConfigListEntry(_("IMAP Server"), config.plugins.emailimap.server))
22         self.list.append(getConfigListEntry(_("IMAP Port"), config.plugins.emailimap.port))
23         self.list.append(getConfigListEntry(_("max of Headers to load"), config.plugins.emailimap.maxheadertoload))
24         
25         ConfigListScreen.__init__(self, self.list)
26         self["buttonred"] = Label(_("cancel"))
27         self["buttongreen"] = Label(_("ok"))
28         self["info"] = Label('by 3c5x9')
29         self["setupActions"] = ActionMap(["SetupActions"],
30         {
31             "green": self.save,
32             "red": self.cancel,
33             "save": self.save,
34             "cancel": self.cancel,
35             "ok": self.save,
36         }, -2)
37
38     def save(self):
39         print "saving"
40         for x in self["config"].list:
41             x[1].save()
42         self.close(True)
43
44     def cancel(self):
45         print "cancel"
46         for x in self["config"].list:
47             x[1].cancel()
48         self.close(False)