New config (Ignore download times: yes/no)
[enigma2-plugins.git] / rsdownloader / src / RSProgress.py
1 ##\r
2 ## RS Downloader\r
3 ## by AliAbdul\r
4 ##\r
5 from Components.ActionMap import ActionMap\r
6 from Components.Label import Label\r
7 from Components.MenuList import MenuList\r
8 from RS import rapidshare
9 from RSTranslation import _, TitleScreen\r
10 \r
11 ##############################################################################\r
12 \r
13 class RSProgress(TitleScreen):\r
14         skin = """\r
15                 <screen position="80,120" size="560,360" title="RS Downloader">\r
16                         <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" transparent="1" alphatest="on" />\r
17                         <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" transparent="1" alphatest="on" />\r
18                         <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" transparent="1" alphatest="on" />\r
19                         <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" transparent="1" alphatest="on" />\r
20                         <widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />\r
21                         <widget name="key_green" position="140,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />\r
22                         <widget name="key_yellow" position="280,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />\r
23                         <widget name="key_blue" position="420,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />\r
24                         <widget name="list" position="10,45" size="540,300" scrollbarMode="showOnDemand" />\r
25                 </screen>"""\r
26 \r
27         def __init__(self, session):\r
28                 TitleScreen.__init__(self, session)\r
29                 \r
30                 self["key_red"] = Label(_("Downloading"))\r
31                 self["key_green"] = Label(_("Files"))\r
32                 self["key_yellow"] = Label(_("Downloaded"))\r
33                 self["key_blue"] = Label(_("Failed"))\r
34                 \r
35                 self["list"] = MenuList(rapidshare.files)\r
36                 \r
37                 self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],\r
38                         {\r
39                                 "red": self.downloading,\r
40                                 "green": self.files,\r
41                                 "yellow": self.downloaded,\r
42                                 "blue": self.failed,\r
43                                 "cancel": self.close\r
44                         }, -1)\r
45 \r
46         def downloading(self):\r
47                 if rapidshare.downloading_file == "":\r
48                         list = []\r
49                 else:\r
50                         list = [rapidshare.downloading_file]\r
51                 self["list"].setList(list)\r
52 \r
53         def files(self):\r
54                 self["list"].setList(rapidshare.files)\r
55 \r
56         def downloaded(self):\r
57                 self["list"].setList(rapidshare.downloaded_files)\r
58 \r
59         def failed(self):\r
60                 self["list"].setList(rapidshare.failed_files)\r