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
10 from enigma import getDesktop
11 DESKTOP_WIDTH = getDesktop(0).size().width()
12 DESKTOP_HEIGHT = getDesktop(0).size().height()
18 return scale(y2, y1, 1280, 720, DESKTOP_WIDTH)
24 return scale(y2, y1, 720, 576, DESKTOP_HEIGHT)
25 def scale(y2, y1, x2, x1, x):
26 return (y2 - y1) * (x - x1) / (x2 - x1) + y1
28 class EmailConfigScreen(ConfigListScreen,Screen):
29 width = max(2*140+100, 550)
31 buttonsGap = (width-2*140)/3
33 <screen position="%d,%d" size="%d,%d" title="Email Setup" >
34 <widget name="config" position="0,0" size="%d,%d" scrollbarMode="showOnDemand" />
35 <ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
36 <ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
37 <widget name="buttonred" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
38 <widget name="buttongreen" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
39 <widget name="info" position="%d,%d" size="100,40" halign="right" zPosition="2" foregroundColor="white" font="Regular;%d"/>
41 (DESKTOP_WIDTH-width)/2, (DESKTOP_HEIGHT-height)/2, width, height,
42 width, height-50, # config
43 buttonsGap, height-45,
44 2*buttonsGap+140, height-45,
45 buttonsGap, height-45, scaleV(22,18),
46 2*buttonsGap+140, height-45, scaleV(22,18),
47 3*buttonsGap+2*140, height-45, scaleV(22,18)
50 def __init__(self, session, args = 0):
51 Screen.__init__(self, session)
53 ConfigListScreen.__init__(self, self.list)
54 self["buttonred"] = Label(_("cancel"))
55 self["buttongreen"] = Label(_("ok"))
56 self["info"] = Label('by 3c5x9')
57 self["setupActions"] = ActionMap(["SetupActions"],
62 "cancel": self.cancel,
67 def createSetup(self):
69 getConfigListEntry(_("Username"), config.plugins.emailimap.username),
70 getConfigListEntry(_("Password"), config.plugins.emailimap.password),
71 getConfigListEntry(_("IMAP Server"), config.plugins.emailimap.server),
72 getConfigListEntry(_("IMAP Port"), config.plugins.emailimap.port),
73 getConfigListEntry(_("max of Headers to load"), config.plugins.emailimap.maxheadertoload),
74 getConfigListEntry(_("show deleted entries"), config.plugins.emailimap.showDeleted),
75 getConfigListEntry(_("notify about new mails"), config.plugins.emailimap.checkForNewMails)
77 if config.plugins.emailimap.checkForNewMails.value:
78 self.list.append(getConfigListEntry(_("interval to check for new mails"), config.plugins.emailimap.checkPeriod))
79 self.list.append(getConfigListEntry(_("timeout displaying new mails"), config.plugins.emailimap.timeout))
80 self["config"].list = self.list
81 self["config"].l.setList(self.list)
84 ConfigListScreen.keyLeft(self)
88 ConfigListScreen.keyRight(self)
93 for x in self["config"].list:
95 if plugin.mailChecker:
96 plugin.mailChecker.exit()
97 if config.plugins.emailimap.checkForNewMails.value:
98 plugin.mailChecker = plugin.CheckMail()
104 for x in self["config"].list: