Exemplo n.º 1
0
 def __updateClubData(self):
     resultVO = _IntroViewVO()
     club = self.getClub()
     if self.clubsState.getStateID() == CLIENT_CLUB_STATE.HAS_CLUB and club:
         profile = self.clubsCtrl.getProfile()
         limits = self.clubsCtrl.getLimits()
         resultVO.setClubLabel(club.getUserName())
         resultVO.setClubDBbID(club.getClubDbID())
         resultVO.setClubLadderChevron(club)
         resultVO.showAdditionalButton(_ms(CYBERSPORT.WINDOW_INTRO_ADDITIONALBTN_LIST), TOOLTIPS.CYBERSPORT_INTRO_ADDITIONALBTN)
         resultVO.moveToTheUnitByCreateButton()
         resultVO.openClubProfileByChevronClick()
         if club.hasActiveUnit():
             unitInfo = club.getUnitInfo()
             resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_JOINTEAM), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_JOINTEAM)
             if unitInfo.isInBattle():
                 isInBattleIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_SWORDSICON, 16, 16, -3, 0)
                 resultVO.setClubDescription(text_styles.neutral('%s %s' % (isInBattleIcon, _ms(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_TEAMINBATTLE))))
             else:
                 resultVO.setClubDescription(text_styles.neutral(CYBERSPORT.STATICFORMATIONPROFILEWINDOW_STATUSLBL_CLUBISCALLED))
         else:
             canCreateUnit = limits.canCreateUnit(profile, club)
             if canCreateUnit.success:
                 resultVO.setClubDescription(text_styles.neutral(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_ASSEMBLINGTEAM))
                 resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ASSEMBLETEAM), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_ASSEMBLETEAM)
             elif canCreateUnit.reason == CLIENT_CLUB_RESTRICTIONS.NOT_ENOUGH_MEMBERS:
                 if club.getPermissions().isOwner():
                     resultVO.setClubDescription(text_styles.main(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_NOTENOUGHPLAYERS))
                     resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ADDPLAYERS), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_ADDPLAYERS)
                 else:
                     resultVO.setClubDescription(text_styles.error(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_OWNERASSEMBLINGTEAM), isBackVisible=True)
                     resultVO.showCreateButton(_ms('#cybersport:window/intro/create/btn/private/seeStaff'), '#tooltips:cyberSport/intro/createBtn/addPlayers/private')
                 resultVO.needAddPlayers()
             else:
                 resultVO.setClubDescription(text_styles.error(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_NOTENOUGHPERMISSIONS_ASSEMBLINGTEAM), isBackVisible=True)
                 resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ASSEMBLETEAM), '#tooltips:StaticFormationProfileWindow/actionBtn/notEnoughPermissions', enabled=False)
     elif self.clubsState.getStateID() == CLIENT_CLUB_STATE.NO_CLUB:
         resultVO.setNoClubChevron(isApplicationSent=False)
         resultVO.setClubLabel(_ms(CYBERSPORT.WINDOW_INTRO_TEAM_HEADER_STATICTEAMS))
         resultVO.setClubDescription(text_styles.main(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_CREATEORFIND))
         resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_LOOK), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_LOOK)
     elif self.clubsState.getStateID() == CLIENT_CLUB_STATE.SENT_APP:
         resultVO.setNoClubChevron(isApplicationSent=True)
         resultVO.openClubProfileByChevronClick()
         if club is not None:
             resultVO.setClubLabel(club.getUserName())
             resultVO.setClubLadderChevron(club)
         resultVO.setClubDescription(text_styles.neutral(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_WAITINGFORREQUEST))
         resultVO.showCancelButton(_ms(CYBERSPORT.WINDOW_INTRO_CANCEL_BTN_LABEL), TOOLTIPS.CYBERSPORT_INTRO_CANCELBTN)
         resultVO.showAdditionalButton(_ms(CYBERSPORT.WINDOW_INTRO_ADDITIONALBTN_LIST), TOOLTIPS.CYBERSPORT_INTRO_ADDITIONALBTN)
     else:
         resultVO.fillDefault()
         resultVO.acceptNavigationByChevron(False)
     if isHourInForbiddenList(self.clubsCtrl.getAvailabilityCtrl().getForbiddenHours()):
         resultVO.setClubDescriptionTooltip(TOOLTIPS_CONSTANTS.LADDER_REGULATIONS)
         resultVO.setClubDescription('{0}{1}'.format(icons.alert(), text_styles.main(CYBERSPORT.LADDERREGULATIONS_WARNING)), True)
     self.as_setStaticTeamDataS(resultVO.getData())
     return
