Wizard shouldn't be a subclass of HelpableScreen since there is no help
[enigma2.git] / lib / python / Components / UsageConfig.py
1 from Components.Harddisk import harddiskmanager
2 from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet
3 from enigma import Misc_Options, setTunerTypePriorityOrder;
4 from SystemInfo import SystemInfo
5 import os
6
7 def InitUsageConfig():
8         config.usage = ConfigSubsection();
9         config.usage.showdish = ConfigYesNo(default = False)
10         config.usage.multibouquet = ConfigYesNo(default = False)
11         config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
12         config.usage.e1like_radio_mode = ConfigYesNo(default = False)
13         config.usage.infobar_timeout = ConfigSelection(default = "5", choices = [
14                 ("0", _("no timeout")), ("1", "1 " + _("second")), ("2", "2 " + _("seconds")), ("3", "3 " + _("seconds")),
15                 ("4", "4 " + _("seconds")), ("5", "5 " + _("seconds")), ("6", "6 " + _("seconds")), ("7", "7 " + _("seconds")),
16                 ("8", "8 " + _("seconds")), ("9", "9 " + _("seconds")), ("10", "10 " + _("seconds"))])
17         config.usage.show_infobar_on_zap = ConfigYesNo(default = True)
18         config.usage.show_infobar_on_skip = ConfigYesNo(default = True)
19         config.usage.show_infobar_on_event_change = ConfigYesNo(default = True)
20         config.usage.hdd_standby = ConfigSelection(default = "120", choices = [
21                 ("0", _("no standby")), ("2", "10 " + _("seconds")), ("6", "30 " + _("seconds")),
22                 ("12", "1 " + _("minute")), ("24", "2 " + _("minutes")),
23                 ("60", "5 " + _("minutes")), ("120", "10 " + _("minutes")), ("240", "20 " + _("minutes")),
24                 ("241", "30 " + _("minutes")), ("242", "1 " + _("hour")), ("244", "2 " + _("hours")),
25                 ("248", "4 " + _("hours")) ])
26         config.usage.output_12V = ConfigSelection(default = "do not change", choices = [
27                 ("do not change", _("do not change")), ("off", _("off")), ("on", _("on")) ])
28
29         config.usage.pip_zero_button = ConfigSelection(default = "standard", choices = [
30                 ("standard", _("standard")), ("swap", _("swap PiP and main picture")),
31                 ("swapstop", _("move PiP to main picture")), ("stop", _("stop PiP")) ])
32
33         config.usage.on_movie_start = ConfigSelection(default = "ask", choices = [
34                 ("ask", _("Ask user")), ("resume", _("Resume from last position")), ("beginning", _("Start from the beginning")) ])
35         config.usage.on_movie_stop = ConfigSelection(default = "ask", choices = [
36                 ("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")) ])
37         config.usage.on_movie_eof = ConfigSelection(default = "ask", choices = [
38                 ("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")), ("pause", _("Pause movie at end")) ])
39
40         config.usage.setup_level = ConfigSelection(default = "intermediate", choices = [
41                 ("simple", _("Simple")),
42                 ("intermediate", _("Intermediate")),
43                 ("expert", _("Expert")) ])
44
45         config.usage.on_long_powerpress = ConfigSelection(default = "show_menu", choices = [
46                 ("show_menu", _("show shutdown menu")),
47                 ("shutdown", _("immediate shutdown")) ] )
48
49         config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [
50                 ("0", "DVB-S/-C/-T"),
51                 ("1", "DVB-S/-T/-C"),
52                 ("2", "DVB-C/-S/-T"),
53                 ("3", "DVB-C/-T/-S"),
54                 ("4", "DVB-T/-C/-S"),
55                 ("5", "DVB-T/-S/-C") ])
56
57         config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False)
58         config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(default = True)
59         
60         def TunerTypePriorityOrderChanged(configElement):
61                 setTunerTypePriorityOrder(int(configElement.value))
62         config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged)
63
64         def setHDDStandby(configElement):
65                 for hdd in harddiskmanager.HDDList():
66                         os.system("hdparm -S%s %s" % (configElement.value, hdd[1].getDeviceName()))
67         config.usage.hdd_standby.addNotifier(setHDDStandby)
68
69         def set12VOutput(configElement):
70                 if configElement.value == "on":
71                         Misc_Options.getInstance().set_12V_output(1)
72                 elif configElement.value == "off":
73                         Misc_Options.getInstance().set_12V_output(0)
74         config.usage.output_12V.addNotifier(set12VOutput)
75
76         SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
77
78         config.usage.keymap = ConfigText(default = "/usr/share/enigma2/keymap.xml")
79
80         config.seek = ConfigSubsection()
81         config.seek.selfdefined_13 = ConfigNumber(default=15)
82         config.seek.selfdefined_46 = ConfigNumber(default=60)
83         config.seek.selfdefined_79 = ConfigNumber(default=300)
84
85         config.seek.speeds_forward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
86         config.seek.speeds_backward = ConfigSet(default=[8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
87         config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8], choices=[2, 4, 6, 8, 12, 16, 25])
88
89         config.seek.enter_forward = ConfigSelection(default = "2", choices = ["2"])
90         config.seek.enter_backward = ConfigSelection(default = "2", choices = ["2"])
91         config.seek.stepwise_minspeed = ConfigSelection(default = "16", choices = ["Never", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
92         config.seek.stepwise_repeat = ConfigSelection(default = "3", choices = ["2", "3", "4", "5", "6"])
93
94         config.seek.on_pause = ConfigSelection(default = "play", choices = [
95                 ("play", _("Play")),
96                 ("step", _("Singlestep (GOP)")),
97                 ("last", _("Last speed")) ])
98
99         def updateEnterForward(configElement):
100                 if not configElement.value:
101                         configElement.value = [2]
102                 updateChoices(config.seek.enter_forward, configElement.value)
103
104         config.seek.speeds_forward.addNotifier(updateEnterForward)
105
106         def updateEnterBackward(configElement):
107                 if not configElement.value:
108                         configElement.value = [2]
109                 updateChoices(config.seek.enter_backward, configElement.value)
110
111         config.seek.speeds_backward.addNotifier(updateEnterBackward)
112
113 def updateChoices(sel, choices):
114         if choices:
115                 defval = None
116                 val = int(sel.value)
117                 if not val in choices:
118                         tmp = choices+[]
119                         tmp.reverse()
120                         for x in tmp:
121                                 if x < val:
122                                         defval = str(x)
123                                         break
124                 sel.setChoices(map(str, choices), defval)