drop plugin-local translations (in favor of the global ones in /po)
[enigma2-plugins.git] / audiosync / src / AC3setup.py
1 from AC3utils import PLUGIN_BASE, PLUGIN_VERSION
2 from Components.ActionMap import NumberActionMap
3 from Components.Button import Button
4 from Components.ConfigList import ConfigListScreen
5 from Components.Label import Label
6 from Components.config import config, getConfigListEntry
7 from Screens.Screen import Screen
8
9 class AC3LipSyncSetup(ConfigListScreen, Screen):
10     skin = """
11     <screen position="center,center" size="560,400" title="AC3 Lip Sync Setup">
12       <ePixmap pixmap="~/img/button-red.png" position="0,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
13       <ePixmap pixmap="~/img/button-green.png" position="140,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
14       <ePixmap pixmap="~/img/button-yellow.png" position="280,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
15       <ePixmap pixmap="~/img/button-blue.png" position="420,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
16       <widget name="key_red" position="0,0" zPosition="1" size="140,40"
17         font="Regular;20" valign="center" halign="center" backgroundColor="#9f1313" transparent="1"
18         shadowColor="#000000" shadowOffset="-1,-1" />
19       <widget name="key_green" position="140,0" zPosition="1" size="140,40"
20         font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1"
21         shadowColor="#000000" shadowOffset="-1,-1" />
22       <widget name="key_yellow" position="280,0" zPosition="1" size="140,40"
23         font="Regular;20" valign="center" halign="center" backgroundColor="#a08500" transparent="1"
24         shadowColor="#000000" shadowOffset="-1,-1" />
25       <widget name="key_blue" position="420,0" zPosition="1" size="140,40"
26         font="Regular;20" valign="center" halign="center" backgroundColor="#18188b" transparent="1"
27         shadowColor="#000000" shadowOffset="-1,-1" />
28       <widget name="config" position="10,40" size="540,320" scrollbarMode="showOnDemand" />
29       <widget name="PluginInfo" position="10,370" size="540,20" zPosition="4" font="Regular;18" foregroundColor="#cccccc" />
30     </screen>"""
31
32     def __init__(self, session, plugin_path):
33         Screen.__init__(self, session)
34
35         # Lets get a list of elements for the config list
36         self.list = [
37             getConfigListEntry(_("Outer Bound (+/-)"), config.plugins.AC3LipSync.outerBounds),
38             getConfigListEntry(_("Step in ms for arrow keys"), config.plugins.AC3LipSync.arrowStepSize),
39             getConfigListEntry(_("Wait time in ms before activation:"), config.plugins.AC3LipSync.activationDelay),
40             getConfigListEntry(_("Step in ms for keys '%s'") % ("1/3"), config.plugins.AC3LipSync.stepSize13),
41             getConfigListEntry(_("Step in ms for keys '%s'") % ("4/6"), config.plugins.AC3LipSync.stepSize46),
42             getConfigListEntry(_("Step in ms for keys '%s'") % ("7/9"), config.plugins.AC3LipSync.stepSize79),
43             getConfigListEntry(_("Step in ms for key %i") % (2), config.plugins.AC3LipSync.absoluteStep2),
44             getConfigListEntry(_("Step in ms for key %i") % (5), config.plugins.AC3LipSync.absoluteStep5),
45             getConfigListEntry(_("Step in ms for key %i") % (8), config.plugins.AC3LipSync.absoluteStep8)
46         ]
47         
48         ConfigListScreen.__init__(self, self.list)
49
50         self["config"].list = self.list
51
52         self.skin_path = plugin_path
53
54         # Plugin Information
55         self["PluginInfo"] = Label(_("Plugin: %(plugin)s , Version: %(version)s") %dict(plugin=PLUGIN_BASE,version=PLUGIN_VERSION))
56
57         # BUTTONS
58         self["key_red"] = Button(_("Cancel"))
59         self["key_green"] = Button(_("Save"))
60         self["key_yellow"] = Button(_(" "))
61         self["key_blue"] = Button(" ")
62
63         self["setupActions"] = NumberActionMap(["SetupActions", "ColorActions"],
64         {
65             "save": self.save,
66             "cancel": self.cancel,
67             "green": self.save,
68             "red": self.cancel,
69             "ok": self.save,
70         }, -2)
71
72     def save(self):
73         for x in self.list:
74             x[1].save()
75         self.close()
76
77     def cancel(self):
78         for x in self["config"].list:
79             x[1].cancel()
80         self.close()