Exemplo n.º 2
0
 def __updateActionButton(self, club):
     labels, isEnableActionBtn, action = self.__getButtonInfo(club)
     data = {'buttonLabel': labels[0],
      'statusLbl': labels[1],
      'tooltipHeader': labels[2],
      'tooltipBody': labels[3],
      'action': action,
      'enabled': isEnableActionBtn}
     if isHourInForbiddenList(self.clubsCtrl.getAvailabilityCtrl().getForbiddenHours()):
         data['statusLbl'] = '{0}{1}'.format(icons.alert(), text_styles.main(CYBERSPORT.LADDERREGULATIONS_WARNING))
         data['isTooltipStatus'] = True
         data['tooltipStatus'] = TOOLTIPS_CONSTANTS.LADDER_REGULATIONS
     self.as_updateActionButtonS(data)
Exemplo n.º 3
0
 def __updateActionButton(self, club):
     labels, isEnableActionBtn, action, canPerformAction = self.__getButtonInfo(club)
     data = {'buttonLabel': labels[0],
      'statusLbl': labels[1],
      'tooltipHeader': labels[2],
      'tooltipBody': labels[3],
      'action': action,
      'enabled': isEnableActionBtn}
     if canPerformAction and isHourInForbiddenList(self.clubsCtrl.getAvailabilityCtrl().getForbiddenHours()):
         data['statusLbl'] = '{0}{1}'.format(icons.alert(), text_styles.main(CYBERSPORT.LADDERREGULATIONS_WARNING))
         data['isTooltipStatus'] = True
         data['tooltipStatus'] = TOOLTIPS_CONSTANTS.LADDER_REGULATIONS
     self.as_updateActionButtonS(data)
 def __updateHeader(self):
     club = self.clubsCtrl.getClub(self.__clubDBID)
     canSetRanked = club is not None and club.getPermissions().canSetRanked()
     seasonState = self.clubsCtrl.getSeasonState()
     modeLabel = ''
     modeTooltip = ''
     modeTooltipType = ''
     isFixedMode = True
     isModeTooltip = False
     if self.__extra.isRatedBattle:
         isFixedMode = not canSetRanked
         if canSetRanked:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETUNRANKEDMODE
         else:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_RANKEDMODE
     elif seasonState.isSuspended():
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSED
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.COMPLEX
         modeTooltip = makeTooltip(CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSEDTOOLTIP_HEADER, CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSEDTOOLTIP_BODY)
     elif seasonState.isFinished():
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHED
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.COMPLEX
         modeTooltip = makeTooltip(CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHEDTOOLTIP_HEADER, CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHEDTOOLTIP_BODY)
     elif canSetRanked:
         isFixedMode = False
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETRANKEDMODE
     if len(modeLabel):
         if canSetRanked and seasonState.isActive() or self.__extra.isRatedBattle:
             modeLabel = text_styles.neutral(modeLabel)
         else:
             modeLabel = text_styles.standard(modeLabel)
     if isHourInForbiddenList(self.clubsCtrl.getAvailabilityCtrl().getForbiddenHours()):
         modeLabel = '{0}{1}'.format(icons.alert(), text_styles.main(CYBERSPORT.LADDERREGULATIONS_WARNING))
         isFixedMode = True
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.LADDER_REGULATIONS
     bgSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_LEAGUERIBBONS_UNRANKED
     battles = self.ABSENT_VALUES
     winRate = self.ABSENT_VALUES
     leagueIcon = getLadderChevron64x64()
     enableWinRateTF = False
     if club is not None:
         clubTotalStats = club.getTotalDossier().getTotalStats()
         battles = BigWorld.wg_getNiceNumberFormat(clubTotalStats.getBattlesCount())
         division = club.getLadderInfo().division
         leagueIcon = getLadderChevron64x64(division)
         winRateValue = ProfileUtils.getValueOrUnavailable(clubTotalStats.getWinsEfficiency())
         if winRateValue != ProfileUtils.UNAVAILABLE_VALUE:
             enableWinRateTF = True
             winRate = ProfileUtils.formatFloatPercent(winRateValue)
         else:
             winRate = self.ABSENT_VALUES
         if self.__extra.isRatedBattle:
             bgSource = getLadderBackground(division)
         self.requestClubEmblem64x64(club.getClubDbID(), club.getEmblem64x64())
     self.as_setHeaderDataS({'clubId': self.__extra.clubDBID,
      'teamName': self.__extra.clubName,
      'isRankedMode': bool(self.__extra.isRatedBattle),
      'battles': battles,
      'winRate': winRate,
      'enableWinRateTF': enableWinRateTF,
      'leagueIcon': leagueIcon,
      'isFixedMode': isFixedMode,
      'modeLabel': modeLabel,
      'modeTooltip': modeTooltip,
      'bgSource': bgSource,
      'modeTooltipType': modeTooltipType,
      'isModeTooltip': isModeTooltip})
     return
