1 from Components.Harddisk import harddiskmanager
2 from Components.NimManager import nimmanager
3 from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations
4 from Tools.Directories import resolveFilename, SCOPE_HDD
5 from enigma import Misc_Options, eEnv
6 from enigma import setTunerTypePriorityOrder, setPreferredTuner
7 from SystemInfo import SystemInfo
10 def InitUsageConfig():
11 config.usage = ConfigSubsection();
12 config.usage.showdish = ConfigYesNo(default = True)
13 config.usage.multibouquet = ConfigYesNo(default = False)
14 config.usage.multiepg_ask_bouquet = ConfigYesNo(default = False)
16 config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
17 config.usage.e1like_radio_mode = ConfigYesNo(default = False)
18 config.usage.infobar_timeout = ConfigSelection(default = "5", choices = [
19 ("0", _("no timeout")), ("1", "1 " + _("second")), ("2", "2 " + _("seconds")), ("3", "3 " + _("seconds")),
20 ("4", "4 " + _("seconds")), ("5", "5 " + _("seconds")), ("6", "6 " + _("seconds")), ("7", "7 " + _("seconds")),
21 ("8", "8 " + _("seconds")), ("9", "9 " + _("seconds")), ("10", "10 " + _("seconds"))])
22 config.usage.show_infobar_on_zap = ConfigYesNo(default = True)
23 config.usage.show_infobar_on_skip = ConfigYesNo(default = True)
24 config.usage.show_infobar_on_event_change = ConfigYesNo(default = True)
25 config.usage.hdd_standby = ConfigSelection(default = "600", choices = [
26 ("0", _("no standby")), ("10", "10 " + _("seconds")), ("30", "30 " + _("seconds")),
27 ("60", "1 " + _("minute")), ("120", "2 " + _("minutes")),
28 ("300", "5 " + _("minutes")), ("600", "10 " + _("minutes")), ("1200", "20 " + _("minutes")),
29 ("1800", "30 " + _("minutes")), ("3600", "1 " + _("hour")), ("7200", "2 " + _("hours")),
30 ("14400", "4 " + _("hours")) ])
31 config.usage.output_12V = ConfigSelection(default = "do not change", choices = [
32 ("do not change", _("do not change")), ("off", _("off")), ("on", _("on")) ])
34 config.usage.pip_zero_button = ConfigSelection(default = "standard", choices = [
35 ("standard", _("standard")), ("swap", _("swap PiP and main picture")),
36 ("swapstop", _("move PiP to main picture")), ("stop", _("stop PiP")) ])
38 config.usage.default_path = ConfigText(default = resolveFilename(SCOPE_HDD))
39 config.usage.timer_path = ConfigText(default = "<default>")
40 config.usage.instantrec_path = ConfigText(default = "<default>")
41 config.usage.timeshift_path = ConfigText(default = "/media/hdd/")
42 config.usage.allowed_timeshift_paths = ConfigLocations(default = ["/media/hdd/"])
44 config.usage.on_movie_start = ConfigSelection(default = "ask", choices = [
45 ("ask", _("Ask user")), ("resume", _("Resume from last position")), ("beginning", _("Start from the beginning")) ])
46 config.usage.on_movie_stop = ConfigSelection(default = "ask", choices = [
47 ("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")) ])
48 config.usage.on_movie_eof = ConfigSelection(default = "ask", choices = [
49 ("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")), ("pause", _("Pause movie at end")) ])
51 config.usage.setup_level = ConfigSelection(default = "intermediate", choices = [
52 ("simple", _("Simple")),
53 ("intermediate", _("Intermediate")),
54 ("expert", _("Expert")) ])
56 config.usage.on_long_powerpress = ConfigSelection(default = "show_menu", choices = [
57 ("show_menu", _("show shutdown menu")),
58 ("shutdown", _("immediate shutdown")),
59 ("standby", _("Standby")) ] )
61 config.usage.on_short_powerpress = ConfigSelection(default = "standby", choices = [
62 ("show_menu", _("show shutdown menu")),
63 ("shutdown", _("immediate shutdown")),
64 ("standby", _("Standby")) ] )
67 config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [
73 ("5", "DVB-T/-S/-C") ])
75 nims = [ ("-1", _("auto")) ]
76 for x in nimmanager.nim_slots:
77 nims.append( (str(x.slot), x.getSlotName()) )
78 config.usage.frontend_priority = ConfigSelection(default = "-1", choices = nims)
80 config.usage.show_event_progress_in_servicelist = ConfigYesNo(default = False)
82 config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False)
84 config.usage.show_message_when_recording_starts = ConfigYesNo(default = True)
86 config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(default = True)
88 def TunerTypePriorityOrderChanged(configElement):
89 setTunerTypePriorityOrder(int(configElement.value))
90 config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged, immediate_feedback=False)
92 def PreferredTunerChanged(configElement):
93 setPreferredTuner(int(configElement.value))
94 config.usage.frontend_priority.addNotifier(PreferredTunerChanged)
96 def setHDDStandby(configElement):
97 for hdd in harddiskmanager.HDDList():
98 hdd[1].setIdleTime(int(configElement.value))
99 config.usage.hdd_standby.addNotifier(setHDDStandby, immediate_feedback=False)
101 def set12VOutput(configElement):
102 if configElement.value == "on":
103 Misc_Options.getInstance().set_12V_output(1)
104 elif configElement.value == "off":
105 Misc_Options.getInstance().set_12V_output(0)
106 config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)
108 SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
110 config.usage.keymap = ConfigText(default = eEnv.resolve("${datadir}/enigma2/keymap.xml"))
112 config.seek = ConfigSubsection()
113 config.seek.selfdefined_13 = ConfigNumber(default=15)
114 config.seek.selfdefined_46 = ConfigNumber(default=60)
115 config.seek.selfdefined_79 = ConfigNumber(default=300)
117 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])
118 config.seek.speeds_backward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
119 config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8], choices=[2, 4, 6, 8, 12, 16, 25])
121 config.seek.enter_forward = ConfigSelection(default = "2", choices = ["2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
122 config.seek.enter_backward = ConfigSelection(default = "1", choices = ["1", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
124 config.seek.on_pause = ConfigSelection(default = "play", choices = [
126 ("step", _("Singlestep (GOP)")),
127 ("last", _("Last speed")) ])
129 config.usage.timerlist_finished_timer_position = ConfigSelection(default = "beginning", choices = [("beginning", _("at beginning")), ("end", _("at end"))])
131 def updateEnterForward(configElement):
132 if not configElement.value:
133 configElement.value = [2]
134 updateChoices(config.seek.enter_forward, configElement.value)
136 config.seek.speeds_forward.addNotifier(updateEnterForward, immediate_feedback = False)
138 def updateEnterBackward(configElement):
139 if not configElement.value:
140 configElement.value = [2]
141 updateChoices(config.seek.enter_backward, configElement.value)
143 config.seek.speeds_backward.addNotifier(updateEnterBackward, immediate_feedback = False)
145 def updateChoices(sel, choices):
149 if not val in choices:
156 sel.setChoices(map(str, choices), defval)
158 def preferredPath(path):
159 if config.usage.setup_level.index < 2 or path == "<default>":
160 return None # config.usage.default_path.value, but delay lookup until usage
161 elif path == "<current>":
162 return config.movielist.last_videodir.value
163 elif path == "<timer>":
164 return config.movielist.last_timer_videodir.value
168 def preferredTimerPath():
169 return preferredPath(config.usage.timer_path.value)
171 def preferredInstantRecordPath():
172 return preferredPath(config.usage.instantrec_path.value)
174 def defaultMoviePath():
175 return config.usage.default_path.value