X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/e25c93ddcc6a2c73b413fced441624703901e22d..89171895f878c5275f8d8e8a8f1e27de48cbf24c:/lib/python/Components/FileList.py diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index 3091436f..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 @@ -59,6 +59,7 @@ class FileList(MenuList, HTMLComponent, GUIComponent): self.l.setFont(0, gFont("Regular", 18)) self.l.setItemHeight(23) + self.serviceHandler = eServiceCenter.getInstance() def getSelection(self): if self.l.getCurrentSelection() is None: @@ -67,7 +68,14 @@ class FileList(MenuList, HTMLComponent, GUIComponent): 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 @@ -190,3 +198,16 @@ class FileList(MenuList, HTMLComponent, GUIComponent): def postWidgetCreate(self, instance): instance.setContent(self.l) + + 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()