Exemplo n.º 5
0
 def __updateClubData(self):
     resultVO = _IntroViewVO()
     club = self.getClub()
     if self.clubsState.getStateID() == CLIENT_CLUB_STATE.HAS_CLUB and club:
         profile = self.clubsCtrl.getProfile()
         limits = self.clubsCtrl.getLimits()
         resultVO.setClubLabel(club.getUserName())
         resultVO.setClubDBbID(club.getClubDbID())
         resultVO.setClubLadderChevron(club)
         resultVO.showAdditionalButton(
             _ms(CYBERSPORT.WINDOW_INTRO_ADDITIONALBTN_LIST),
             TOOLTIPS.CYBERSPORT_INTRO_ADDITIONALBTN)
         resultVO.moveToTheUnitByCreateButton()
         resultVO.openClubProfileByChevronClick()
         if club.hasActiveUnit():
             unitInfo = club.getUnitInfo()
             resultVO.showCreateButton(
                 _ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_JOINTEAM),
                 TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_JOINTEAM)
             if unitInfo.isInBattle():
                 isInBattleIcon = icons.makeImageTag(
                     RES_ICONS.MAPS_ICONS_LIBRARY_SWORDSICON, 16, 16, -3, 0)
                 resultVO.setClubDescription(
                     text_styles.neutral(
                         '%s %s' %
                         (isInBattleIcon,
                          _ms(CYBERSPORT.
                              WINDOW_INTRO_TEAM_DESCRIPTION_TEAMINBATTLE))))
             else:
                 resultVO.setClubDescription(
                     text_styles.neutral(
                         CYBERSPORT.
                         STATICFORMATIONPROFILEWINDOW_STATUSLBL_CLUBISCALLED
                     ))
         else:
             canCreateUnit = limits.canCreateUnit(profile, club)
             if canCreateUnit.success:
                 resultVO.setClubDescription(
                     text_styles.neutral(
                         CYBERSPORT.
                         WINDOW_INTRO_TEAM_DESCRIPTION_ASSEMBLINGTEAM))
                 resultVO.showCreateButton(
                     _ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ASSEMBLETEAM),
                     TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_ASSEMBLETEAM)
             elif canCreateUnit.reason == CLIENT_CLUB_RESTRICTIONS.NOT_ENOUGH_MEMBERS:
                 if club.getPermissions().isOwner():
                     resultVO.setClubDescription(
                         text_styles.main(
                             CYBERSPORT.
                             WINDOW_INTRO_TEAM_DESCRIPTION_NOTENOUGHPLAYERS)
                     )
                     resultVO.showCreateButton(
                         _ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ADDPLAYERS),
                         TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_ADDPLAYERS)
                 else:
                     resultVO.setClubDescription(text_styles.error(
                         CYBERSPORT.
                         WINDOW_INTRO_TEAM_DESCRIPTION_OWNERASSEMBLINGTEAM),
                                                 isBackVisible=True)
                     resultVO.showCreateButton(
                         _ms('#cybersport:window/intro/create/btn/private/seeStaff'
                             ),
                         '#tooltips:cyberSport/intro/createBtn/addPlayers/private'
                     )
                 resultVO.needAddPlayers()
             else:
                 resultVO.setClubDescription(text_styles.error(
                     CYBERSPORT.
                     WINDOW_INTRO_TEAM_DESCRIPTION_NOTENOUGHPERMISSIONS_ASSEMBLINGTEAM
                 ),
                                             isBackVisible=True)
                 resultVO.showCreateButton(
                     _ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ASSEMBLETEAM),
                     '#tooltips:StaticFormationProfileWindow/actionBtn/notEnoughPermissions',
                     enabled=False)
     elif self.clubsState.getStateID() == CLIENT_CLUB_STATE.NO_CLUB:
         resultVO.setNoClubChevron(isApplicationSent=False)
         resultVO.setClubLabel(
             _ms(CYBERSPORT.WINDOW_INTRO_TEAM_HEADER_STATICTEAMS))
         resultVO.setClubDescription(
             text_styles.main(
                 CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_CREATEORFIND))
         resultVO.showCreateButton(
             _ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_LOOK),
             TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_LOOK)
     elif self.clubsState.getStateID() == CLIENT_CLUB_STATE.SENT_APP:
         resultVO.setNoClubChevron(isApplicationSent=True)
         resultVO.openClubProfileByChevronClick()
         if club is not None:
             resultVO.setClubLabel(club.getUserName())
             resultVO.setClubLadderChevron(club)
         resultVO.setClubDescription(
             text_styles.neutral(
                 CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_WAITINGFORREQUEST)
         )
         resultVO.showCancelButton(
             _ms(CYBERSPORT.WINDOW_INTRO_CANCEL_BTN_LABEL),
             TOOLTIPS.CYBERSPORT_INTRO_CANCELBTN)
         resultVO.showAdditionalButton(
             _ms(CYBERSPORT.WINDOW_INTRO_ADDITIONALBTN_LIST),
             TOOLTIPS.CYBERSPORT_INTRO_ADDITIONALBTN)
     else:
         resultVO.fillDefault()
         resultVO.acceptNavigationByChevron(False)
     if isHourInForbiddenList(
             self.clubsCtrl.getAvailabilityCtrl().getForbiddenHours()):
         resultVO.setClubDescriptionTooltip(
             TOOLTIPS_CONSTANTS.LADDER_REGULATIONS)
         resultVO.setClubDescription(
             '{0}{1}'.format(
                 icons.alert(),
                 text_styles.main(CYBERSPORT.LADDERREGULATIONS_WARNING)),
             True)
     self.as_setStaticTeamDataS(resultVO.getData())
 def __updateHeader(self):
     club = self.clubsCtrl.getClub(self.__clubDBID)
     canSetRanked = club is not None and club.getPermissions().canSetRanked(
     )
     seasonState = self.clubsCtrl.getSeasonState()
     modeLabel = ''
     modeTooltip = ''
     modeTooltipType = ''
     isFixedMode = True
     isModeTooltip = False
     if self.__extra.isRatedBattle:
         isFixedMode = not canSetRanked
         if canSetRanked:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETUNRANKEDMODE
         else:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_RANKEDMODE
     elif seasonState.isSuspended():
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSED
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.COMPLEX
         modeTooltip = makeTooltip(
             CYBERSPORT.
             STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSEDTOOLTIP_HEADER,
             CYBERSPORT.
             STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSEDTOOLTIP_BODY
         )
     elif seasonState.isFinished():
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHED
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.COMPLEX
         modeTooltip = makeTooltip(
             CYBERSPORT.
             STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHEDTOOLTIP_HEADER,
             CYBERSPORT.
             STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHEDTOOLTIP_BODY
         )
     elif canSetRanked:
         isFixedMode = False
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETRANKEDMODE
     if len(modeLabel):
         if canSetRanked and seasonState.isActive(
         ) or self.__extra.isRatedBattle:
             modeLabel = text_styles.neutral(modeLabel)
         else:
             modeLabel = text_styles.standard(modeLabel)
     if isHourInForbiddenList(
             self.clubsCtrl.getAvailabilityCtrl().getForbiddenHours()):
         modeLabel = '{0}{1}'.format(
             icons.alert(),
             text_styles.main(CYBERSPORT.LADDERREGULATIONS_WARNING))
         isFixedMode = True
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.LADDER_REGULATIONS
     bgSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_LEAGUERIBBONS_UNRANKED
     battles = self.ABSENT_VALUES
     winRate = self.ABSENT_VALUES
     leagueIcon = getLadderChevron64x64()
     enableWinRateTF = False
     if club is not None:
         clubTotalStats = club.getTotalDossier().getTotalStats()
         battles = BigWorld.wg_getNiceNumberFormat(
             clubTotalStats.getBattlesCount())
         division = club.getLadderInfo().division
         leagueIcon = getLadderChevron64x64(division)
         winRateValue = ProfileUtils.getValueOrUnavailable(
             clubTotalStats.getWinsEfficiency())
         if winRateValue != ProfileUtils.UNAVAILABLE_VALUE:
             enableWinRateTF = True
             winRate = ProfileUtils.formatFloatPercent(winRateValue)
         else:
             winRate = self.ABSENT_VALUES
         if self.__extra.isRatedBattle:
             bgSource = getLadderBackground(division)
         self.requestClubEmblem64x64(club.getClubDbID(),
                                     club.getEmblem64x64())
     self.as_setHeaderDataS({
         'clubId': self.__extra.clubDBID,
         'teamName': self.__extra.clubName,
         'isRankedMode': bool(self.__extra.isRatedBattle),
         'battles': battles,
         'winRate': winRate,
         'enableWinRateTF': enableWinRateTF,
         'leagueIcon': leagueIcon,
         'isFixedMode': isFixedMode,
         'modeLabel': modeLabel,
         'modeTooltip': modeTooltip,
         'bgSource': bgSource,
         'modeTooltipType': modeTooltipType,
         'isModeTooltip': isModeTooltip
     })
     return