+
+ def applyButtonState(self, state):
+ if state == 0:
+ self["now_button"].hide()
+ self["now_button_sel"].hide()
+ self["next_button"].hide()
+ self["next_button_sel"].hide()
+ self["more_button"].hide()
+ self["more_button_sel"].hide()
+ self["now_text"].hide()
+ self["next_text"].hide()
+ self["more_text"].hide()
+ self["key_red"].setText("")
+ else:
+ if state == 1:
+ self["now_button_sel"].show()
+ self["now_button"].hide()
+ else:
+ self["now_button"].show()
+ self["now_button_sel"].hide()
+
+ if state == 2:
+ self["next_button_sel"].show()
+ self["next_button"].hide()
+ else:
+ self["next_button"].show()
+ self["next_button_sel"].hide()
+
+ if state == 3:
+ self["more_button_sel"].show()
+ self["more_button"].hide()
+ else:
+ self["more_button"].show()
+ self["more_button_sel"].hide()
+
+ def onSelectionChanged(self):
+ cur = self["list"].getCurrent()
+ if cur is None:
+ if self.key_green_choice != self.EMPTY:
+ self["key_green"].setText("")
+ self.key_green_choice = self.EMPTY
+ if self.key_red_choice != self.EMPTY:
+ self["key_red"].setText("")
+ self.key_red_choice = self.EMPTY
+ return
+ event = cur[0]
+ self["Event"].newEvent(event)
+ if self.type == EPG_TYPE_MULTI:
+ count = self["list"].getCurrentChangeCount()
+ if self.ask_time != -1:
+ self.applyButtonState(0)
+ elif count > 1:
+ self.applyButtonState(3)
+ elif count > 0:
+ self.applyButtonState(2)
+ else:
+ self.applyButtonState(1)
+ days = [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ]
+ datestr = ""
+ 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)
+ if cur[1] is None:
+ self["Service"].newService(None)
+ else:
+ self["Service"].newService(cur[1].ref)
+
+ if cur[1] is None or cur[1].getServiceName() == "":
+ if self.key_green_choice != self.EMPTY:
+ self["key_green"].setText("")
+ self.key_green_choice = self.EMPTY
+ if self.key_red_choice != self.EMPTY:
+ self["key_red"].setText("")
+ self.key_red_choice = self.EMPTY
+ return
+ elif self.key_red_choice != self.ZAP and self.type == EPG_TYPE_MULTI:
+ self["key_red"].setText("Zap")
+ self.key_red_choice = self.ZAP
+
+ if event is None:
+ if self.key_green_choice != self.EMPTY:
+ self["key_green"].setText("")
+ self.key_green_choice = self.EMPTY
+ return
+
+ serviceref = cur[1]
+ eventid = event.getEventId()
+ refstr = serviceref.ref.toString()
+ isRecordEvent = False
+ for timer in self.session.nav.RecordTimer.timer_list:
+ if timer.eit == eventid and timer.service_ref.ref.toString() == refstr:
+ isRecordEvent = True
+ break
+ if isRecordEvent and self.key_green_choice != self.REMOVE_TIMER:
+ self["key_green"].setText(_("Remove timer"))
+ self.key_green_choice = self.REMOVE_TIMER
+ elif not isRecordEvent and self.key_green_choice != self.ADD_TIMER:
+ self["key_green"].setText(_("Add timer"))
+ self.key_green_choice = self.ADD_TIMER