SecondInfoBar: A diffirent way to save resources.
authorLittlesat <Littlesat99@yahoo.com>
Sat, 14 Apr 2012 09:08:45 +0000 (11:08 +0200)
committerLittlesat <Littlesat99@yahoo.com>
Sat, 14 Apr 2012 09:08:45 +0000 (11:08 +0200)
When the second infobar was hidden the PliExtraInfo was not polled anymore
except when enigma2 was started and the secondInfoBar was never showed
before. By using onLayoutFinish.append we can toggle the secondInfobar
being showed and hidden at initialization. This will save receive resources
also when the SecondInfoBar was never shown before.

This will also allow to use PliExtraInfo outside a SecondInfoBar

There can still be more resources be saved later by not "polling" frontend
data and service information when it is not requred in PliExtraInfo

lib/python/Components/Converter/PliExtraInfo.py
lib/python/Screens/InfoBarGenerics.py

index 86def1b..793f8aa 100644 (file)
@@ -14,12 +14,6 @@ def addspace(text):
        return text
 
 class PliExtraInfo(Poll, Converter, object):
-       @classmethod
-       def enablePliExtraInfo(self, val):
-               self.isEnabled = val
-
-       isEnabled = False
-
        def __init__(self, type):
                Converter.__init__(self, type)
                Poll.__init__(self)
@@ -154,8 +148,6 @@ class PliExtraInfo(Poll, Converter, object):
 
        @cached
        def getText(self):
-               if PliExtraInfo.isEnabled is False:
-                       return ""
 
                service = self.source.service
                if service is None:
@@ -234,9 +226,6 @@ class PliExtraInfo(Poll, Converter, object):
 
        @cached
        def getBool(self):
-               if PliExtraInfo.isEnabled is False:
-                       return False
-
                service = self.source.service
                info = service and service.info()
 
index 9feb7b6..ce0fb26 100644 (file)
@@ -11,7 +11,6 @@ from Components.Sources.Boolean import Boolean
 from Components.config import config, ConfigBoolean, ConfigClock
 from Components.SystemInfo import SystemInfo
 from Components.UsageConfig import preferredInstantRecordPath, defaultMoviePath
-from Components.Converter.PliExtraInfo import PliExtraInfo
 from EpgSelection import EPGSelection
 from Plugins.Plugin import PluginDescriptor
 
@@ -195,7 +194,11 @@ class InfoBarShowHide:
                self.secondInfoBarScreen = ""
                if isStandardInfoBar(self):
                        self.secondInfoBarScreen = self.session.instantiateDialog(SecondInfoBar)
-                       self.secondInfoBarScreen.hide()
+                       self.secondInfoBarScreen.show()
+               self.onLayoutFinish.append(self.__layoutFinished)
+
+       def __layoutFinished(self):
+               self.secondInfoBarScreen.hide()
 
        def keyHide(self):
                if self.__state == self.STATE_SHOWN:
@@ -236,7 +239,6 @@ class InfoBarShowHide:
        def __onHide(self):
                self.__state = self.STATE_HIDDEN
                if self.secondInfoBarScreen:
-                       PliExtraInfo.enablePliExtraInfo(False)
                        self.secondInfoBarScreen.hide()
                for x in self.onShowHideNotifiers:
                        x(False)
@@ -254,10 +256,8 @@ class InfoBarShowHide:
                if self.__state == self.STATE_HIDDEN:
                        self.show()
                        if self.secondInfoBarScreen:
-                               PliExtraInfo.enablePliExtraInfo(False)
                                self.secondInfoBarScreen.hide()
                elif self.secondInfoBarScreen and config.usage.show_second_infobar.value and not self.secondInfoBarScreen.shown:
-                       PliExtraInfo.enablePliExtraInfo(True)
                        self.secondInfoBarScreen.show()
                        self.startHideTimer()
                else: