Merge branch 'bug_293_indicate_unhandled_key' into experimental
[enigma2.git] / lib / python / Components / UsageConfig.py
index 21e057f27b980054e08f5374f1912a40f2c64824..6082710768479543100ea036b4584ac788c10d0c 100644 (file)
@@ -1,12 +1,13 @@
 from Components.Harddisk import harddiskmanager
 from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations
 from Components.Harddisk import harddiskmanager
 from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations
+from Tools.Directories import resolveFilename, SCOPE_HDD
 from enigma import Misc_Options, setTunerTypePriorityOrder;
 from SystemInfo import SystemInfo
 import os
 
 def InitUsageConfig():
        config.usage = ConfigSubsection();
 from enigma import Misc_Options, setTunerTypePriorityOrder;
 from SystemInfo import SystemInfo
 import os
 
 def InitUsageConfig():
        config.usage = ConfigSubsection();
-       config.usage.showdish = ConfigYesNo(default = False)
+       config.usage.showdish = ConfigYesNo(default = True)
        config.usage.multibouquet = ConfigYesNo(default = False)
        config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
        config.usage.e1like_radio_mode = ConfigYesNo(default = False)
        config.usage.multibouquet = ConfigYesNo(default = False)
        config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
        config.usage.e1like_radio_mode = ConfigYesNo(default = False)
@@ -30,8 +31,11 @@ def InitUsageConfig():
                ("standard", _("standard")), ("swap", _("swap PiP and main picture")),
                ("swapstop", _("move PiP to main picture")), ("stop", _("stop PiP")) ])
 
                ("standard", _("standard")), ("swap", _("swap PiP and main picture")),
                ("swapstop", _("move PiP to main picture")), ("stop", _("stop PiP")) ])
 
+       config.usage.default_path = ConfigText(default = resolveFilename(SCOPE_HDD))
+       config.usage.timer_path = ConfigText(default = "<default>")
+       config.usage.instantrec_path = ConfigText(default = "<default>")
+       config.usage.timeshift_path = ConfigText(default = "/media/hdd/")
        config.usage.allowed_timeshift_paths = ConfigLocations(default = ["/media/hdd/"])
        config.usage.allowed_timeshift_paths = ConfigLocations(default = ["/media/hdd/"])
-       config.usage.timeshift_path = ConfigText(default = "/media/hdd")
 
        config.usage.on_movie_start = ConfigSelection(default = "ask", choices = [
                ("ask", _("Ask user")), ("resume", _("Resume from last position")), ("beginning", _("Start from the beginning")) ])
 
        config.usage.on_movie_start = ConfigSelection(default = "ask", choices = [
                ("ask", _("Ask user")), ("resume", _("Resume from last position")), ("beginning", _("Start from the beginning")) ])
@@ -58,23 +62,26 @@ def InitUsageConfig():
                ("5", "DVB-T/-S/-C") ])
 
        config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False)
                ("5", "DVB-T/-S/-C") ])
 
        config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False)
+
+       config.usage.show_message_when_recording_starts = ConfigYesNo(default = True)
+
        config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(default = True)
        
        def TunerTypePriorityOrderChanged(configElement):
                setTunerTypePriorityOrder(int(configElement.value))
        config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(default = True)
        
        def TunerTypePriorityOrderChanged(configElement):
                setTunerTypePriorityOrder(int(configElement.value))
-       config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged)
+       config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged, immediate_feedback=False)
 
        def setHDDStandby(configElement):
                for hdd in harddiskmanager.HDDList():
                        hdd[1].setIdleTime(int(configElement.value))
 
        def setHDDStandby(configElement):
                for hdd in harddiskmanager.HDDList():
                        hdd[1].setIdleTime(int(configElement.value))
-       config.usage.hdd_standby.addNotifier(setHDDStandby)
+       config.usage.hdd_standby.addNotifier(setHDDStandby, immediate_feedback=False)
 
        def set12VOutput(configElement):
                if configElement.value == "on":
                        Misc_Options.getInstance().set_12V_output(1)
                elif configElement.value == "off":
                        Misc_Options.getInstance().set_12V_output(0)
 
        def set12VOutput(configElement):
                if configElement.value == "on":
                        Misc_Options.getInstance().set_12V_output(1)
                elif configElement.value == "off":
                        Misc_Options.getInstance().set_12V_output(0)
-       config.usage.output_12V.addNotifier(set12VOutput)
+       config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)
 
        SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
 
 
        SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
 
@@ -118,10 +125,30 @@ def updateChoices(sel, choices):
                defval = None
                val = int(sel.value)
                if not val in choices:
                defval = None
                val = int(sel.value)
                if not val in choices:
-                       tmp = choices+[]
+                       tmp = choices[:]
                        tmp.reverse()
                        for x in tmp:
                                if x < val:
                                        defval = str(x)
                                        break
                sel.setChoices(map(str, choices), defval)
                        tmp.reverse()
                        for x in tmp:
                                if x < val:
                                        defval = str(x)
                                        break
                sel.setChoices(map(str, choices), defval)
+
+def preferredPath(path):
+       if config.usage.setup_level.index < 2 or path == "<default>":
+               return None  # config.usage.default_path.value, but delay lookup until usage
+       elif path == "<current>":
+               return config.movielist.last_videodir.value
+       elif path == "<timer>":
+               return config.movielist.last_timer_videodir.value
+       else:
+               return path
+
+def preferredTimerPath():
+       return preferredPath(config.usage.timer_path.value)
+
+def preferredInstantRecordPath():
+       return preferredPath(config.usage.instantrec_path.value)
+
+def defaultMoviePath():
+       return config.usage.default_path.value
+