add "divx" as known file extension
[enigma2.git] / lib / python / Plugins / SystemPlugins / Videomode / VideoWizard.py
index 18b20f6ed79764e739f53b38c9f620a534015b87..1d7ce7b56eff8aa4d35ecf97ccae8fa3e78eb1a5 100644 (file)
@@ -1,14 +1,12 @@
-from Screens.Wizard import wizardManager, WizardSummary
+from Screens.Wizard import WizardSummary
 from Screens.WizardLanguage import WizardLanguage
-import sys
+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, SCOPE_SKIN_IMAGE
-from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
-from Tools.LoadPixmap import LoadPixmap
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS
 
 config.misc.showtestcard = ConfigBoolean(default = False)
 
@@ -32,22 +30,23 @@ class VideoWizardSummary(WizardSummary):
        def setLCDPic(self, file):
                self["pic"].instance.setPixmapFromFile(file)
 
-class VideoWizard(WizardLanguage):
+class VideoWizard(WizardLanguage, Rc):
        skin = """
                <screen position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder" >
                        <widget name="text" position="153,50" size="340,270" font="Regular;23" />
                        <widget source="list" render="Listbox" position="200,300" size="290,200" scrollbarMode="showOnDemand" >
                                <convert type="StringList" />
                        </widget>
-                       <widget name="config" position="50,300" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />                    
-                       <widget name="wizard" pixmap="wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
-                       <ePixmap pixmap="skin_default/button_red.png" position="40,225" zPosition="0" size="15,16" transparent="1" alphatest="on" />
+                       <widget name="config" position="50,300" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />
+                       <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
+                       <ePixmap pixmap="skin_default/buttons/button_red.png" position="40,225" zPosition="0" size="15,16" transparent="1" alphatest="on" />
                        <widget name="languagetext" position="55,225" size="95,30" font="Regular;18" />
                        <widget name="portpic" pixmap="%s" position="50,300" zPosition="10" size="150,150" transparent="1" alphatest="on"/>
-                       <widget name="rc" pixmap="rc.png" position="500,600" zPosition="10" size="154,475" transparent="1" alphatest="on"/>
-                       <widget name="arrowdown" pixmap="arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
-                       <widget name="arrowup" pixmap="arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
-                       <widget name="arrowup2" pixmap="arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
+                       <widget name="rc" pixmaps="skin_default/rc.png,skin_default/rcold.png" position="500,50" zPosition="10" size="154,500" transparent="1" alphatest="on"/>
+                       <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
+                       <widget name="arrowdown2" pixmap="skin_default/arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
+                       <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
+                       <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
                </screen>""" % (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/Scart.png"))
        
        def __init__(self, session):
@@ -56,12 +55,9 @@ class VideoWizard(WizardLanguage):
                self.hw = video_hw
                
                WizardLanguage.__init__(self, session, showSteps = False, showStepSlider = False)
+               Rc.__init__(self)
                self["wizard"] = Pixmap()
-               self["rc"] = MovingPixmap()
                self["portpic"] = Pixmap()
-               self["arrowdown"] = MovingPixmap()
-               self["arrowup"] = MovingPixmap()
-               self["arrowup2"] = MovingPixmap()
                
                self.port = None
                self.mode = None
@@ -74,7 +70,9 @@ class VideoWizard(WizardLanguage):
                return VideoWizardSummary
                
        def markDone(self):
-               pass
+               config.misc.videowizardenabled.value = 0
+               config.misc.videowizardenabled.save()
+               configfile.save()
        
        def listInputChannels(self):
                list = []
@@ -101,13 +99,15 @@ class VideoWizard(WizardLanguage):
                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
+               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
@@ -135,6 +135,11 @@ class VideoWizard(WizardLanguage):
                        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
        
@@ -158,3 +163,16 @@ class VideoWizard(WizardLanguage):
                        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)