ec223d3e22ffc1ea8622446f7fd9c5b75dca918b
[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["actions"] = ActionMap(["SetupActions"],
19                 {
20                         "ok": self.keySave,
21                         "cancel": self.keyCancel,
22                 }, -2)
23
24                 Screen.__init__(self, session)
25                 list = [
26                         ("Delay after diseqc reset command", config.sec.delay_after_diseqc_reset_cmd),
27                         ("Delay after diseqc peripherial poweron command", config.sec.delay_after_diseqc_peripherial_poweron_cmd),
28                         ("Delay after continuous tone change", config.sec.delay_after_continuous_tone_change),
29                         ("Delay after last voltage change", config.sec.delay_after_final_voltage_change),
30                         ("Delay between diseqc commands", config.sec.delay_between_diseqc_repeats),
31                         ("Delay after last diseqc command", config.sec.delay_after_last_diseqc_command),
32                         ("Delay after toneburst", config.sec.delay_after_toneburst),
33                         ("Delay after change voltage before switch command", config.sec.delay_after_change_voltage_before_switch_command),
34                         ("Delay after enable voltage before switch command", config.sec.delay_after_enable_voltage_before_switch_command),
35                         ("Delay between switch and motor command", config.sec.delay_between_switch_and_motor_command),
36                         ("Delay after set voltage before measure motor power", config.sec.delay_after_voltage_change_before_measure_idle_inputpower),
37                         ("Delay after enable voltage before motor command", config.sec.delay_after_enable_voltage_before_motor_command),
38                         ("Delay after motor stop command", config.sec.delay_after_motor_stop_command),
39                         ("Delay after voltage change before motor command", config.sec.delay_after_voltage_change_before_motor_command),
40                         ("Delay before sequence repeat", config.sec.delay_before_sequence_repeat),
41                         ("Motor running timeout", config.sec.motor_running_timeout),
42                         ("Motor command retries", config.sec.motor_command_retries) ]
43                 ConfigListScreen.__init__(self, list)
44
45 session = None
46
47 def confirmed(answer):
48         global session
49         if answer:
50                 session.open(SecParameterSetup)
51
52 def SecSetupMain(Session, **kwargs):
53         global session
54         session = Session
55         session.openWithCallback(confirmed, MessageBox, _("Please do not change any values unless you know what you are doing!"), MessageBox.TYPE_INFO)
56
57 def SecSetupStart(menuid):
58         show = False
59         
60         # other menu than "scan"?
61         if menuid != "scan": 
62                 return [ ]
63
64         # only show if DVB-S frontends are available
65         for slot in nimmgr.nim_slots:
66                 if slot.isCompatible("DVB-S"):
67                         return [(_("Satellite Equipment Setup"), SecSetupMain, "satellite_equipment_setup", None)]
68
69         return [ ]
70
71 def Plugins(**kwargs):
72         if (nimmgr.hasNimType("DVB-S")):
73                 return PluginDescriptor(name=_("Satellite Equipment Setup"), description="Setup your satellite equipment", where = PluginDescriptor.WHERE_MENU, fnc=SecSetupStart)
74         else:
75                 return []