return self.__width
class EPGList(HTMLComponent, GUIComponent):
- def __init__(self, type=EPG_TYPE_SINGLE):
+ def __init__(self, type=EPG_TYPE_SINGLE, selChangedCB=None):
+ self.onSelChanged = [ ]
+ if selChangedCB is not None:
+ self.onSelChanged.append(selChangedCB)
GUIComponent.__init__(self)
self.type=type
if type == EPG_TYPE_SINGLE and SINGLE_CPP > 0:
def moveDown(self):
self.instance.moveSelection(self.instance.moveDown)
+ def connectSelectionChanged(func):
+ if not self.onSelChanged.count(func):
+ self.onSelChanged.append(func)
+
+ def disconnectSelectionChanged(func):
+ self.onSelChanged.remove(func)
+
+ def selectionChanged(self):
+ for x in self.onSelChanged:
+ if x is not None:
+ try:
+ x()
+ except:
+ pass
+
def GUIcreate(self, parent):
self.instance = eListbox(parent)
+ self.instance.selectionChanged.get().append(self.selectionChanged)
self.instance.setContent(self.l)
if SINGLE_CPP > 0:
self.instance.setItemHeight(25)
self.instance = None
def recalcEntrySize(self):
- t = time()
- esize = self.l.getItemSize()
- self.l.setFont(0, gFont("Regular", 22))
- self.l.setFont(1, gFont("Regular", 16))
- width = esize.width()
- height = esize.height()
- if self.type == EPG_TYPE_SINGLE:
- w = width/20*5
- self.datetime_rect = Rect(0,0, w, height)
- self.descr_rect = Rect(w, 0, width/20*15, height)
- else:
- xpos = 0;
- w = width/10*3;
- self.service_rect = Rect(xpos, 0, w-10, height)
- xpos += w;
- w = width/10*2;
- self.start_end_rect = Rect(xpos, 0, w-10, height)
- self.progress_rect = Rect(xpos, 4, w-10, height-8)
- xpos += w
- w = width/10*5;
- self.descr_rect = Rect(xpos, 0, width, height)
- print "recalcEntrySize", time() - t
+ if SINGLE_CPP == 0:
+ esize = self.l.getItemSize()
+ self.l.setFont(0, gFont("Regular", 22))
+ self.l.setFont(1, gFont("Regular", 16))
+ width = esize.width()
+ height = esize.height()
+ if self.type == EPG_TYPE_SINGLE:
+ w = width/20*5
+ self.datetime_rect = Rect(0,0, w, height)
+ self.descr_rect = Rect(w, 0, width/20*15, height)
+ else:
+ xpos = 0;
+ w = width/10*3;
+ self.service_rect = Rect(xpos, 0, w-10, height)
+ xpos += w;
+ w = width/10*2;
+ self.start_end_rect = Rect(xpos, 0, w-10, height)
+ self.progress_rect = Rect(xpos, 4, w-10, height-8)
+ xpos += w
+ w = width/10*5;
+ self.descr_rect = Rect(xpos, 0, width, height)
def buildSingleEntry(self, eventId, beginTime, duration, EventName):
r1=self.datetime_rect
service = data[1]
begTime = data[2]
duration = data[3]
- new_stime = 0
- if begTime is not None:
- if direction > 0:
- new_stime = begTime+duration+120
- else:
- new_stime = begTime-120
- test.append((service, 0, new_stime))
+ if begTime is None:
+ begTime = 0
+ test.append((service, direction, begTime))
# self.list = self.queryEPG(test, self.buildMultiEntry)
tmp = self.queryEPG(test)
- self.list = [ ]
+ cnt=0
for x in tmp:
- self.list.append(self.buildMultiEntry(x[0], x[1], x[2], x[3], x[4], x[5], x[6]))
+ if x[2] is not None:
+ self.list[cnt]=self.buildMultiEntry(x[0], x[1], x[2], x[3], x[4], x[5], x[6])
+ cnt+=1
self.l.setList(self.list)
print time() - t
+ self.selectionChanged()
def fillSingleEPG(self, service):
t = time()