fix save current selected video mode
[enigma2.git] / lib / python / Plugins / SystemPlugins / Videomode / VideoHardware.py
index b9b5dca8661a678f4056b38029c1c88f7752272b..2422475eaa0ba7997ac292b3bcb99b20441d8565 100644 (file)
@@ -1,15 +1,5 @@
-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.ConfigList import ConfigListScreen
-from Components.config import getConfigListEntry, config, ConfigSelection, ConfigSubDict, ConfigYesNo
+from Components.config import config, ConfigSelection, ConfigSubDict, ConfigYesNo
 
 from Tools.CList import CList
 
@@ -22,36 +12,49 @@ class VideoHardware:
 
        modes = { }  # a list of (high-level) modes for a certain port.
 
-       rates["PAL"] =                  { "50Hz":               { 50: "pal", 60: "pal"},
-                                                                                               "60Hz":         { 50: "pal60", 60: "pal60"},
-                                                                                               "multi":        { 50: "pal", 60: "pal60"} }
-       rates["NTSC"] =                 { "60Hz":       { 50: "ntsc", 60: "ntsc"} }
-       rates["Multi"] =                { "multi":      { 50: "pal", 60: "ntsc"} }
-       rates["720p"] =                 {       "50Hz":         { 50: "720p50", 60: "720p50"},
-                                                                                               "60Hz":         { 50: "720p", 60: "720p"},
-                                                                                               "multi":        { 50: "720p50", 60: "720p"} }
-       rates["1080i"] =                { "50Hz":               { 50: "1080i50", 60: "1080i50"},
-                                                                                               "60Hz":         { 50: "1080i", 60: "1080i"},
-                                                                                               "multi":        { 50: "1080i50", 60: "1080i"} }
+       rates["PAL"] =                  { "50Hz":               { 50: "pal" },
+                                                               "60Hz":         { 60: "pal60" },
+                                                               "multi":        { 50: "pal", 60: "pal60" } }
+
+       rates["NTSC"] =                 { "60Hz":       { 60: "ntsc" } }
+
+       rates["Multi"] =                { "multi":      { 50: "pal", 60: "ntsc" } }
+
+       rates["480i"] =                 { "60Hz":       { 60: "480i" } }
+
+       rates["576i"] =                 { "50Hz":       { 50: "576i" } }
+
+       rates["480p"] =                 { "60Hz":       { 60: "480p" } }
+
+       rates["576p"] =                 { "50Hz":       { 50: "576p" } }
+
+       rates["720p"] =                 { "50Hz":       { 50: "720p50" },
+                                                               "60Hz":         { 60: "720p" },
+                                                               "multi":        { 50: "720p50", 60: "720p" } }
+
+       rates["1080i"] =                { "50Hz":               { 50: "1080i50" },
+                                                               "60Hz":         { 60: "1080i" },
+                                                               "multi":        { 50: "1080i50", 60: "1080i" } }
+
        rates["PC"] = { 
-               "1024x768": { 60: "1024x768"}, # not possible on DM7025
-               "800x600" : { 60: "800x600"},  # also not possible
-               "720x480" : { 60: "720x480"},
-               "720x576" : { 60: "720x576"},
-               "1280x720": { 60: "1280x720"},
-               "1280x720 multi": { 50: "1280x720_50", 60: "1280x720"},
+               "1024x768": { 60: "1024x768" }, # not possible on DM7025
+               "800x600" : { 60: "800x600" },  # also not possible
+               "720x480" : { 60: "720x480" },
+               "720x576" : { 60: "720x576" },
+               "1280x720": { 60: "1280x720" },
+               "1280x720 multi": { 50: "1280x720_50", 60: "1280x720" },
                "1920x1080": { 60: "1920x1080"},
-               "1920x1080 multi": { 50: "1920x1080", 60: "1920x1080_50"},
+               "1920x1080 multi": { 50: "1920x1080", 60: "1920x1080_50" },
                "1280x1024" : { 60: "1280x1024"},
                "1366x768" : { 60: "1366x768"},
-               "1366x768 multi" : { 50: "1366x768", 60: "1366x768_50"},
-               "1280x768": { 60: "1280x768"},
-               "640x480" : { 60: "640x480"}
+               "1366x768 multi" : { 50: "1366x768", 60: "1366x768_50" },
+               "1280x768": { 60: "1280x768" },
+               "640x480" : { 60: "640x480" }
        }
 
        modes["Scart"] = ["PAL", "NTSC", "Multi"]
-       modes["YPbPr"] = ["720p", "1080i"]
-       modes["DVI"] = ["720p", "1080i", "PC"]
+       modes["YPbPr"] = ["720p", "1080i", "576p", "480p", "576i", "480i"]
+       modes["DVI"] = ["720p", "1080i", "576p", "480p", "576i", "480i"]
        modes["DVI-PC"] = ["PC"]
 
        widescreen_modes = set(["720p", "1080i"])
@@ -146,17 +149,6 @@ class VideoHardware:
                if mode_60 is None or force == 50: 
                        mode_60 = mode_50
 
-               dvimode = (mode_50.find('x') != -1 or mode_60.find('x') != -1) and '1' or '0'
-               try:
-                       open("/etc/dvimode", "w").write(dvimode) # use 50Hz mode (if available) for booting
-               except IOError:
-                       print "writing initial dvimode to /etc/dvimode failed."
-
-               try:
-                       open("/proc/stb/hdmi/enable_hdmi_reset", "w").write(dvimode)
-               except IOError:
-                       print "setting dvimode failed."
-
                try:
                        open("/proc/stb/video/videomode_50hz", "w").write(mode_50)
                        open("/proc/stb/video/videomode_60hz", "w").write(mode_60)
@@ -175,6 +167,7 @@ class VideoHardware:
                self.updateAspect(None)
 
        def saveMode(self, port, mode, rate):
+               print "saveMode", port, mode, rate
                config.av.videoport.value = port
                config.av.videoport.save()
                config.av.videomode[port].value = mode