from Screen import Screen
-from Components.ActionMap import ActionMap
+from Components.ActionMap import ActionMap, HelpableActionMap
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
from Components.EventInfo import EventInfo
+from ServiceReference import ServiceReference
from EpgSelection import EPGSelection
from Screens.MessageBox import MessageBox
from Screens.Volume import Volume
from Screens.Mute import Mute
from Screens.Standby import Standby
+from Screens.EventView import EventView
#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,
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):
class NumberZap(Screen):
def quit(self):
self.Timer.stop()
- self.close()
+ self.close(0)
def keyOK(self):
self.Timer.stop()
- print "do the action here"
- self.close()
+ self.close(int(self["number"].getText()))
def keyNumberGlobal(self, number):
self.Timer.start(3000) #reset timer
def __init__(self):
self.powerKeyTimer = eTimer()
self.powerKeyTimer.timeout.get().append(self.powertimer)
- self["PowerKeyActions"] = ActionMap( ["PowerKeyActions"],
+ self["PowerKeyActions"] = HelpableActionMap(self, "PowerKeyActions",
{
"powerdown": self.powerdown,
"powerup": self.powerup,
+ "discreteStandby": (self.standby, "Go standby"),
+ "discretePowerOff": (self.quit, "Go to deep standby"),
})
def powertimer(self):
self.powerKeyTimer.stop()
if self.standbyblocked == 0:
self.standbyblocked = 1
- self.session.open(Standby, self)
+ self.standby()
- def quit(self):
- # self.session.open(Standby, self)
- ref = self.session.nav.getCurrentlyPlayingServiceReference()
- if ref is not None:
- refstr = ref.toString()
- else:
- refstr = ""
-
- #configfile.save()
- quitMainloop(0)
+ def standby(self):
+ self.session.open(Standby, self)
+ def quit(self):
+ # halt
+ quitMainloop(1)
class InfoBarNumberZap:
""" Handles an initial number for NumberZapping """
})
def keyNumberGlobal(self, number):
- print "You pressed number " + str(number)
- self.session.open(NumberZap, number)
+# print "You pressed number " + str(number)
+ self.session.openWithCallback(self.numberEntered, NumberZap, number)
+
+ def numberEntered(self, retval):
+# print self.servicelist
+ if retval > 0:
+ self.servicelist.zapToNumber(retval)
class InfoBarChannelSelection:
""" ChannelSelection - handles the channelSelection dialog and the initial
#instantiate forever
self.servicelist = self.session.instantiateDialog(ChannelSelection)
- self["ChannelSelectActions"] = ActionMap( ["InfobarChannelSelection"],
+ self["ChannelSelectActions"] = HelpableActionMap(self, "InfobarChannelSelection",
{
"switchChannelUp": self.switchChannelUp,
"switchChannelDown": self.switchChannelDown,
- "zapUp": self.zapUp,
- "zapDown": self.zapDown,
+ "zapUp": (self.zapUp, _("next channel")),
+ "zapDown": (self.zapDown, _("previous channel")),
})
def switchChannelUp(self):
class InfoBarMenu:
""" Handles a menu action, to open the (main) menu """
def __init__(self):
- self["MenuActions"] = ActionMap( [ "InfobarMenuActions" ],
+ self["MenuActions"] = HelpableActionMap(self, "InfobarMenuActions",
{
- "mainMenu": self.mainMenu,
+ "mainMenu": (self.mainMenu, "Enter main menu..."),
})
def mainMenu(self):
class InfoBarEPG:
""" EPG - Opens an EPG list when the showEPGList action fires """
def __init__(self):
- self["EPGActions"] = ActionMap( [ "InfobarEPGActions" ],
+ self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions",
{
- "showEPGList": self.showEPGList,
+ "showEPGList": (self.showEPGList, _("show EPG...")),
})
def showEPGList(self):
ptr=eEPGCache.getInstance()
if ptr.startTimeQuery(ref) != -1:
self.session.open(EPGSelection, ref)
- else:
+ else: # try to show now/next
print 'no epg for service', ref.toString()
-
-class InfoBarEvent:
+ try:
+ self.epglist = [ ]
+ service = self.session.nav.getCurrentService()
+ info = service.info()
+ ptr=info.getEvent(0)
+ if ptr:
+ self.epglist.append(ptr)
+ ptr=info.getEvent(1)
+ if ptr:
+ self.epglist.append(ptr)
+ if len(self.epglist) > 0:
+ self.session.open(EventView, self.epglist[0], ServiceReference(ref), self.eventViewCallback)
+ except:
+ pass
+
+ def eventViewCallback(self, setEvent, val): #used for now/next displaying
+ if len(self.epglist) > 1:
+ tmp = self.epglist[0]
+ self.epglist[0]=self.epglist[1]
+ self.epglist[1]=tmp
+ setEvent(self.epglist[0])
+
+class InfoBarEvent:
"""provides a current/next event info display"""
def __init__(self):
self["Event_Now_StartTime"] = EventInfo(self.session.nav, EventInfo.Now_StartTime)
class InfoBarPVR:
"""handles PVR specific actions like seeking, pause"""
def __init__(self):
- self["PVRActions"] = ActionMap( [ "InfobarPVRActions" ],
+ self["PVRActions"] = HelpableActionMap(self, "InfobarPVRActions",
{
- "pauseService": self.pauseService,
- "unPauseService": self.unPauseService,
+ "pauseService": (self.pauseService, "pause"),
+ "unPauseService": (self.unPauseService, "continue"),
- "seekFwd": self.seekFwd,
- "seekBack": self.seekBack,
+ "seekFwd": (self.seekFwd, "skip forward"),
+ "seekBack": (self.seekBack, "skip backward"),
})
def pauseService(self):
"""Instant Record - handles the instantRecord action in order to
start/stop instant records"""
def __init__(self):
- self["InstnantRecordActions"] = ActionMap( [ "InfobarInstantRecord" ],
+ self["InstnantRecordActions"] = HelpableActionMap(self, "InfobarInstantRecord",
{
- "instantRecord": self.instantRecord,
+ "instantRecord": (self.instantRecord, "Instant Record..."),
})
self.recording = None
# 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:
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:
class InfoBarAudioSelection:
def __init__(self):
- self["AudioSelectionAction"] = ActionMap( [ "InfobarAudioSelectionActions" ],
+ self["AudioSelectionAction"] = HelpableActionMap(self, "InfobarAudioSelectionActions",
{
- "audioSelection": self.audioSelection,
+ "audioSelection": (self.audioSelection, "Audio Options..."),
})
def audioSelection(self):