X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fpython%2FPlugins%2FSystemPlugins%2FVideomode%2FVideoWizard.py;h=18e817645639fb6e041ee1f67e69a60494647949;hb=75f57338d1db813a290d55a617498f9b8cb6f578;hp=5524dfce92bdac9d86a03197dec16b88271f8e06;hpb=6874d42b68d15fa07542bc536535539997d9ba68;p=vuplus_dvbapp diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py old mode 100644 new mode 100755 index 5524dfc..18e8176 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -1,58 +1,101 @@ -from Screens.Wizard import Wizard, wizardManager -import sys +from Screens.Wizard import WizardSummary +from Screens.WizardLanguage import WizardLanguage +from Screens.Rc import Rc from VideoHardware import video_hw -from Components.Pixmap import Pixmap, MovingPixmap +from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap from Components.config import config, ConfigBoolean, configfile +from Tools.Directories import resolveFilename, SCOPE_PLUGINS +from Tools.HardwareInfo import HardwareInfo + config.misc.showtestcard = ConfigBoolean(default = False) -class VideoWizard(Wizard): +class VideoWizardSummary(WizardSummary): + skin = ( + """ + + + + + + """, + """ + + + + + + """) + #% (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/lcd_Scart.png")) + + def __init__(self, session, parent): + WizardSummary.__init__(self, session, parent) + #self["pic"] = Pixmap() + + def setLCDPicCallback(self): + self.parent.setLCDTextCallback(self.setText) + + def setLCDPic(self, file): + self["pic"].instance.setPixmapFromFile(file) + +class VideoWizard(WizardLanguage, Rc): skin = """ - + - - - - - - - - """ + + + + + + + + + + + """ % (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/Scart.png")) def __init__(self, session): # FIXME anyone knows how to use relative paths from the plugin's directory? - self.xmlfile = sys.path[0] + "/Plugins/SystemPlugins/Videomode/videowizard.xml" + self.xmlfile = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/videowizard.xml") self.hw = video_hw - Wizard.__init__(self, session, showSteps = False) + WizardLanguage.__init__(self, session, showSteps = False, showStepSlider = False) + Rc.__init__(self) self["wizard"] = Pixmap() - self["rc"] = MovingPixmap() - self["arrowdown"] = MovingPixmap() - self["arrowup"] = MovingPixmap() - self["arrowup2"] = MovingPixmap() + self["portpic"] = Pixmap() self.port = None self.mode = None + self.rate = None def createSummary(self): print "++++++++++++***++**** VideoWizard-createSummary" from Screens.Wizard import WizardSummary - return WizardSummary + return VideoWizardSummary def markDone(self): - pass + config.misc.videowizardenabled.value = 0 + config.misc.videowizardenabled.save() + configfile.save() def listInputChannels(self): + hw_type = HardwareInfo().get_device_name() list = [] for port in self.hw.getPortList(): if self.hw.isPortUsed(port): - list.append((port, port)) + descr = port + if descr == 'DVI' and hw_type in ('dm500hd', 'dm800se', 'dm7020hd'): + descr = 'HDMI' + if port != "DVI-PC": + list.append((descr,port)) + list.sort(key = lambda x: x[0]) + print "listInputChannels:", list return list def inputSelectionMade(self, index): @@ -63,19 +106,28 @@ class VideoWizard(Wizard): def inputSelectionMoved(self): print "input selection moved:", self.selection self.inputSelect(self.selection) + if self["portpic"].instance is not None: + picname = self.selection + if picname == "DVI" and HardwareInfo().get_device_name() in ("dm500hd", "dm800se", "dm7020hd"): + picname = "HDMI" + self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + picname + ".png")) def inputSelect(self, port): print "inputSelect:", port modeList = self.hw.getModeList(self.selection) print "modeList:", modeList - self.hw.setMode(port = port, mode = modeList[0][0], rate = modeList[0][1][0]) + self.port = port + if (len(modeList) > 0): + ratesList = self.listRates(modeList[0][0]) + self.hw.setMode(port = port, mode = modeList[0][0], rate = ratesList[0][0]) def listModes(self): list = [] print "modes for port", self.port for mode in self.hw.getModeList(self.port): - if mode[0] != "PC": + #if mode[0] != "PC": list.append((mode[0], mode[0])) + print "modeslist:", list return list def modeSelectionMade(self, index): @@ -90,8 +142,12 @@ class VideoWizard(Wizard): def modeSelect(self, mode): ratesList = self.listRates(mode) print "ratesList:", ratesList - self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0]) - + if self.port == "DVI" and mode in ("720p", "1080i"): + self.rate = "multi" + self.hw.setMode(port = self.port, mode = mode, rate = "multi") + else: + self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0]) + def listRates(self, querymode = None): if querymode is None: querymode = self.mode @@ -101,11 +157,17 @@ class VideoWizard(Wizard): print mode if mode[0] == querymode: for rate in mode[1]: + if self.port == "DVI-PC": + print "rate:", rate + if rate == "640x480": + list.insert(0, (rate, rate)) + continue list.append((rate, rate)) return list def rateSelectionMade(self, index): print "rateSelectionMade:", index + self.rate = index self.rateSelect(index) def rateSelectionMoved(self): @@ -123,3 +185,16 @@ class VideoWizard(Wizard): config.misc.showtestcard.value = True else: config.misc.showtestcard.value = False + + def keyNumberGlobal(self, number): + if number in (1,2,3): + if number == 1: + self.hw.saveMode("DVI", "720p", "multi") + elif number == 2: + self.hw.saveMode("DVI", "1080i", "multi") + elif number == 3: + self.hw.saveMode("Scart", "Multi", "multi") + self.hw.setConfiguredMode() + self.close() + + WizardLanguage.keyNumberGlobal(self, number)