1 from HTMLComponent import *
2 from GUIComponent import *
4 from enigma import loadPNG, eListboxServiceContent, eListbox, eServiceCenter, eServiceReference, gFont, eRect
6 from string import upper
8 from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE, SCOPE_FONTS
10 class ServiceList(HTMLComponent, GUIComponent):
15 GUIComponent.__init__(self)
16 self.l = eListboxServiceContent()
18 pic = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "folder.png"))
20 self.l.setPixmap(self.l.picFolder, pic)
22 pic = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "marker-fs8.png"))
24 self.l.setPixmap(self.l.picMarker, pic)
26 pic = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "ico_dvb_s-fs8.png"))
28 self.l.setPixmap(self.l.picDVB_S, pic)
30 pic = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "ico_dvb_c-fs8.png"))
32 self.l.setPixmap(self.l.picDVB_C, pic)
34 pic = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "ico_dvb_t-fs8.png"))
36 self.l.setPixmap(self.l.picDVB_T, pic)
39 self.mode = self.MODE_NORMAL
41 def setCurrent(self, ref):
42 self.l.setCurrent(ref)
45 r = eServiceReference()
50 return self.instance.atBegin()
53 return self.instance.atEnd()
56 self.instance.moveSelection(self.instance.moveUp)
59 self.instance.moveSelection(self.instance.moveDown)
61 def moveToChar(self, char):
64 index = self.l.getNextBeginningWithChar(char)
65 indexup = self.l.getNextBeginningWithChar(upper(char))
67 if (index > indexup or index == 0):
70 self.instance.moveSelectionTo(index)
71 print "Moving to character " + str(char)
73 def moveToNextMarker(self):
74 idx = self.l.getNextMarkerPos()
75 self.instance.moveSelectionTo(idx)
77 def moveToPrevMarker(self):
78 idx = self.l.getPrevMarkerPos()
79 self.instance.moveSelectionTo(idx)
81 def moveToIndex(self, index):
82 self.instance.moveSelectionTo(index)
84 def getCurrentIndex(self):
85 return self.instance.getCurrentIndex()
89 def postWidgetCreate(self, instance):
90 instance.setWrapAround(True)
91 instance.setContent(self.l)
92 self.setMode(self.mode)
97 def getRootServices(self):
98 serviceHandler = eServiceCenter.getInstance()
99 list = serviceHandler.list(self.root)
105 dest.append(s.toString())
110 def setNumberOffset(self, offset):
111 self.l.setNumberOffset(offset)
113 def setPlayableIgnoreService(self, ref):
114 self.l.setIgnoreService(ref)
116 def setRoot(self, root, justSet=False):
118 self.l.setRoot(root, justSet)
122 def removeCurrent(self):
123 self.l.removeCurrent()
125 def addService(self, service, beforeCurrent=False):
126 self.l.addService(service, beforeCurrent)
128 def finishFill(self):
129 self.l.FillFinished()
132 # stuff for multiple marks (edit mode / later multiepg)
133 def clearMarks(self):
136 def isMarked(self, ref):
137 return self.l.isMarked(ref)
139 def addMarked(self, ref):
140 self.l.addMarked(ref)
142 def removeMarked(self, ref):
143 self.l.removeMarked(ref)
148 ref = eServiceReference()
150 while i.markedQueryNext(ref) == 0:
151 marked.append(ref.toString())
152 ref = eServiceReference()
155 #just for movemode.. only one marked entry..
156 def setCurrentMarked(self, state):
157 self.l.setCurrentMarked(state)
159 def setMode(self, mode):
162 if mode == self.MODE_NORMAL:
163 self.instance.setItemHeight(28)
164 self.l.setVisualMode(eListboxServiceContent.visModeComplex)
165 self.l.setElementFont(self.l.celServiceName, gFont("Regular", 22))
166 self.l.setElementPosition(self.l.celServiceName, eRect(0, 0, self.instance.size().width(), 28))
167 self.l.setElementFont(self.l.celServiceInfo, gFont("Regular", 18))
169 self.instance.setItemHeight(28)
170 self.l.setVisualMode(eListboxServiceContent.visModeComplex)
171 self.l.setElementFont(self.l.celServiceNumber, gFont("Regular", 20))
172 self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, 50, 28))
173 self.l.setElementFont(self.l.celServiceName, gFont("Regular", 22))
174 self.l.setElementPosition(self.l.celServiceName, eRect(60, 0, self.instance.size().width()-60, 28))
175 self.l.setElementFont(self.l.celServiceInfo, gFont("Regular", 18))