</map>
<map context="InfobarEPGActions">
- <key id="KEY_INFO" mapto="showEPGList" flags="m" />
+ <key id="KEY_INFO" mapto="showEventInfo" flags="m" />
</map>
<map context="InfobarInstantRecord">
<key id="KEY_LEFT" mapto="prevEvent" flags="mr" />
<key id="KEY_RIGHT" mapto="nextEvent" flags="mr" />
<key id="KEY_GREEN" mapto="timerAdd" flags="m" />
+ <key id="KEY_INFO" mapto="cancel" flags="m" />
+ </map>
+
+ <map context="EventViewEPGActions">
+ <key id="KEY_YELLOW" mapto="openSingleServiceEPG" flags="m" />
+ <key id="KEY_BLUE" mapto="openMultiServiceEPG" flags="m" />
</map>
<map context="OkCancelActions">
<!--<widget name="menu" position="10,55" size="280,150" font="Regular;23" />-->
<widget name="menu" position="10,55" size="290,175" scrollbarMode="showOnDemand" />
</screen>
+ <screen name="BouquetSelector" position="210,150" size="300,195" title="Choose bouquet">
+ <widget name="menu" position="10,10" size="280,175" scrollbarMode="showOnDemand" />
+ </screen>
<screen name="Scart" position="0,0" size="720,576">
</screen>
<screen name="ServiceInfo" position="160,120" size="400,330" title="Serviceinfo">
<widget name="key_blue" position="420,0" size="140,40" backgroundColor="blue" font="Regular;21" />
</screen>
<screen name="EPGSelection" position="90,100" size="560,420" title="EPG Selection">
+ <widget name="key_red" position="0,0" size="140,30" backgroundColor="red" font="Regular;21" />
+ <widget name="key_green" position="140,0" size="140,30" backgroundColor="green" font="Regular;21" />
+ <widget name="key_yellow" position="280,0" size="140,30" backgroundColor="yellow" font="Regular;21" />
+ <widget name="key_blue" position="420,0" size="140,30" backgroundColor="blue" font="Regular;21" />
<widget name="list" position="0,40" size="560,375" scrollbarMode="showOnDemand" />
+ </screen>
+ <screen name="EPGSelectionMulti" position="90,100" size="560,420" title="EPG Selection">
<widget name="key_red" position="0,0" size="140,30" backgroundColor="red" font="Regular;21" />
<widget name="key_green" position="140,0" size="140,30" backgroundColor="green" font="Regular;21" />
<widget name="key_yellow" position="280,0" size="140,30" backgroundColor="yellow" font="Regular;21" />
<widget name="key_blue" position="420,0" size="140,30" backgroundColor="blue" font="Regular;21" />
+ <widget name="now_button" position="10,40" size="123,40" pixmap="/usr/share/enigma2/button-fs8.png" />
+ <widget name="next_button" position="143,40" size="123,40" pixmap="/usr/share/enigma2/button-fs8.png" />
+ <widget name="more_button" position="276,40" size="123,40" pixmap="/usr/share/enigma2/button-fs8.png" />
+ <widget name="now_button_sel" position="10,40" size="123,40" pixmap="/usr/share/enigma2/button-selected-fs8.png" />
+ <widget name="next_button_sel" position="143,40" size="123,40" pixmap="/usr/share/enigma2/button-selected-fs8.png" />
+ <widget name="more_button_sel" position="276,40" size="123,40" pixmap="/usr/share/enigma2/button-selected-fs8.png" />
+ <widget name="now_text" text="NOW" zPosition="2" position="10,40" size="123,40" transparent="1" halign="center" valign="center" font="Regular;21" />
+ <widget name="next_text" text="NEXT" zPosition="2" position="143,40" size="123,40" transparent="1" halign="center" valign="center" font="Regular;21" />
+ <widget name="more_text" text="MORE" zPosition="2" position="276,40" size="123,40" transparent="1" halign="center" valign="center" font="Regular;21" />
+ <widget name="date" position="410,40" size="140,40" valign="center" halign="right" font="Regular;24" />
+ <widget name="list" position="00,85" size="560,325" scrollbarMode="showOnDemand" />
</screen>
<screen name="EventView" position="100,100" size="520,380" title="Eventview">
- <widget name="epg_description" position="10,5" size="500,335" font="Regular;22" />
+ <widget name="key_red" position="0,0" size="130,30" backgroundColor="red" font="Regular;21" />
+ <widget name="key_green" position="130,0" size="130,30" backgroundColor="green" font="Regular;21" />
+ <widget name="key_yellow" position="260,0" size="130,30" backgroundColor="yellow" font="Regular;21" />
+ <widget name="key_blue" position="390,0" size="130,30" backgroundColor="blue" font="Regular;21" />
+ <widget name="epg_description" position="10,40" size="500,305" font="Regular;22" />
<widget name="datetime" position="10,345" size="130,30" font="Regular;22" />
<widget name="duration" position="140,345" size="100,30" font="Regular;22" />
<widget name="channel" position="240,345" size="270,30" font="Regular;22" />
event = self.epgcache.lookupEventId(service.ref, eventid)
return event
+ def getCurrentChangeCount(self):
+ if self.type == EPG_TYPE_SINGLE:
+ return 0
+ return self.l.getCurrentSelection()[0][0]
+
def getCurrent(self):
if self.type == EPG_TYPE_SINGLE:
if SINGLE_CPP > 0:
evt = self.getEventFromId(self.service, eventid)
else:
tmp = self.l.getCurrentSelection()[0]
- eventid = tmp[0]
- service = ServiceReference(tmp[1])
+ eventid = tmp[1]
+ service = ServiceReference(tmp[2])
event = self.getEventFromId(service, eventid)
evt = ( event, service )
return evt
res.append((eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r2.height(), 0, RT_HALIGN_LEFT, EventName))
return res
- def buildMultiEntry(self, service, eventId, begTime, duration, EventName, nowTime, service_name):
+ def buildMultiEntry(self, changecount, service, eventId, begTime, duration, EventName, nowTime, service_name):
sname = service_name
r1=self.service_rect
r2=self.progress_rect
r3=self.descr_rect
r4=self.start_end_rect
- res = [ (eventId, service, begTime, duration) ]
+ res = [ (changecount, eventId, service, begTime, duration) ]
re = compile('\xc2\x86.*?\xc2\x87')
list = re.findall(sname)
if len(list):
tmp = self.queryEPG(test)
self.list = [ ]
for x in tmp:
- self.list.append(self.buildMultiEntry(x[0], x[1], x[2], x[3], x[4], x[5], x[6]))
+ self.list.append(self.buildMultiEntry(0, x[0], x[1], x[2], x[3], x[4], x[5], x[6]))
self.l.setList(self.list)
print time() - t
+ self.selectionChanged()
def updateMultiEPG(self, direction):
t = time()
test = [ 'RIBDTCN' ]
for x in self.list:
data = x[0]
- service = data[1]
- begTime = data[2]
- duration = data[3]
+ service = data[2]
+ begTime = data[3]
+ duration = data[4]
if begTime is None:
begTime = 0
test.append((service, direction, begTime))
tmp = self.queryEPG(test)
cnt=0
for x in tmp:
- if x[2] is not None:
- self.list[cnt]=self.buildMultiEntry(x[0], x[1], x[2], x[3], x[4], x[5], x[6])
+ changecount = self.list[cnt][0][0] + direction
+ if changecount >= 0:
+ if x[2] is not None:
+ self.list[cnt]=self.buildMultiEntry(changecount, x[0], x[1], x[2], x[3], x[4], x[5], x[6])
cnt+=1
self.l.setList(self.list)
print time() - t
# self.list.append(self.buildSingleEntry(refstr, x[0], x[1], x[2], x[3]))
self.l.setList(self.list)
print time() - t
+ self.selectionChanged()
def InitUsageConfig():
config.usage = ConfigSubsection();
- config.usage.epgtoggle = configElement("config.usage.epgtoggle", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
config.usage.showdish = configElement("config.usage.showdish", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
config.usage.multibouquet = configElement("config.usage.multibouquet", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
from Components.Button import Button
from Components.ServiceList import ServiceList
from Components.ActionMap import NumberActionMap, ActionMap
+from Components.MenuList import MenuList
from EpgSelection import EPGSelection
from enigma import eServiceReference, eEPGCache, eEPGCachePtr, eServiceCenter, eServiceCenterPtr, iMutableServiceListPtr, iStaticServiceInformationPtr, eTimer, eDVBDB
from Components.config import config, configElement, ConfigSubsection, configText, currentConfigSelectionElement
import xml.dom.minidom
-class BouquetSelector(FixedMenu):
+class BouquetSelector(Screen):
def __init__(self, session, bouquets, selectedFunc):
+ Screen.__init__(self, session)
+
self.selectedFunc=selectedFunc
+
+ self["actions"] = ActionMap(["OkCancelActions"],
+ {
+ "ok": self.okbuttonClick,
+ "cancel": self.cancelClick
+ })
entrys = [ ]
for x in bouquets:
- entrys.append((x[0], self.bouquetSelected, x[1]))
- FixedMenu.__init__(self, session, "Bouquetlist", entrys)
- self.skinName = "Menu"
+ entrys.append((x[0], x[1]))
+ self["menu"] = MenuList(entrys)
+
+ def okbuttonClick(self):
+ self.selectedFunc(self["menu"].getCurrent()[1])
- def bouquetSelected(self):
- self.selectedFunc(self["menu"].getCurrent()[2])
+ def cancelClick(self):
+ self.close(False)
class ChannelContextMenu(FixedMenu):
def __init__(self, session, csel):
from Screen import Screen
from Components.Button import Button
+from Components.Pixmap import Pixmap
+from Components.Label import Label
from Components.EpgList import *
from Components.ActionMap import ActionMap
-from Screens.EventView import EventView
+from Components.ScrollLabel import ScrollLabel
+from Screens.EventView import EventViewSimple
from enigma import eServiceReference, eServiceEventPtr
from Screens.FixedMenu import FixedMenu
from RecordTimer import RecordTimerEntry, parseEvent
from TimerEntry import TimerEntry
from ServiceReference import ServiceReference
from Components.config import config, currentConfigSelectionElement
+from time import localtime
import xml.dom.minidom
class EPGSelection(Screen):
- def __init__(self, session, service):
+ def __init__(self, session, service, zapFunc=None):
Screen.__init__(self, session)
-
self["key_red"] = Button("")
- self["key_green"] = Button(_("Add timer"))
-
+ self.closeRecursive = False
if isinstance(service, eServiceReference):
self.type = EPG_TYPE_SINGLE
self["key_yellow"] = Button()
self["key_blue"] = Button()
self.currentService=ServiceReference(service)
else:
+ self.skinName = "EPGSelectionMulti"
self.type = EPG_TYPE_MULTI
self["key_yellow"] = Button(_("Prev"))
self["key_blue"] = Button(_("Next"))
+ self["now_button"] = Pixmap()
+ self["next_button"] = Pixmap()
+ self["more_button"] = Pixmap()
+ self["now_button_sel"] = Pixmap()
+ self["next_button_sel"] = Pixmap()
+ self["more_button_sel"] = Pixmap()
+ self["now_text"] = Label()
+ self["next_text"] = Label()
+ self["more_text"] = Label()
+ self["date"] = Label()
self.services = service
+ self.zapFunc = zapFunc
- self["list"] = EPGList(self.type)
+ self["key_green"] = Button(_("Add timer"))
+ self["list"] = EPGList(self.type, self.onSelectionChanged)
class ChannelActionMap(ActionMap):
def action(self, contexts, action):
"timerAdd": self.timerAdd,
"yellow": self.yellowButtonPressed,
"blue": self.blueButtonPressed,
- "info": self.infoKeyPressed
+ "info": self.infoKeyPressed,
+ "zapTo": self.zapTo
})
self["actions"].csel = self
self.onLayoutFinish.append(self.onCreate)
- def infoKeyPressed(self):
- if currentConfigSelectionElement(config.usage.epgtoggle) == "yes":
- self.close(True)
- else:
- self.close(False)
-
def closeScreen(self):
- self.close(False)
+ self.close(self.closeRecursive or self.type == EPG_TYPE_SINGLE)
+ def infoKeyPressed(self):
+ if self.type == EPG_TYPE_MULTI:
+ cur = self["list"].getCurrent()
+ event = cur[0]
+ service = cur[1]
+ else:
+ event = self["list"].getCurrent()
+ service = self.currentService
+ if event is not None:
+ self.session.open(EventViewSimple, event, service, self.eventViewCallback)
#just used in multipeg
def onCreate(self):
setEvent(cur[0])
setService(cur[1])
+ def zapTo(self): # just used in multiepg
+ if self.zapFunc != None:
+ self.closeRecursive = True
+ ref = self["list"].getCurrent()[1]
+ self.zapFunc(ref.ref)
+
def eventSelected(self):
if self.type == EPG_TYPE_SINGLE:
- event = self["list"].getCurrent()
- service = self.currentService
+ self.infoKeyPressed()
else: # EPG_TYPE_MULTI
- cur = self["list"].getCurrent()
- event = cur[0]
- service = cur[1]
- if event is not None:
- self.session.open(EventView, event, service, self.eventViewCallback)
+ self.zapTo()
def yellowButtonPressed(self):
if self.type == EPG_TYPE_MULTI:
def moveDown(self):
self["list"].moveDown()
+
+ def applyButtonState(self, state):
+ if state == 1:
+ self["now_button_sel"].showWidget()
+ self["now_button"].hideWidget()
+ else:
+ self["now_button"].showWidget()
+ self["now_button_sel"].hideWidget()
+
+ if state == 2:
+ self["next_button_sel"].showWidget()
+ self["next_button"].hideWidget()
+ else:
+ self["next_button"].showWidget()
+ self["next_button_sel"].hideWidget()
+
+ if state == 3:
+ self["more_button_sel"].showWidget()
+ self["more_button"].hideWidget()
+ else:
+ self["more_button"].showWidget()
+ self["more_button_sel"].hideWidget()
+
+ def onSelectionChanged(self):
+ if self.type == EPG_TYPE_MULTI:
+ count = self["list"].getCurrentChangeCount()
+ if count > 1:
+ self.applyButtonState(3)
+ elif count > 0:
+ self.applyButtonState(2)
+ else:
+ self.applyButtonState(1)
+ days = [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ]
+ datastr = ""
+ event = self["list"].getCurrent()[0]
+ if event is not None:
+ now = time()
+ beg = event.getBeginTime()
+ nowTime = localtime(now)
+ begTime = localtime(beg)
+ if nowTime[2] != begTime[2]:
+ datestr = '%s %d.%d.'%(days[begTime[6]], begTime[2], begTime[1])
+ else:
+ datestr = '%s %d.%d.'%(_("Today"), begTime[2], begTime[1])
+ self["date"].setText(datestr)
from Screen import Screen
from Components.ActionMap import ActionMap
+from Components.Button import Button
from Components.Label import Label
from Components.ScrollLabel import ScrollLabel
from enigma import eServiceEventPtr
from RecordTimer import RecordTimerEntry, parseEvent
from TimerEntry import TimerEntry
-class EventView(Screen):
- def __init__(self, session, Event, Ref, callback=None):
- Screen.__init__(self, session)
+class EventViewBase:
+ def __init__(self, Event, Ref, callback=None):
self.cbFunc = callback
self.currentService=Ref
self.event = Event
self["datetime"] = Label()
self["channel"] = Label()
self["duration"] = Label()
+ self["key_red"] = Button(_(""))
+ self["key_green"] = Button(_("Add Timer"))
+ self["key_yellow"] = Button(_(""))
+ self["key_blue"] = Button(_(""))
self["actions"] = ActionMap(["OkCancelActions", "EventViewActions"],
{
"cancel": self.close,
if (answer[0]):
self.session.nav.RecordTimer.record(answer[1])
else:
- print "Timeredit aborted"
+ print "Timeredit aborted"
def setService(self, service):
self.currentService=service
def pageUp(self):
self["epg_description"].pageUp()
-
+
def pageDown(self):
self["epg_description"].pageDown()
+
+class EventViewSimple(Screen, EventViewBase):
+ def __init__(self, session, Event, Ref, callback=None):
+ Screen.__init__(self, session)
+ self.skinName = "EventView"
+ EventViewBase.__init__(self, Event, Ref, callback)
+
+class EventViewEPGSelect(Screen, EventViewBase):
+ def __init__(self, session, Event, Ref, callback=None, singleEPGCB=None, multiEPGCB=None):
+ Screen.__init__(self, session)
+ self.skinName = "EventView"
+ EventViewBase.__init__(self, Event, Ref, callback)
+ self["key_yellow"].setText(_("Single EPG"))
+ self["key_blue"].setText(_("Multi EPG"))
+ self["epgactions"] = ActionMap(["EventViewEPGActions"],
+ {
+ "openSingleServiceEPG": singleEPGCB,
+ "openMultiServiceEPG": multiEPGCB
+ })
from Screens.MessageBox import MessageBox
from Screens.Dish import Dish
from Screens.Standby import Standby
-from Screens.EventView import EventView
+from Screens.EventView import EventViewEPGSelect
from Screens.MinuteInput import MinuteInput
from Components.Harddisk import harddiskmanager
def __init__(self):
self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions",
{
- "showEPGList": (self.showEPG, _("show EPG...")),
+ "showEventInfo": (self.openEventView, _("show EPG...")),
})
- def showEPG(self):
- if currentConfigSelectionElement(config.usage.epgtoggle) == "yes":
- self.openSingleServiceEPG()
- else:
- self.showEPGList()
-
- def showEPGList(self):
- bouquets = self.servicelist.getBouquetList()
- if bouquets is None:
- cnt = 0
- else:
- cnt = len(bouquets)
- if cnt > 1: # show bouquet list
- self.session.open(BouquetSelector, bouquets, self.openBouquetEPG)
- elif cnt == 1: # add to only one existing bouquet
- self.openBouquetEPG(bouquets[0][1])
- else: #no bouquets so we open single epg
- self.openSingleEPGSelector(self.session.nav.getCurrentlyPlayingServiceReference())
-
- def bouquetEPGCallback(self, info):
- if info:
- self.openSingleServiceEPG()
-
- def singleEPGCallback(self, info):
- if info:
- self.showEPGList()
-
- def openEventView(self):
- 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 openSingleServiceEPG(self):
- ref=self.session.nav.getCurrentlyPlayingServiceReference()
- ptr=eEPGCache.getInstance()
- if ptr.startTimeQuery(ref) != -1:
- self.session.openWithCallback(self.singleEPGCallback, EPGSelection, ref)
- else: # try to show now/next
- print 'no epg for service', ref.toString()
+ def zapToService(self, service):
+ if not service is None:
+ if self.servicelist.getRoot() != self.epg_bouquet: #already in correct bouquet?
+ self.servicelist.clearPath()
+ if self.servicelist.bouquet_root != self.epg_bouquet:
+ self.servicelist.enterPath(self.servicelist.bouquet_root)
+ self.servicelist.enterPath(self.epg_bouquet)
+ self.servicelist.setCurrentSelection(service) #select the service in servicelist
+ self.servicelist.zap()
def openBouquetEPG(self, bouquet):
ptr=eEPGCache.getInstance()
continue
services.append(ServiceReference(service))
if len(services):
- self.session.openWithCallback(self.bouquetEPGCallback, EPGSelection, services)
+ self.epg_bouquet = bouquet
+ self.session.openWithCallback(self.closed, EPGSelection, services, self.zapToService)
+
+ def closed(self, ret):
+ if ret:
+ self.close(ret)
- def openSingleEPGSelector(self, ref):
+ def openMultiServiceEPG(self):
+ bouquets = self.servicelist.getBouquetList()
+ if bouquets is None:
+ cnt = 0
+ else:
+ cnt = len(bouquets)
+ if cnt > 1: # show bouquet list
+ self.session.openWithCallback(self.closed, BouquetSelector, bouquets, self.openBouquetEPG)
+ elif cnt == 1:
+ self.openBouquetEPG(bouquets[0][1])
+
+ def openSingleServiceEPG(self):
+ ref=self.session.nav.getCurrentlyPlayingServiceReference()
ptr=eEPGCache.getInstance()
- if ptr.startTimeQuery(ref) != -1:
- self.session.open(EPGSelection, ref)
- else: # try to show now/next
- print 'no epg for service', ref.toString()
- 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)
+ self.session.openWithCallback(self.closed, EPGSelection, ref)
+
+ def openEventView(self):
+ self.epglist = [ ]
+ service = self.session.nav.getCurrentService()
+ ref = self.session.nav.getCurrentlyPlayingServiceReference()
+ 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:
+ epg = eEPGCache.getInstance()
+ ptr = epg.lookupEventTime(ref, -1)
+ if ptr:
+ self.epglist.append(ptr)
+ ptr = epg.lookupEventTime(ref, ptr.getBeginTime(), +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
+ if len(self.epglist) > 0:
+ self.session.open(EventViewEPGSelect, self.epglist[0], ServiceReference(ref), self.eventViewCallback, self.openSingleServiceEPG, self.openMultiServiceEPG)
+ else:
+ print "no epg for the service avail.. so we show multiepg instead of eventinfo"
+ self.openMultiServiceEPG()
def eventViewCallback(self, setEvent, setService, val): #used for now/next displaying
if len(self.epglist) > 1: