1
1
from __future__ import print_function
2
2
3
3
# Core
4
- from enigma import RT_HALIGN_LEFT , eListboxPythonMultiContent
4
+ from enigma import RT_HALIGN_LEFT , RT_VALIGN_CENTER , getDesktop , eListboxPythonMultiContent
5
5
6
6
# Tools
7
- from Tools .Directories import SCOPE_SKIN_IMAGE , resolveFilename
7
+ from Tools .Directories import SCOPE_SKIN_IMAGE , SCOPE_CURRENT_SKIN , resolveFilename
8
8
from Tools .LoadPixmap import LoadPixmap
9
9
from Tools .Notifications import AddPopup , AddNotificationWithCallback
10
10
23
23
from Components .FileList import FileList , FileEntryComponent , EXTENSIONS
24
24
from Components .Sources .StaticText import StaticText
25
25
from VariableProgressSource import VariableProgressSource
26
+ from skin import componentSizes
26
27
27
28
# FTP Client
28
29
from twisted .internet import reactor , defer
37
38
import re
38
39
39
40
def FTPFileEntryComponent (file , directory ):
41
+ sizes = componentSizes [componentSizes .FILE_LIST ]
42
+ tx = sizes .get ("textX" , 35 )
43
+ ty = sizes .get ("textY" , 0 )
44
+ tw = sizes .get ("textWidth" , 1000 )
45
+ th = sizes .get ("textHeight" , 25 )
46
+ pxw = sizes .get ("pixmapWidth" , 20 )
47
+ pxh = sizes .get ("pixmapHeight" , 20 )
48
+
40
49
isDir = True if file ['filetype' ] == 'd' else False
41
50
name = file ['filename' ]
42
51
absolute = directory + name
@@ -45,10 +54,10 @@ def FTPFileEntryComponent(file, directory):
45
54
46
55
res = [
47
56
(absolute , isDir , file ['size' ]),
48
- (eListboxPythonMultiContent .TYPE_TEXT , 35 , 1 , 470 , 20 , 0 , RT_HALIGN_LEFT , name )
57
+ (eListboxPythonMultiContent .TYPE_TEXT , tx , ty , tw , th , 0 , RT_HALIGN_LEFT | RT_VALIGN_CENTER , name )
49
58
]
50
59
if isDir :
51
- png = LoadPixmap (resolveFilename (SCOPE_SKIN_IMAGE , "extensions/directory.png" ))
60
+ png = LoadPixmap (resolveFilename (SCOPE_CURRENT_SKIN , "extensions/directory.png" ))
52
61
else :
53
62
extension = name .split ('.' )
54
63
extension = extension [- 1 ].lower ()
@@ -57,7 +66,7 @@ def FTPFileEntryComponent(file, directory):
57
66
else :
58
67
png = None
59
68
if png is not None :
60
- res .append ((eListboxPythonMultiContent .TYPE_PIXMAP_ALPHATEST , 10 , 2 , 20 , 20 , png ))
69
+ res .append ((eListboxPythonMultiContent .TYPE_PIXMAP_ALPHATEST , 10 , ( th - pxh ) / 2 , pxw , pxh , png ))
61
70
62
71
return res
63
72
@@ -132,23 +141,32 @@ def listFailed(self, *args):
132
141
133
142
class FTPBrowser (Screen , Protocol , InfoBarNotifications , HelpableScreen ):
134
143
skin = """
135
- <screen name="FTPBrowser" position="center,center" size="600,440" title="FTP Browser">
136
- <ePixmap position="0,0" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
137
- <ePixmap position="140,0" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
138
- <ePixmap position="280,0" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
139
- <ePixmap position="420,0" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
140
- <ePixmap position="565,10" size="35,25" pixmap="skin_default/buttons/key_menu.png" alphatest="on" />
141
- <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
142
- <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
143
- <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
144
- <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
145
- <widget source="localText" render="Label" position="10,50" size="200,20" font="Regular;18" />
146
- <widget name="local" position="10,80" size="290,320" scrollbarMode="showOnDemand" />
147
- <widget source="remoteText" render="Label" position="300,50" size="200,20" font="Regular;18" />
148
- <widget name="remote" position="300,80" size="290,320" scrollbarMode="showOnDemand" />
149
- <widget source="eta" render="Label" position="20,410" size="200,30" font="Regular;23" />
150
- <widget source="speed" render="Label" position="380,410" size="200,30" halign="right" font="Regular;23" />
151
- <widget source="progress" render="Progress" position="20,440" size="560,10" />
144
+ <screen name="FTPBrowser" position="center,80" size="1200,610" title="FTP Browser">
145
+ <ePixmap pixmap="skin_default/buttons/red.png" position="10,5" size="200,40" />
146
+ <ePixmap pixmap="skin_default/buttons/green.png" position="210,5" size="200,40" />
147
+ <ePixmap pixmap="skin_default/buttons/yellow.png" position="410,5" size="200,40" />
148
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="610,5" size="200,40" />
149
+ <widget source="key_red" render="Label" position="10,5" size="200,40" zPosition="1" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-2,-2" />
150
+ <widget source="key_green" render="Label" position="210,5" size="200,40" zPosition="1" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-2,-2" />
151
+ <widget source="key_yellow" render="Label" position="410,5" size="200,40" zPosition="1" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-2,-2" />
152
+ <widget source="key_blue" render="Label" position="610,5" size="200,40" zPosition="1" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-2,-2" />
153
+ <widget source="global.CurrentTime" render="Label" position="1130,12" size="60,25" font="Regular;22" halign="right">
154
+ <convert type="ClockToText">Default</convert>
155
+ </widget>
156
+ <widget source="global.CurrentTime" render="Label" position="820,12" size="300,25" font="Regular;22" halign="right">
157
+ <convert type="ClockToText">Format:%A %d. %B</convert>
158
+ </widget>
159
+ <eLabel position="10,50" size="1180,1" backgroundColor="grey" />
160
+ <widget source="localText" foregroundColor="yellow" render="Label" position="20,55" size="500,30" font="Regular;24" />
161
+ <widget name="local" position="20,90" size="580,450" enableWrapAround="1" scrollbarMode="showOnDemand" />
162
+ <widget source="remoteText" foregroundColor="yellow" render="Label" position="610,55" size="500,30" font="Regular;24" />
163
+ <widget name="remote" position="610,90" size="580,450" enableWrapAround="1" scrollbarMode="showOnDemand" />
164
+ <eLabel backgroundColor="grey" position="604,60" size="2,480" />
165
+ <eLabel position="10,550" size="1180,1" backgroundColor="grey" />
166
+ <widget source="eta" render="Label" position="20,560" size="300,30" font="Regular;22" />
167
+ <widget source="speed" render="Label" position="350,560" size="300,30" font="Regular;22" />
168
+ <widget source="progress" render="Progress" position="20,590" size="650,10" />
169
+ <ePixmap pixmap="skin_default/icons/menu.png" position="1130,575" size="60,30" />
152
170
</screen>"""
153
171
154
172
def __init__ (self , session ):
0 commit comments