aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/FileList.py
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-11-10 16:51:42 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-11-10 16:51:42 +0000
commitd459fe1406ae27625c9e5988ff894f6be4a62519 (patch)
tree1e3c86a0d85dc7e49246923477261bd97976e499 /lib/python/Components/FileList.py
parent3aeae44ab4224e9695f1304478dcfccd6b77a7cd (diff)
downloadenigma2-d459fe1406ae27625c9e5988ff894f6be4a62519.tar.gz
enigma2-d459fe1406ae27625c9e5988ff894f6be4a62519.zip
select directory on .. (and first entry otherewise) in Filelist, add getCurrentDirectory, fix getFilename when service references are not used
Diffstat (limited to 'lib/python/Components/FileList.py')
-rw-r--r--lib/python/Components/FileList.py34
1 files changed, 29 insertions, 5 deletions
diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py
index a0b01b2e..4238ed1a 100644
--- a/lib/python/Components/FileList.py
+++ b/lib/python/Components/FileList.py
@@ -52,6 +52,7 @@ class FileList(MenuList, HTMLComponent, GUIComponent):
GUIComponent.__init__(self)
self.l = eListboxPythonMultiContent()
+ self.current_directory = None
self.useServiceRef = useServiceRef
self.showDirectories = showDirectories
self.showFiles = showFiles
@@ -68,9 +69,10 @@ class FileList(MenuList, HTMLComponent, GUIComponent):
def getFileList(self):
return self.list
- def changeDir(self, directory):
+ def changeDir(self, directory, select = None):
self.list = []
+ self.current_directory = directory
directories = []
files = []
@@ -122,20 +124,42 @@ class FileList(MenuList, HTMLComponent, GUIComponent):
self.list.append(FileEntryComponent(name = name, absolute = x , isDir = False))
else:
self.list.append(FileEntryComponent(name = name, absolute = x , isDir = False))
-
+
self.l.setList(self.list)
+ if select is not None:
+ i = 0
+ self.moveToIndex(0)
+ for x in self.list:
+ p = x[0][0]
+
+ if isinstance(p, eServiceReference):
+ p = p.getPath()
+
+ if p == select:
+ self.moveToIndex(i)
+ i += 1
+
+ def getCurrentDirectory(self):
+ return self.current_directory
+
def canDescent(self):
return self.getSelection()[1]
def descent(self):
- self.changeDir(self.getSelection()[0])
+ self.changeDir(self.getSelection()[0], select = self.current_directory)
def getFilename(self):
- return self.getSelection()[0].getPath()
+ x = self.getSelection()[0]
+ if isinstance(x, eServiceReference):
+ x = x.getPath()
+ return x
def getServiceRef(self):
- return self.getSelection()[0]
+ x = self.getSelection()[0]
+ if isinstance(x, eServiceReference):
+ return x
+ return None
GUI_WIDGET = eListbox