Alter behavior of the zero button in PiP mode. The exact behavior may be
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 13 Aug 2007 17:02:00 +0000 (17:02 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 13 Aug 2007 17:02:00 +0000 (17:02 +0000)
configured by changing the value of the 'Behaviour of 0 key in PiP-mode'
property  in the settings menu. Possible values are:

- standard
  the behavior of the zero button is remains as is (switch to last channel)
- swap
  the zero button swaps the pip service with the active
- swap and stop
  the zero button swaps the pip service with the active and then turns
  pip off
- stop
  turns pip off

Patch by John Holland <johnbock@i-have-a-dreambox.com>, with some
modifications.

data/setup.xml
lib/python/Components/UsageConfig.py
lib/python/Screens/InfoBarGenerics.py

index aca8040..408927f 100644 (file)
@@ -29,6 +29,7 @@
                        <item text="Show infobar on skip forward/backward">config.usage.show_infobar_on_skip</item>
                        <item text="Show infobar on event change">config.usage.show_infobar_on_event_change</item>
                        <item text="Custom skip time for 1/3 keys">config.usage.self_defined_seek</item>
+                       <item text="Behaviour of 0 key in PiP-mode">config.usage.pip_zero_button</item>
                </setup>
                <setup key="harddisk" title="Harddisk setup">
                        <item text="Harddisk standby after">config.usage.hdd_standby</item>
index 507696f..d122a4f 100644 (file)
@@ -25,6 +25,10 @@ def InitUsageConfig():
                ("do not change", _("do not change")), ("off", _("off")), ("on", _("on")) ])
        config.usage.self_defined_seek = ConfigInteger(default=10, limits=(1,9999))
 
+       config.usage.pip_zero_button = ConfigSelection(default = "standard", choices = [
+               ("standard", _("standard")), ("swap", _("swap PiP and main picture")),
+               ("swapstop", _("move PiP to main picture")), ("stop", _("stop PiP")) ])
+
        def setHDDStandby(configElement):
                os.system("hdparm -S" + configElement.value + " /dev/ide/host0/bus0/target0/lun0/disc")
        config.usage.hdd_standby.addNotifier(setHDDStandby)
index 85b1d80..fd2e0e9 100644 (file)
@@ -198,7 +198,10 @@ class InfoBarNumberZap:
        def keyNumberGlobal(self, number):
 #              print "You pressed number " + str(number)
                if number == 0:
-                       self.servicelist.recallPrevService()
+                       if isinstance(self, InfoBarPiP) and self.pipHandles0Action():
+                               self.pipDoHandle0Action()
+                       else:
+                               self.servicelist.recallPrevService()
                else:
                        self.session.openWithCallback(self.numberEntered, NumberZap, number)
 
@@ -1234,6 +1237,9 @@ class InfoBarPiP:
        def pipShown(self):
                return self.session.pipshown
 
+       def pipHandles0Action(self):
+               return self.pipShown() and config.usage.pip_zero_button.value != "standard"
+
        def getShowHideName(self):
                if self.session.pipshown:
                        return _("Disable Picture in Picture")
@@ -1278,6 +1284,16 @@ class InfoBarPiP:
        def movePiP(self):
                self.session.open(PiPSetup, pip = self.session.pip)
 
+       def pipDoHandle0Action(self):
+               use = config.usage.pip_zero_button.value
+               if "swap" == use:
+                       self.swapPiP()
+               elif "swapstop" == use:
+                       self.swapPiP()
+                       self.showPiP()
+               elif "stop" == use:
+                       self.showPiP()
+
 from RecordTimer import parseEvent
 
 class InfoBarInstantRecord: