add basic support for repeated timers (doesn't work yet)
[enigma2.git] / lib / python / Screens / InfoBarGenerics.py
index 5e28cdee216ab58c178070be1e56be9dd187a211..3af52ae85da361e7a4b6ec6b67e8d38417965e8c 100644 (file)
@@ -2,7 +2,8 @@ from Screen import Screen
 from Components.ActionMap import ActionMap
 from Components.ActionMap import NumberActionMap
 from Components.Label import Label
-from Components.config import configfile
+from Components.config import configfile, configsequencearg
+from Components.config import config, configElement, ConfigSubsection, configSequence
 from ChannelSelection import ChannelSelection
 
 from Components.ServiceName import ServiceName
@@ -18,14 +19,19 @@ from Screens.Standby import Standby
 #from enigma import eTimer, eDVBVolumecontrol, quitMainloop
 from enigma import *
 
+import time
+import os
+
 # hack alert!
 from Menu import MainMenu, mdom
 
 class InfoBarVolumeControl:
        """Volume control, handles volUp, volDown, volMute actions and display 
        a corresponding dialog"""
-       
        def __init__(self):
+               config.audio = ConfigSubsection()
+               config.audio.volume = configElement("config.audio.volume", configSequence, [5], configsequencearg.get("INTEGER", (0, 100)))
+
                self["VolumeActions"] = ActionMap( ["InfobarVolumeActions"] ,
                        {
                                "volumeUp": self.volUp,
@@ -38,17 +44,27 @@ class InfoBarVolumeControl:
 
                self.hideVolTimer = eTimer()
                self.hideVolTimer.timeout.get().append(self.volHide)
+
+               vol = config.audio.volume.value[0]
+               self.volumeDialog.setValue(vol)
+               eDVBVolumecontrol.getInstance().setVolume(vol, vol)
        
+       def volSave(self):
+               config.audio.volume.value = eDVBVolumecontrol.getInstance().getVolume()
+               config.audio.volume.save()
+               
        def     volUp(self):
                eDVBVolumecontrol.getInstance().volumeUp()
                self.volumeDialog.instance.show()
                self.volumeDialog.setValue(eDVBVolumecontrol.getInstance().getVolume())
+               self.volSave()
                self.hideVolTimer.start(3000)
 
        def     volDown(self):
                eDVBVolumecontrol.getInstance().volumeDown()
                self.volumeDialog.instance.show()
                self.volumeDialog.setValue(eDVBVolumecontrol.getInstance().getVolume())
+               self.volSave()
                self.hideVolTimer.start(3000)
                
        def volHide(self):
@@ -183,11 +199,8 @@ class InfoBarPowerKey:
                        self.session.open(Standby, self)
 
        def quit(self):
-               #       self.session.open(Standby, self)
-               configfile.save()
                quitMainloop(0)
 
-
 class InfoBarNumberZap:
        """ Handles an initial number for NumberZapping """
        def __init__(self):
@@ -315,10 +328,10 @@ class InfoBarPVR:
                seekable.seekRelative(dir, 90 * seektime)
 
        def seekFwd(self):
-               self.doSeek(+1, 10000)
+               self.doSeek(+1, 60000)
        
        def seekBack(self):
-               self.doSeek(-1, 10000)
+               self.doSeek(-1, 60000)
 
 class InfoBarInstantRecord:
        """Instant Record - handles the instantRecord action in order to 
@@ -349,6 +362,7 @@ class InfoBarInstantRecord:
                
                # fix me, description. 
                self.recording = self.session.nav.recordWithTimer(time.time(), time.time() + 3600, serviceref, epg, "instant record")
+               self.recording.dontSave = True
 
        def recordQuestionCallback(self, answer):
                if answer == False:
@@ -360,6 +374,12 @@ class InfoBarInstantRecord:
                        self.startInstantRecording()
 
        def instantRecord(self):
+               try:
+                       stat = os.stat("/hdd/movies")
+               except:
+                       self.session.open(MessageBox, "No HDD found!")
+                       return
+       
                if self.recording != None:
                        self.session.openWithCallback(self.recordQuestionCallback, MessageBox, "Do you want to stop the current\n(instant) recording?")
                else: