aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/python/Components/Button.py13
-rw-r--r--lib/python/Components/Clock.py3
-rw-r--r--lib/python/Components/ConditionalWidget.py33
-rw-r--r--lib/python/Components/ConfigList.py30
-rw-r--r--lib/python/Components/DiskInfo.py2
-rw-r--r--lib/python/Components/EpgList.py17
-rw-r--r--lib/python/Components/EventInfo.py73
-rw-r--r--lib/python/Components/FileList.py13
-rw-r--r--lib/python/Components/GUIComponent.py48
-rw-r--r--lib/python/Components/Header.py2
-rw-r--r--lib/python/Components/HelpMenuList.py16
-rw-r--r--lib/python/Components/Input.py2
-rw-r--r--lib/python/Components/Label.py20
-rw-r--r--lib/python/Components/LanguageList.py13
-rw-r--r--lib/python/Components/Makefile.am12
-rw-r--r--lib/python/Components/MediaPlayer.py13
-rw-r--r--lib/python/Components/MenuList.py14
-rw-r--r--lib/python/Components/MovieList.py13
-rw-r--r--lib/python/Components/PerServiceDisplay.py12
-rw-r--r--lib/python/Components/Pixmap.py21
-rw-r--r--lib/python/Components/PluginList.py13
-rw-r--r--lib/python/Components/ProgressBar.py2
-rw-r--r--lib/python/Components/ServiceList.py19
-rw-r--r--lib/python/Components/ServicePosition.py8
-rw-r--r--lib/python/Components/Slider.py4
-rw-r--r--lib/python/Components/TextInput.py0
-rw-r--r--lib/python/Components/TimeInput.py0
-rw-r--r--lib/python/Components/TimerList.py19
-rw-r--r--lib/python/Components/TunerInfo.py14
-rw-r--r--lib/python/Components/VariableText.py16
-rw-r--r--lib/python/Components/VariableValue.py31
-rw-r--r--lib/python/Components/VideoWindow.py6
-rw-r--r--lib/python/Components/VolumeBar.py10
-rw-r--r--lib/python/Screens/ServiceInfo.py9
34 files changed, 200 insertions, 321 deletions
diff --git a/lib/python/Components/Button.py b/lib/python/Components/Button.py
index cb4b4213..2839a034 100644
--- a/lib/python/Components/Button.py
+++ b/lib/python/Components/Button.py
@@ -4,7 +4,7 @@ from VariableText import *
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)
@@ -26,12 +26,7 @@ class Button(HTMLComponent, GUIComponent, VariableText):
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)
diff --git a/lib/python/Components/Clock.py b/lib/python/Components/Clock.py
index 9129acaf..ae828c4f 100644
--- a/lib/python/Components/Clock.py
+++ b/lib/python/Components/Clock.py
@@ -12,7 +12,7 @@ from config import config
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)
@@ -43,4 +43,5 @@ class Clock(HTMLComponent, GUIComponent, VariableText):
# ...und als HTML:
def produceHTML(self):
+ # return T.b[self.getText()]
return self.getText()
diff --git a/lib/python/Components/ConditionalWidget.py b/lib/python/Components/ConditionalWidget.py
index 07d59e02..62daf5e6 100644
--- a/lib/python/Components/ConditionalWidget.py
+++ b/lib/python/Components/ConditionalWidget.py
@@ -3,28 +3,9 @@ from GUIComponent 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):
- Widget.__init__(self)
+ GUIComponent.__init__(self)
self.setConnect(None)
@@ -38,11 +19,9 @@ class ConditionalWidget(Widget):
def activateCondition(self, condition):
if (condition):
- if self.state == self.HIDDEN:
- self.show()
+ self.state = self.HIDDEN
else:
- if self.state == self.SHOWN:
- self.hide()
+ self.state = self.SHOWN
def update(self):
if (self.conditionalFunction != None):
@@ -55,9 +34,9 @@ class ConditionalWidget(Widget):
import time
-class BlinkingWidget(Widget):
+class BlinkingWidget(GUIComponent):
def __init__(self):
- Widget.__init__(self)
+ GUIComponent.__init__(self)
self.blinking = True
diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py
index 6ff9116f..0181ef02 100644
--- a/lib/python/Components/ConfigList.py
+++ b/lib/python/Components/ConfigList.py
@@ -4,13 +4,13 @@ from config import *
from enigma import eListbox, eListboxPythonConfigContent
-class ConfigList(HTMLComponent, GUIComponent):
+class ConfigList(HTMLComponent, GUIComponent, object):
def __init__(self, list):
GUIComponent.__init__(self)
self.l = eListboxPythonConfigContent()
- self.l.setList(list)
self.l.setSeperation(100)
self.list = list
+ self.onSelectionChanged = [ ]
def toggle(self):
selection = self.getCurrent()
@@ -31,16 +31,26 @@ class ConfigList(HTMLComponent, GUIComponent):
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
-
- 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)
diff --git a/lib/python/Components/DiskInfo.py b/lib/python/Components/DiskInfo.py
index 9490a0f8..be1521cf 100644
--- a/lib/python/Components/DiskInfo.py
+++ b/lib/python/Components/DiskInfo.py
@@ -6,7 +6,7 @@ from enigma import eLabel
# 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
diff --git a/lib/python/Components/EpgList.py b/lib/python/Components/EpgList.py
index 5d519f88..cf55d265 100644
--- a/lib/python/Components/EpgList.py
+++ b/lib/python/Components/EpgList.py
@@ -122,20 +122,19 @@ class EPGList(HTMLComponent, GUIComponent):
if x is not None:
try:
x()
- except:
+ except: # FIXME!!!
+ print "FIXME in EPGList.selectionChanged"
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)
- def GUIdelete(self):
- self.instance = None
-
def recalcEntrySize(self):
if SINGLE_CPP == 0:
esize = self.l.getItemSize()
diff --git a/lib/python/Components/EventInfo.py b/lib/python/Components/EventInfo.py
index 69487b5f..e69de29b 100644
--- a/lib/python/Components/EventInfo.py
+++ b/lib/python/Components/EventInfo.py
@@ -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)
diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py
index d726b833..ce1f236f 100644
--- a/lib/python/Components/FileList.py
+++ b/lib/python/Components/FileList.py
@@ -47,7 +47,7 @@ def FileEntryComponent(name, absolute = None, isDir = False):
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()
@@ -134,8 +134,9 @@ class FileList(HTMLComponent, GUIComponent, MenuList):
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)
diff --git a/lib/python/Components/GUIComponent.py b/lib/python/Components/GUIComponent.py
index 8f6362fd..afe95266 100644
--- a/lib/python/Components/GUIComponent.py
+++ b/lib/python/Components/GUIComponent.py
@@ -2,15 +2,15 @@ import skin
from enigma import ePoint
-class GUIComponent:
+class GUIComponent(object):
""" GUI component """
SHOWN = 0
HIDDEN = 1
def __init__(self):
- self.state = self.SHOWN
self.instance = None
+ self.state = self.SHOWN
def execBegin(self):
pass
@@ -37,11 +37,51 @@ class GUIComponent:
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):
- self.state = self.HIDDEN
+ self.__state = self.HIDDEN
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
diff --git a/lib/python/Components/Header.py b/lib/python/Components/Header.py
index 9f7be60e..07d5ee83 100644
--- a/lib/python/Components/Header.py
+++ b/lib/python/Components/Header.py
@@ -4,7 +4,7 @@ from VariableText import *
from enigma import eLabel
-class Header(HTMLComponent, GUIComponent, VariableText):
+class Header(VariableText, HTMLComponent, GUIComponent):
def __init__(self, message):
GUIComponent.__init__(self)
diff --git a/lib/python/Components/HelpMenuList.py b/lib/python/Components/HelpMenuList.py
index c8ff3795..103727a7 100644
--- a/lib/python/Components/HelpMenuList.py
+++ b/lib/python/Components/HelpMenuList.py
@@ -48,17 +48,13 @@ class HelpMenuList(GUIComponent):
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()
diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py
index a3ab764e..d561c5db 100644
--- a/lib/python/Components/Input.py
+++ b/lib/python/Components/Input.py
@@ -6,7 +6,7 @@ from enigma import eLabel
from Tools.NumericalTextInput import NumericalTextInput
-class Input(HTMLComponent, GUIComponent, VariableText):
+class Input(VariableText, HTMLComponent, GUIComponent):
TEXT = 0
PIN = 1
NUMBER = 2
diff --git a/lib/python/Components/Label.py b/lib/python/Components/Label.py
index 5ad071ab..4d90badc 100644
--- a/lib/python/Components/Label.py
+++ b/lib/python/Components/Label.py
@@ -6,7 +6,7 @@ from ConditionalWidget import *
from enigma import eLabel
-class Label(HTMLComponent, GUIComponent, VariableText):
+class Label(VariableText, HTMLComponent, GUIComponent):
def __init__(self, text=""):
GUIComponent.__init__(self)
VariableText.__init__(self)
@@ -17,9 +17,8 @@ class Label(HTMLComponent, GUIComponent, VariableText):
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())
@@ -34,20 +33,7 @@ class BlinkingLabel(Label, BlinkingWidget):
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)
-
- def GUIcreate(self, parent):
- LabelConditional.GUIcreate(self, parent)
-
- def GUIdelete(self):
- LabelConditional.GUIcreate(self)
- \ No newline at end of file
diff --git a/lib/python/Components/LanguageList.py b/lib/python/Components/LanguageList.py
index adf87186..e625d7c7 100644
--- a/lib/python/Components/LanguageList.py
+++ b/lib/python/Components/LanguageList.py
@@ -26,15 +26,16 @@ def LanguageEntryComponent(file, name, index):
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 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)
diff --git a/lib/python/Components/Makefile.am b/lib/python/Components/Makefile.am
index 80393aef..f7e26e42 100644
--- a/lib/python/Components/Makefile.am
+++ b/lib/python/Components/Makefile.am
@@ -1,16 +1,16 @@
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 \
- 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
diff --git a/lib/python/Components/MediaPlayer.py b/lib/python/Components/MediaPlayer.py
index 70a1dbbd..c271c3c6 100644
--- a/lib/python/Components/MediaPlayer.py
+++ b/lib/python/Components/MediaPlayer.py
@@ -50,7 +50,7 @@ def PlaylistEntryComponent(serviceref, state):
return res
-class PlayList(HTMLComponent, GUIComponent, MenuList):
+class PlayList(MenuList, HTMLComponent, GUIComponent):
def __init__(self):
GUIComponent.__init__(self)
self.l = eListboxPythonMultiContent()
@@ -66,11 +66,12 @@ class PlayList(HTMLComponent, GUIComponent, MenuList):
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]
diff --git a/lib/python/Components/MenuList.py b/lib/python/Components/MenuList.py
index f4b2c361..b1b115b7 100644
--- a/lib/python/Components/MenuList.py
+++ b/lib/python/Components/MenuList.py
@@ -14,17 +14,17 @@ class MenuList(HTMLComponent, GUIComponent):
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)
- 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:
diff --git a/lib/python/Components/MovieList.py b/lib/python/Components/MovieList.py
index 3b7e7e36..970180cd 100644
--- a/lib/python/Components/MovieList.py
+++ b/lib/python/Components/MovieList.py
@@ -63,15 +63,12 @@ class MovieList(HTMLComponent, GUIComponent):
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)
diff --git a/lib/python/Components/PerServiceDisplay.py b/lib/python/Components/PerServiceDisplay.py
index 821f6d16..22305ca9 100644
--- a/lib/python/Components/PerServiceDisplay.py
+++ b/lib/python/Components/PerServiceDisplay.py
@@ -44,12 +44,9 @@ class PerServiceDisplay(PerServiceBase, VariableText):
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)
@@ -60,7 +57,4 @@ class PerServiceDisplayProgress(GUIComponent, VariableValue, PerServiceBase):
# 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
diff --git a/lib/python/Components/Pixmap.py b/lib/python/Components/Pixmap.py
index 211b772c..3cc8c661 100644
--- a/lib/python/Components/Pixmap.py
+++ b/lib/python/Components/Pixmap.py
@@ -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):
diff --git a/lib/python/Components/PluginList.py b/lib/python/Components/PluginList.py
index 1b4daf18..7220f0a9 100644
--- a/lib/python/Components/PluginList.py
+++ b/lib/python/Components/PluginList.py
@@ -44,7 +44,7 @@ def PluginDownloadComponent(plugin, name):
return res
-class PluginList(HTMLComponent, GUIComponent, MenuList):
+class PluginList(MenuList, HTMLComponent, GUIComponent):
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))
-
- 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)
diff --git a/lib/python/Components/ProgressBar.py b/lib/python/Components/ProgressBar.py
index 00b1bbe3..9bec1796 100644
--- a/lib/python/Components/ProgressBar.py
+++ b/lib/python/Components/ProgressBar.py
@@ -5,7 +5,7 @@ from VariableValue import *
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)
diff --git a/lib/python/Components/ServiceList.py b/lib/python/Components/ServiceList.py
index 2b80c225..85f004c0 100644
--- a/lib/python/Components/ServiceList.py
+++ b/lib/python/Components/ServiceList.py
@@ -6,7 +6,6 @@ from enigma import *
from string import upper
class ServiceList(HTMLComponent, GUIComponent):
-
MODE_NORMAL = 0
MODE_FAVOURITES = 1
@@ -14,7 +13,6 @@ class ServiceList(HTMLComponent, GUIComponent):
GUIComponent.__init__(self)
self.l = eListboxServiceContent()
self.root = None
-
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 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
@@ -129,11 +125,6 @@ class ServiceList(HTMLComponent, GUIComponent):
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)
diff --git a/lib/python/Components/ServicePosition.py b/lib/python/Components/ServicePosition.py
index 467a80e3..cb444921 100644
--- a/lib/python/Components/ServicePosition.py
+++ b/lib/python/Components/ServicePosition.py
@@ -123,13 +123,11 @@ class ServicePositionGauge(PerServiceBase):
def stopEvent(self):
self.disablePolling()
- def GUIcreate(self, parent):
- self.instance = ePositionGauge(parent)
+ GUI_WIDGET = ePositionGauge
+
+ def postWidgetCreate(self, instance):
self.newService()
- def GUIdelete(self):
- self.instance = None
-
def newCuesheet(self):
service = self.navcore.getCurrentService()
cue = service and service.cueSheet()
diff --git a/lib/python/Components/Slider.py b/lib/python/Components/Slider.py
index dae13d9c..e61b47f4 100644
--- a/lib/python/Components/Slider.py
+++ b/lib/python/Components/Slider.py
@@ -5,7 +5,7 @@ from VariableText import *
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)
@@ -16,4 +16,4 @@ class Slider(HTMLComponent, GUIComponent, VariableValue):
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
index e69de29b..00000000
--- a/lib/python/Components/TextInput.py
+++ /dev/null
diff --git a/lib/python/Components/TimeInput.py b/lib/python/Components/TimeInput.py
deleted file mode 100644
index e69de29b..00000000
--- a/lib/python/Components/TimeInput.py
+++ /dev/null
diff --git a/lib/python/Components/TimerList.py b/lib/python/Components/TimerList.py
index d3774cfa..2f60fcfb 100644
--- a/lib/python/Components/TimerList.py
+++ b/lib/python/Components/TimerList.py
@@ -75,7 +75,7 @@ def TimerEntryComponent(timer, processed):
return res
-class TimerList(HTMLComponent, GUIComponent):
+class TimerList(HTMLComponent, GUIComponent, object):
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 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)
@@ -97,13 +98,11 @@ class TimerList(HTMLComponent, GUIComponent):
def getCurrentIndex(self):
return self.instance.getCurrentIndex()
+ currentIndex = property(moveToIndex, getCurrentIndex)
+ currentSelection = property(getCurrent)
+
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()
-
diff --git a/lib/python/Components/TunerInfo.py b/lib/python/Components/TunerInfo.py
index f841832c..53cb3d90 100644
--- a/lib/python/Components/TunerInfo.py
+++ b/lib/python/Components/TunerInfo.py
@@ -105,16 +105,8 @@ class TunerInfo(GUIComponent):
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:
- self.instance.setText(self.message)
+ instance.setText(self.message)
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)
diff --git a/lib/python/Components/VariableText.py b/lib/python/Components/VariableText.py
index e2a755c5..bb8b5fe3 100644
--- a/lib/python/Components/VariableText.py
+++ b/lib/python/Components/VariableText.py
@@ -1,9 +1,10 @@
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):
+ object.__init__(self)
self.message = ""
self.instance = None
@@ -19,14 +20,7 @@ class VariableText:
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)
diff --git a/lib/python/Components/VariableValue.py b/lib/python/Components/VariableValue.py
index 8f0cef4c..288de01a 100644
--- a/lib/python/Components/VariableValue.py
+++ b/lib/python/Components/VariableValue.py
@@ -1,27 +1,22 @@
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):
- self.value = 0
- self.instance = None
-
+ self.__value = 0
+
def setValue(self, value):
- self.value = value
+ self.__value = value
if self.instance:
- self.instance.setValue(self.value)
+ self.instance.setValue(self.__value)
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)
diff --git a/lib/python/Components/VideoWindow.py b/lib/python/Components/VideoWindow.py
index db247980..88cd33f9 100644
--- a/lib/python/Components/VideoWindow.py
+++ b/lib/python/Components/VideoWindow.py
@@ -4,9 +4,5 @@ from enigma import eVideoWidget
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
diff --git a/lib/python/Components/VolumeBar.py b/lib/python/Components/VolumeBar.py
index 09dde5e1..c51bdb19 100644
--- a/lib/python/Components/VolumeBar.py
+++ b/lib/python/Components/VolumeBar.py
@@ -6,12 +6,12 @@ from VariableText import *
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 createWidget(self, parent):
- g = eSlider(parent)
- g.setRange(0, 100)
- return g
+ GUI_WIDGET = eSlider
+
+ def postWidgetCreate(self, instance):
+ instance.setRange(0, 100)
diff --git a/lib/python/Screens/ServiceInfo.py b/lib/python/Screens/ServiceInfo.py
index 7738e325..747ee6f5 100644
--- a/lib/python/Screens/ServiceInfo.py
+++ b/lib/python/Screens/ServiceInfo.py
@@ -45,15 +45,12 @@ class ServiceInfoList(HTMLComponent, GUIComponent):
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)
- def GUIdelete(self):
- self.instance.setContent(None)
- self.instance = None
-
class ServiceInfo(Screen):
def __init__(self, session):
Screen.__init__(self, session)