from Screens.Screen import Screen
from Plugins.Plugin import PluginDescriptor
-
-from enigma import eTimer
-
-from Components.ActionMap import ActionMap
-from Components.Label import Label
-from Components.Pixmap import Pixmap
-from Screens.MessageBox import MessageBox
-from Screens.Setup import SetupSummary
+from Components.SystemInfo import SystemInfo
from Components.ConfigList import ConfigListScreen
-from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, ConfigSubDict
-from VideoWizard import VideoWizard
-from Components.config import config
-
-from Tools.CList import CList
+from Components.config import getConfigListEntry, config, ConfigBoolean
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.list = [ ]
ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry)
+ from Components.ActionMap import ActionMap
self["actions"] = ActionMap(["SetupActions"],
{
"cancel": self.keyCancel,
"save": self.apply,
}, -2)
- self["title"] = Label(_("Video-Setup"))
+ 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.hw.on_hotplug.remove(self.createSetup)
def createSetup(self):
+ level = config.usage.setup_level.index
+
self.list = [ ]
- self.list.append(getConfigListEntry(_("Output Type"), config.av.videoport))
+ self.list.append(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(_("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:
+ mode = None
+ else:
+ mode = config.av.videomode[port].value
+
+ # some modes (720p, 1080i) are always widescreen. Don't let the user select something here, "auto" is not what he wants.
+ force_wide = self.hw.isWidescreenMode(port, mode)
+
+ 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))
+ elif config.av.aspect.value == "4_3":
+ self.list.append(getConfigListEntry(_("Display 16:9 content as"), config.av.policy_169))
+
+# if config.av.videoport.value == "DVI":
+# self.list.append(getConfigListEntry(_("Allow Unsupported Modes"), config.av.edid_override))
+ if config.av.videoport.value == "Scart":
+ self.list.append(getConfigListEntry(_("Color Format"), config.av.colorformat))
+ if level >= 1:
+ self.list.append(getConfigListEntry(_("WSS on 4:3"), config.av.wss))
+ if SystemInfo["ScartSwitch"]:
+ self.list.append(getConfigListEntry(_("Auto scart switching"), config.av.vcrswitch))
+
+ if level >= 1:
+ self.list.append(getConfigListEntry(_("AC3 default"), config.av.defaultac3))
+ if SystemInfo["CanDownmixAC3"]:
+ self.list.append(getConfigListEntry(_("AC3 downmix"), config.av.downmix_ac3))
self["config"].list = self.list
self["config"].l.setList(self.list)
port = config.av.videoport.value
mode = config.av.videomode[port].value
rate = config.av.videorate[mode].value
- if (port, mode, rate) != self.last_good or True:
+ if (port, mode, rate) != self.last_good:
self.hw.setMode(port, mode, rate)
- self.session.openWithCallback(self.confirm, MessageBox, "Is this videomode ok?", MessageBox.TYPE_YESNO, timeout = 5, default = False)
+ from Screens.MessageBox import MessageBox
+ self.session.openWithCallback(self.confirm, MessageBox, "Is this videomode ok?", MessageBox.TYPE_YESNO, timeout = 20, default = False)
else:
self.keySave()
return str(self["config"].getCurrent()[1].getText())
def createSummary(self):
+ from Screens.Setup import SetupSummary
return SetupSummary
-#class VideomodeHotplug:
-# def __init__(self, hw):
-# self.hw = hw
-# self.hw.on_hotplug.append(self.hotplug)
-#
-# def hotplug(self, what):
-# print "hotplug detected on port '%s'" % (what)
-# ...
-#
-#hotplug = None
-#
-#def startHotplug(self):
-# global hotplug
-# hotplug = VideomodeHotplug()
-# hotplug.start()
-#
-#def stopHotplug(self):
-# global hotplug
-# hotplug.stop()
-#
-#
-#def autostart(reason, session = None, **kwargs):
-# if session is not None:
-# global my_global_session
-# my_global_session = session
-# return
-#
-# if reason == 0:
-# startHotplug()
-# elif reason == 1:
-# stopHotplug()
+class VideomodeHotplug:
+ def __init__(self, hw):
+ self.hw = hw
+
+ def start(self):
+ self.hw.on_hotplug.append(self.hotplug)
+
+ def stop(self):
+ self.hw.on_hotplug.remove(self.hotplug)
+
+ def hotplug(self, what):
+ print "hotplug detected on port '%s'" % (what)
+ port = config.av.videoport.value
+ mode = config.av.videomode[port].value
+ rate = config.av.videorate[mode].value
+
+ if not self.hw.isModeAvailable(port, mode, rate):
+ print "mode %s/%s/%s went away!" % (port, mode, rate)
+ modelist = self.hw.getModeList(port)
+ if not len(modelist):
+ print "sorry, no other mode is available (unplug?). Doing nothing."
+ return
+ mode = modelist[0][0]
+ rate = modelist[0][1]
+ print "setting %s/%s/%s" % (port, mode, rate)
+ self.hw.setMode(port, mode, rate)
+
+hotplug = None
+
+def startHotplug():
+ global hotplug, video_hw
+ hotplug = VideomodeHotplug(video_hw)
+ hotplug.start()
+
+def stopHotplug():
+ global hotplug
+ hotplug.stop()
+
+
+def autostart(reason, session = None, **kwargs):
+ if session is not None:
+ global my_global_session
+ my_global_session = session
+ return
+
+ if reason == 0:
+ startHotplug()
+ elif reason == 1:
+ stopHotplug()
def videoSetupMain(session, **kwargs):
session.open(VideoSetup, video_hw)
if menuid != "system":
return [ ]
- return [(_("Video Setup"), videoSetupMain, "video_setup", None)]
+ return [(_("A/V Settings") + "...", videoSetupMain, "av_setup", 40)]
+
+def VideoWizard(*args, **kwargs):
+ from VideoWizard import VideoWizard
+ return VideoWizard(*args, **kwargs)
def Plugins(**kwargs):
- list = []
- list.append(PluginDescriptor(name=_("Video Setup"), description=_("Advanced Video Setup"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup))
- if config.misc.firstrun.value:
- list.append(PluginDescriptor(name=_("Video Wizard"), where = PluginDescriptor.WHERE_WIZARD, fnc=VideoWizard))
+ list = [
+# 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.videowizardenabled.value:
+ list.append(PluginDescriptor(name=_("Video Wizard"), where = PluginDescriptor.WHERE_WIZARD, fnc=(0, VideoWizard)))
return list