fix/simplify MenuList handling
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 15 Feb 2008 16:41:33 +0000 (16:41 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 15 Feb 2008 16:41:33 +0000 (16:41 +0000)
emailclient/src/plugin.py
movietagger/src/plugin.py
netcaster/src/bin/plugin.py
trafficinfo/src/plugin.py
webcamviewer/src/plugin.py

index 0117723..2c67946 100755 (executable)
@@ -406,20 +406,14 @@ class ScreenMailView(Screen):
             print "Attachment selected", choice[1].getFilename()
             #showMessageBox(self.session)
     
-class MailList(MenuList, HTMLComponent, GUIComponent):
-    def __init__(self, list):
-        MenuList.__init__(self, list)
-        GUIComponent.__init__(self)
-        self.l = eListboxPythonMultiContent()
-        self.list = list
-        self.l.setList(list)
+class MailList(MenuList):
+    def __init__(self, list, enableWrapAround = False):
+        MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent())
         self.l.setFont(0, gFont("Regular", 18))
         self.l.setFont(1, gFont("Regular", 20))
         
-    GUI_WIDGET = eListbox
-
     def postWidgetCreate(self, instance):
-        instance.setContent(self.l)
+        MenuList.postWidgetCreate(self, instance)
         instance.setItemHeight(60)
 
 class MessageHeader(object):        
index 71c52d2..b87ec4b 100644 (file)
@@ -10,8 +10,6 @@ from Components.MovieList import MovieList
 from Screens.InputBox import InputBox
 from Screens.MessageBox import MessageBox
 from Components.ActionMap import ActionMap
-from Components.GUIComponent import GUIComponent
-from Components.HTMLComponent import HTMLComponent
 from Components.MultiContent import MultiContentEntryText
 from enigma import eServiceReference, eListboxPythonMultiContent, eListbox, eServiceCenter, gFont, iServiceInformation, eServiceReference
 
@@ -270,21 +268,15 @@ class MovieTagger(Screen):
                if newTag >=0:
                        self.addTag(newTag.strip().replace(" ","_"))
 
-class TagMenuList(MenuList, HTMLComponent, GUIComponent):
-    def __init__(self, list):
-        MenuList.__init__(self,list)
-        GUIComponent.__init__(self)
-        self.l = eListboxPythonMultiContent()
-        self.list = list
-        self.l.setList(list)
-        self.l.setFont(0, gFont("Regular", 20))
-        self.l.setFont(1, gFont("Regular", 25))
-
-    GUI_WIDGET = eListbox
-
-    def postWidgetCreate(self, instance):
-        instance.setContent(self.l)
-        instance.setItemHeight(25)
+class TagMenuList(MenuList):
+       def __init__(self, list, enableWrapAround = False):
+               MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent())
+               self.l.setFont(0, gFont("Regular", 20))
+               self.l.setFont(1, gFont("Regular", 25))
+
+       def postWidgetCreate(self, instance):
+               MenuList.postWidgetCreate(self, instance)
+               instance.setItemHeight(25)
 
 def main(session, service, **kwargs):
        try:
index 531c324..357346f 100644 (file)
@@ -4,10 +4,7 @@ from Screens.MessageBox import MessageBox
 from Components.ActionMap import ActionMap
 from Components.ScrollLabel import ScrollLabel
 from Components.Label import Label
-from Components.GUIComponent import GUIComponent
 from Components.MenuList import MenuList
-from Components.HTMLComponent import HTMLComponent
-from Components.GUIComponent import GUIComponent
 from Components.MultiContent import MultiContentEntryText
 from enigma import eListboxPythonMultiContent, eListbox, gFont
 
@@ -186,20 +183,14 @@ class NETcasterScreenHelp(Screen):
              }, -1)
         
 ############################################################################### 
-class StreamMenu(MenuList, HTMLComponent, GUIComponent):
-    def __init__(self, list):
-        MenuList.__init__(self,list)
-        GUIComponent.__init__(self)
-        self.l = eListboxPythonMultiContent()
-        self.list = list
-        self.l.setList(list)
+class StreamMenu(MenuList):
+    def __init__(self, list, enableWrapAround = False):
+        MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent())
         self.l.setFont(0, gFont("Regular", 20))
         self.l.setFont(1, gFont("Regular", 18))
 
-    GUI_WIDGET = eListbox
-    
     def postWidgetCreate(self, instance):
-        instance.setContent(self.l)
+        MenuList.postWidgetCreate(self, instance)
         instance.setItemHeight(50)
     
     def buildList(self,listnew):
index b49d0b0..2a30499 100755 (executable)
@@ -193,12 +193,10 @@ class TrafficInfoMain(Screen):
         return TrafficInfoItem(street,direction,details)
 
 class ItemList(MenuList):
-    def __init__(self, items):
-        MenuList.__init__(self,items)
-        self.l = eListboxPythonMultiContent()
+    def __init__(self, items, enableWrapAround = False):
+        MenuList.__init__(self, items, enableWrapAround, eListboxPythonMultiContent())
         self.l.setFont(0, gFont("Regular", 20))
         self.l.setFont(1, gFont("Regular", 18))
-    GUI_WIDGET = eListbox
 
     def getCurrentEntry(self):
         return self.l.getCurrentSelection()
index 18a3d0b..c284d7d 100755 (executable)
@@ -4,8 +4,6 @@ from enigma import loadPic
 from enigma import loadPNG\r
 from enigma import gFont\r
 ### Picturelist\r
-from Components.HTMLComponent import HTMLComponent\r
-from Components.GUIComponent import GUIComponent\r
 from Screens.Screen import Screen\r
 from Screens.MessageBox import MessageBox\r
 from Screens.InputBox import InputBox\r
@@ -305,6 +303,7 @@ class PictureViewer(Screen):
              self.filelist.pageUp()         \r
              self.updateInfoPanel()\r
          else:\r
+\r
              self.slideshowlist.pageUp()\r
     def rightUp(self):\r
         if self.currList is "filelist" :\r
@@ -397,10 +396,9 @@ class WebcamViewer(Screen):
 ###################\r
 \r
 ##################\r
-class PictureList(MenuList, HTMLComponent, GUIComponent):\r
-    def __init__(self, directory, matchingPattern = None):\r
-        GUIComponent.__init__(self)\r
-        self.l = eListboxPythonMultiContent()\r
+class PictureList(MenuList):\r
+    def __init__(self, directory, matchingPattern = None, enableWrapAround = False):\r
+        MenuList.__init__(self, None, enableWrapAround, eListboxPythonMultiContent())\r
         self.showDirectories = True\r
         self.showFiles = True\r
         self.isTop = False\r
@@ -408,7 +406,7 @@ class PictureList(MenuList, HTMLComponent, GUIComponent):
         self.changeDir(directory)\r
         self.l.setFont(0, gFont("Regular", 18))\r
         self.currentDir = directory\r
-    \r
+\r
     def getCurrentDir(self):\r
         return self.currentDir\r
     \r
@@ -465,10 +463,8 @@ class PictureList(MenuList, HTMLComponent, GUIComponent):
     def getServiceRef(self):\r
         return self.getSelection()[0]\r
 \r
-    GUI_WIDGET = eListbox\r
-\r
     def postWidgetCreate(self, instance):\r
-        instance.setContent(self.l)\r
+        MenuList.postWidgetCreate(self, instance)\r
         instance.setItemHeight(23)\r
     \r
     def getPictureEntryComponent(self,name, absolute, isDir):\r