make menu text translatable
[enigma2.git] / lib / python / Plugins / SystemPlugins / VideoTune / VideoFinetune.py
index 7b64588e36f5aef96f4b402fc80fe941cd161651..d27e84f953cd141f6c8eb49c78e85cc863e25cfa 100644 (file)
@@ -2,7 +2,7 @@ from Screens.Screen import Screen
 from Components.Sources.CanvasSource import CanvasSource
 from Components.ActionMap import ActionMap
 from enigma import gFont
-from enigma import RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP
+from enigma import RT_HALIGN_RIGHT, RT_WRAP
 
 def RGB(r,g,b):
        return (r<<16)|(g<<8)|b
@@ -23,10 +23,10 @@ class VideoFinetune(Screen):
                {
                        "1": self.testpic_brightness,
                        "2": self.testpic_contrast,
-                       "3": self.testpic_colors,
-                       "4": self.testpic_filter,
-                       "5": self.testpic_gamma,
-                       "6": self.testpic_fubk,
+#                      "3": self.testpic_colors,
+                       "3": self.testpic_filter,
+                       "4": self.testpic_gamma,
+                       "5": self.testpic_fubk,
                        "ok": self.callNext,
                        "cancel": self.close,
                })
@@ -52,21 +52,21 @@ class VideoFinetune(Screen):
                bbw, bbh = xres / 192, yres / 192
                c.fill(0, 0, xres, yres, RGB(0,0,0))
 
+#              for i in range(8):
+#                      col = (7-i) * 255 / 7
+#                      width = xres - xres/5
+#                      ew = width / 15
+#                      offset = xres/10 + ew * i
+#                      y = yres * 2 / 3
+#                      height = yres / 6
+#
+#                      c.fill(offset, y, ew, height, RGB(col, col, col))
+#
+#                      if col == 0 or col == 16 or col == 116:
+#                              self.bbox(offset, y, ew, height, RGB(255,255,255), bbw, bbh)
+
                for i in range(15):
                        col = i * 116 / 14
-                       width = xres - xres/5
-                       ew = width / 15
-                       offset = xres/10 + ew * i
-                       y = yres * 2 / 3
-                       height = yres / 6
-
-                       c.fill(offset, y, ew, height, RGB(col, col, col))
-
-                       if col == 0 or col == 16 or col == 116:
-                               self.bbox(offset, y, ew, height, RGB(255,255,255), bbw, bbh)
-
-               for i in range(8):
-                       col = (7-i) * 255 / 7
                        height = yres / 3
                        eh = height / 8
                        offset = yres/6 + eh * i
@@ -74,24 +74,29 @@ class VideoFinetune(Screen):
                        width = yres / 6
 
                        c.fill(x, offset, width, eh, RGB(col, col, col))
