restore video mode to prev valid mode, when change to another mode was not
[vuplus_dvbapp] / lib / python / Plugins / SystemPlugins / Videomode / plugin.py
index 115e81f..b51cc08 100644 (file)
@@ -59,7 +59,10 @@ class VideoSetup(Screen, ConfigListScreen):
                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(_("Refresh 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:
@@ -105,6 +108,9 @@ class VideoSetup(Screen, ConfigListScreen):
 
        def confirm(self, confirmed):
                if not confirmed:
+                       config.av.videoport.value = self.last_good[0]
+                       config.av.videomode[self.last_good[0]].value = self.last_good[1]
+                       config.av.videorate[self.last_good[1]].value = self.last_good[2]
                        self.hw.setMode(*self.last_good)
                else:
                        self.keySave()
@@ -118,8 +124,11 @@ class VideoSetup(Screen, ConfigListScreen):
        def apply(self):
                port = config.av.videoport.value
                mode = config.av.videomode[port].value
-               rate = config.av.videorate[mode].value
+               rate =config.av.videorate[mode].value
                if (port, mode, rate) != self.last_good:
+                       config.av.videoport.value = self.last_good[0]
+                       config.av.videomode[port].value = self.last_good[1]
+                       config.av.videorate[mode].value = self.last_good[2]
                        self.hw.setMode(port, mode, rate)
                        from Screens.MessageBox import MessageBox
                        self.session.openWithCallback(self.confirm, MessageBox, "Is this videomode ok?", MessageBox.TYPE_YESNO, timeout = 20, default = False)