split Misc Converter/Source into RecordState and TunerInfo Source /
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 2 Nov 2007 01:54:54 +0000 (01:54 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 2 Nov 2007 01:54:54 +0000 (01:54 +0000)
Converter
add deprecation Warnings for some old InfoBar Components (Nim_A, NimB,
NimA_Active, NimB_Active, BlinkingPoint)

13 files changed:
data/skin.xml
lib/python/Components/Converter/Makefile.am
lib/python/Components/Converter/Misc.py [deleted file]
lib/python/Components/Converter/TunerInfo.py [new file with mode: 0644]
lib/python/Components/GUIComponent.py
lib/python/Components/GUISkin.py
lib/python/Components/Sources/Makefile.am
lib/python/Components/Sources/Misc.py [deleted file]
lib/python/Components/Sources/RecordState.py [new file with mode: 0644]
lib/python/Components/Sources/TunerInfo.py [new file with mode: 0644]
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/SessionGlobals.py
lib/python/Screens/Standby.py

index b86160f0107dde0dddfd299fdab2074932a255f7..8e6445fae07d4493e769e2454507fb61a2605e60 100644 (file)
                        <convert type="ClockToText">Default</convert>
                </widget>
                <!-- tuners in use? -->
-               <!-- DEPRECATED widget name="NimA_Active" position="129,6" zPosition="1" size="9,9" pixmap="skin_default/nim_a.png" alphatest="on" /-->
                <widget source="session.FrontendInfo" render="Pixmap" position="129,6" zPosition="1" size="9,9" pixmap="skin_default/nim_a.png" alphatest="on" >
                        <convert type="FrontendInfo">NUMBER</convert>
                        <convert type="ValueRange">0,0</convert>
                        <convert type="ConditionalShowHide" />
                </widget>
-               <!-- DEPRECATED widget name="NimB_Active" position="129,20" zPosition="1" size="9,9" pixmap="skin_default/nim_b.png" alphatest="on" /-->
-               <widget source="session.FrontendInfo" render="Pixmap" position="129,6" zPosition="1" size="9,9" pixmap="skin_default/nim_b.png" alphatest="on" >
+               <widget source="session.FrontendInfo" render="Pixmap" position="129,20" zPosition="1" size="9,9" pixmap="skin_default/nim_b.png" alphatest="on" >
                        <convert type="FrontendInfo">NUMBER</convert>
                        <convert type="ValueRange">1,1</convert>
                        <convert type="ConditionalShowHide" />
                </widget>
-               <!-- DEPRECATED widget name="NimA" position="142,6" zPosition="1" size="8,9" pixmap="skin_default/nim_active.png" alphatest="on" /-->
-               <widget source="session.GlobalInfo" render="Pixmap" position="142,6" zPosition="1" size="8,9" pixmap="skin_default/nim_active.png" alphatest="on" >
-                       <convert type="Misc">TunerUseMask</convert>
+               <widget source="session.TunerInfo" render="Pixmap" position="142,6" zPosition="1" size="8,9" pixmap="skin_default/nim_active.png" alphatest="on" >
+                       <convert type="TunerInfo">TunerUseMask</convert>
                        <convert type="ValueBitTest">1</convert>
                        <convert type="ConditionalShowHide" />
                </widget>
-               <!-- DEPRECATED widget name="NimB" position="142,20" zPosition="1" size="8,9" pixmap="skin_default/nim_active.png" alphatest="on" /-->
-               <widget source="session.GlobalInfo" render="Pixmap" position="142,20" zPosition="1" size="8,9" pixmap="skin_default/nim_active.png" alphatest="on" >
-                       <convert type="Misc">TunerUseMask</convert>
+               <widget source="session.TunerInfo" render="Pixmap" position="142,20" zPosition="1" size="8,9" pixmap="skin_default/nim_active.png" alphatest="on" >
+                       <convert type="TunerInfo">TunerUseMask</convert>
                        <convert type="ValueBitTest">2</convert>
                        <convert type="ConditionalShowHide" />
                </widget>
                        <convert type="EventTime">Progress</convert>
                </widget>
                <!-- Blinking pixmap (recording in progress?) -->
-               <!-- DEPRECATED widget name="BlinkingPoint" pixmap="skin_default/icon_rec.png" position="561,21" zPosition="2" size="34,21" alphatest="off" /-->
-               <widget source="session.GlobalInfo" render="Pixmap" pixmap="skin_default/icon_rec.png" position="561,21" zPosition="2" size="34,21" alphatest="off">
-                       <convert type="Misc">RecordRunning</convert>
+               <widget source="session.RecordState" render="Pixmap" pixmap="skin_default/icon_rec.png" position="561,21" zPosition="2" size="34,21" alphatest="off">
                        <convert type="ConditionalShowHide">Blink</convert>
                </widget>
                <!-- Event (now) -->
index 8519d0cdfa07d8d3e72f6d43fdf90915ab09ba82..73b689b3f646fc61248579ce4172831da27939bc 100644 (file)
@@ -5,4 +5,4 @@ install_PYTHON = \
        Poll.py RemainingToText.py StringList.py ServiceName.py FrontendInfo.py ServiceInfo.py \
        ConditionalShowHide.py ServicePosition.py ValueRange.py RdsInfo.py Streaming.py \
        StaticMultiList.py ServiceTime.py MovieInfo.py MenuEntryCompare.py StringListSelection.py \
-       ValueBitTest.py Misc.py
+       ValueBitTest.py TunerInfo.py
diff --git a/lib/python/Components/Converter/Misc.py b/lib/python/Components/Converter/Misc.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/lib/python/Components/Converter/TunerInfo.py b/lib/python/Components/Converter/TunerInfo.py
new file mode 100644 (file)
index 0000000..2ed71e3
--- /dev/null
@@ -0,0 +1,34 @@
+from Components.Sources.TunerInfo import TunerInfo as TunerInfoSource
+from Components.Converter.Converter import Converter
+from Components.Element import cached
+
+class TunerInfo(Converter, object):
+       def __init__(self, type):
+               Converter.__init__(self, type)
+               self.type = {
+                               "TunerUseMask": TunerInfoSource.FE_USE_MASK
+                       }[type]
+
+       @cached
+       def getBoolean(self):
+               if self.type == TunerInfoSource.FE_USE_MASK:
+                       return self.source.getTunerUseMask() and True or False
+       boolean = property(getBoolean)
+
+       @cached
+       def getText(self):
+               if self.type == TunerInfoSource.FE_USE_MASK:
+                       return str(self.source.getTunerUseMask())
+               return ""
+       text = property(getText)
+
+       @cached
+       def getValue(self):
+               if self.type == TunerInfoSource.FE_USE_MASK:
+                       return self.source.getTunerUseMask()
+               return -1
+       value = property(getValue)
+
+       def changed(self, what):
+               if what[0] != self.CHANGED_SPECIFIC or what[1] == self.type:
+                       Converter.changed(self, what)
index deb8b34a6356c11c6c30a8851af1627fce44c425..a3b1b9e198dea2830af46ebb46259344e90b202a 100644 (file)
@@ -11,6 +11,7 @@ class GUIComponent(object):
                self.__visible = 0
                self.visible = 1
                self.skinAttributes = None
+               self.deprecationInfo = None
        
        def execBegin(self):
                pass
index 39499c77ef16f9feac914f7a7f159fce889c990b..ce4d397d07df59f8808498f45ee5eed8b6808c2b 100644 (file)
@@ -20,7 +20,12 @@ class GUISkin:
                        val = self[key]
                        if isinstance(val, GUIComponent):
                                val.GUIcreate(parent)
-                               if not val.applySkin(desktop):
+                               depr = val.deprecationInfo
+                               if val.applySkin(desktop):
+                                       if depr:
+                                               print "WARNING: OBSOLETE COMPONENT '%s' USED IN SKIN. USE '%s' INSTEAD!" % (key, depr[0])
+                                               print "OBSOLETE COMPONENT WILL BE REMOVED %s, PLEASE UPDATE!" % (depr[1])
+                               elif not depr:
                                        print "warning, skin is missing element", key, "in", self
 
                for w in self.additionalWidgets:
index b6f2555413ad7d49ebb07c5b48c0f45e6435b5c0..5ac636c8eb6bc195798cc3d4c6c49d727438b851 100644 (file)
@@ -3,5 +3,5 @@ installdir = $(LIBDIR)/enigma2/python/Components/Sources
 install_PYTHON = \
        __init__.py Clock.py EventInfo.py Source.py List.py CurrentService.py \
        FrontendStatus.py Boolean.py Config.py ServiceList.py RdsDecoder.py StreamService.py \
-       StaticText.py CanvasSource.py ServiceEvent.py Event.py FrontendInfo.py \
-       Misc.py
+       StaticText.py CanvasSource.py ServiceEvent.py Event.py FrontendInfo.py TunerInfo.py \
+       RecordState.py
diff --git a/lib/python/Components/Sources/Misc.py b/lib/python/Components/Sources/Misc.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/lib/python/Components/Sources/RecordState.py b/lib/python/Components/Sources/RecordState.py
new file mode 100644 (file)
index 0000000..328f921
--- /dev/null
@@ -0,0 +1,32 @@
+from Source import Source
+from Components.Element import cached
+from enigma import iRecordableService
+
+class RecordState(Source):
+       def __init__(self, session):
+               Source.__init__(self)
+               self.records_running = 0
+               self.session = session
+               session.nav.record_event.append(self.gotRecordEvent)
+
+       def gotRecordEvent(self, service, event):
+               prev_records = self.records_running
+               if event in (iRecordableService.evEnd, iRecordableService.evStart):
+                       recs = self.session.nav.getRecordings()
+                       self.records_running = len(recs)
+                       if self.records_running != prev_records:
+                               self.changed((self.CHANGED_ALL,))
+
+       def destroy(self):
+               session.nav.record_event.remove(self.gotRecordEvent)
+               Source.destroy(self)
+
+       @cached
+       def getBoolean(self):
+               return self.records_running and True or False
+       boolean = property(getBoolean)
+
+       @cached
+       def getValue(self):
+               return self.records_running
+       value = property(getValue)
diff --git a/lib/python/Components/Sources/TunerInfo.py b/lib/python/Components/Sources/TunerInfo.py
new file mode 100644 (file)
index 0000000..7ac3491
--- /dev/null
@@ -0,0 +1,29 @@
+from Source import Source
+from enigma import eDVBResourceManager
+
+class TunerInfo(Source):
+       FE_USE_MASK = 0
+
+       def __init__(self):
+               Source.__init__(self)
+               self.tuner_use_mask = 0
+               res_mgr = eDVBResourceManager.getInstance()
+               if res_mgr:
+                       res_mgr.frontendUseMaskChanged.get().append(self.tunerUseMaskChanged)
+               else:
+                       print "no res_mgr!!"
+
+       def tunerUseMaskChanged(self, mask):
+               self.tuner_use_mask = mask
+               self.changed((self.CHANGED_SPECIFIC, self.FE_USE_MASK))
+
+       def getTunerUseMask(self):
+               return self.tuner_use_mask
+
+       def destroy(self):
+               res_mgr = eDVBResourceManager.getInstance()
+               if res_mgr:
+                       res_mgr.frontendUseMaskChanged.get().remove(self.tunerUseMaskChanged)
+               else:
+                       print "no res_mgr!!"
+               Source.destroy(self)
index f0a5267a4bc7cef1d7a8f8692d1cd3a2b47b1836..806a7a0c0161a15d0c4138fe56422bc8e8aea267 100644 (file)
@@ -1318,6 +1318,9 @@ class InfoBarInstantRecord:
 #### DEPRECATED CODE ####
                self["BlinkingPoint"] = BlinkingPixmapConditional()
                self["BlinkingPoint"].setConnect(self.session.nav.RecordTimer.isRecording)
+               self["BlinkingPoint"].deprecationInfo = (
+                       "session.RecordState source, Pixmap renderer and "
+                       "ConditionalShowHide/Blink Converter", "2008-02")
 #########################
 
        def stopCurrentRecording(self, entry = -1):
@@ -1663,9 +1666,21 @@ class InfoBarAdditionalInfo:
 
 ######### DEPRECATED CODE ##########
                self["NimA"] = Pixmap()
+               self["NimA"].deprecationInfo = (
+                       "session.TunerInfo source, Pixmap renderer, TunerInfo/UseMask Converter"
+                       ", ValueBitTest(1) Converter and ConditionalShowHide Converter", "2008-02")
                self["NimB"] = Pixmap()
+               self["NimB"].deprecationInfo = (
+                       "session.TunerInfo source, Pixmap renderer, TunerInfo/UseMask Converter"
+                       ", ValueBitTest(2) Converter and ConditionalShowHide Converter", "2008-02")
                self["NimA_Active"] = Pixmap()
+               self["NimA_Active"].deprecationInfo = (
+                       "session.FrontendInfo source, Pixmap renderer, FrontendInfo/NUMBER Converter"
+                       ", ValueRange(1,1) Converter and ConditionalShowHide Converter", "2008-02")
                self["NimB_Active"] = Pixmap()
+               self["NimB_Active"].deprecationInfo = (
+                       "session.FrontendInfo source, Pixmap renderer, FrontendInfo/NUMBER Converter"
+                       ", ValueRange(1,1) Converter and ConditionalShowHide Converter", "2008-02")
 
                res_mgr = eDVBResourceManager.getInstance()
                if res_mgr:
@@ -1915,8 +1930,7 @@ class InfoBarSummary(Screen):
                <widget source="global.CurrentTime" render="Label" position="62,46" size="82,18" font="Regular;16" >
                        <convert type="ClockToText">WithSeconds</convert>
                </widget>
-               <widget source="session.GlobalInfo" render="FixedLabel" text=" " position="62,46" size="82,18" zPosition="1" >
-                       <convert type="Misc">RecordRunning</convert>
+               <widget source="session.RecordState" render="FixedLabel" text=" " position="62,46" size="82,18" zPosition="1" >
                        <convert type="ConditionalShowHide">Blink</convert>
                </widget>
                <widget source="session.CurrentService" render="Label" position="6,4" size="120,42" font="Regular;18" >
@@ -1948,8 +1962,7 @@ class InfoBarMoviePlayerSummary(Screen):
                <widget source="global.CurrentTime" render="Label" position="62,46" size="64,18" font="Regular;16" halign="right" >
                        <convert type="ClockToText">WithSeconds</convert>
                </widget>
-               <widget source="session.GlobalInfo" render="FixedLabel" text=" " position="62,46" size="64,18" zPosition="1" >
-                       <convert type="Misc">RecordRunning</convert>
+               <widget source="session.RecordState" render="FixedLabel" text=" " position="62,46" size="64,18" zPosition="1" >
                        <convert type="ConditionalShowHide">Blink</convert>
                </widget>
                <widget source="session.CurrentService" render="Label" position="6,4" size="120,42" font="Regular;18" >
index df884ba970c5b5fc05c4c491b7d5f0afb479ceef..3eadf3329050a4c9d0fc465d8e91c0299f7ed566 100644 (file)
@@ -5,7 +5,8 @@ from Components.Sources.EventInfo import EventInfo
 from Components.Sources.FrontendStatus import FrontendStatus
 from Components.Sources.FrontendInfo import FrontendInfo
 from Components.Sources.Source import Source
-from Components.Sources.Misc import Misc
+from Components.Sources.TunerInfo import TunerInfo
+from Components.Sources.RecordState import RecordState
 
 class SessionGlobals(Screen):
        def __init__(self, session):
@@ -16,7 +17,8 @@ class SessionGlobals(Screen):
                self["FrontendStatus"] = FrontendStatus(service_source = session.nav.getCurrentService)
                self["FrontendInfo"] = FrontendInfo(service_source = session.nav.getCurrentService)
                self["VideoPicture"] = Source()
-               self["GlobalInfo"] = Misc(session)
+               self["TunerInfo"] = TunerInfo()
+               self["RecordState"] = RecordState(session)
                session.nav.event.append(self.serviceEvent)
                self.service_state = 0
 
index 86b7ca038f481f3de65721902c524023ac4b21ea..ab3e413a2a0bc32645efce788553220411892606 100644 (file)
@@ -75,8 +75,7 @@ class StandbySummary(Screen):
                <widget source="global.CurrentTime" render="Label" position="0,0" size="132,64" font="Regular;40" halign="center">
                        <convert type="ClockToText" />
                </widget>
-               <widget source="session.GlobalInfo" render="FixedLabel" text=" " position="0,0" size="132,64" zPosition="1" >
-                       <convert type="Global">RecordRunning</convert>
+               <widget source="session.RecordState" render="FixedLabel" text=" " position="0,0" size="132,64" zPosition="1" >
                        <convert type="ConditionalShowHide">Blink</convert>
                </widget>
        </screen>"""