remove GUIComponent from PerServiceDisplay
[enigma2.git] / lib / python / Components / ServicePosition.py
index 467a80e3161778f61a1f6ea5b78b4eaf0963fad8..f5771e3a0d9f8e9be032f9c5bde480429eec690d 100644 (file)
@@ -1,4 +1,5 @@
 from PerServiceDisplay import PerServiceDisplay, PerServiceBase
+from Components.GUIComponent import GUIComponent
 from enigma import eTimer, iPlayableService, iSeekableServicePtr, ePositionGauge
 import time
 
@@ -65,8 +66,11 @@ class ServicePosition(PerServiceDisplay):
                                l = self.get(self.TYPE_POSITION)
                                if l != -1:
                                        l += self.relative_base
-                                       t = time.localtime(l)
-                                       timestr = "%2d:%02d:%02d" % (t.tm_hour, t.tm_min, t.tm_sec)
+                                       try:
+                                               t = time.localtime(l)
+                                               timestr = "%2d:%02d:%02d" % (t.tm_hour, t.tm_min, t.tm_sec)
+                                       except ValueError:
+                                               timestr = ""
                                else:
                                        timestr = ""
 
@@ -81,8 +85,9 @@ class ServicePosition(PerServiceDisplay):
                self.updateTimer.stop()
                self.setText("");
 
-class ServicePositionGauge(PerServiceBase):
+class ServicePositionGauge(PerServiceBase, GUIComponent):
        def __init__(self, navcore):
+               GUIComponent.__init__(self)
                PerServiceBase.__init__(self, navcore,
                        {
                                iPlayableService.evStart: self.newService,
@@ -123,13 +128,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()