-                       if col == 0 or col == 36:
-                               self.bbox(x, offset, width, eh, RGB(255,255,255), bbw, bbh)
+                       if col == 0 or col == 16 or col == 116:
+                               c.fill(x, offset, width, 2, RGB(255, 255, 255))
+#                      if col == 0 or col == 36:
+#                              self.bbox(x, offset, width, eh, RGB(255,255,255), bbw, bbh)
+                       if i < 2:
+                               c.writeText(x + width, offset, width, eh, RGB(255, 255, 255), RGB(0,0,0), gFont("Regular", 20), "%d." % (i+1))
 
                c.writeText(xres / 10, yres / 6 - 40, xres * 3 / 5, 40, RGB(128,255,255), RGB(0,0,0), gFont("Regular", 40), 
                        _("Brightness"))
                c.writeText(xres / 10, yres / 6, xres * 4 / 7, yres / 6, RGB(255,255,255), RGB(0,0,0), gFont("Regular", 20),
-                       ("If your TV has a brightness or contrast enhancement, disable it. If there is something called \"dynamic\", "
-                               "set it to standard. Adjust the backlight level to your favourite value. "
-                               "Turn down contrast on your TV as much as possible.\nThen turn the brightness setting as"
-                               "low as possible, but make sure that the two lowermost shades of gray are still distinguishable.\n"
-                               "Do not care for the bright shades now, they will be set up in the next step.\n"
+                       _("If your TV has a brightness or contrast enhancement, disable it. If there is something called \"dynamic\", "
+                               "set it to standard. Adjust the backlight level to a value suiting your taste. "
+                               "Turn down contrast on your TV as much as possible.\nThen turn the brightness setting as "
+                               "low as possible, but make sure that the two lowermost shades of gray stay distinguishable.\n"
+                               "Do not care about the bright shades now. They will be set up in the next step.\n"
                                "If you are happy with the result, press OK."),
                                RT_WRAP)
 
                c.flush()
 
        def testpic_contrast(self):
-               self.next = self.testpic_colors
+#              self.next = self.testpic_colors
+               self.next = self.close
 
                c = self["Canvas"]
 
@@ -104,21 +109,22 @@ class VideoFinetune(Screen):
                bbh = yres / 192
                c.fill(0, 0, xres, yres, RGB(255,255,255))
 
+#              for i in range(15):
+#                      col = 185 + i * 5
+#                      width = xres - xres/5
+#                      ew = width / 15
+#                      offset = xres/10 + ew * i
+#                      y = yres * 2 / 3
+#                      height = yres / 6
+#
+#                      c.fill(offset, y, ew, height, RGB(col, col, col))
+#
+#                      if col == 185 or col == 235 or col == 255:
+#                              self.bbox(offset, y, ew, height, RGB(0,0,0), bbw, bbh)
+
                for i in range(15):
+#                      col = (7-i) * 255 / 7
                        col = 185 + i * 5
-                       width = xres - xres/5
-                       ew = width / 15
-                       offset = xres/10 + ew * i
-                       y = yres * 2 / 3
-                       height = yres / 6
-
-                       c.fill(offset, y, ew, height, RGB(col, col, col))
-
-                       if col == 185 or col == 235 or col == 255:
-                               self.bbox(offset, y, ew, height, RGB(0,0,0), bbw, bbh)
-
-               for i in range(8):
-                       col = (7-i) * 255 / 7
                        height = yres / 3
                        eh = height / 8
                        offset = yres/6 + eh * i
@@ -126,16 +132,20 @@ class VideoFinetune(Screen):
                        width = yres / 6
 
                        c.fill(x, offset, width, eh, RGB(col, col, col))
-                       if col == 0 or col == 36:
-                               self.bbox(x, offset, width, eh, RGB(255,255,255), bbw, bbh);
-                       if col == 255:
-                               self.bbox(x, offset, width, eh, RGB(0,0,0), bbw, bbh);
+#                      if col == 0 or col == 36:
+#                              self.bbox(x, offset, width, eh, RGB(255,255,255), bbw, bbh);
+#                      if col == 255:
+#                              self.bbox(x, offset, width, eh, RGB(0,0,0), bbw, bbh);
+                       if col == 185 or col == 235 or col == 255:
+                               c.fill(x, offset, width, 2, RGB(0,0,0)) 
+                       if i >= 13:
+                               c.writeText(x + width, offset, width, eh, RGB(0, 0, 0), RGB(255, 255, 255), gFont("Regular", 20), "%d." % (i-13+1))
 
                c.writeText(xres / 10, yres / 6 - 40, xres * 3 / 5, 40, RGB(128,0,0), RGB(255,255,255), gFont("Regular", 40), 
                        _("Contrast"))
                c.writeText(xres / 10, yres / 6, xres / 2, yres / 6, RGB(0,0,0), RGB(255,255,255), gFont("Regular", 20),
-                       ("Now, use the contrast setting to turn up the brightness of the background as much as possible, "
-                               "but make sure that you can still see the difference between the two brightest level of shades."
+                       _("Now, use the contrast setting to turn up the brightness of the background as much as possible, "
+                               "but make sure that you can still see the difference between the two brightest levels of shades."
                                "If you have done that, press OK."),
                                RT_WRAP)
 
@@ -192,8 +202,8 @@ class VideoFinetune(Screen):
                c.writeText(xres / 10, yres / 6 - 40, xres * 3 / 5, 40, RGB(128,0,0), RGB(255,255,255), gFont("Regular", 40), 
                        ("Color"))
                c.writeText(xres / 10, yres / 6, xres / 2, yres / 6, RGB(0,0,0), RGB(255,255,255), gFont("Regular", 20),
-                       ("Adjust the color settings so that all the color shades are distinguishable, but appear as saturated as possible. "
-                               "If you are happy with the result, press OK to close the video finetuning, or use the number keys to select other test screens."),
+                       _("Adjust the color settings so that all the color shades are distinguishable, but appear as saturated as possible. "
+                               "If you are happy with the result, press OK to close the video fine-tuning, or use the number keys to select other test screens."),
                                RT_WRAP)
 
                c.flush()
@@ -247,14 +257,17 @@ class VideoFinetune(Screen):
                        c.fill(offset_x, offset_y + y, width/2, 2, RGB(255,255,255))
 
                l = 0
+               fnt = gFont("Regular", height / 14)
                import math
-               for i in xrange(1, 14):
+               for i in xrange(1, 15):
                        y = i * height / 14
                        h = y - l
-                       l = y
                        gamma = 0.6 + i * 0.2
                        col = int(math.pow(.5, 1.0/gamma) * 256.0)
-                       c.fill(offset_x + width/2, offset_y + y, width/2, h, RGB(col,col,col))
+                       c.fill(offset_x + width/2, offset_y + l, width/2, h, RGB(col,col,col))
+
+                       c.writeText(offset_x + width/2, offset_y + l, width/2, h, RGB(0,0,0), RGB(col,col,col), fnt, "%1.2f" % gamma, RT_WRAP|RT_HALIGN_RIGHT)
+                       l = y
 
                c.flush()