simplify GUIcreate/createWidget, fix base class order
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 1 May 2006 11:47:04 +0000 (11:47 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 1 May 2006 11:47:04 +0000 (11:47 +0000)
34 files changed:
lib/python/Components/Button.py
lib/python/Components/Clock.py
lib/python/Components/ConditionalWidget.py
lib/python/Components/ConfigList.py
lib/python/Components/DiskInfo.py
lib/python/Components/EpgList.py
lib/python/Components/EventInfo.py
lib/python/Components/FileList.py
lib/python/Components/GUIComponent.py
lib/python/Components/Header.py
lib/python/Components/HelpMenuList.py
lib/python/Components/Input.py
lib/python/Components/Label.py
lib/python/Components/LanguageList.py
lib/python/Components/Makefile.am
lib/python/Components/MediaPlayer.py
lib/python/Components/MenuList.py
lib/python/Components/MovieList.py
lib/python/Components/PerServiceDisplay.py
lib/python/Components/Pixmap.py
lib/python/Components/PluginList.py
lib/python/Components/ProgressBar.py
lib/python/Components/ServiceList.py
lib/python/Components/ServicePosition.py
lib/python/Components/Slider.py
lib/python/Components/TextInput.py [deleted file]
lib/python/Components/TimeInput.py [deleted file]
lib/python/Components/TimerList.py
lib/python/Components/TunerInfo.py
lib/python/Components/VariableText.py
lib/python/Components/VariableValue.py
lib/python/Components/VideoWindow.py
lib/python/Components/VolumeBar.py
lib/python/Screens/ServiceInfo.py

index cb4b42139550fad53e2be63be7407480741166bc..2839a034c449d87bee54d9a37020d2753535825e 100644 (file)
@@ -4,7 +4,7 @@ from VariableText import *
 
 from enigma import eButton
 
 
 from enigma import eButton
 
-class Button(HTMLComponent, GUIComponent, VariableText):
+class Button(VariableText, HTMLComponent, GUIComponent):
        def __init__(self, text="", onClick = [ ]):
                GUIComponent.__init__(self)
                VariableText.__init__(self)
        def __init__(self, text="", onClick = [ ]):
                GUIComponent.__init__(self)
                VariableText.__init__(self)
@@ -26,12 +26,7 @@ class Button(HTMLComponent, GUIComponent, VariableText):
        def produceHTML(self):
                return "<input type=\"submit\" text=\"" + self.getText() + "\">\n"
 
        def produceHTML(self):
                return "<input type=\"submit\" text=\"" + self.getText() + "\">\n"
 
-# GUI:
-       def createWidget(self, parent):
-               g = eButton(parent)
-               g.selected.get().append(self.push)
-               return g
-
-       def removeWidget(self, w):
-               w.selected.get().remove(self.push)
+       GUI_WIDGET = eButton
 
 
+       def postWidgetCreate(self, instance):
+               instance.selected.get().append(self.push)
index 9129acafc5b8d6aa69978d7d64b4c953aba05901..ae828c4f01769069ffcd9a202d51704aff272bdf 100644 (file)
@@ -12,7 +12,7 @@ from config import config
 import time
 # now some "real" components:
 
 import time
 # now some "real" components:
 
-class Clock(HTMLComponent, GUIComponent, VariableText):
+class Clock(VariableText, HTMLComponent, GUIComponent):
        def __init__(self):
                VariableText.__init__(self)
                GUIComponent.__init__(self)
        def __init__(self):
                VariableText.__init__(self)
                GUIComponent.__init__(self)
@@ -43,4 +43,5 @@ class Clock(HTMLComponent, GUIComponent, VariableText):
 
 # ...und als HTML:
        def produceHTML(self):
 
 # ...und als HTML:
        def produceHTML(self):
+       #       return T.b[self.getText()]
                return self.getText()
                return self.getText()
index 07d59e02be63a658a259cc148197e0785015a751..62daf5e69b6efa06751a610cc2fbb1848b9193c2 100644 (file)
@@ -3,28 +3,9 @@ from GUIComponent import *
 
 from enigma import *
 
 
 from enigma import *
 
-class Widget(GUIComponent):
-       def __init__(self):
-               GUIComponent.__init__(self)
-       
-       def GUIcreate(self, parent):
-               self.instance = self.createWidget(parent)
-               if self.state == self.HIDDEN:
-                       self.instance.hide()
-       
-       def GUIdelete(self):
-               self.removeWidget(self.instance)
-               self.instance = None
-       
-       def removeWidget(self, w):
-               pass
-       
-       def move(self, x, y):
-               self.instance.move(ePoint(int(x), int(y)))
-       
-class ConditionalWidget(Widget):
+class ConditionalWidget(GUIComponent):
        def __init__(self, withTimer = True):
        def __init__(self, withTimer = True):
-               Widget.__init__(self)
+               GUIComponent.__init__(self)
                
                self.setConnect(None)
                
                
                self.setConnect(None)
                
@@ -38,11 +19,9 @@ class ConditionalWidget(Widget):
                
        def activateCondition(self, condition):
                if (condition):
                
        def activateCondition(self, condition):
                if (condition):
-                       if self.state == self.HIDDEN:
-                               self.show()
+                       self.state = self.HIDDEN
                else:
                else:
-                       if self.state == self.SHOWN:
-                               self.hide()
+                       self.state = self.SHOWN
 
        def update(self):
                if (self.conditionalFunction != None):
 
        def update(self):
                if (self.conditionalFunction != None):
@@ -55,9 +34,9 @@ class ConditionalWidget(Widget):
                        
 import time
 
                        
 import time
 
-class BlinkingWidget(Widget):
+class BlinkingWidget(GUIComponent):
        def __init__(self):
        def __init__(self):
-               Widget.__init__(self)
+               GUIComponent.__init__(self)
                
                self.blinking = True
                
                
                self.blinking = True
                
index 6ff9116ffef91da2b4bc535276badb20583ed8e9..0181ef02873e38a51ba7288387802515427ca420 100644 (file)
@@ -4,13 +4,13 @@ from config import *
 
 from enigma import eListbox, eListboxPythonConfigContent
 
 
 from enigma import eListbox, eListboxPythonConfigContent
 
-class ConfigList(HTMLComponent, GUIComponent):
+class ConfigList(HTMLComponent, GUIComponent, object):
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonConfigContent()
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonConfigContent()
-               self.l.setList(list)
                self.l.setSeperation(100)
                self.list = list
                self.l.setSeperation(100)
                self.list = list
+               self.onSelectionChanged = [ ]
        
        def toggle(self):
                selection = self.getCurrent()
        
        def toggle(self):
                selection = self.getCurrent()
@@ -31,16 +31,26 @@ class ConfigList(HTMLComponent, GUIComponent):
                
        def invalidate(self, entry):
                i = 0
                
        def invalidate(self, entry):
                i = 0
-               for x in self.list:
+               for x in self.__list:
                        if (entry.getConfigPath() == x[1].parent.getConfigPath()):
                                self.l.invalidateEntry(i)
                        i += 1
                        if (entry.getConfigPath() == x[1].parent.getConfigPath()):
                                self.l.invalidateEntry(i)
                        i += 1
-               
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
+
+       GUI_WIDGET = eListbox
        
        
-       def GUIdelete(self):
-               self.instance.setContent(None)
-               self.instance = None
+       def selectionChanged(self):
+               for x in self.onSelectionChanged:
+                       x()
+
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.selectionChanged.get().append(self.selectionChanged)
+       
+       def setList(self, list):
+               self.__list = list
+               self.l.setList(self.__list)
+
+       def getList(self):
+               return self.__list
 
 
+       list = property(getList, setList)
index 9490a0f818789740bcf99ea53328530ca791d2fd..be1521cf304fa3a92ca20b289b1b763d8e8f16dd 100644 (file)
@@ -6,7 +6,7 @@ from enigma import eLabel
 
 # TODO: Harddisk.py has similiar functions, but only similiar.
 # fix this to use same code
 
 # TODO: Harddisk.py has similiar functions, but only similiar.
 # fix this to use same code
-class DiskInfo(GUIComponent, VariableText):
+class DiskInfo(VariableText, GUIComponent):
        FREE = 0
        USED = 1
        SIZE = 2
        FREE = 0
        USED = 1
        SIZE = 2
index 5d519f88a913f69e34ecc808a1c0d691b9537b36..cf55d265afaac2b3fee34b6d99d2c38fb1bb1043 100644 (file)
@@ -122,20 +122,19 @@ class EPGList(HTMLComponent, GUIComponent):
                        if x is not None:
                                try:
                                        x()
                        if x is not None:
                                try:
                                        x()
-                               except:
+                               except: # FIXME!!!
+                                       print "FIXME in EPGList.selectionChanged"
                                        pass
 
                                        pass
 
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setWrapAround(True)
-               self.instance.selectionChanged.get().append(self.selectionChanged)
-               self.instance.setContent(self.l)
+       GUI_WIDGET = eListbox
+       
+       def postCreateWidget(self, instance):
+               instance.setWrapAround(True)
+               instance.selectionChanged.get().append(self.selectionChanged)
+               instance.setContent(self.l)
                if SINGLE_CPP > 0:
                        self.instance.setItemHeight(25)
 
                if SINGLE_CPP > 0:
                        self.instance.setItemHeight(25)
 
-       def GUIdelete(self):
-               self.instance = None
-
        def recalcEntrySize(self):
                if SINGLE_CPP == 0:
                        esize = self.l.getItemSize()
        def recalcEntrySize(self):
                if SINGLE_CPP == 0:
                        esize = self.l.getItemSize()
index 69487b5fa97ce81938f125551f45d3f6d6b1fa4a..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,73 +0,0 @@
-from PerServiceDisplay import *
-from time import strftime
-from time import localtime, time
-
-from enigma import iServiceInformationPtr, eServiceEventPtr
-
-class EventInfo(PerServiceDisplay):
-       Now = 0
-       Next = 1
-       Now_Duration = 2
-       Next_Duration = 3
-       Now_StartTime = 4
-       Next_StartTime = 5
-       Now_Remaining = 6
-       
-       def __init__(self, navcore, now_or_next):
-               # listen to evUpdatedEventInfo and evEnd
-               # note that evEnd will be called once to establish a known state
-               self.now_or_next = now_or_next
-               PerServiceDisplay.__init__(self, navcore, 
-                       { 
-                               iPlayableService.evUpdatedEventInfo: self.ourEvent, 
-                               iPlayableService.evEnd: self.stopEvent 
-                       })
-               
-               if now_or_next in [self.Now_Remaining]:
-                       self.enablePolling()
-
-       def ourEvent(self):
-               info = iServiceInformationPtr()
-               service = self.navcore.getCurrentService()
-               
-               if service != None:
-                       info = service.info()
-                       if info is not None: 
-                               ev = info.getEvent(self.now_or_next & 1)
-                               if ev is not None:
-                                       self.update(ev)
-
-       def update(self, ev):
-               if self.now_or_next == self.Now_Remaining and ev.getBeginTime() <= time() <= (ev.getBeginTime() + ev.getDuration()):
-                       self.setText("+%d min" % ((ev.getBeginTime() + ev.getDuration() - time()) / 60))
-               elif self.now_or_next in [self.Now_Duration, self.Next_Duration, self.Now_Remaining]:
-                       self.setText("%d min" % (ev.getDuration() / 60))
-               elif self.now_or_next in [self.Now_StartTime, self.Next_StartTime]:
-                       self.setText(strftime("%H:%M", localtime(ev.getBeginTime())))
-               elif self.now_or_next in [self.Now, self.Next]:
-                       self.setText(ev.getEventName())         
-
-       def stopEvent(self):
-               self.setText(
-                       ("", "", "",  "", "--:--", "--:--", "")[self.now_or_next]);
-
-       def poll(self):
-               self.ourEvent()
-
-class EventInfoProgress(PerServiceDisplayProgress, EventInfo):
-       def __init__(self, navcore, now_or_next):
-               self.now_or_next = now_or_next
-               PerServiceDisplayProgress.__init__(self, navcore, 
-                       { 
-                               iPlayableService.evUpdatedEventInfo: self.ourEvent, 
-                               iPlayableService.evEnd: self.stopEvent 
-                       })
-
-       def update(self, ev):
-               self.g.setRange(0, ev.getDuration())
-               progress = int(time() - ev.getBeginTime())
-
-               self.setValue(progress)
-               
-       def stopEvent(self):
-               self.setValue(0)
index d726b833a86c42786bd0345a052c436ce13ce9f2..ce1f236f4246af6f019e27daaecec840769e7ecd 100644 (file)
@@ -47,7 +47,7 @@ def FileEntryComponent(name, absolute = None, isDir = False):
        
        return res
 
        
        return res
 
-class FileList(HTMLComponent, GUIComponent, MenuList):
+class FileList(MenuList, HTMLComponent, GUIComponent):
        def __init__(self, directory, showDirectories = True, showFiles = True, matchingPattern = None, useServiceRef = False, isTop = False):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
        def __init__(self, directory, showDirectories = True, showFiles = True, matchingPattern = None, useServiceRef = False, isTop = False):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
@@ -134,8 +134,9 @@ class FileList(HTMLComponent, GUIComponent, MenuList):
 
        def getServiceRef(self):
                return self.getSelection()[0]
 
        def getServiceRef(self):
                return self.getSelection()[0]
-                               
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.setItemHeight(23)
+
+       GUI_WIDGET = eListbox
+
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.setItemHeight(23)
index 8f6362fdadbe88407c4b045aec8cd6042631fdc2..afe95266aa8f9f5a20b887248df9ccc201b77656 100644 (file)
@@ -2,15 +2,15 @@ import skin
 
 from enigma import ePoint
 
 
 from enigma import ePoint
 
-class GUIComponent:
+class GUIComponent(object):
        """ GUI component """
        
        SHOWN = 0
        HIDDEN = 1
        
        def __init__(self):
        """ GUI component """
        
        SHOWN = 0
        HIDDEN = 1
        
        def __init__(self):
-               self.state = self.SHOWN
                self.instance = None
                self.instance = None
+               self.state = self.SHOWN
        
        def execBegin(self):
                pass
        
        def execBegin(self):
                pass
@@ -37,11 +37,51 @@ class GUIComponent:
                self.instance.move(ePoint(int(x), int(y)))
 
        def show(self):
                self.instance.move(ePoint(int(x), int(y)))
 
        def show(self):
-               self.state = self.SHOWN
+               self.__state = self.SHOWN
                if self.instance is not None:
                        self.instance.show()
 
        def hide(self):
                if self.instance is not None:
                        self.instance.show()
 
        def hide(self):
-               self.state = self.HIDDEN
+               self.__state = self.HIDDEN
                if self.instance is not None:
                        self.instance.hide()
                if self.instance is not None:
                        self.instance.hide()
+
+       def getState(self):
+               return self.__state
+       
+       def setState(self, state):
+               if state == self.SHOWN:
+                       self.show()
+               elif state == self.HIDDEN:
+                       self.hide()
+
+       state = property(getState, setState)
+
+       def setPosition(self, x, y):
+               self.instance.move(ePoint(int(x), int(y)))
+
+       def getPosition(self):
+               p = self.instance.position()
+               return (p.x(), p.y())
+
+       position = property(getPosition, setPosition)
+
+       # default implementation for only one widget per component
+       # feel free to override!
+       def GUIcreate(self, parent):
+               self.instance = self.createWidget(parent)
+               self.postWidgetCreate(self.instance)
+       
+       def GUIdelete(self):
+               self.preWidgetRemove(self.instance)
+               self.instance = None
+
+       # default for argumentless widget constructor
+       def createWidget(self, parent):
+               return self.GUI_WIDGET(parent)
+
+       def postWidgetCreate(self, instance):
+               pass
+       
+       def preWidgetRemove(self, instance):
+               pass
index 9f7be60edb26042109d0d0bf2781f7f8e32adb69..07d5ee8341010e3db3bc84ac126ab61222de6e7f 100644 (file)
@@ -4,7 +4,7 @@ from VariableText import *
 
 from enigma import eLabel
 
 
 from enigma import eLabel
 
-class Header(HTMLComponent, GUIComponent, VariableText):
+class Header(VariableText, HTMLComponent, GUIComponent):
 
        def __init__(self, message):
                GUIComponent.__init__(self)
 
        def __init__(self, message):
                GUIComponent.__init__(self)
index c8ff3795ffedae7fa86ebdd21566010e0d5fa31f..103727a7520708b8be660020612b38c356fe65ff 100644 (file)
@@ -48,17 +48,13 @@ class HelpMenuList(GUIComponent):
        def getCurrent(self):
                return self.l.getCurrentSelection()[0]
 
        def getCurrent(self):
                return self.l.getCurrentSelection()[0]
 
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.setItemHeight(42)
-               self.instance.selectionChanged.get().append(self.selectionChanged)
-               
-       def GUIdelete(self):
-               self.instance.setContent(None)
-               self.instance.selectionChanged.get().remove(self.selectionChanged)
-               self.instance = None
+       GUI_WIDGET = eListbox
 
 
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.setItemHeight(42)
+               instance.selectionChanged.get().append(self.selectionChanged)
+               
        def selectionChanged(self):
                for x in self.onSelChanged:
                        x()
        def selectionChanged(self):
                for x in self.onSelChanged:
                        x()
index a3ab764e8840016b4e399e2c4ccc007750f0f429..d561c5dbf83469e35ecdebec960bce18b04d16af 100644 (file)
@@ -6,7 +6,7 @@ from enigma import eLabel
 
 from Tools.NumericalTextInput import NumericalTextInput
 
 
 from Tools.NumericalTextInput import NumericalTextInput
 
-class Input(HTMLComponent, GUIComponent, VariableText):
+class Input(VariableText, HTMLComponent, GUIComponent):
        TEXT = 0
        PIN = 1
        NUMBER = 2      
        TEXT = 0
        PIN = 1
        NUMBER = 2      
index 5ad071abbfcdb2843548836751c2ce0ccac95972..4d90badc58b03085fc6aab0eb739ec138c70cb16 100644 (file)
@@ -6,7 +6,7 @@ from ConditionalWidget import *
 
 from enigma import eLabel
 
 
 from enigma import eLabel
 
-class Label(HTMLComponent, GUIComponent, VariableText):
+class Label(VariableText, HTMLComponent, GUIComponent):
        def __init__(self, text=""):
                GUIComponent.__init__(self)
                VariableText.__init__(self)
        def __init__(self, text=""):
                GUIComponent.__init__(self)
                VariableText.__init__(self)
@@ -17,9 +17,8 @@ class Label(HTMLComponent, GUIComponent, VariableText):
                return self.getText()
 
 # GUI:
                return self.getText()
 
 # GUI:
-       def createWidget(self, parent):
-               return eLabel(parent)
-       
+       GUI_WIDGET = eLabel
+
        def getSize(self):
                s = self.instance.calculateSize()
                return (s.width(), s.height())
        def getSize(self):
                s = self.instance.calculateSize()
                return (s.width(), s.height())
@@ -34,20 +33,7 @@ class BlinkingLabel(Label, BlinkingWidget):
                Label.__init__(text = text)
                BlinkingWidget.__init__()
 
                Label.__init__(text = text)
                BlinkingWidget.__init__()
 
-       def GUIcreate(self, parent):
-               LabelConditional.GUIcreate(self, parent)
-       
-       def GUIdelete(self):
-               LabelConditional.GUIcreate(self)
-               
 class BlinkingLabelConditional(BlinkingWidgetConditional, LabelConditional):
        def __init__(self, text = ""):
                LabelConditional.__init__(self, text = text)
                BlinkingWidgetConditional.__init__(self)
 class BlinkingLabelConditional(BlinkingWidgetConditional, LabelConditional):
        def __init__(self, text = ""):
                LabelConditional.__init__(self, text = text)
                BlinkingWidgetConditional.__init__(self)
-               
-       def GUIcreate(self, parent):
-               LabelConditional.GUIcreate(self, parent)
-       
-       def GUIdelete(self):
-               LabelConditional.GUIcreate(self)
-               
\ No newline at end of file
index adf871863ccce249529d3d3d7ef934fce57d2849..e625d7c758cd2a57e03fa1aa0d78f8f9cf840236 100644 (file)
@@ -26,15 +26,16 @@ def LanguageEntryComponent(file, name, index):
        
        return res
 
        
        return res
 
-class LanguageList(HTMLComponent, GUIComponent, MenuList):
+class LanguageList(MenuList, HTMLComponent, GUIComponent):
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
                self.list = list
                self.l.setList(list)
                self.l.setFont(0, gFont("Regular", 20))
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
                self.list = list
                self.l.setList(list)
                self.l.setFont(0, gFont("Regular", 20))
-       
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.setItemHeight(50)
+
+       GUI_WIDGET = eListbox
+               
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.setItemHeight(50)
index 80393aeffe9413b402ae27a5e9d9ab6353feeff3..f7e26e428d39b271d14c8030b76d95ab45cfb511 100644 (file)
@@ -1,16 +1,16 @@
 installdir = $(LIBDIR)/enigma2/python/Components
 
 install_PYTHON = \
 installdir = $(LIBDIR)/enigma2/python/Components
 
 install_PYTHON = \
-       ActionMap.py GUISkin.py PerServiceDisplay.py TimeInput.py components.py \
+       ActionMap.py GUISkin.py PerServiceDisplay.py components.py              \
        Button.py HTMLComponent.py ProgressBar.py TimerList.py config.py        \
        Clock.py HTMLSkin.py ServiceList.py VariableText.py                     \
        ConfigList.py Header.py ServiceName.py VariableValue.py                 \
        EventInfo.py Label.py ServiceScan.py VolumeBar.py                       \
        Button.py HTMLComponent.py ProgressBar.py TimerList.py config.py        \
        Clock.py HTMLSkin.py ServiceList.py VariableText.py                     \
        ConfigList.py Header.py ServiceName.py VariableValue.py                 \
        EventInfo.py Label.py ServiceScan.py VolumeBar.py                       \
-       GUIComponent.py MenuList.py TextInput.py __init__.py MovieList.py                               \
-       InputDevice.py ServicePosition.py SetupDevices.py Harddisk.py                                           \
-       AVSwitch.py Network.py RFmod.py DiskInfo.py NimManager.py Lcd.py                                \
-       EpgList.py ScrollLabel.py Timezones.py Language.py HelpMenuList.py \
-       BlinkingPixmap.py Pixmap.py ConditionalWidget.py Slider.py LanguageList.py \
+       GUIComponent.py MenuList.py __init__.py MovieList.py                \
+       InputDevice.py ServicePosition.py SetupDevices.py Harddisk.py           \
+       AVSwitch.py Network.py RFmod.py DiskInfo.py NimManager.py Lcd.py        \
+       EpgList.py ScrollLabel.py Timezones.py Language.py HelpMenuList.py      \
+       BlinkingPixmap.py Pixmap.py ConditionalWidget.py Slider.py LanguageList.py  \
        PluginList.py PluginComponent.py RecordingConfig.py About.py UsageConfig.py \
        FIFOList.py ServiceEventTracker.py Input.py TimerSanityCheck.py FileList.py \
        MultiContent.py MediaPlayer.py TunerInfo.py VideoWindow.py ChoiceList.py
        PluginList.py PluginComponent.py RecordingConfig.py About.py UsageConfig.py \
        FIFOList.py ServiceEventTracker.py Input.py TimerSanityCheck.py FileList.py \
        MultiContent.py MediaPlayer.py TunerInfo.py VideoWindow.py ChoiceList.py
index 70a1dbbdd18ba90125ed0a448588d3e1708f35c9..c271c3c64989bfa5105efbe6edee5ddfc369f9cc 100644 (file)
@@ -50,7 +50,7 @@ def PlaylistEntryComponent(serviceref, state):
     
        return res
 
     
        return res
 
-class PlayList(HTMLComponent, GUIComponent, MenuList):
+class PlayList(MenuList, HTMLComponent, GUIComponent):
        def __init__(self):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
        def __init__(self):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
@@ -66,11 +66,12 @@ class PlayList(HTMLComponent, GUIComponent, MenuList):
                self.currPlaying = 0
                self.oldCurrPlaying = -1
 
                self.currPlaying = 0
                self.oldCurrPlaying = -1
 
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.setItemHeight(32)
-       
+       GUI_WIDGET = eListbox
+
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.setItemHeight(32)
+
        def getSelection(self):
                return self.l.getCurrentSelection()[0]
                
        def getSelection(self):
                return self.l.getCurrentSelection()[0]
                
index f4b2c361c7ed17bfc480f2a80b3ed1e2206061b1..b1b115b7230aa6a9ebe1d6041b08e2f335f212a4 100644 (file)
@@ -14,17 +14,17 @@ class MenuList(HTMLComponent, GUIComponent):
        
        def getCurrent(self):
                return self.l.getCurrentSelection()
        
        def getCurrent(self):
                return self.l.getCurrentSelection()
+
+       GUI_WIDGET = eListbox
        
        
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.selectionChanged.get().append(self.selectionChanged)
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.selectionChanged.get().append(self.selectionChanged)
                if self.enableWrapAround:
                        self.instance.setWrapAround(True)
        
                if self.enableWrapAround:
                        self.instance.setWrapAround(True)
        
-       def GUIdelete(self):
-               self.instance.setContent(None)
-               self.instance = None
+       def preWidgetRemove(self, instance):
+               instance.setContent(None)
 
        def selectionChanged(self):
                for f in self.onSelectionChanged:
 
        def selectionChanged(self):
                for f in self.onSelectionChanged:
index 3b7e7e3647e3b24a481110fcdb729aedfaa4ea12..970180cd243ec1a685ce8ef2b9dec45c28045424 100644 (file)
@@ -63,15 +63,12 @@ class MovieList(HTMLComponent, GUIComponent):
                l = self.l.getCurrentSelection()
                return l and l[0]
 
                l = self.l.getCurrentSelection()
                return l and l[0]
 
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.setItemHeight(75)
+       GUI_WIDGET = eListbox
+       
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.setItemHeight(75)
        
        
-       def GUIdelete(self):
-               self.instance.setContent(None)
-               self.instance = None
-
        def reload(self, root = None):
                if root is not None:
                        self.load(root)
        def reload(self, root = None):
                if root is not None:
                        self.load(root)
index 821f6d165bc2a070a271761e59de42dd0948b5a2..22305ca94ab8c94fd8dcff70254b458e85000e91 100644 (file)
@@ -44,12 +44,9 @@ class PerServiceDisplay(PerServiceBase, VariableText):
                VariableText.__init__(self)
                PerServiceBase.__init__(self, navcore, eventmap)
 
                VariableText.__init__(self)
                PerServiceBase.__init__(self, navcore, eventmap)
 
-       def createWidget(self, parent):
-               # by default, we use a label to display our data.
-               g = eLabel(parent)
-               return g
+       GUI_WIDGET = eLabel
 
 
-class PerServiceDisplayProgress(GUIComponent, VariableValue, PerServiceBase):
+class PerServiceDisplayProgress(PerServiceBase, VariableValue, GUIComponent):
        def __init__(self, navcore, eventmap):
                GUIComponent.__init__(self)
                VariableValue.__init__(self)
        def __init__(self, navcore, eventmap):
                GUIComponent.__init__(self)
                VariableValue.__init__(self)
@@ -60,7 +57,4 @@ class PerServiceDisplayProgress(GUIComponent, VariableValue, PerServiceBase):
                # start with stopped state, so simulate that
                self.event(iPlayableService.evEnd)
 
                # start with stopped state, so simulate that
                self.event(iPlayableService.evEnd)
 
-       def createWidget(self, parent):
-               # by default, we use a label to display our data.
-               self.g = eSlider(parent)
-               return self.g
+       GUI_WIDGET = eSlider
index 211b772c2be02edd02c9b348ea1b7c069e6f69f0..3cc8c661e3572b066941fe1e8999b13f3cf3eca8 100644 (file)
@@ -1,21 +1,10 @@
-from ConditionalWidget import *
+from ConditionalWidget import ConditionalWidget
+from GUIComponent import GUIComponent
 
 
-from enigma import *
+from enigma import ePixmap, eTimer
 
 
-class Pixmap(Widget):
-       def __init__(self):
-               Widget.__init__(self)
-
-       def getePixmap(self, parent):
-               #pixmap = ePixmap(parent)
-               #pixmap.setPixmapFromFile(self.filename)
-               return ePixmap(parent)
-       
-       def createWidget(self, parent):
-               return self.getePixmap(parent)
-
-       def removeWidget(self, w):
-               pass
+class Pixmap(GUIComponent):
+       GUI_WIDGET = ePixmap
 
 class PixmapConditional(ConditionalWidget, Pixmap):
        def __init__(self, withTimer = True):
 
 class PixmapConditional(ConditionalWidget, Pixmap):
        def __init__(self, withTimer = True):
index 1b4daf184d5dce7d8bdbcec1f4b150c357e65b51..7220f0a9349d4f09d33895fafa6aeb7cb8edf0d3 100644 (file)
@@ -44,7 +44,7 @@ def PluginDownloadComponent(plugin, name):
        
        return res
 
        
        return res
 
-class PluginList(HTMLComponent, GUIComponent, MenuList):
+class PluginList(MenuList, HTMLComponent, GUIComponent):
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
@@ -52,8 +52,9 @@ class PluginList(HTMLComponent, GUIComponent, MenuList):
                self.l.setList(list)
                self.l.setFont(0, gFont("Regular", 20))
                self.l.setFont(1, gFont("Regular", 14))
                self.l.setList(list)
                self.l.setFont(0, gFont("Regular", 20))
                self.l.setFont(1, gFont("Regular", 14))
-       
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.setItemHeight(50)
+
+       GUI_WIDGET = eListbox
+
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.setItemHeight(50)
index 00b1bbe3c94b314246b8f80bc97ed5009c8f15a7..9bec1796b0df9b4afa38f73eda3c286150ece038 100644 (file)
@@ -5,7 +5,7 @@ from VariableValue import *
 from enigma import eSlider
 
 # a general purpose progress bar
 from enigma import eSlider
 
 # a general purpose progress bar
-class ProgressBar(HTMLComponent, GUIComponent, VariableValue):
+class ProgressBar(VariableValue, HTMLComponent, GUIComponent):
        def __init__(self):
                GUIComponent.__init__(self)
                VariableValue.__init__(self)
        def __init__(self):
                GUIComponent.__init__(self)
                VariableValue.__init__(self)
index 2b80c225d4e615e5fded817e1d603b293a771673..85f004c069289eefac7891480c1f906385c90347 100644 (file)
@@ -6,7 +6,6 @@ from enigma import *
 from string import upper
 
 class ServiceList(HTMLComponent, GUIComponent):
 from string import upper
 
 class ServiceList(HTMLComponent, GUIComponent):
-
        MODE_NORMAL = 0
        MODE_FAVOURITES = 1
 
        MODE_NORMAL = 0
        MODE_FAVOURITES = 1
 
@@ -14,7 +13,6 @@ class ServiceList(HTMLComponent, GUIComponent):
                GUIComponent.__init__(self)
                self.l = eListboxServiceContent()
                self.root = None
                GUIComponent.__init__(self)
                self.l = eListboxServiceContent()
                self.root = None
-               
                self.mode = self.MODE_NORMAL
 
        def setCurrent(self, ref):
                self.mode = self.MODE_NORMAL
 
        def setCurrent(self, ref):
@@ -55,14 +53,12 @@ class ServiceList(HTMLComponent, GUIComponent):
        def getCurrentIndex(self):
                return self.instance.getCurrentIndex()
 
        def getCurrentIndex(self):
                return self.instance.getCurrentIndex()
 
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setWrapAround(True)
-               self.instance.setContent(self.l)
-               self.setMode(self.mode)
+       GUI_WIDGET = eListbox
        
        
-       def GUIdelete(self):
-               self.instance = None
+       def postWidgetCreate(self, instance):
+               instance.setWrapAround(True)
+               instance.setContent(self.l)
+               self.setMode(self.mode)
 
        def getRoot(self):
                return self.root
 
        def getRoot(self):
                return self.root
@@ -129,11 +125,6 @@ class ServiceList(HTMLComponent, GUIComponent):
        def setMode(self, mode):
                self.mode = mode
 
        def setMode(self, mode):
                self.mode = mode
 
-               try:
-                       self.instance
-               except:
-                       return
-               
                if mode == self.MODE_NORMAL:
                        self.instance.setItemHeight(28)
                        self.l.setVisualMode(eListboxServiceContent.visModeSimple)
                if mode == self.MODE_NORMAL:
                        self.instance.setItemHeight(28)
                        self.l.setVisualMode(eListboxServiceContent.visModeSimple)
index 467a80e3161778f61a1f6ea5b78b4eaf0963fad8..cb4449210d0a04d942aaf00286a408908d5bd30a 100644 (file)
@@ -123,13 +123,11 @@ class ServicePositionGauge(PerServiceBase):
        def stopEvent(self):
                self.disablePolling()
 
        def stopEvent(self):
                self.disablePolling()
 
-       def GUIcreate(self, parent):
-               self.instance = ePositionGauge(parent)
+       GUI_WIDGET = ePositionGauge
+       
+       def postWidgetCreate(self, instance):
                self.newService()
        
                self.newService()
        
-       def GUIdelete(self):
-               self.instance = None
-
        def newCuesheet(self):
                service = self.navcore.getCurrentService()
                cue = service and service.cueSheet()
        def newCuesheet(self):
                service = self.navcore.getCurrentService()
                cue = service and service.cueSheet()
index dae13d9c6ab10b127ae8f0e7b2ab00b5fbd2254b..e61b47f4cc9e65d11bc703461eb580330e2df66d 100644 (file)
@@ -5,7 +5,7 @@ from VariableText import *
 
 from enigma import eSlider
 
 
 from enigma import eSlider
 
-class Slider(HTMLComponent, GUIComponent, VariableValue):
+class Slider(VariableValue, HTMLComponent, GUIComponent):
        def __init__(self, min, max):
                VariableValue.__init__(self)
                GUIComponent.__init__(self)
        def __init__(self, min, max):
                VariableValue.__init__(self)
                GUIComponent.__init__(self)
@@ -16,4 +16,4 @@ class Slider(HTMLComponent, GUIComponent, VariableValue):
        def createWidget(self, parent):
                g = eSlider(parent)
                g.setRange(self.min, self.max)
        def createWidget(self, parent):
                g = eSlider(parent)
                g.setRange(self.min, self.max)
-               return g
\ No newline at end of file
+               return g
diff --git a/lib/python/Components/TextInput.py b/lib/python/Components/TextInput.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/lib/python/Components/TimeInput.py b/lib/python/Components/TimeInput.py
deleted file mode 100644 (file)
index e69de29..0000000
index d3774cfad56cb32e9cf1e71d57d928b5b81c2d5a..2f60fcfb27d286820f1aa7b1e12ddabc38970af1 100644 (file)
@@ -75,7 +75,7 @@ def TimerEntryComponent(timer, processed):
        
        return res
 
        
        return res
 
-class TimerList(HTMLComponent, GUIComponent):
+class TimerList(HTMLComponent, GUIComponent, object):
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
@@ -86,10 +86,11 @@ class TimerList(HTMLComponent, GUIComponent):
        def getCurrent(self):
                return self.l.getCurrentSelection()
        
        def getCurrent(self):
                return self.l.getCurrentSelection()
        
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.setItemHeight(70)
+       GUI_WIDGET = eListbox
+       
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.setItemHeight(70)
 
        def moveToIndex(self, index):
                self.instance.moveSelectionTo(index)
 
        def moveToIndex(self, index):
                self.instance.moveSelectionTo(index)
@@ -97,13 +98,11 @@ class TimerList(HTMLComponent, GUIComponent):
        def getCurrentIndex(self):
                return self.instance.getCurrentIndex()
 
        def getCurrentIndex(self):
                return self.instance.getCurrentIndex()
 
+       currentIndex = property(moveToIndex, getCurrentIndex)
+       currentSelection = property(getCurrent)
+
        def moveDown(self):
                self.instance.moveSelection(self.instance.moveDown)
 
        def moveDown(self):
                self.instance.moveSelection(self.instance.moveDown)
 
-       def GUIdelete(self):
-               self.instance.setContent(None)
-               self.instance = None
-
        def invalidate(self):
                self.l.invalidate()
        def invalidate(self):
                self.l.invalidate()
-
index f841832c06c3e8bb0764ad52ed287e9bf9cbbe2b..53cb3d90b8f94e30f594c4e9c5bb3d66fa0d40af 100644 (file)
@@ -105,16 +105,8 @@ class TunerInfo(GUIComponent):
                        self.g.setRange(0, 100)
                        return self.g
                
                        self.g.setRange(0, 100)
                        return self.g
                
-       def GUIcreate(self, parent):
-               self.instance = self.createWidget(parent)
+       def postWidgetCreate(self, instance):
                if self.message is not None:
                if self.message is not None:
-                       self.instance.setText(self.message)
+                       instance.setText(self.message)
                elif self.value is not None:
                elif self.value is not None:
-                       self.instance.setValue(self.value)      
-
-       def GUIdelete(self):
-               self.removeWidget(self.instance)
-               self.instance = None
-       
-       def removeWidget(self, instance):
-               pass
\ No newline at end of file
+                       instance.setValue(self.value)
index e2a755c539f57b561ab081810aefb1cf7d0fff8f..bb8b5fe326e96f1f8f5898f1812293df0c58a288 100644 (file)
@@ -1,9 +1,10 @@
 import skin
 
 import skin
 
-class VariableText:
+class VariableText(object):
        """VariableText can be used for components which have a variable text, based on any widget with setText call"""
        
        def __init__(self):
        """VariableText can be used for components which have a variable text, based on any widget with setText call"""
        
        def __init__(self):
+               object.__init__(self)
                self.message = ""
                self.instance = None
        
                self.message = ""
                self.instance = None
        
@@ -19,14 +20,7 @@ class VariableText:
        def getText(self):
                return self.message
        
        def getText(self):
                return self.message
        
-       def GUIcreate(self, parent):
-               self.instance = self.createWidget(parent)
-               self.instance.setText(self.message)
+       text = property(getText, setText)
        
        
-       def GUIdelete(self):
-               self.removeWidget(self.instance)
-               self.instance = None
-       
-       def removeWidget(self, instance):
-               pass
-
+       def postWidgetCreate(self, instance):
+               instance.setText(self.message)
index 8f0cef4c5ecc415f966554075ba3a6405e4208c7..288de01a43431aea06307f21a7d63a8d66c97bef 100644 (file)
@@ -1,27 +1,22 @@
 import skin
 
 import skin
 
-class VariableValue:
+class VariableValue(object):
        """VariableValue can be used for components which have a variable value (like eSlider), based on any widget with setValue call"""
        
        def __init__(self):
        """VariableValue can be used for components which have a variable value (like eSlider), based on any widget with setValue call"""
        
        def __init__(self):
-               self.value = 0
-               self.instance = None
-       
+               self.__value = 0
+
        def setValue(self, value):
        def setValue(self, value):
-               self.value = value
+               self.__value = value
                if self.instance:
                if self.instance:
-                       self.instance.setValue(self.value)
+                       self.instance.setValue(self.__value)
 
        def getValue(self):
 
        def getValue(self):
-               return self.value
-               
-       def GUIcreate(self, parent):
-               self.instance = self.createWidget(parent)
-               self.instance.setValue(self.value)
-       
-       def GUIdelete(self):
-               self.removeWidget(self.instance)
-               self.instance = None
-       
-       def removeWidget(self, instance):
-               pass
+               return self.__value
+
+       def postWidgetCreate(self, instance):
+               print self
+               print self.GUI_WIDGET
+               self.instance.setValue(self.__value)
+
+       value = property(getValue, setValue)
index db247980caf69e738dafd086c136bd3ffe69cc0a..88cd33f98668996030fa1408677c8258357c75bf 100644 (file)
@@ -4,9 +4,5 @@ from enigma import eVideoWidget
 class VideoWindow(GUIComponent):
        def __init__(self):
                GUIComponent.__init__(self)
 class VideoWindow(GUIComponent):
        def __init__(self):
                GUIComponent.__init__(self)
-       
-       def GUIcreate(self, parent):
-               self.instance = eVideoWidget(parent)
 
 
-       def GUIdelete(self):
-               self.instance = None
+       GUI_WIDGET = eVideoWidget
index 09dde5e1a93dbfc4ea5bf4bd3bd180babf1c035a..c51bdb1913b2369ef5dff55c7be245a3293c1b4d 100644 (file)
@@ -6,12 +6,12 @@ from VariableText import *
 from enigma import eSlider
 from enigma import eLabel
 
 from enigma import eSlider
 from enigma import eLabel
 
-class VolumeBar(HTMLComponent, GUIComponent, VariableValue):
+class VolumeBar(VariableValue, HTMLComponent, GUIComponent):
        def __init__(self):
                VariableValue.__init__(self)
                GUIComponent.__init__(self)
 
        def __init__(self):
                VariableValue.__init__(self)
                GUIComponent.__init__(self)
 
-       def createWidget(self, parent):
-               g = eSlider(parent)
-               g.setRange(0, 100)
-               return g
+       GUI_WIDGET = eSlider
+
+       def postWidgetCreate(self, instance):
+               instance.setRange(0, 100)
index 7738e325754ae1b5f0d2de84c779c5dedc92c721..747ee6f5579c324748165552a2bf27347f7af029 100644 (file)
@@ -45,15 +45,12 @@ class ServiceInfoList(HTMLComponent, GUIComponent):
                self.l.setList(self.list)
                self.l.setFont(0, gFont("Regular", 23))
 
                self.l.setList(self.list)
                self.l.setFont(0, gFont("Regular", 23))
 
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
+       GUI_WIDGET = eListbox
+       
+       def postWidgetCreate(self, instance):
                self.instance.setContent(self.l)
                self.instance.setItemHeight(25)
 
                self.instance.setContent(self.l)
                self.instance.setItemHeight(25)
 
-       def GUIdelete(self):
-               self.instance.setContent(None)
-               self.instance = None
-
 class ServiceInfo(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)
 class ServiceInfo(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)