fix
[enigma2.git] / lib / python / Components / UsageConfig.py
1 from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigInteger
2 from enigma import Misc_Options, setTunerTypePriorityOrder;
3 from SystemInfo import SystemInfo
4 import os
5
6 def InitUsageConfig():
7         config.usage = ConfigSubsection();
8         config.usage.showdish = ConfigYesNo(default = False)
9         config.usage.multibouquet = ConfigYesNo(default = False)
10         config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
11         config.usage.e1like_radio_mode = ConfigYesNo(default = False)
12         config.usage.infobar_timeout = ConfigSelection(default = "5", choices = [
13                 ("0", _("no timeout")), ("1", "1 " + _("second")), ("2", "2 " + _("seconds")), ("3", "3 " + _("seconds")),
14                 ("4", "4 " + _("seconds")), ("5", "5 " + _("seconds")), ("6", "6 " + _("seconds")), ("7", "7 " + _("seconds")),
15                 ("8", "8 " + _("seconds")), ("9", "9 " + _("seconds")), ("10", "10 " + _("seconds"))])
16         config.usage.show_infobar_on_zap = ConfigYesNo(default = True)
17         config.usage.show_infobar_on_skip = ConfigYesNo(default = True)
18         config.usage.show_infobar_on_event_change = ConfigYesNo(default = True)
19         config.usage.hdd_standby = ConfigSelection(default = "120", choices = [
20                 ("0", _("no standby")), ("2", "10 " + _("seconds")), ("6", "30 " + _("seconds")),
21                 ("12", "1 " + _("minute")), ("24", "2 " + _("minutes")),
22                 ("60", "5 " + _("minutes")), ("120", "10 " + _("minutes")), ("240", "20 " + _("minutes")),
23                 ("241", "30 " + _("minutes")), ("242", "1 " + _("hour")), ("244", "2 " + _("hours")),
24                 ("248", "4 " + _("hours")) ])
25         config.usage.output_12V = ConfigSelection(default = "do not change", choices = [
26                 ("do not change", _("do not change")), ("off", _("off")), ("on", _("on")) ])
27         config.usage.self_defined_seek = ConfigInteger(default=10, limits=(1,9999))
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.setup_level = ConfigSelection(default = "intermediate", choices = [
34                 ("simple", _("Simple")),
35                 ("intermediate", _("Intermediate")),
36                 ("expert", _("Expert")) ])
37
38         config.usage.on_long_powerpress = ConfigSelection(default = "show_menu", choices = [
39                 ("show_menu", _("show shutdown menu")),
40                 ("shutdown", _("immediate shutdown")) ] )
41
42         config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [
43                 ("0", "DVB-S/-C/-T"),
44                 ("1", "DVB-S/-T/-C"),
45                 ("2", "DVB-C/-S/-T"),
46                 ("3", "DVB-C/-T/-S"),
47                 ("4", "DVB-T/-C/-S"),
48                 ("5", "DVB-T/-S/-C") ])
49
50         config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False)
51
52         def TunerTypePriorityOrderChanged(configElement):
53                 setTunerTypePriorityOrder(int(configElement.value))
54         config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged)
55
56         def setHDDStandby(configElement):
57                 os.system("hdparm -S" + configElement.value + " /dev/ide/host0/bus0/target0/lun0/disc")
58         config.usage.hdd_standby.addNotifier(setHDDStandby)
59
60         def set12VOutput(configElement):
61                 if configElement.value == "on":
62                         Misc_Options.getInstance().set_12V_output(1)
63                 elif configElement.value == "off":
64                         Misc_Options.getInstance().set_12V_output(0)
65         config.usage.output_12V.addNotifier(set12VOutput)
66
67         SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
68
69         config.usage.keymap = ConfigText(default = "/usr/share/enigma2/keymap.xml")