lib/python/Components/VolumeControl.py: make the VolumeControl instance global access...
authorghost <andreas.monzner@multimedia-labs.de>
Thu, 5 Aug 2010 09:06:49 +0000 (11:06 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Thu, 5 Aug 2010 09:07:10 +0000 (11:07 +0200)
lib/python/Components/VolumeControl.py

index 19fb90d..eef74d0 100644 (file)
@@ -5,6 +5,8 @@ from Screens.Mute import Mute
 from GlobalActions import globalActionMap
 from config import config, ConfigSubsection, ConfigInteger
 
 from GlobalActions import globalActionMap
 from config import config, ConfigSubsection, ConfigInteger
 
+instance = None
+
 profile("VolumeControl")
 #TODO .. move this to a own .py file
 class VolumeControl:
 profile("VolumeControl")
 #TODO .. move this to a own .py file
 class VolumeControl:
@@ -12,10 +14,14 @@ class VolumeControl:
        a corresponding dialog"""
        def __init__(self, session):
                global globalActionMap
        a corresponding dialog"""
        def __init__(self, session):
                global globalActionMap
+               global instance
                globalActionMap.actions["volumeUp"]=self.volUp
                globalActionMap.actions["volumeDown"]=self.volDown
                globalActionMap.actions["volumeMute"]=self.volMute
 
                globalActionMap.actions["volumeUp"]=self.volUp
                globalActionMap.actions["volumeDown"]=self.volDown
                globalActionMap.actions["volumeMute"]=self.volMute
 
+               assert not instance, "only one VolumeControl instance is allowed!"
+               instance = self
+
                config.audio = ConfigSubsection()
                config.audio.volume = ConfigInteger(default = 100, limits = (0, 100))
 
                config.audio = ConfigSubsection()
                config.audio.volume = ConfigInteger(default = 100, limits = (0, 100))