X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/ed40f6f85c9c07c3c1224ae20601082c0309a631..89171895f878c5275f8d8e8a8f1e27de48cbf24c:/lib/python/Components/FileList.py diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index b85b8ea3..ae171c30 100644 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@ -1,5 +1,5 @@ -from HTMLComponent import * -from GUIComponent import * +from HTMLComponent import HTMLComponent +from GUIComponent import GUIComponent import re from os import path as os_path, listdir @@ -58,12 +58,24 @@ class FileList(MenuList, HTMLComponent, GUIComponent): self.changeDir(directory) self.l.setFont(0, gFont("Regular", 18)) - + self.l.setItemHeight(23) + self.serviceHandler = eServiceCenter.getInstance() + def getSelection(self): if self.l.getCurrentSelection() is None: return None return self.l.getCurrentSelection()[0] + def getSelectionIndex(self): + return self.l.getCurrentSelectionIndex() + + def getCurrentEvent(self): + l = self.l.getCurrentSelection() + if not l or l[0][1] == True: + return None + else: + return self.serviceHandler.info(l[0][0]).getEvent(l[0][0]) + def getFileList(self): return self.list @@ -186,4 +198,16 @@ class FileList(MenuList, HTMLComponent, GUIComponent): def postWidgetCreate(self, instance): instance.setContent(self.l) - instance.setItemHeight(23) + + def execBegin(self): + harddiskmanager.on_partition_list_change.append(self.partitionListChanged) + + def execEnd(self): + harddiskmanager.on_partition_list_change.remove(self.partitionListChanged) + + def refresh(self): + self.changeDir(self.current_directory, self.getFilename()) + + def partitionListChanged(self, action, device): + if self.current_directory is None: + self.refresh()