if isDir:
png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "/extensions/directory.png"))
else:
- # FIXME: detect file extensions correctly
- if EXTENSIONS.has_key(name[-3:]):
- png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "/extensions/" + EXTENSIONS[name[-3:]] + ".png"))
+ extension = name.split('.')
+ extension = extension[-1]
+ if EXTENSIONS.has_key(extension):
+ png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "/extensions/" + EXTENSIONS[extension] + ".png"))
if png is not None:
res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 2, 20, 20, png))
def changeDir(self, directory):
self.list = []
- directories = os.listdir(directory)
+ files = os.listdir(directory)
+ files.sort()
if directory != "/" and self.showDirectories:
self.list.append(FileEntryComponent(name = "..", absolute = '/'.join(directory.split('/')[:-2]) + '/', isDir = True))
- for x in directories:
+
+ directories = []
+ for x in files:
if os.path.isdir(directory + x):
- if self.showDirectories:
- self.list.append(FileEntryComponent(name = x, absolute = directory + x + "/" , isDir = True))
- elif self.showFiles:
+ directories.append(x)
+ files.remove(x)
+
+ if self.showDirectories:
+ for x in directories:
+ self.list.append(FileEntryComponent(name = x, absolute = directory + x + "/" , isDir = True))
+
+
+ if self.showFiles:
+ for x in files:
if self.matchingPattern is not None:
if re.compile(self.matchingPattern).search(x):
self.list.append(FileEntryComponent(name = x, absolute = directory + x , isDir = False))