NIM cleanup, as described in https://lists.elitedvb.net/pipermail/enigma2-devel/2007...
[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 continuous tone change", config.sec.delay_after_continuous_tone_change),
27                         ("Delay after last voltage change", config.sec.delay_after_final_voltage_change),
28                         ("Delay between diseqc commands", config.sec.delay_between_diseqc_repeats),
29                         ("Delay after last diseqc command", config.sec.delay_after_last_diseqc_command),
30                         ("Delay after toneburst", config.sec.delay_after_toneburst),
31                         ("Delay after enable voltage before switch command", config.sec.delay_after_enable_voltage_before_switch_command),
32                         ("Delay between switch and motor command", config.sec.delay_between_switch_and_motor_command),
33                         ("Delay after set voltage before measure motor power", config.sec.delay_after_voltage_change_before_measure_idle_inputpower),
34                         ("Delay after enable voltage before motor command", config.sec.delay_after_enable_voltage_before_motor_command),
35                         ("Delay after motor stop command", config.sec.delay_after_motor_stop_command),
36                         ("Delay after voltage change before motor command", config.sec.delay_after_voltage_change_before_motor_command),
37                         ("Motor running timeout", config.sec.motor_running_timeout),
38                         ("Motor command retries", config.sec.motor_command_retries) ]
39                 ConfigListScreen.__init__(self, list)
40
41 session = None
42
43 def confirmed(answer):
44         global session
45         if answer:
46                 session.open(SecParameterSetup)
47
48 def SecSetupMain(Session, **kwargs):
49         global session
50         session = Session
51         session.openWithCallback(confirmed, MessageBox, _("Please do not change values when you not know what you do!"), MessageBox.TYPE_INFO)
52
53 def SecSetupStart(menuid):
54         show = False
55         
56         # other menu than "scan"?
57         if menuid != "scan": 
58                 return [ ]
59
60         # only show if DVB-S frontends are available
61         for slot in nimmgr.nim_slots:
62                 if slot.isCompatible("DVB-S"):
63                         return [(_("Satellite Equipment Setup"), SecSetupMain)]
64
65         return [ ]
66
67 def Plugins(**kwargs):
68         return PluginDescriptor(name=_("Satellite Equipment Setup"), description="Setup your satellite equipment", where = PluginDescriptor.WHERE_SETUP, fnc=SecSetupStart)