def _populateMonthEvents(self):
        calendar = self.getCalendar()
        if calendar is not None:
            result = []
            for dayStartTimestamp, battles in self._getBattlesByDay().iteritems():
                if time_utils.isFuture(dayStartTimestamp):
                    tooltipHead = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_FUTURE_HEADER, count=len(battles))
                    tooltipBody = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_FUTURE_BODY)
                    iconSource = RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_DEFENCEFUTUREBG
                elif time_utils.isToday(dayStartTimestamp):
                    finishedBattles = [ b for b in battles if b.isEnded() ]
                    upcomingBattles = [ b for b in battles if b.isPlanned() ]
                    if not upcomingBattles:
                        tooltipHead = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_PAST_HEADER, count=len(finishedBattles))
                        tooltipBody = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_PAST_BODY)
                        iconSource = RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_DEFENCEPASTBG
                    else:
                        tooltipHead = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_FUTURE_HEADER, count=len(upcomingBattles))
                        tooltipBody = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_FUTURE_BODY)
                        iconSource = RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_DEFENCEFUTUREBG
                else:
                    tooltipHead = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_PAST_HEADER, count=len(battles))
                    tooltipBody = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_PAST_BODY)
                    iconSource = RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_DEFENCEPASTBG
                result.append({'tooltipHeader': tooltipHead,
                 'tooltipBody': tooltipBody,
                 'iconSource': iconSource,
                 'rawDate': dayStartTimestamp})

            calendar.as_updateMonthEventsS(result)
        return
    def _populateMonthEvents(self):
        calendar = self.getCalendar()
        if calendar is not None:
            result = []
            for dayStartTimestamp, battles in self._getBattlesByDay().iteritems():
                if time_utils.isFuture(dayStartTimestamp):
                    tooltipHead = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_FUTURE_HEADER, count=len(battles))
                    tooltipBody = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_FUTURE_BODY)
                    iconSource = RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_DEFENCEFUTUREBG
                elif time_utils.isToday(dayStartTimestamp):
                    finishedBattles = [ b for b in battles if b.isEnded() ]
                    upcomingBattles = [ b for b in battles if b.isPlanned() ]
                    if not upcomingBattles:
                        tooltipHead = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_PAST_HEADER, count=len(finishedBattles))
                        tooltipBody = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_PAST_BODY)
                        iconSource = RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_DEFENCEPASTBG
                    else:
                        tooltipHead = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_FUTURE_HEADER, count=len(upcomingBattles))
                        tooltipBody = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_FUTURE_BODY)
                        iconSource = RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_DEFENCEFUTUREBG
                else:
                    tooltipHead = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_PAST_HEADER, count=len(battles))
                    tooltipBody = _ms(FORTIFICATIONS.FORTCALENDARWINDOW_CALENDAR_DAYTOOLTIP_PAST_BODY)
                    iconSource = RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_DEFENCEPASTBG
                result.append({'tooltipHeader': tooltipHead,
                 'tooltipBody': tooltipBody,
                 'iconSource': iconSource,
                 'rawDate': dayStartTimestamp})

            calendar.as_updateMonthEventsS(result)
Exemple #3
0
 def scheduleTask(self, task):
     if TaskScheduler.isTaskValid(task) and time_utils.isFuture(task.getTime()):
         if self.__bwCbId is not None:
             schTask = self.__queue[0]
             if task.getId() == schTask.getId() or task.getTime() < schTask.getTime():
                 self._cancelBigWorldCb()
         self._addTask(task)
         self._processQueue()
     return
 def scheduleTask(self, task):
     if TaskScheduler.isTaskValid(task) and time_utils.isFuture(task.getTime()):
         if self.__bwCbId is not None:
             schTask = self.__queue[0]
             if task.getId() == schTask.getId() or task.getTime() < schTask.getTime():
                 self._cancelBigWorldCb()
         self._addTask(task)
         self._processQueue()
     return
 def _processNotification(self, notification):
     typeID = notification.getType()
     if typeID in self.__notificationTypes:
         vt = notification.getVisibilityTime()
         if vt is not None:
             if time_utils.isFuture(vt):
                 self.__visibilitySch.scheduleTask(Task((typeID, notification.getID()), vt, self.__onInviteVisibilityChanged, None))
             else:
                 self._model.removeNotification(typeID, notification.getID())
     return
Exemple #6
0
 def _processNotification(self, notification):
     typeID = notification.getType()
     if typeID in self.__notificationTypes:
         vt = notification.getVisibilityTime()
         if vt is not None:
             if time_utils.isFuture(vt):
                 self.__visibilitySch.scheduleTask(Task((typeID, notification.getID()), vt, self.__onInviteVisibilityChanged, None))
             else:
                 self._model.removeNotification(typeID, notification.getID())
     return