plugins must not depend on kernel modules, because they can be compiled into the...
[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
16     def __init__(self, session, args = 0):
17         Screen.__init__(self, session)
18         l = [
19             getConfigListEntry(_("Username"), config.plugins.emailimap.username),
20             getConfigListEntry(_("Password"), config.plugins.emailimap.password),
21             getConfigListEntry(_("IMAP Server"), config.plugins.emailimap.server),
22             getConfigListEntry(_("IMAP Port"), config.plugins.emailimap.port),
23             getConfigListEntry(_("max of Headers to load"), config.plugins.emailimap.maxheadertoload)
24         ]
25         
26         ConfigListScreen.__init__(self, l)
27         self["buttonred"] = Label(_("cancel"))
28         self["buttongreen"] = Label(_("ok"))
29         self["info"] = Label('by 3c5x9')
30         self["setupActions"] = ActionMap(["SetupActions"],
31         {
32             "green": self.save,
33             "red": self.cancel,
34             "save": self.save,
35             "cancel": self.cancel,
36             "ok": self.save,
37         }, -2)
38
39     def save(self):
40         print "saving"
41         for x in self["config"].list:
42             x[1].save()
43         self.close(True)
44
45     def cancel(self):
46         print "cancel"
47         for x in self["config"].list:
48             x[1].cancel()
49         self.close(False)
50