7b5ae8c20d64bfd2d07a767e5d324d6338676a80
[openblackhole/openblackhole-enigma2.git] / lib / python / Plugins / SystemPlugins / SatelliteEquipmentControl / plugin.py
1 from Screens.Screen import Screen
2 from Screens.MessageBox import MessageBox
3 from Plugins.Plugin import PluginDescriptor
4
5 from Components.ConfigList import ConfigListScreen
6 from Components.ActionMap import ActionMap
7 from Components.config import config
8 from Components.NimManager import nimmanager as nimmgr
9
10 class SecParameterSetup(Screen, ConfigListScreen):
11         skin = """
12                 <screen position="100,100" size="560,400" title="Satellite equipment setup" >
13                         <widget name="config" position="10,10" size="540,390" />
14                 </screen>"""
15         def __init__(self, session):
16                 self.skin = SecParameterSetup.skin
17
18                 self.setTitle(_("Satellite equipment setup"))
19
20                 self["actions"] = ActionMap(["SetupActions", "MenuActions"],
21                 {
22                         "ok": self.keySave,
23                         "cancel": self.keyCancel,
24                         "menu": self.closeRecursive,
25                 }, -2)
26
27                 Screen.__init__(self, session)
28                 list = [
29                         (_("Delay after diseqc reset command"), config.sec.delay_after_diseqc_reset_cmd),
30                         (_("Delay after diseqc peripherial poweron command"), config.sec.delay_after_diseqc_peripherial_poweron_cmd),
31                         (_("Delay after continuous tone disable before diseqc"), config.sec.delay_after_continuous_tone_disable_before_diseqc),
32                         (_("Delay after final continuous tone change"), config.sec.delay_after_final_continuous_tone_change),
33                         (_("Delay after last voltage change"), config.sec.delay_after_final_voltage_change),
34                         (_("Delay between diseqc commands"), config.sec.delay_between_diseqc_repeats),
35                         (_("Delay after last diseqc command"), config.sec.delay_after_last_diseqc_command),
36                         (_("Delay after toneburst"), config.sec.delay_after_toneburst),
37                         (_("Delay after change voltage before switch command"), config.sec.delay_after_change_voltage_before_switch_command),
38                         (_("Delay after enable voltage before switch command"), config.sec.delay_after_enable_voltage_before_switch_command),
39                         (_("Delay between switch and motor command"), config.sec.delay_between_switch_and_motor_command),
40                         (_("Delay after set voltage before measure motor power"), config.sec.delay_after_voltage_change_before_measure_idle_inputpower),
41                         (_("Delay after enable voltage before motor command"), config.sec.delay_after_enable_voltage_before_motor_command),
42                         (_("Delay after motor stop command"), config.sec.delay_after_motor_stop_command),
43                         (_("Delay after voltage change before motor command"), config.sec.delay_after_voltage_change_before_motor_command),
44                         (_("Delay before sequence repeat"), config.sec.delay_before_sequence_repeat),
45                         (_("Motor running timeout"), config.sec.motor_running_timeout),
46                         (_("Motor command retries"), config.sec.motor_command_retries) ]
47                 ConfigListScreen.__init__(self, list)
48
49 session = None
50
51 def confirmed(answer):
52         global session
53         if answer:
54                 session.open(SecParameterSetup)
55
56 def SecSetupMain(Session, **kwargs):
57         global session
58         session = Session
59         session.openWithCallback(confirmed, MessageBox, _("Please do not change any values unless you know what you are doing!"), MessageBox.TYPE_INFO)
60
61 def SecSetupStart(menuid):
62         show = False
63
64         # other menu than "scan"?
65         if menuid != "scan":
66                 return [ ]
67
68         # only show if DVB-S frontends are available
69         for slot in nimmgr.nim_slots:
70                 if slot.isCompatible("DVB-S"):
71                         return [(_("Satellite equipment setup"), SecSetupMain, "satellite_equipment_setup", None)]
72
73         return [ ]
74
75 def Plugins(**kwargs):
76         if (nimmgr.hasNimType("DVB-S")):
77                 return PluginDescriptor(name=_("Satellite equipment setup"), description=_("Setup your satellite equipment"), where = PluginDescriptor.WHERE_MENU, needsRestart = False, fnc=SecSetupStart)
78         else:
79                 return []