show event information of current selected event in channelselection
[enigma2.git] / lib / python / Components / ServiceList.py
index 0532d24..4a27c76 100644 (file)
@@ -1,11 +1,11 @@
-from HTMLComponent import *
-from GUIComponent import *
+from HTMLComponent import HTMLComponent
+from GUIComponent import GUIComponent
 
 from enigma import loadPNG, eListboxServiceContent, eListbox, eServiceCenter, eServiceReference, gFont, eRect
 
 from string import upper
 
 
 from enigma import loadPNG, eListboxServiceContent, eListbox, eServiceCenter, eServiceReference, gFont, eRect
 
 from string import upper
 
-from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE, SCOPE_FONTS
+from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
 
 class ServiceList(HTMLComponent, GUIComponent):
        MODE_NORMAL = 0
 
 class ServiceList(HTMLComponent, GUIComponent):
        MODE_NORMAL = 0
@@ -35,8 +35,25 @@ class ServiceList(HTMLComponent, GUIComponent):
                if pic:
                        self.l.setPixmap(self.l.picDVB_T, pic)
 
                if pic:
                        self.l.setPixmap(self.l.picDVB_T, pic)
 
+               pic = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "ico_service_group-fs8.png"))
+               if pic:
+                       self.l.setPixmap(self.l.picServiceGroup, pic)
+
                self.root = None
                self.mode = self.MODE_NORMAL
                self.root = None
                self.mode = self.MODE_NORMAL
+               self.onSelectionChanged = [ ]
+
+       def connectSelChanged(self, fnc):
+               if not fnc in self.onSelectionChanged:
+                       self.onSelectionChanged.append(fnc)
+
+       def disconnectSelChanged(self, fnc):
+               if fnc in self.onSelectionChanged:
+                       self.onSelectionChanged.remove(fnc)
+
+       def selectionChanged(self):
+               for x in self.onSelectionChanged:
+                       x()
 
        def setCurrent(self, ref):
                self.l.setCurrent(ref)
 
        def setCurrent(self, ref):
                self.l.setCurrent(ref)
@@ -89,6 +106,7 @@ class ServiceList(HTMLComponent, GUIComponent):
        def postWidgetCreate(self, instance):
                instance.setWrapAround(True)
                instance.setContent(self.l)
        def postWidgetCreate(self, instance):
                instance.setWrapAround(True)
                instance.setContent(self.l)
+               instance.selectionChanged.get().append(self.selectionChanged)
                self.setMode(self.mode)
 
        def getRoot(self):
                self.setMode(self.mode)
 
        def getRoot(self):
@@ -118,6 +136,7 @@ class ServiceList(HTMLComponent, GUIComponent):
                self.l.setRoot(root, justSet)
                if not justSet:
                        self.l.sort()
                self.l.setRoot(root, justSet)
                if not justSet:
                        self.l.sort()
+               self.selectionChanged()
 
        def removeCurrent(self):
                self.l.removeCurrent()
 
        def removeCurrent(self):
                self.l.removeCurrent()
@@ -160,13 +179,13 @@ class ServiceList(HTMLComponent, GUIComponent):
                self.mode = mode
 
                if mode == self.MODE_NORMAL:
                self.mode = mode
 
                if mode == self.MODE_NORMAL:
-                       self.instance.setItemHeight(28)
+                       self.l.setItemHeight(28)
                        self.l.setVisualMode(eListboxServiceContent.visModeComplex)
                        self.l.setElementFont(self.l.celServiceName, gFont("Regular", 22))
                        self.l.setElementPosition(self.l.celServiceName, eRect(0, 0, self.instance.size().width(), 28))
                        self.l.setElementFont(self.l.celServiceInfo, gFont("Regular", 18))
                else:
                        self.l.setVisualMode(eListboxServiceContent.visModeComplex)
                        self.l.setElementFont(self.l.celServiceName, gFont("Regular", 22))
                        self.l.setElementPosition(self.l.celServiceName, eRect(0, 0, self.instance.size().width(), 28))
                        self.l.setElementFont(self.l.celServiceInfo, gFont("Regular", 18))
                else:
-                       self.instance.setItemHeight(28)
+                       self.l.setItemHeight(28)
                        self.l.setVisualMode(eListboxServiceContent.visModeComplex)
                        self.l.setElementFont(self.l.celServiceNumber, gFont("Regular", 20))
                        self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, 50, 28))
                        self.l.setVisualMode(eListboxServiceContent.visModeComplex)
                        self.l.setElementFont(self.l.celServiceNumber, gFont("Regular", 20))
                        self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, 50, 28))