comment out non correct working code,
[enigma2.git] / lib / python / Components / ServiceList.py
1 from HTMLComponent import *
2 from GUIComponent import *
3
4 from enigma import *
5
6 class ServiceList(HTMLComponent, GUIComponent):
7
8         MODE_NORMAL = 0
9         MODE_FAVOURITES = 1
10         
11         def __init__(self):
12                 GUIComponent.__init__(self)
13                 self.l = eListboxServiceContent()
14                 
15         def getCurrent(self):
16                 r = eServiceReference()
17                 self.l.getCurrent(r)
18                 return r
19                 
20         def moveUp(self):
21                 self.instance.moveSelection(self.instance.moveUp)
22
23         def moveDown(self):
24                 self.instance.moveSelection(self.instance.moveDown)
25
26         def GUIcreate(self, parent):
27                 self.instance = eListbox(parent)
28                 self.instance.setContent(self.l)
29         
30         def GUIdelete(self):
31                 self.instance = None
32
33         def setRoot(self, root):
34                 self.l.setRoot(root)
35                 self.l.sort()
36                 
37                 # mark stuff
38         def clearMarked(self):
39                 self.l.clearMarked()
40                 
41         def clearMarks(self):
42                 self.l.initMarked()
43         
44         def isMarked(self, ref):
45                 return self.l.isMarked(ref)
46
47         def addMarked(self, ref):
48                 self.l.addMarked(ref)
49         
50         def removeMarked(self, ref):
51                 self.l.removeMarked(ref)
52
53         def getMarked(self):
54                 i = self.l
55                 i.markedQueryStart()
56                 ref = eServiceReference()
57                 marked = [ ]
58                 while i.markedQueryNext(ref) == 0:
59                         marked.append(ref)
60                         ref = eServiceReference()
61
62                 return marked
63
64         def setCurrentMarked(self, state):
65                 self.l.setCurrentMarked(state)
66
67         def setMode(self, mode):
68                 if mode == self.MODE_NORMAL:
69                         self.instance.setItemHeight(25)
70                         self.l.setVisualMode(eListboxServiceContent.visModeSimple)
71                 else:
72                         self.instance.setItemHeight(40)
73                         self.l.setElementFont(self.l.celServiceName, gFont("Arial", 30))
74                         self.l.setElementPosition(self.l.celServiceName, eRect(40, 0, self.instance.size().width(), 40))
75                         self.l.setElementFont(self.l.celServiceNumber, gFont("Arial", 20))
76                         self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 10, 40, 30))
77
78                         self.l.setVisualMode(eListboxServiceContent.visModeComplex)