[EasyInfo] New EasyInfo plugin pushed to the GIT
[vuplus_dvbapp-plugin] / easyinfo / src / plugin.py
1 #######################################################################
2 #
3 #    EasyInfo for Dreambox-Enigma2
4 #    Coded by Vali (c)2011
5 #    Support: www.dreambox-tools.info
6 #
7 #  This plugin is licensed under the Creative Commons 
8 #  Attribution-NonCommercial-ShareAlike 3.0 Unported License.
9 #  To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
10 #  or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
11 #
12 #  Alternatively, this plugin may be distributed and executed on hardware which
13 #  is licensed by Dream Multimedia GmbH.
14 #
15 #  This plugin is NOT free software. It is open source, you are allowed to
16 #  modify it (if you keep the license), but it may not be commercially 
17 #  distributed other than under the conditions noted above.
18 #
19 #######################################################################
20
21
22
23 from Plugins.Plugin import PluginDescriptor
24 from Screens.Screen import Screen
25 from Screens.MessageBox import MessageBox
26 from Screens.InfoBarGenerics import InfoBarPlugins
27 from Screens.ChoiceBox import ChoiceBox
28 from Screens.TimerEdit import TimerEditList
29 from Screens.EpgSelection import EPGSelection
30 from Screens.EventView import EventViewSimple, EventViewBase
31 from Screens.ServiceInfo import ServiceInfo
32 from Screens.ChannelSelection import BouquetSelector
33 from Screens.TimeDateInput import TimeDateInput
34 from Components.ActionMap import ActionMap
35 from Components.MenuList import MenuList
36 from Components.Label import Label
37 from Components.EpgList import EPGList, EPG_TYPE_MULTI
38 from Components.ConfigList import ConfigListScreen
39 from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSelection, ConfigClock
40 from Components.Sources.StaticText import StaticText
41 from Tools.Directories import fileExists, pathExists
42 from Tools.LoadPixmap import LoadPixmap
43 from Tools.HardwareInfo import HardwareInfo
44 from ServiceReference import ServiceReference
45 from enigma import eListboxPythonMultiContent, gFont, getDesktop, eTimer, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, RT_HALIGN_RIGHT, RT_VALIGN_TOP
46 from time import localtime, time, mktime
47
48
49
50 EINbaseInfoBarPlugins__init__ = None
51 EINStartOnlyOneTime = False
52 EINsession = None
53 EINposition = 0
54 InfoBar_instance = None
55 mepg_config_initialized = False
56 sz_w = getDesktop(0).size().width()
57 if sz_w == 1280:
58         SKINTYPE = 3
59 elif sz_w == 1024:
60         SKINTYPE = 2
61 else:
62         SKINTYPE = 1
63
64
65
66 CHOICELIST=[("no", _("Disabled")),
67                         ("eventinfo", _("Event info")),
68                         ("singleepg", _("Single EPG")),
69                         ("multiepg", _("Multi EPG")),
70                         ("easypg", _("Easy-PG")),
71                         ("graphepg", _("Graphik multi-EPG")),
72                         ("merlinepg", _("Merlin EPG")),
73                         ("cooltv", _("Cool-TV")),
74                         ("timers", _("Timerlist")),
75                         ("epgsearch", _("EPG search")),
76                         ("autotimer", _("Autotimer")),
77                         ("channelinfo", _("Channel info")),
78                         ("imdbinfo", _("IMDB info")),
79                         ("primetime", _("Prime Time Manager")),
80                         ("epgrefresh", _("EPG refresh")),
81                         ("sysinfo", _("Sherlock"))
82                         ]
83 config.plugins.EasyInfo  = ConfigSubsection()
84 config.plugins.EasyInfo.pos1 = ConfigSelection(default="eventinfo", choices = CHOICELIST)
85 config.plugins.EasyInfo.pos2 = ConfigSelection(default="singleepg", choices = CHOICELIST)
86 config.plugins.EasyInfo.pos3 = ConfigSelection(default="merlinepg", choices = CHOICELIST)
87 config.plugins.EasyInfo.pos4 = ConfigSelection(default="timers", choices = CHOICELIST)
88 config.plugins.EasyInfo.pos5 = ConfigSelection(default="channelinfo", choices = CHOICELIST)
89 config.plugins.EasyInfo.pos6 = ConfigSelection(default="no", choices = CHOICELIST)
90 config.plugins.EasyInfo.pos7 = ConfigSelection(default="no", choices = CHOICELIST)
91 config.plugins.EasyInfo.pos8 = ConfigSelection(default="no", choices = CHOICELIST)
92 config.plugins.EasyInfo.pos9 = ConfigSelection(default="no", choices = CHOICELIST)
93 config.plugins.EasyInfo.pos10 = ConfigSelection(default="no", choices = CHOICELIST)
94 config.plugins.EasyInfo.pos11 = ConfigSelection(default="no", choices = CHOICELIST)
95 config.plugins.EasyInfo.EvInStart = ConfigSelection(default="yes", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
96 config.plugins.EasyInfo.bEvInYellow = ConfigSelection(default="singleepg", choices=[("singleepg", _("Single EPG")),("multiepg", _("Multi EPG")),("easypg", _("Easy-PG")),("graphepg", _("Graphik multi-EPG")),("merlinepg", _("Merlin EPG")),("cooltv", _("Cool-TV")),("imdbinfo", _("IMDB info"))])
97 config.plugins.EasyInfo.bEvInBlue = ConfigSelection(default="multiepg", choices=[("singleepg", _("Single EPG")),("multiepg", _("Multi EPG")),("easypg", _("Easy-PG")),("graphepg", _("Graphik multi-EPG")),("merlinepg", _("Merlin EPG")),("cooltv", _("Cool-TV")),("imdbinfo", _("IMDB info"))])
98 config.plugins.EasyInfo.myPicons = ConfigSelection(default="/media/usb/epgpicon/", choices = [("/media/usb/epgpicon/", "/media/usb/epgpicon/"), ("/media/cf/epgpicon/", "/media/cf/epgpicon/"), ("/media/hdd/epgpicon/", "/media/hdd/epgpicon/")])
99 config.plugins.EasyInfo.epgOKFunc = ConfigSelection(default="info", choices = [("info", _("Event info")), ("zap", _("Just zap")),("exitzap", _("Zap and Exit"))])
100 config.plugins.EasyInfo.Primetime1 = ConfigClock(default = 63000)
101 config.plugins.EasyInfo.Primetime2 = ConfigClock(default = 69300)
102 config.plugins.EasyInfo.Primetime3 = ConfigClock(default = 75600)
103
104
105
106
107
108 def Plugins(**kwargs):
109         return [PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = EasyInfoAutostart)]
110
111
112
113 def EasyInfoAutostart(reason, **kwargs):
114         global EINbaseInfoBarPlugins__init__
115         if "session" in kwargs:
116                 global EINsession
117                 EINsession = kwargs["session"]
118                 if EINbaseInfoBarPlugins__init__ is None:
119                         EINbaseInfoBarPlugins__init__ = InfoBarPlugins.__init__
120                 InfoBarPlugins.__init__ = InfoBarPlugins__init__
121                 InfoBarPlugins.info = info
122
123
124
125 def InfoBarPlugins__init__(self):
126         global EINStartOnlyOneTime
127         if not EINStartOnlyOneTime: 
128                 EINStartOnlyOneTime = True
129                 global InfoBar_instance
130                 InfoBar_instance = self
131                 self["EasyInfoActions"] = ActionMap(["EasyInfoActions"],
132                         {"info_but": self.info}, -1)
133         else:
134                 InfoBarPlugins.__init__ = InfoBarPlugins.__init__
135                 InfoBarPlugins.info = None
136         EINbaseInfoBarPlugins__init__(self)
137
138
139
140 def info(self):
141         if config.plugins.EasyInfo.EvInStart.value == "yes":
142                 epglist = [ ]
143                 self.epglist = epglist
144                 service = self.session.nav.getCurrentService()
145                 ref = self.session.nav.getCurrentlyPlayingServiceReference()
146                 info = service.info()
147                 ptr=info.getEvent(0)
148                 if ptr:
149                         epglist.append(ptr)
150                 ptr=info.getEvent(1)
151                 if ptr:
152                         epglist.append(ptr)
153                 if epglist:
154                         self.session.open(EasyEvent, epglist[0], ServiceReference(ref))
155                 else:
156                         self.session.open(EasyInfo)
157         else:
158                 self.session.open(EasyInfo)
159
160
161
162 def getPluginByName(sstr):
163         sret = " "
164         for xs in CHOICELIST:
165                 if sstr == xs[0]:
166                         sret = xs[1]
167                         break
168         return sret
169
170
171
172 def EINPanelEntryComponent(key, text):
173         res = [ text ]
174         bpng = LoadPixmap(EasyInfo.EINiconspath + "key-" + text[0] + ".png")
175         if bpng is not None:
176                 res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 5, 5, 50, bpng))
177         png = LoadPixmap(EasyInfo.EINiconspath + key + ".png")
178         if png is not None:
179                 res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 5, 100, 50, png))
180         if config.plugins.EasyInfo.EvInStart.value == "yes" or SKINTYPE == 1:
181                 res.append((eListboxPythonMultiContent.TYPE_TEXT, 115, 17, 300, 35, 0, RT_HALIGN_LEFT, getPluginByName(text[1])))
182         return res
183
184
185
186 class EINPanelList(MenuList):
187         def __init__(self, list, selection = 0, enableWrapAround=True):
188                 MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
189                 self.l.setFont(0, gFont("Regular", 20))
190                 self.l.setItemHeight(60)
191                 self.selection = selection
192         def postWidgetCreate(self, instance):
193                 MenuList.postWidgetCreate(self, instance)
194                 self.moveToIndex(self.selection)
195
196
197
198 class ConfigEasyInfo(ConfigListScreen, Screen):
199         skin = """
200                 <screen name="ConfigEasyInfo" position="center,center" size="600,410" title="EasyInfo settings...">
201                         <widget name="config" position="5,5" scrollbarMode="showOnDemand" size="590,375"/>
202                         <eLabel font="Regular;20" foregroundColor="#00ff4A3C" halign="center" position="20,385" size="140,26" text="Cancel"/>
203                         <eLabel font="Regular;20" foregroundColor="#0056C856" halign="center" position="165,385" size="140,26" text="Save"/>
204                 </screen>"""
205         def __init__(self, session):
206                 Screen.__init__(self, session)
207                 self.setTitle(_("EasyInfo settings..."))
208                 self.session = session
209                 self.oldsetting = config.plugins.EasyInfo.EvInStart.value
210                 list = []
211                 list.append(getConfigListEntry(_("Start first EventInfo:"), config.plugins.EasyInfo.EvInStart ))
212                 list.append(getConfigListEntry(_("EventInfo yellow button:"), config.plugins.EasyInfo.bEvInYellow ))
213                 list.append(getConfigListEntry(_("EventInfo blue button:"), config.plugins.EasyInfo.bEvInBlue ))
214                 list.append(getConfigListEntry(_("OK function in Easy-PG:"), config.plugins.EasyInfo.epgOKFunc))
215                 list.append(getConfigListEntry(_("Easy-PG picons path:"), config.plugins.EasyInfo.myPicons))
216                 list.append(getConfigListEntry(_("Easy-PG Primetime 1:"), config.plugins.EasyInfo.Primetime1))
217                 list.append(getConfigListEntry(_("Easy-PG Primetime 2 (main):"), config.plugins.EasyInfo.Primetime2))
218                 list.append(getConfigListEntry(_("Easy-PG Primetime 3:"), config.plugins.EasyInfo.Primetime3))
219                 list.append(getConfigListEntry(_("Position 1 (info button):"), config.plugins.EasyInfo.pos1))
220                 list.append(getConfigListEntry(_("Position 2 (red button):"), config.plugins.EasyInfo.pos2))
221                 list.append(getConfigListEntry(_("Position 3 (green button):"), config.plugins.EasyInfo.pos3))
222                 list.append(getConfigListEntry(_("Position 4 (yellow button):"), config.plugins.EasyInfo.pos4))
223                 list.append(getConfigListEntry(_("Position 5 (blue button):"), config.plugins.EasyInfo.pos5))
224                 list.append(getConfigListEntry(_("Position 6:"), config.plugins.EasyInfo.pos6))
225                 list.append(getConfigListEntry(_("Position 7:"), config.plugins.EasyInfo.pos7))
226                 list.append(getConfigListEntry(_("Position 8:"), config.plugins.EasyInfo.pos8))
227                 list.append(getConfigListEntry(_("Position 9:"), config.plugins.EasyInfo.pos9))
228                 list.append(getConfigListEntry(_("Position 10:"), config.plugins.EasyInfo.pos10))
229                 list.append(getConfigListEntry(_("Position 11:"), config.plugins.EasyInfo.pos11))
230                 ConfigListScreen.__init__(self, list)
231                 self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {"green": self.save, "red": self.exit, "cancel": self.exit, "yellow": self.exit}, -1)
232
233         def save(self):
234                 for x in self["config"].list:
235                         x[1].save()
236                 if self.oldsetting != config.plugins.EasyInfo.EvInStart.value:
237                         self.session.open(MessageBox, text = _('You need GUI-restart to load the new settings!'), type = MessageBox.TYPE_INFO)
238                 self.close()
239
240         def exit(self):
241                 for x in self["config"].list:
242                         x[1].cancel()
243                 self.close()
244
245
246
247 class EasyInfo(Screen):
248         if SKINTYPE == 3:
249                 if config.plugins.EasyInfo.EvInStart.value == "yes":
250                         skin = """
251                         <screen flags="wfNoBorder" position="0,0" size="450,720" title="Easy Info">
252                                 <ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/bg.png" position="0,0" size="450,576"/>
253                                 <ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/bg.png" position="0,576" size="450,145"/>
254                                 <widget name="list" position="60,30" size="350,660" scrollbarMode="showNever" transparent="1" zPosition="2"/>
255                         </screen>"""
256                 else:
257                         skin = """
258                         <screen backgroundColor="background" flags="wfNoBorder" position="0,0" size="1280,720" title="Easy Info">
259                                 <widget name="list" position="55,30" size="110,660" scrollbarMode="showNever" transparent="1" zPosition="2"/>
260                                 <eLabel backgroundColor="#666666" position="250,359" size="1280,2"/>
261                                 <widget font="Regular;24" foregroundColor="#fcc000" position="600,50" render="Label" size="600,30" source="session.CurrentService" transparent="1" zPosition="1">
262                                         <convert type="ServiceName">Name</convert>
263                                 </widget>
264                                 <widget font="Regular;24" position="250,50" render="Label" size="70,30" source="session.Event_Now" transparent="1" zPosition="1">
265                                         <convert type="EventTime">StartTime</convert>
266                                         <convert type="ClockToText">Default</convert>
267                                 </widget>
268                                 <widget font="Regular;24" noWrap="1" position="250,90" render="Label" size="900,30" source="session.Event_Now" transparent="1" zPosition="1">
269                                         <convert type="EventName">Name</convert>
270                                 </widget>
271                                 <widget font="Regular;22" foregroundColor="#fcc000" position="320,50" halign="right" render="Label" size="130,30" source="session.Event_Now" transparent="1" zPosition="1">
272                                         <convert type="EventTime">Remaining</convert>
273                                         <convert type="RemainingToText">InMinutes</convert>
274                                 </widget>
275                                 <widget font="Regular;24" position="250,400" render="Label" size="70,30" source="session.Event_Next" transparent="1" zPosition="1">
276                                         <convert type="EventTime">StartTime</convert>
277                                         <convert type="ClockToText">Default</convert>
278                                 </widget>
279                                 <widget font="Regular;24" foregroundColor="#aaaaaa" noWrap="1" position="250,370" render="Label" size="900,30" source="session.Event_Next" transparent="1" zPosition="1">
280                                         <convert type="EventName">Name</convert>
281                                 </widget>
282                                 <widget font="Regular;24" foregroundColor="#aaaaaa" position="320,400" render="Label" size="130,30" source="session.Event_Next" transparent="1" zPosition="1">
283                                         <convert type="EventTime">Duration</convert>
284                                         <convert type="ClockToText">InMinutes</convert>
285                                 </widget>
286                                 <widget backgroundColor="#555555" borderColor="#555555" borderWidth="4" position="460,57" render="Progress" size="120,14" source="session.Event_Now" zPosition="2">
287                                         <convert type="EventTime">Progress</convert>
288                                 </widget>
289                                 <widget font="Regular;22" position="250,127" render="Label" size="950,225" source="session.Event_Now" transparent="1" valign="top" zPosition="5">
290                                         <convert type="EventName">ExtendedDescription</convert>
291                                 </widget>
292                                 <widget font="Regular;22" foregroundColor="#aaaaaa" position="250,437" render="Label" size="950,225" source="session.Event_Next" transparent="1" valign="top" zPosition="5">
293                                         <convert type="EventName">ExtendedDescription</convert>
294                                 </widget>
295                         </screen>"""
296         elif SKINTYPE == 2:
297                 if config.plugins.EasyInfo.EvInStart.value == "yes":
298                         skin = """
299                         <screen flags="wfNoBorder" position="-20,0" size="450,576" title="Easy Info">
300                                 <ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/bg.png" position="0,0" size="450,576"/>
301                                 <widget name="list" position="70,48" size="320,480" scrollbarMode="showNever" transparent="1" zPosition="2"/>
302                         </screen>"""
303                 else:
304                         skin = """
305                         <screen backgroundColor="background" flags="wfNoBorder" position="0,0" size="1024,720" title="Easy Info">
306                                 <widget name="list" position="40,48" scrollbarMode="showNever" size="110,480" transparent="1" zPosition="2"/>
307                                 <eLabel backgroundColor="#666666" position="210,289" size="1000,2"/>
308                                 <widget font="Regular;20" foregroundColor="#fcc000" position="570,50" render="Label" size="377,30" source="session.CurrentService" transparent="1" zPosition="1">
309                                         <convert type="ServiceName">Name</convert>
310                                 </widget>
311                                 <widget font="Regular;20" position="210,50" render="Label" size="70,30" source="session.Event_Now" transparent="1" zPosition="1">
312                                         <convert type="EventTime">StartTime</convert>
313                                         <convert type="ClockToText">Default</convert>
314                                 </widget>
315                                 <widget font="Regular;20" noWrap="1" position="210,85" render="Label" size="736,30" source="session.Event_Now" transparent="1" zPosition="1">
316                                         <convert type="EventName">Name</convert>
317                                 </widget>
318                                 <widget font="Regular;20" foregroundColor="#fcc000" halign="right" position="290,50" render="Label" size="130,30" source="session.Event_Now" transparent="1" zPosition="1">
319                                         <convert type="EventTime">Remaining</convert>
320                                         <convert type="RemainingToText">InMinutes</convert>
321                                 </widget>
322                                 <widget font="Regular;20" position="210,333" render="Label" size="82,30" source="session.Event_Next" transparent="1" zPosition="1">
323                                         <convert type="EventTime">StartTime</convert>
324                                         <convert type="ClockToText">Default</convert>
325                                 </widget>
326                                 <widget font="Regular;20" foregroundColor="#aaaaaa" noWrap="1" position="210,300" render="Label" size="900,30" source="session.Event_Next" transparent="1" zPosition="1">
327                                         <convert type="EventName">Name</convert>
328                                 </widget>
329                                 <widget font="Regular;20" foregroundColor="#aaaaaa" position="295,333" render="Label" size="130,30" source="session.Event_Next" transparent="1" zPosition="1">
330                                         <convert type="EventTime">Duration</convert>
331                                         <convert type="ClockToText">InMinutes</convert>
332                                 </widget>
333                                 <widget backgroundColor="#555555" borderColor="#555555" borderWidth="4" position="425,55" render="Progress" size="120,14" source="session.Event_Now" zPosition="2">
334                                         <convert type="EventTime">Progress</convert>
335                                 </widget>
336                                 <widget font="Regular;18" position="210,115" render="Label" size="736,170" source="session.Event_Now" transparent="1" valign="top" zPosition="5">
337                                         <convert type="EventName">ExtendedDescription</convert>
338                                 </widget>
339                                 <widget font="Regular;18" foregroundColor="#aaaaaa" position="210,362" render="Label" size="736,170" source="session.Event_Next" transparent="1" valign="top" zPosition="5">
340                                         <convert type="EventName">ExtendedDescription</convert>
341                                 </widget>
342                         </screen>"""
343         else:
344                 skin = """
345                 <screen position="center,center" size="320,440" title="Easy Info">
346                         <widget name="list" position="10,10" size="300,420" scrollbarMode="showOnDemand" />
347                 </screen>"""
348         if pathExists('/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/icons/'):
349                 EINiconspath = '/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/icons/'
350         else:
351                 EINiconspath = '/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/'
352         def __init__(self, session):
353                 Screen.__init__(self, session)
354                 self.session = session
355                 self.list = []
356                 self.__keys = []
357                 MPaskList = []
358                 fertig = False
359                 if True:
360                         if config.plugins.EasyInfo.pos1.value != "no":
361                                 self.__keys.append(config.plugins.EasyInfo.pos1.value)
362                                 MPaskList.append(("info", config.plugins.EasyInfo.pos1.value))
363                                 self["key_info"] = StaticText(_(getPluginByName(config.plugins.EasyInfo.pos1.value)))
364                         else: fertig = True
365                         if config.plugins.EasyInfo.pos2.value != "no" and not fertig:
366                                 self.__keys.append(config.plugins.EasyInfo.pos2.value)
367                                 MPaskList.append(("red", config.plugins.EasyInfo.pos2.value))
368                                 self["key_red"] = StaticText(_(getPluginByName(config.plugins.EasyInfo.pos2.value)))
369                         else: fertig = True
370                         if config.plugins.EasyInfo.pos3.value != "no" and not fertig:
371                                 self.__keys.append(config.plugins.EasyInfo.pos3.value)
372                                 MPaskList.append(("green", config.plugins.EasyInfo.pos3.value))
373                                 self["key_green"] = StaticText(_(getPluginByName(config.plugins.EasyInfo.pos3.value)))
374                         else: fertig = True
375                         if config.plugins.EasyInfo.pos4.value != "no" and not fertig:
376                                 self.__keys.append(config.plugins.EasyInfo.pos4.value)
377                                 MPaskList.append(("yellow", config.plugins.EasyInfo.pos4.value))
378                                 self["key_yellow"] = StaticText(_(getPluginByName(config.plugins.EasyInfo.pos4.value)))
379                         else: fertig = True
380                         if config.plugins.EasyInfo.pos5.value != "no" and not fertig:
381                                 self.__keys.append(config.plugins.EasyInfo.pos5.value)
382                                 MPaskList.append(("blue", config.plugins.EasyInfo.pos5.value))
383                                 self["key_blue"] = StaticText(_(getPluginByName(config.plugins.EasyInfo.pos5.value)))
384                         else: fertig = True
385                         if config.plugins.EasyInfo.pos6.value != "no" and not fertig:
386                                 self.__keys.append(config.plugins.EasyInfo.pos6.value)
387                                 MPaskList.append(("x", config.plugins.EasyInfo.pos6.value))
388                         else: fertig = True
389                         if config.plugins.EasyInfo.pos7.value != "no" and not fertig:
390                                 self.__keys.append(config.plugins.EasyInfo.pos7.value)
391                                 MPaskList.append(("x", config.plugins.EasyInfo.pos7.value))
392                         else: fertig = True
393                         if config.plugins.EasyInfo.pos8.value != "no" and not fertig:
394                                 self.__keys.append(config.plugins.EasyInfo.pos8.value)
395                                 MPaskList.append(("x", config.plugins.EasyInfo.pos8.value))
396                         else: fertig = True
397                         if config.plugins.EasyInfo.pos9.value != "no" and not fertig:
398                                 self.__keys.append(config.plugins.EasyInfo.pos9.value)
399                                 MPaskList.append(("x", config.plugins.EasyInfo.pos9.value))
400                         else: fertig = True
401                         if config.plugins.EasyInfo.pos10.value != "no" and not fertig:
402                                 self.__keys.append(config.plugins.EasyInfo.pos10.value)
403                                 MPaskList.append(("x", config.plugins.EasyInfo.pos10.value))
404                         else: fertig = True
405                         if config.plugins.EasyInfo.pos11.value != "no" and not fertig:
406                                 self.__keys.append(config.plugins.EasyInfo.pos11.value)
407                                 MPaskList.append(("x", config.plugins.EasyInfo.pos11.value))
408                 self.keymap = {}
409                 pos = 0
410                 for x in MPaskList:
411                         strpos = str(self.__keys[pos])
412                         self.list.append(EINPanelEntryComponent(key = strpos, text = x))
413                         if self.__keys[pos] != "":
414                                 self.keymap[self.__keys[pos]] = MPaskList[pos]
415                         pos += 1
416                 self["list"] = EINPanelList(list = self.list, selection = 0)
417                 self["actions"] = ActionMap(["WizardActions", "MenuActions", "ColorActions", "EPGSelectActions"],
418                 {
419                         "ok": self.go,
420                         "back": self.cancel,
421                         "menu": self.emContextMenu,
422                         "green": self.shotgreen,
423                         "red": self.shotred,
424                         "blue": self.shotblue,
425                         "yellow": self.shotyellow,
426                         "info": self.shotinfo
427                 }, -1)
428
429         def cancel(self):
430                 self.close(None)
431
432         def go(self):
433                 cursel = self["list"].l.getCurrentSelection()
434                 if cursel:
435                         antw = cursel[0]
436                         antw = antw and antw[1]
437                         EINcallbackFunc(antw)
438
439         def emContextMenu(self):
440                 self.session.open(ConfigEasyInfo)
441
442         def shotinfo(self):
443                 self["list"].moveToIndex(0)
444                 self.go()
445
446         def shotred(self):
447                 self["list"].moveToIndex(1)
448                 self.go()
449
450         def shotgreen(self):
451                 self["list"].moveToIndex(2)
452                 self.go()
453
454         def shotyellow(self):
455                 self["list"].moveToIndex(3)
456                 self.go()
457
458         def shotblue(self):
459                 self["list"].moveToIndex(4)
460                 self.go()
461
462
463
464 def EINchangeBouquetCB(direction, epg):
465         global EINposition
466         IBbouquets = InfoBar_instance.servicelist.getBouquetList()
467         if EINposition>0 and direction<0:
468                 EINposition = EINposition - 1
469         elif EINposition==0 and direction<0:
470                 EINposition = len(IBbouquets) - 1
471         elif EINposition<(len(IBbouquets)-1) and direction>0:
472                 EINposition = EINposition + 1
473         elif EINposition==(len(IBbouquets)-1) and direction>0:
474                 EINposition = 0
475         IBservices = InfoBar_instance.getBouquetServices(IBbouquets[EINposition][1])
476         if IBservices:
477                 epg.setServices(IBservices)
478
479
480
481 def EINzapTo(NewService):
482         IBbouquets = InfoBar_instance.servicelist.getBouquetList()
483         NewBbouquet = IBbouquets[EINposition][1]
484         InfoBar_instance.servicelist.clearPath()
485         if InfoBar_instance.servicelist.bouquet_root != NewBbouquet:
486                 InfoBar_instance.servicelist.enterPath(InfoBar_instance.servicelist.bouquet_root)
487         InfoBar_instance.servicelist.enterPath(NewBbouquet)
488         InfoBar_instance.servicelist.setCurrentSelection(NewService)
489         InfoBar_instance.servicelist.zap()
490
491
492
493 def EINcallbackFunc(answer):
494         if answer is None: return
495         if EINsession is None: return
496         if not InfoBar_instance: return
497         if answer == "singleepg":
498                 ref=InfoBar_instance.servicelist.getCurrentSelection()
499                 if ref:
500                         InfoBar_instance.servicelist.savedService = ref
501                         EINsession.openWithCallback(InfoBar_instance.servicelist.SingleServiceEPGClosed, EPGSelection, ref, serviceChangeCB = InfoBar_instance.servicelist.changeServiceCB)
502         elif answer == "easypg":
503                 bouquets = InfoBar_instance.servicelist.getBouquetList()
504                 if bouquets is None:
505                         cnt = 0
506                 else:
507                         cnt = len(bouquets)
508                         IBservices = InfoBar_instance.getBouquetServices(bouquets[0][1])
509                 if cnt > 1:
510                         InfoBar_instance.dlg_stack.append(InfoBar_instance.session.open(EasyPG, IBservices, EINzapTo, None, EINchangeBouquetCB))
511                 elif cnt == 1:
512                         InfoBar_instance.dlg_stack.append(InfoBar_instance.session.open(EasyPG, IBservices, EINzapTo, None, None))
513         elif answer == "timers":
514                 EINsession.open(TimerEditList)
515         elif answer == "multiepg":
516                 bouquets = InfoBar_instance.servicelist.getBouquetList()
517                 if bouquets is None:
518                         cnt = 0
519                 else:
520                         cnt = len(bouquets)
521                 if cnt > 1:
522                         InfoBar_instance.bouquetSel = EINsession.openWithCallback(InfoBar_instance.closed, BouquetSelector, bouquets, InfoBar_instance.openBouquetEPG, enableWrapAround=True)
523                         InfoBar_instance.dlg_stack.append(InfoBar_instance.bouquetSel)
524                 elif cnt == 1:
525                         InfoBar_instance.openBouquetEPG(bouquets[0][1], True)
526         elif answer == "eventinfo":
527                 epglist = [ ]
528                 InfoBar_instance.epglist = epglist
529                 service = EINsession.nav.getCurrentService()
530                 ref = EINsession.nav.getCurrentlyPlayingServiceReference()
531                 info = service.info()
532                 ptr=info.getEvent(0)
533                 if ptr:
534                         epglist.append(ptr)
535                 ptr=info.getEvent(1)
536                 if ptr:
537                         epglist.append(ptr)
538                 if epglist:
539                         EINsession.open(EventViewSimple, epglist[0], ServiceReference(ref), InfoBar_instance.eventViewCallback)
540         elif answer == "merlinepg":
541                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/MerlinEPG/plugin.pyo"):
542                         from Plugins.Extensions.MerlinEPG.plugin import Merlin_PGII, Merlin_PGd
543                         if config.plugins.MerlinEPG.Columns.value:
544                                 EINsession.open(Merlin_PGII, InfoBar_instance.servicelist)
545                         else:
546                                 EINsession.open(Merlin_PGd, InfoBar_instance.servicelist)
547                 else:
548                         EINsession.open(MessageBox, text = _('MerlinEPG is not installed!'), type = MessageBox.TYPE_INFO)
549         elif answer == "autotimer":
550                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/AutoTimer/AutoTimerEditor.pyo"):
551                         from Plugins.Extensions.AutoTimer.plugin import main as AutoTimerView
552                         AutoTimerView(EINsession)
553                 else:
554                         EINsession.open(MessageBox, text = _('Autotimer is not installed!'), type = MessageBox.TYPE_INFO)
555         elif answer == "epgsearch":
556                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/EPGSearch/plugin.pyo"):
557                         from Plugins.Extensions.EPGSearch.EPGSearch import EPGSearch
558                         service = EINsession.nav.getCurrentService()
559                         info = service.info()
560                         epg_event=info.getEvent(0)
561                         if epg_event:
562                                 epg_name = epg_event and epg_event.getEventName() or ''
563                                 EINsession.open(EPGSearch, epg_name, False)
564                 else:
565                         EINsession.open(MessageBox, text = _('EPGsearch is not installed!'), type = MessageBox.TYPE_INFO)
566         elif answer == "channelinfo":
567                 EINsession.open(ServiceInfo, InfoBar_instance.servicelist.getCurrentSelection())
568         elif answer == "imdbinfo":
569                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/IMDb/plugin.pyo"):
570                         from Plugins.Extensions.IMDb.plugin import IMDB
571                         service = EINsession.nav.getCurrentService()
572                         info = service.info()
573                         epg_event=info.getEvent(0)
574                         if epg_event:
575                                 IeventName = epg_event.getEventName()
576                                 EINsession.open(IMDB, IeventName)
577                 else:
578                         EINsession.open(MessageBox, text = _('IMDB is not installed!'), type = MessageBox.TYPE_INFO)
579         elif answer == "graphepg":
580                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/GraphMultiEPG/plugin.pyo"):
581                         from Plugins.Extensions.GraphMultiEPG.plugin import main as gmepgmain
582                         gmepgmain(EINsession, InfoBar_instance.servicelist)
583                 else:
584                         EINsession.open(MessageBox, text = _('GraphMultiEPG is not installed!'), type = MessageBox.TYPE_INFO)
585         elif answer == "primetime":
586                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/PrimeTimeManager/plugin.pyo"):
587                         from Plugins.Extensions.PrimeTimeManager.plugin import main as ptmanmain
588                         ptmanmain(EINsession)
589                 else:
590                         EINsession.open(MessageBox, text = _('Prime Time Manager is not installed!'), type = MessageBox.TYPE_INFO)
591         elif answer == "epgrefresh":
592                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/EPGRefresh/plugin.pyo"):
593                         from Plugins.Extensions.EPGRefresh.plugin import main as epgrefmain
594                         epgrefmain(EINsession)
595                 else:
596                         EINsession.open(MessageBox, text = _('EPGRefresh is not installed!'), type = MessageBox.TYPE_INFO)
597         elif answer == "cooltv":
598                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/plugin.pyo"):
599                         from Plugins.Extensions.CoolTVGuide.plugin import main as ctvmain
600                         ctvmain(EINsession, InfoBar_instance.servicelist)
601                 else:
602                         EINsession.open(MessageBox, text = _('CoolTVGuide is not installed!'), type = MessageBox.TYPE_INFO)
603         elif answer == "sysinfo":
604                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/Sherlock/plugin.pyo"):
605                         from Plugins.Extensions.Sherlock.plugin import SherlockII
606                         EINsession.open(SherlockII)
607                 else:
608                         EINsession.open(MessageBox, text = _('Sherlock is not installed!'), type = MessageBox.TYPE_INFO)
609         else:
610                 EINsession.open(MessageBox, text = _('This function is yet not available!'), type = MessageBox.TYPE_INFO)
611
612
613
614 class EasyEvent(Screen, EventViewBase):
615         def __init__(self, session, Event, Ref, callback=None, singleEPGCB=None, multiEPGCB=None):
616                 Screen.__init__(self, session)
617                 self.session = session
618                 self.skinName = "EventView"
619                 EventViewBase.__init__(self, Event, Ref, callback=InfoBar_instance.eventViewCallback)
620                 self["key_yellow"].setText(_(getPluginByName(config.plugins.EasyInfo.bEvInYellow.value)))
621                 self["key_blue"].setText(_(getPluginByName(config.plugins.EasyInfo.bEvInBlue.value)))
622                 self["key_red"].setText(_("Similar"))
623                 self["epgactions"] = ActionMap(["EventViewEPGActions", "EPGSelectActions",  "EventViewActions"],
624                         {
625                                 "openSingleServiceEPG": self.singleEPGCB,
626                                 "openMultiServiceEPG": self.multiEPGCB,
627                                 "openSimilarList": self.openSimilarList,
628                                 "info": self.newExit,
629                                 "pageUp": self.pageUp,
630                                 "pageDown": self.pageDown,
631                                 "prevEvent": self.prevEvent,
632                                 "nextEvent": self.nextEvent
633                         },-1)
634
635         def openSimilarList(self):
636                 self.hide()
637                 EINcallbackFunc("epgsearch")
638                 self.close()
639
640         def singleEPGCB(self):
641                 self.hide()
642                 EINcallbackFunc(config.plugins.EasyInfo.bEvInYellow.value)
643                 self.close()
644
645         def multiEPGCB(self):
646                 self.hide()
647                 EINcallbackFunc(config.plugins.EasyInfo.bEvInBlue.value)
648                 self.close()
649
650         def setEvent(self, event):
651                 self.event = event
652                 if event is None:
653                         return
654                 text = event.getEventName()
655                 short = event.getShortDescription()
656                 ext = event.getExtendedDescription()
657                 if short and short != text:
658                         text += '\n\n' + short
659                 if ext:
660                         if text:
661                                 text += '\n\n'
662                         text += ext
663                 self.setTitle(event.getEventName())
664                 self["epg_description"].setText(text)
665                 self["datetime"].setText(event.getBeginTimeString())
666                 self["duration"].setText(_("%d min")%(event.getDuration()/60))
667                 self["key_red"].setText(_("Similar"))
668                 serviceref = self.currentService
669                 eventid = self.event.getEventId()
670                 refstr = serviceref.ref.toString()
671                 isRecordEvent = False
672                 for timer in self.session.nav.RecordTimer.timer_list:
673                         if timer.eit == eventid and timer.service_ref.ref.toString() == refstr:
674                                 isRecordEvent = True
675                                 break
676                 if isRecordEvent and self.key_green_choice != self.REMOVE_TIMER:
677                         self["key_green"].setText(_("Remove timer"))
678                         self.key_green_choice = self.REMOVE_TIMER
679                 elif not isRecordEvent and self.key_green_choice != self.ADD_TIMER:
680                         self["key_green"].setText(_("Add timer"))
681                         self.key_green_choice = self.ADD_TIMER
682
683         def newExit(self):
684                 self.hide()
685                 self.session.open(EasyInfo)
686                 self.close()
687
688
689
690 class EvNewList(EPGList):
691         def __init__(self, type=EPG_TYPE_MULTI, selChangedCB=None, timer = None):
692                 EPGList.__init__(self, type, selChangedCB, timer)
693                 self.l.setFont(0, gFont("Regular", 20))
694                 self.l.setFont(1, gFont("Regular", 18))
695                 self.l.setItemHeight(50)
696                 self.l.setBuildFunc(self.buildMultiEntry)
697                 self.breite = 200
698                 MyPiconPath = "/"
699
700         def recalcEntrySize(self):
701                 esize = self.l.getItemSize()
702                 self.breite = esize.width() - 200
703
704         def buildMultiEntry(self, changecount, service, eventId, beginTime, duration, EventName, nowTime, service_name):
705                 (clock_pic, rec) = self.getPixmapForEntry(service, eventId, beginTime, duration)
706                 res = [ None ]
707                 sref = str(service)[:-1].replace(':','_')
708                 Spixmap = LoadPixmap(path=(config.plugins.EasyInfo.myPicons.value + sref + '.png'))
709                 if Spixmap is not None:
710                         res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 5, 4, 70, 42, Spixmap))
711                 else:
712                         res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 77, 50, 1, RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, service_name))
713                 if rec:
714                         res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 80, 16, 21, 21, clock_pic))
715                 if beginTime is not None and len(EventName) > 60:
716                         if nowTime < beginTime:
717                                 begin = localtime(beginTime)
718                                 end = localtime(beginTime+duration)
719                                 res.extend((
720                                         (eListboxPythonMultiContent.TYPE_TEXT, 100, 4, 10, 20, 1, RT_HALIGN_RIGHT, '>'),
721                                         (eListboxPythonMultiContent.TYPE_TEXT, 110, 4, 70, 44, 1, RT_HALIGN_LEFT, "%02d.%02d\n%02d.%02d"%(begin[3],begin[4],end[3],end[4])),
722                                         (eListboxPythonMultiContent.TYPE_TEXT, 180, 1, self.breite, 48, 0, RT_HALIGN_LEFT|RT_VALIGN_TOP|RT_WRAP, EventName)
723                                 ))
724                         else:
725                                 percent = (nowTime - beginTime)*100/duration
726                                 restzeit = ((beginTime+duration)-nowTime)
727                                 res.extend((
728                                         (eListboxPythonMultiContent.TYPE_PROGRESS, 110, 11, 40, 8, percent),
729                                         (eListboxPythonMultiContent.TYPE_TEXT, 110, 25, 60, 22, 1, RT_HALIGN_LEFT, "+%d:%02d" % (restzeit/3600, (restzeit/60)-((restzeit /3600)*60))),
730                                         (eListboxPythonMultiContent.TYPE_TEXT, 180, 1, self.breite, 48, 0, RT_HALIGN_LEFT|RT_VALIGN_TOP|RT_WRAP, EventName)
731                                 ))
732                 elif beginTime is not None:
733                         if nowTime < beginTime:
734                                 begin = localtime(beginTime)
735                                 end = localtime(beginTime+duration)
736                                 res.extend((
737                                         (eListboxPythonMultiContent.TYPE_TEXT, 100, 4, 10, 20, 1, RT_HALIGN_RIGHT, '>'),
738                                         (eListboxPythonMultiContent.TYPE_TEXT, 110, 4, 70, 44, 1, RT_HALIGN_LEFT, "%02d.%02d\n%02d.%02d"%(begin[3],begin[4],end[3],end[4])),
739                                         (eListboxPythonMultiContent.TYPE_TEXT, 180, 1, self.breite, 48, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER|RT_WRAP, EventName)
740                                 ))
741                         else:
742                                 percent = (nowTime - beginTime)*100/duration
743                                 restzeit = ((beginTime+duration)-nowTime)
744                                 res.extend((
745                                         (eListboxPythonMultiContent.TYPE_PROGRESS, 110, 11, 40, 8, percent),
746                                         (eListboxPythonMultiContent.TYPE_TEXT, 110, 25, 60, 22, 1, RT_HALIGN_LEFT, "+%d:%02d" % (restzeit/3600, (restzeit/60)-((restzeit /3600)*60))),
747                                         (eListboxPythonMultiContent.TYPE_TEXT, 180, 1, self.breite, 48, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER|RT_WRAP, EventName)
748                                 ))
749                 return res
750
751
752
753 class EasyPG(EPGSelection, Screen):
754         if SKINTYPE == 3:
755                 skin = """
756                 <screen name="EasyPG" backgroundColor="#101220" flags="wfNoBorder" position="0,0" size="1280,720" title="Easy PG">
757                         <ePixmap alphatest="on" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/lines.png" position="60,35" size="660,650" zPosition="-1"/>
758                         <widget font="Regular;20" position="785,30" render="Label" size="202,25" source="global.CurrentTime" transparent="1" zPosition="1">
759                                 <convert type="ClockToText">Format:%a %d. %b   %H:%M</convert>
760                         </widget>
761                         <widget backgroundColor="#ff000000" position="755,125" render="Pig" size="497,280" source="session.VideoPicture" zPosition="1"/>
762                         <widget foregroundColor="#fcc000" font="Regular;20" name="date" position="755,415" size="100,25" transparent="1"/>
763                         <widget name="list" position="60,35" scrollbarMode="showNever" size="660,650" transparent="1"/>
764                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-red.png" position="785,65" size="5,20"/>
765                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-green.png" position="785,90" size="5,20"/>
766                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-yellow.png" position="1005,65" size="5,20"/>
767                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-blue.png" position="1005,90" size="5,20"/>
768                         <eLabel font="Regular;18" position="800,63" size="150,25" text="Similar" transparent="1"/>
769                         <eLabel font="Regular;18" position="800,90" size="150,25" text="Timer" transparent="1"/>
770                         <eLabel font="Regular;18" position="1015,63" size="150,25" text="Back" transparent="1"/>
771                         <eLabel font="Regular;18" position="1015,90" size="150,25" text="Next" transparent="1"/>
772                         <widget font="Regular;20" halign="right" position="870,415" render="Label" size="70,25" source="Event" transparent="1" zPosition="1">
773                                 <convert type="EventTime">StartTime</convert>
774                                 <convert type="ClockToText">Default</convert>
775                         </widget>
776                         <eLabel font="Regular;18" position="945,415" size="10,25" text="-" transparent="1"/>
777                         <widget font="Regular;20" position="955,415" render="Label" size="70,25" source="Event" transparent="1" zPosition="1">
778                                 <convert type="EventTime">EndTime</convert>
779                                 <convert type="ClockToText">Default</convert>
780                         </widget>
781                         <widget font="Regular;20" position="1050,415" render="Label" size="171,25" source="Event" transparent="1" zPosition="1">
782                         <convert type="EventTime">Duration</convert>
783                                 <convert type="ClockToText">InMinutes</convert>
784                         </widget>
785                         <widget font="Regular;20" position="755,445" render="Label" size="480,25" source="Event" transparent="1" zPosition="2" noWrap="1">
786                                 <convert type="EventName">ShortDescription</convert>
787                         </widget>
788                         <widget font="Regular;18" position="755,475" render="Label" size="480,210" source="Event" transparent="1" zPosition="3">
789                                 <convert type="EventName">ExtendedDescription</convert>
790                         </widget>
791                 </screen>"""
792         elif SKINTYPE == 2:
793                 skin = """
794                 <screen name="EasyPG" backgroundColor="#0e1018" flags="wfNoBorder" position="0,0" size="1024,576" title="Easy PG">
795                         <ePixmap alphatest="on" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/lines.png" position="50,50" size="520,450" zPosition="-1"/>
796                         <eLabel backgroundColor="#666666" position="0,518" size="1024,1"/>
797                         <widget font="Regular;20" position="50,525" render="Label" size="186,25" source="global.CurrentTime" transparent="1" zPosition="1">
798                                 <convert type="ClockToText">Format:%a %d. %b   %H:%M</convert>
799                         </widget>
800                         <widget backgroundColor="#ff000000" position="590,30" render="Pig" size="384,216" source="session.VideoPicture" zPosition="-1"/>
801                         <widget foregroundColor="#fcc000" font="Regular;20" name="date" position="590,255" size="100,25" transparent="1"/>
802                         <widget name="list" position="50,48" scrollbarMode="showNever" size="520,450" transparent="1"/>
803                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-red.png" position="275,525" size="5,20"/>
804                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-green.png" position="450,525" size="5,20"/>
805                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-yellow.png" position="625,525" size="5,20"/>
806                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-blue.png" position="800,525" size="5,20"/>
807                         <eLabel font="Regular;18" position="290,526" size="150,25" text="Similar" transparent="1"/>
808                         <eLabel font="Regular;18" position="465,526" size="150,25" text="Timer" transparent="1"/>
809                         <eLabel font="Regular;18" position="640,526" size="150,25" text="Back" transparent="1"/>
810                         <eLabel font="Regular;18" position="815,526" size="150,25" text="Next" transparent="1"/>
811                         <widget font="Regular;20" halign="right" position="695,255" render="Label" size="70,25" source="Event" transparent="1" zPosition="1">
812                                 <convert type="EventTime">StartTime</convert>
813                                 <convert type="ClockToText">Default</convert>
814                         </widget>
815                         <eLabel font="Regular;18" position="770,255" size="10,25" text="-" transparent="1"/>
816                         <widget font="Regular;20" position="780,255" render="Label" size="70,25" source="Event" transparent="1" zPosition="1">
817                                 <convert type="EventTime">EndTime</convert>
818                                 <convert type="ClockToText">Default</convert>
819                         </widget>
820                         <widget font="Regular;20" position="855,255" render="Label" size="130,25" source="Event" transparent="1" zPosition="1">
821                         <convert type="EventTime">Duration</convert>
822                                 <convert type="ClockToText">InMinutes</convert>
823                         </widget>
824                         <widget font="Regular;20" noWrap="1" position="590,285" render="Label" size="390,25" source="Event" transparent="1" zPosition="2">
825                                 <convert type="EventName">ShortDescription</convert>
826                         </widget>
827                         <widget font="Regular;18" position="590,315" render="Label" size="390,190" source="Event" transparent="1" zPosition="3">
828                                 <convert type="EventName">ExtendedDescription</convert>
829                         </widget>
830                 </screen>
831                 """
832         else:
833                 skin = """
834                 <screen name="EasyPG" backgroundColor="background" flags="wfNoBorder" position="0,0" size="720,576" title="Easy PG">
835                         <ePixmap alphatest="on" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/lines.png" position="50,48" size="620,450" zPosition="-1"/>
836                         <eLabel backgroundColor="#666666" position="0,522" size="756,1"/>
837                         <widget foregroundColor="#fcc000" font="Regular;20" name="date" position="50,525" size="100,25" transparent="1"/>
838                         <widget name="list" position="50,48" scrollbarMode="showOnDemand" size="620,450" transparent="1"/>
839                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-red.png" position="175,525" size="5,20"/>
840                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-yellow.png" position="350,525" size="5,20"/>
841                         <ePixmap alphatest="blend" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyInfo/key-blue.png" position="525,525" size="5,20"/>
842                         <eLabel font="Regular;18" position="190,526" size="150,25" text="Similar" transparent="1"/>
843                         <eLabel font="Regular;18" position="365,526" size="150,25" text="Back" transparent="1"/>
844                         <eLabel font="Regular;18" position="540,526" size="150,25" text="Next" transparent="1"/>
845                 </screen>
846                 """
847         def __init__(self, session, service, zapFunc=None, eventid=None, bouquetChangeCB=None, serviceChangeCB=None):
848                 Screen.__init__(self, session)
849                 EPGSelection.__init__(self, session, service, zapFunc, eventid, bouquetChangeCB, serviceChangeCB)
850                 global EINposition
851                 EINposition = 0
852                 self.PTinit = False
853                 self.session = session
854                 EPGSelection.skinName = "EasyPG"
855                 self.PThour = config.plugins.EasyInfo.Primetime2.value[0]
856                 self.PTmin = config.plugins.EasyInfo.Primetime2.value[1]
857                 self["list"] = EvNewList(type = EPG_TYPE_MULTI, selChangedCB = self.onSelectionChanged, timer = session.nav.RecordTimer)
858                 self.skinName = "EasyPG"
859                 self.RefrTimer = eTimer()
860                 self.RefrTimer.callback.append(self.RefreshEPG)
861                 self["actions"] = ActionMap(["EPGSelectActions", "OkCancelActions", "NumberActions", "InfobarActions"],
862                         {
863                                 "cancel": self.closeScreen,
864                                 "ok": self.newOKFunc,
865                                 "timerAdd": self.timerAdd,
866                                 "yellow": self.yellowButtonPressed,
867                                 "blue": self.blueButtonPressed,
868                                 "info": self.infoKeyPressed,
869                                 "red": self.newRedFunc,
870                                 "input_date_time": self.einContextMenu,
871                                 "nextBouquet": self.nextBouquet,
872                                 "prevBouquet": self.prevBouquet,
873                                 "nextService": self.PTfor,
874                                 "prevService": self.PTback,
875                                 "showMovies": self.enterDateTime,
876                                 "showTv": self.zapTo,
877                                 "showRadio": self.zapForRefr,
878                                 "0": self.GoFirst,
879                                 "1": self.SetPT1,
880                                 "2": self.SetPT2,
881                                 "3": self.SetPT3
882                         },-1)
883
884         def closeScreen(self):
885                 self.close(True)
886
887         def GoFirst(self):
888                 self["list"].fillMultiEPG(self.services, -1)
889                 self.PTinit = False
890
891         def GoPrimetime(self):
892                 heute = localtime()
893                 pt = (heute[0],heute[1],heute[2],self.PThour,self.PTmin,0,heute[6],heute[7],0)
894                 self.ask_time = int(mktime(pt))
895                 self.PTinit = True
896                 if self.ask_time > int(mktime(heute)):
897                         self["list"].fillMultiEPG(self.services, self.ask_time)
898
899         def newOKFunc(self):
900                 if  config.plugins.EasyInfo.epgOKFunc.value == "exitzap":
901                         self.zapTo()
902                         self.close(True)
903                 elif config.plugins.EasyInfo.epgOKFunc.value == "zap":
904                         self.zapTo()
905                 else:
906                         self.infoKeyPressed()
907
908         def newRedFunc(self):
909                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/EPGSearch/plugin.pyo"):
910                         from Plugins.Extensions.EPGSearch.EPGSearch import EPGSearch
911                         epg_event = self["list"].getCurrent()[0]
912                         if epg_event:
913                                 epg_name = epg_event and epg_event.getEventName() or ''
914                                 self.session.open(EPGSearch, epg_name, False)
915                 else:
916                         self.session.open(MessageBox, text = _('EPGsearch is not installed!'), type = MessageBox.TYPE_INFO)
917
918         def PTfor(self):
919                 if not self["list"].getCurrent()[0]:
920                         return
921                 heute = localtime()
922                 if not self.PTinit:
923                         pt = (heute[0],heute[1],heute[2],self.PThour,self.PTmin,0,heute[6],heute[7],0)
924                         self.ask_time = int(mktime(pt))
925                         self.PTinit = True
926                         if self.ask_time < int(mktime(heute)):
927                                 self.ask_time = self.ask_time + 86400
928                 else:
929                         self.ask_time = self.ask_time + 86400
930                 self["list"].fillMultiEPG(self.services, self.ask_time)
931
932         def PTback(self):
933                 heute = localtime()
934                 if not self.PTinit:
935                         pt = (heute[0],heute[1],heute[2],self.PThour,self.PTmin,0,heute[6],heute[7],0)
936                         self.ask_time = int(mktime(pt))
937                         self.PTinit = True
938                 else:
939                         self.ask_time = self.ask_time - 86400
940                 if self.ask_time > int(mktime(heute)):
941                         self["list"].fillMultiEPG(self.services, self.ask_time)
942                 else:
943                         self["list"].fillMultiEPG(self.services, -1)
944                         self.PTinit = False
945
946         def SetPT1(self):
947                 self.PThour = config.plugins.EasyInfo.Primetime1.value[0]
948                 self.PTmin = config.plugins.EasyInfo.Primetime1.value[1]
949                 self.GoPrimetime()
950
951         def SetPT2(self):
952                 self.PThour = config.plugins.EasyInfo.Primetime2.value[0]
953                 self.PTmin = config.plugins.EasyInfo.Primetime2.value[1]
954                 self.GoPrimetime()
955
956         def SetPT3(self):
957                 self.PThour = config.plugins.EasyInfo.Primetime3.value[0]
958                 self.PTmin = config.plugins.EasyInfo.Primetime3.value[1]
959                 self.GoPrimetime()
960
961         def einContextMenu(self):
962                 self.session.open(ConfigEasyInfo)
963
964         def zapForRefr(self):
965                 self.zapTo()
966                 self.RefrTimer.start(4000, True)
967
968         def RefreshEPG(self):
969                 self.RefrTimer.stop()
970                 self.GoFirst()
971                 
972
973
974
975
976
977
978
979
980         
981
982
983
984