initial version
[enigma2-plugins.git] / lastfm / src / LastFMConfig.py
1 from enigma import *
2 from Screens.Screen import Screen
3 from Components.config import config, getConfigListEntry
4 from Components.ConfigList import *
5 from Components.Label import Label
6 from Components.ActionMap import ActionMap
7        
8 class LastFMConfigScreen(ConfigListScreen,Screen):
9     skin = """
10         <screen position="100,100" size="550,400" title="Last.FM 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(_("Last.FM Username"), config.plugins.LastFM.username))
20         self.list.append(getConfigListEntry(_("Password"), config.plugins.LastFM.password))
21         self.list.append(getConfigListEntry(_("Recommentation Level"), config.plugins.LastFM.recommendedlevel))
22         self.list.append(getConfigListEntry(_("show Coverart"), config.plugins.LastFM.showcoverart))
23         self.list.append(getConfigListEntry(_("Timeout Statustext (Seconds)"), config.plugins.LastFM.timeoutstatustext))
24         self.list.append(getConfigListEntry(_("Timeout to select a Tab (Seconds)"), config.plugins.LastFM.timeouttabselect))
25         self.list.append(getConfigListEntry(_("Interval to refresh Metadata (Seconds)"), config.plugins.LastFM.metadatarefreshinterval))
26         
27         ConfigListScreen.__init__(self, self.list)
28         self["buttonred"] = Label(_("cancel"))
29         self["buttongreen"] = Label(_("ok"))
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
42         
43         for x in self["config"].list:
44             x[1].save()
45         self.close(True)
46
47     def cancel(self):
48         print "cancel"
49         for x in self["config"].list:
50             x[1].cancel()
51         self.close(False)