Пример #1
0
 def up(self):
     if self.current_y == 0:
         if self.start_channel_id - settings.getDisplayChannelsCount() < 0:
             self.start_channel_id = 0
         else:
             self.start_channel_id -= settings.getDisplayChannelsCount()
         self.displayChannels()
         self.setFocus(0, settings.getDisplayChannelsCount() - 1)
         self.setTimesLabels()
     else:
         self.current_y -= 1
         self.current_x = 0
         self.setFocus(self.current_x, self.current_y)
Пример #2
0
 def down(self):
     if len(self.currentGrid) - 1 == self.current_y:
         if (self.start_channel_id + settings.getDisplayChannelsCount()) > (
                 self.getChannelsCount() -
                 settings.getDisplayChannelsCount()):
             self.start_channel_id = self.getChannelsCount(
             ) - settings.getDisplayChannelsCount()
         else:
             self.start_channel_id += settings.getDisplayChannelsCount()
         self.displayChannels()
         self.setFocus(0, 0)
         self.setTimesLabels()
     else:
         self.current_y += 1
         self.current_x = 0
         self.setFocus(self.current_x, self.current_y)
Пример #3
0
    def __getGridPortion(self):
        def __removeDuplicates(plist):
            rem = []
            for i in range(len(plist)):
                for y in range(len(plist)):
                    if y != i and int(plist[y]["start"]) == int(
                            plist[i]["start"]):
                        idx = i if int(plist[y]["end"]) > int(
                            plist[i]["end"]) else y
                        if not idx in rem:
                            rem.append(idx)
                        break
            remrt = []
            for i in range(len(plist)):
                if not i in rem:
                    remrt.append(plist[i])
            return remrt

        grid = self.globalGrid[self.start_channel_id:self.start_channel_id +
                               settings.getDisplayChannelsCount()]
        tbr = []
        for channel in grid:
            programs = []
            for program in __removeDuplicates(channel["programs"]):

                stop = strToDatetime(program["end"])
                start = strToDatetime(program["start"])

                if stop > self.start_time and start < self.stop_time:
                    programs.append(program)

            tbr.append({
                "db_id": channel["db_id"],
                "id_channel": channel["id_channel"],
                "display_name": channel["display_name"],
                "programs": programs,
                "logo": channel["logo"]
            })
        return tbr
Пример #4
0
    def __init__(self, window):

        self.window = window
        self.start_time = self.stop_time = None
        self.start_channel_id = 0

        globalControl = self.window.getControl(EPGControl.GLOBAL_CONTROL)
        self.left, self.top = globalControl.getPosition()
        self.right = self.left + globalControl.getWidth()
        self.bottom = self.top + globalControl.getHeight()
        self.width = globalControl.getWidth()
        self.cellHeight = globalControl.getHeight(
        ) / settings.getDisplayChannelsCount()

        start_time = datetime.now()
        self.start_time = start_time.replace(
            minute=(0 if start_time.minute <= 29 else 30))
        self.stop_time = self.start_time + timedelta(
            minutes=settings.getTimelineToDisplay() - 2)

        self.setEPGBackgrounds()
        self.setTimeMarker(timer=True)
        self.setTimesLabels()