don't crash when video modes are broken
[enigma2.git] / lib / python / Plugins / SystemPlugins / Videomode / VideoWizard.py
index 8f8bea095cc95dc7c4e1612b2a6bbaaa3eb6f2ab..3759c21af13e4f66bde3e1c2af8fffc1cf31144a 100644 (file)
@@ -7,6 +7,7 @@ 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)
 
@@ -75,11 +76,15 @@ class VideoWizard(WizardLanguage, Rc):
                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 == 'dm500hd':
+                                       descr = 'HDMI'
+                               list.append((descr,port))
                list.sort(key = lambda x: x[0])
                print "listInputChannels:", list
                return list
@@ -100,8 +105,9 @@ class VideoWizard(WizardLanguage, Rc):
                modeList = self.hw.getModeList(self.selection)
                print "modeList:", modeList
                self.port = port
-               ratesList = self.listRates(modeList[0][0])
-               self.hw.setMode(port = port, mode = modeList[0][0], rate = ratesList[0][0])
+               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 = []