aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2007-07-30 21:46:35 +0000
committerFelix Domke <tmbinc@elitedvb.net>2007-07-30 21:46:35 +0000
commitfe0d65abf126e400bd20a51aa96dd532b03efd3d (patch)
tree669410c815197c75035d92db73b3b30f002b4ead /lib
parenta2ad8bed55ff15188ce37107c3d44945cd2df0a7 (diff)
downloadenigma2-fe0d65abf126e400bd20a51aa96dd532b03efd3d.tar.gz
enigma2-fe0d65abf126e400bd20a51aa96dd532b03efd3d.zip
possibility to sort epg list alphabetically (thanks to Moritz Venn)
Diffstat (limited to 'lib')
-rw-r--r--lib/python/Components/EpgList.py21
-rw-r--r--lib/python/Screens/EpgSelection.py17
2 files changed, 30 insertions, 8 deletions
diff --git a/lib/python/Components/EpgList.py b/lib/python/Components/EpgList.py
index 618c9c9c..1bc98ef6 100644
--- a/lib/python/Components/EpgList.py
+++ b/lib/python/Components/EpgList.py
@@ -223,17 +223,22 @@ class EPGList(HTMLComponent, GUIComponent):
def fillSingleEPG(self, service):
t = time()
test = [ 'RIBDT', (service.ref.toString(), 0, -1, -1) ]
- self.l.setList(self.queryEPG(test))
+ self.list = self.queryEPG(test)
+ self.l.setList(self.list)
print time() - t
self.selectionChanged()
- def sort_func(self,x,y):
- if x[2] < y[2]:
- return -1
- elif x[2] == y[2]:
- return 0
- else:
- return 1
+ def sortSingleEPG(self, type):
+ if len(self.list):
+ if type == 1:
+ self.list.sort(key=lambda x: (x[4].lower(), x[2]))
+ self.l.setList(self.list)
+ self.selectionChanged()
+ else:
+ assert(type == 0)
+ self.list.sort(key=lambda x: x[2])
+ self.l.setList(self.list)
+ self.selectionChanged()
def fillSimilarList(self, refstr, event_id):
t = time()
diff --git a/lib/python/Screens/EpgSelection.py b/lib/python/Screens/EpgSelection.py
index ef654521..a2c31d26 100644
--- a/lib/python/Screens/EpgSelection.py
+++ b/lib/python/Screens/EpgSelection.py
@@ -36,6 +36,8 @@ class EPGSelection(Screen):
self["key_blue"] = Button()
self.currentService=ServiceReference(service)
self.zapFunc = None
+ self.sort_type = 0
+ self.setSortDescription()
else:
self.skinName = "EPGSelectionMulti"
self.type = EPG_TYPE_MULTI
@@ -156,6 +158,21 @@ class EPGSelection(Screen):
def yellowButtonPressed(self):
if self.type == EPG_TYPE_MULTI:
self["list"].updateMultiEPG(-1)
+ elif self.type == EPG_TYPE_SINGLE:
+ if self.sort_type == 0:
+ self.sort_type = 1
+ else:
+ self.sort_type = 0
+ self["list"].sortSingleEPG(self.sort_type)
+ self.setSortDescription()
+
+ def setSortDescription(self):
+ if self.sort_type == 1:
+ # TRANSLATORS: This must fit into the header button in the EPG-List
+ self["key_yellow"].setText(_("Sort Time"))
+ else:
+ # TRANSLATORS: This must fit into the header button in the EPG-List
+ self["key_yellow"].setText(_("Sort A-Z"))
def blueButtonPressed(self):
if self.type == EPG_TYPE_MULTI: