+ def popCurrent(self):
+ if len(self.dialogStack):
+ self.currentDialog = self.dialogStack.pop()
+ self.execBegin()
+ else:
+ self.currentDialog = None
+
+ def execDialog(self, dialog):
+ self.pushCurrent()
+ self.currentDialog = dialog
+ self.currentDialog.isTmp = False
+ self.currentDialog.callback = None # would cause re-entrancy problems.
+ self.execBegin()
+
+ def openWithCallback(self, callback, screen, *arguments):
+ dlg = self.open(screen, *arguments)
+ dlg.callback = callback
+
+ def open(self, screen, *arguments):
+ self.pushCurrent()
+ dlg = self.currentDialog = self.instantiateDialog(screen, *arguments)
+ dlg.isTmp = True
+ dlg.callback = None
+ self.execBegin()
+ return dlg
+
+ def keyEvent(self, code):
+ print "code " + str(code)
+
+ def close(self, *retval):
+ self.currentDialog.returnValue = retval
+ self.delayTimer.start(0, 1)
+
+from Screens.Volume import Volume
+from Screens.Mute import Mute
+from GlobalActions import globalActionMap
+from Components.config import ConfigSubsection, configSequence, configElement, configsequencearg
+
+#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 = configElement("config.audio.volume", configSequence, [100], configsequencearg.get("INTEGER", (0, 100)))
+
+ self.volumeDialog = session.instantiateDialog(Volume)
+ self.muteDialog = session.instantiateDialog(Mute)
+
+ self.hideVolTimer = eTimer()
+ self.hideVolTimer.timeout.get().append(self.volHide)