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