From ecd15d83806de513514e2ef84892b6d30c64cc8c Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Aug 2010 11:06:49 +0200 Subject: [PATCH] lib/python/Components/VolumeControl.py: make the VolumeControl instance global accessible and add a singleton check --- lib/python/Components/VolumeControl.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/python/Components/VolumeControl.py b/lib/python/Components/VolumeControl.py index 19fb90d7..eef74d0e 100644 --- a/lib/python/Components/VolumeControl.py +++ b/lib/python/Components/VolumeControl.py @@ -5,6 +5,8 @@ from Screens.Mute import Mute from GlobalActions import globalActionMap from config import config, ConfigSubsection, ConfigInteger +instance = None + 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 + global instance 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)) -- 2.30.2