-#TODO .. move this to a own .py file
-class VolumeControl:
- """Volume control, handles volUp, volDown, volMute actions and display
- a corresponding dialog"""
- def __init__(self, session):
- global globalActionMap
- globalActionMap.actions["volumeUp"]=self.volUp
- globalActionMap.actions["volumeDown"]=self.volDown
- globalActionMap.actions["volumeMute"]=self.volMute
-
- config.audio = ConfigSubsection()
- config.audio.volume = ConfigInteger(default = 100, limits = (0, 100))
-
- self.volumeDialog = session.instantiateDialog(Volume)
- self.muteDialog = session.instantiateDialog(Mute)
-
- self.hideVolTimer = eTimer()
- self.hideVolTimer.timeout.get().append(self.volHide)
-
- vol = config.audio.volume.value
- print "volume is", vol
- 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):
- if (eDVBVolumecontrol.getInstance().isMuted()):
- self.volMute()
- eDVBVolumecontrol.getInstance().volumeUp()
- self.volumeDialog.show()
- self.volumeDialog.setValue(eDVBVolumecontrol.getInstance().getVolume())
- self.volSave()
- self.hideVolTimer.start(3000, True)
-
- def volDown(self):
- if (eDVBVolumecontrol.getInstance().isMuted()):
- self.volMute()
- eDVBVolumecontrol.getInstance().volumeDown()
- self.volumeDialog.show()
- self.volumeDialog.setValue(eDVBVolumecontrol.getInstance().getVolume())
- self.volSave()
- self.hideVolTimer.start(3000, True)
-
- def volHide(self):
- self.volumeDialog.hide()
-
- def volMute(self):
- eDVBVolumecontrol.getInstance().volumeToggleMute()
- self.volumeDialog.setValue(eDVBVolumecontrol.getInstance().getVolume())
-
- if (eDVBVolumecontrol.getInstance().isMuted()):
- self.muteDialog.show()
- else:
- self.muteDialog.hide()
-
-from Screens.Standby import Standby
-