def __onBSListReceived(self, sessions): result = [] for bs in sessions: result.append({'prbID': bs.prbID, 'prbType': bs.prbType, 'descr': formatters.getPrebattleFullDescription(bs.description), 'opponents': formatters.getPrebattleOpponentsString(bs.description), 'startTime': formatters.getBattleSessionStartTimeString(bs.startTime)}) self.as_refreshListS(result)
def __onBSListReceived(self, sessions): result = [] clanDBID = self.__webCtrl.getClanDbID() for bs in sessions: detachment, vehicleLvl, _ = formatters.getBattleSessionDetachment(bs.description, clanDBID) if bs.prbType == PREBATTLE_TYPE.CLAN: startTime = self.__getClanBattleStartTime(bs) else: startTime = formatters.getBattleSessionStartTimeString(bs.startTime) result.append({'prbID': bs.prbID, 'prbType': bs.prbType, 'descr': formatters.getPrebattleFullDescription(bs.description), 'opponents': formatters.getPrebattleOpponentsString(bs.description), 'startTime': startTime, 'unitName': detachment, 'vehicleLevel': vehicleLvl}) self.as_refreshListS(result)
def __addNotification(self, invite): formatted = g_settings.htmlTemplates.format( 'inviteToSpecialBattle', ctx={ 'icon': self.NOTIFICATION_ICON.get(invite.prbType, self.NOTIFICATION_ICON_DEFAULT), 'text': u'%s, %s' % (unicode(getPrebattleFullDescription(invite.description), 'utf-8'), unicode(getBattleSessionStartTimeString(invite.startTime), 'utf-8')) }) self.__notifications.append(formatted) if self._activated: if self._view: self._view.as_addMessageS(formatted) else: events_dispatcher.notifyCarousel(self._channel.getClientID())
def getText(self, invite): return u'%s, %s' % (unicode( getPrebattleFullDescription(invite.description), 'utf-8' ), unicode(getBattleSessionStartTimeString(invite.startTime), 'utf-8'))
def getText(self, invite): return u'%s, %s' % (unicode(getPrebattleFullDescription(invite.description), 'utf-8'), unicode(getBattleSessionStartTimeString(invite.startTime), 'utf-8'))
def __addNotification(self, invite): formatted = g_settings.htmlTemplates.format('inviteToSpecialBattle', ctx={'icon': self.NOTIFICATION_ICON.get(invite.prbType, self.NOTIFICATION_ICON_DEFAULT), 'text': u'%s, %s' % (unicode(getPrebattleFullDescription(invite.description), 'utf-8'), unicode(getBattleSessionStartTimeString(invite.startTime), 'utf-8'))}) self.__notifications.append(formatted) if self._activated: if self._view: self._view.as_addMessageS(formatted) else: events_dispatcher.notifyCarousel(self._channel.getClientID())