adding possibilty to use a proxy
[enigma2-plugins.git] / lastfm / src / LastFMConfig.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 LastFMConfigScreen(ConfigListScreen,Screen):
8     skin = """
9         <screen position="100,100" size="550,400" title="Last.FM 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         </screen>"""
14     def __init__(self, session, args = 0):
15         self.session = session
16         Screen.__init__(self, session)
17         self.list = []
18         self.list.append(getConfigListEntry(_("Last.FM Username"), config.plugins.LastFM.username))
19         self.list.append(getConfigListEntry(_("Password"), config.plugins.LastFM.password))
20         self.list.append(getConfigListEntry(_("send now playing Audio Tracks"), config.plugins.LastFM.sendSubmissions))
21         self.list.append(getConfigListEntry(_("use LastFMProxy"), config.plugins.LastFM.useproxy))
22         self.list.append(getConfigListEntry(_("LastFMProxy Port"), config.plugins.LastFM.proxyport))
23         self.list.append(getConfigListEntry(_("Recommentation Level"), config.plugins.LastFM.recommendedlevel))
24         self.list.append(getConfigListEntry(_("show Coverart"), config.plugins.LastFM.showcoverart))
25         self.list.append(getConfigListEntry(_("Timeout Statustext (Seconds)"), config.plugins.LastFM.timeoutstatustext))
26         self.list.append(getConfigListEntry(_("Timeout to select a Tab (Seconds)"), config.plugins.LastFM.timeouttabselect))
27         self.list.append(getConfigListEntry(_("Interval to refresh Metadata (Seconds)"), config.plugins.LastFM.metadatarefreshinterval))
28
29         self.list.append(getConfigListEntry(_("use Screensaver"), config.plugins.LastFM.sreensaver.use))
30         self.list.append(getConfigListEntry(_("wait before Screensaver"), config.plugins.LastFM.sreensaver.wait))
31         self.list.append(getConfigListEntry(_("show Coverart in Screensaver"), config.plugins.LastFM.sreensaver.showcoverart))
32         self.list.append(getConfigListEntry(_("do Coverartanimation in Screensaver"), config.plugins.LastFM.sreensaver.coverartanimation))
33         self.list.append(getConfigListEntry(_("Speed for Coverartanimation"), config.plugins.LastFM.sreensaver.coverartspeed))
34         self.list.append(getConfigListEntry(_("Interval for Coverartanimation"), config.plugins.LastFM.sreensaver.coverartinterval))
35         
36         ConfigListScreen.__init__(self, self.list)
37         self["buttonred"] = Label(_("cancel"))
38         self["buttongreen"] = Label(_("ok"))
39         self["setupActions"] = ActionMap(["SetupActions"],
40         {
41             "green": self.save,
42             "red": self.cancel,
43             "save": self.save,
44             "cancel": self.cancel,
45             "ok": self.save,
46         }, -2)
47
48     def save(self):
49         print "saving"
50
51         
52         for x in self["config"].list:
53             x[1].save()
54         self.close(True)
55
56     def cancel(self):
57         print "cancel"
58         for x in self["config"].list:
59             x[1].cancel()
60         self.close(False)