Merge commit 'origin/translations' into experimental
[enigma2.git] / lib / python / Plugins / SystemPlugins / Videomode / plugin.py
old mode 100644 (file)
new mode 100755 (executable)
index 031d2c1..733edd6
@@ -2,16 +2,20 @@ from Screens.Screen import Screen
 from Plugins.Plugin import PluginDescriptor
 from Components.SystemInfo import SystemInfo
 from Components.ConfigList import ConfigListScreen
-from Components.config import getConfigListEntry, config
-from Components.config import config
+from Components.config import getConfigListEntry, config, ConfigBoolean, ConfigNothing, ConfigSlider
+from Components.Sources.StaticText import StaticText
 
 from VideoHardware import video_hw
 
+config.misc.videowizardenabled = ConfigBoolean(default = True)
+
 class VideoSetup(Screen, ConfigListScreen):
+
        def __init__(self, session, hw):
                Screen.__init__(self, session)
-               self.skinName = "Setup"
-               self.setup_title = "Videomode Setup"
+               # for the skin: first try VideoSetup, then Setup, this allows individual skinning
+               self.skinName = ["VideoSetup", "Setup" ]
+               self.setup_title = _("A/V Settings")
                self.hw = hw
                self.onChangedEntry = [ ]
 
@@ -29,18 +33,15 @@ class VideoSetup(Screen, ConfigListScreen):
                                "save": self.apply,
                        }, -2)
 
-               from Components.Label import Label
-               self["title"] = Label(_("A/V Settings"))
-
-               self["oktext"] = Label(_("OK"))
-               self["canceltext"] = Label(_("Cancel"))
-
-               from Components.Pixmap import Pixmap
-               self["ok"] = Pixmap()
-               self["cancel"] = Pixmap()
+               self["key_red"] = StaticText(_("Cancel"))
+               self["key_green"] = StaticText(_("OK"))
 
                self.createSetup()
                self.grabLastGoodMode()
+               self.onLayoutFinish.append(self.layoutFinished)
+
+       def layoutFinished(self):
+               self.setTitle(self.setup_title)
 
        def startHotplug(self):
                self.hw.on_hotplug.append(self.createSetup)
@@ -51,14 +52,18 @@ class VideoSetup(Screen, ConfigListScreen):
        def createSetup(self):
                level = config.usage.setup_level.index
 
-               self.list = [ ]
-               self.list.append(getConfigListEntry(_("Video Output"), config.av.videoport))
+               self.list = [
+                       getConfigListEntry(_("Video Output"), config.av.videoport)
+               ]
 
                # if we have modes for this port:
                if config.av.videoport.value in config.av.videomode:
                        # add mode- and rate-selection:
                        self.list.append(getConfigListEntry(_("Mode"), config.av.videomode[config.av.videoport.value]))
-                       self.list.append(getConfigListEntry(_("Refresh Rate"), config.av.videorate[config.av.videomode[config.av.videoport.value].value]))
+                       if config.av.videomode[config.av.videoport.value].value == 'PC':
+                               self.list.append(getConfigListEntry(_("Resolution"), config.av.videorate[config.av.videomode[config.av.videoport.value].value]))
+                       else:
+                               self.list.append(getConfigListEntry(_("Refresh Rate"), config.av.videorate[config.av.videomode[config.av.videoport.value].value]))
 
                port = config.av.videoport.value
                if port not in config.av.videomode:
@@ -72,8 +77,11 @@ class VideoSetup(Screen, ConfigListScreen):
                if not force_wide:
                        self.list.append(getConfigListEntry(_("Aspect Ratio"), config.av.aspect))
 
-               if force_wide or config.av.aspect.value in ["16_9", "16_10"]:
-                       self.list.append(getConfigListEntry(_("Display 4:3 content as"), config.av.policy_43))
+               if force_wide or config.av.aspect.value in ("16_9", "16_10"):
+                       self.list.extend((
+                               getConfigListEntry(_("Display 4:3 content as"), config.av.policy_43),
+                               getConfigListEntry(_("Display >16:9 content as"), config.av.policy_169)
+                       ))
                elif config.av.aspect.value == "4_3":
                        self.list.append(getConfigListEntry(_("Display 16:9 content as"), config.av.policy_169))
 
@@ -90,6 +98,16 @@ class VideoSetup(Screen, ConfigListScreen):
                        self.list.append(getConfigListEntry(_("AC3 default"), config.av.defaultac3))
                        if SystemInfo["CanDownmixAC3"]:
                                self.list.append(getConfigListEntry(_("AC3 downmix"), config.av.downmix_ac3))
+                       self.list.extend((
+                               getConfigListEntry(_("General AC3 Delay"), config.av.generalAC3delay),
+                               getConfigListEntry(_("General PCM Delay"), config.av.generalPCMdelay)
+                       ))
+
+               if SystemInfo["CanChangeOsdAlpha"]:
+                       self.list.append(getConfigListEntry(_("OSD visibility"), config.av.osd_alpha))
+
+               if not isinstance(config.av.scaler_sharpness, ConfigNothing):
+                       self.list.append(getConfigListEntry(_("Scaler sharpness"), config.av.scaler_sharpness))
 
                self["config"].list = self.list
                self["config"].l.setList(self.list)
@@ -104,6 +122,9 @@ class VideoSetup(Screen, ConfigListScreen):
 
        def confirm(self, confirmed):
                if not confirmed:
+                       config.av.videoport.value = self.last_good[0]
+                       config.av.videomode[self.last_good[0]].value = self.last_good[1]
+                       config.av.videorate[self.last_good[1]].value = self.last_good[2]
                        self.hw.setMode(*self.last_good)
                else:
                        self.keySave()
@@ -121,7 +142,7 @@ class VideoSetup(Screen, ConfigListScreen):
                if (port, mode, rate) != self.last_good:
                        self.hw.setMode(port, mode, rate)
                        from Screens.MessageBox import MessageBox
-                       self.session.openWithCallback(self.confirm, MessageBox, "Is this videomode ok?", MessageBox.TYPE_YESNO, timeout = 20, default = False)
+                       self.session.openWithCallback(self.confirm, MessageBox, _("Is this videomode ok?"), MessageBox.TYPE_YESNO, timeout = 20, default = False)
                else:
                        self.keySave()
 
@@ -208,6 +229,6 @@ def Plugins(**kwargs):
 #              PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART, PluginDescriptor.WHERE_AUTOSTART], fnc = autostart),
                PluginDescriptor(name=_("Video Setup"), description=_("Advanced Video Setup"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup) 
        ]
-       if config.misc.firstrun.value:
+       if config.misc.videowizardenabled.value:
                list.append(PluginDescriptor(name=_("Video Wizard"), where = PluginDescriptor.WHERE_WIZARD, fnc=(0, VideoWizard)))
-       return list
+       return list