Exemplo n.º 1
0
 def getDisplayableData(self, level):
     ms = i18n.makeString
     requiredLevel = level
     statusLevel = 'warning'
     description = ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_DESCRIPTION)
     statusMsg = ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_BODY_TOTALLEVEL, sumLevels=level)
     dispatcher = g_prbLoader.getDispatcher()
     if dispatcher is not None:
         functional = dispatcher.getUnitFunctional()
         if functional:
             requiredLevel = functional.getRosterSettings().getMinTotalLevel()
             canDoAction, restriction = functional.validateLevels()
             if restriction == UNIT_RESTRICTION.MIN_TOTAL_LEVEL:
                 statusLevel = 'critical'
                 statusMsg = ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_BODY_MINTOTALLEVELERROR, sumLevels=level)
             elif restriction == UNIT_RESTRICTION.MAX_TOTAL_LEVEL:
                 statusLevel = 'critical'
                 statusMsg = ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_BODY_MAXTOTALLEVELERROR, sumLevels=level)
             elif restriction == UNIT_RESTRICTION.INVALID_TOTAL_LEVEL:
                 msg, ctx = ActionButtonStateVO.getInvalidVehicleLevelsMessage(functional)
                 reason = i18n.makeString(msg, **ctx)
                 description = makeHtmlString('html_templates:lobby/cyberSport/unit', 'invalidLevelDescription', {'description': description,
                  'reason': reason})
             elif canDoAction and not restriction:
                 statusLevel = 'info'
     result = {'header': ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_TITLE),
      'description': description,
      'level': str(requiredLevel),
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_OKICON,
      'levelDescription': ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_BODY),
      'statusMsg': statusMsg,
      'statusLevel': statusLevel}
     return result
 def getDisplayableData(self, level):
     ms = i18n.makeString
     requiredLevel = level
     statusLevel = 'warning'
     description = ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_DESCRIPTION)
     statusMsg = ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_BODY_TOTALLEVEL, sumLevels=level)
     dispatcher = g_prbLoader.getDispatcher()
     if dispatcher is not None:
         entity = dispatcher.getEntity()
         if entity:
             requiredLevel = entity.getRosterSettings().getMinTotalLevel()
             levelsValidation = entity.validateLevels()
             canDoAction, restriction = levelsValidation.isValid, levelsValidation.restriction
             if restriction == UNIT_RESTRICTION.MIN_TOTAL_LEVEL:
                 statusLevel = 'critical'
                 statusMsg = ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_BODY_MINTOTALLEVELERROR, sumLevels=level)
             elif restriction == UNIT_RESTRICTION.MAX_TOTAL_LEVEL:
                 statusLevel = 'critical'
                 statusMsg = ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_BODY_MAXTOTALLEVELERROR, sumLevels=level)
             elif restriction == UNIT_RESTRICTION.INVALID_TOTAL_LEVEL:
                 msg, ctx = ActionButtonStateVO.getInvalidVehicleLevelsMessage(levelsValidation.ctx)
                 reason = i18n.makeString(msg, **ctx)
                 description = makeHtmlString('html_templates:lobby/cyberSport/unit', 'invalidLevelDescription', {'description': description,
                  'reason': reason})
             elif canDoAction and not restriction:
                 statusLevel = 'info'
     result = {'header': ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_TITLE),
      'description': description,
      'level': str(requiredLevel),
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_OKICON,
      'levelDescription': ms(TOOLTIPS.CYBERSPORT_UNITLEVEL_BODY),
      'statusMsg': statusMsg,
      'statusLevel': statusLevel}
     return result
Exemplo n.º 3
0
 def _setActionButtonState(self):
     self.as_setActionButtonStateS(ActionButtonStateVO(self.unitFunctional))
Exemplo n.º 4
0
 def _setActionButtonState(self):
     self.as_setActionButtonStateS(ActionButtonStateVO(self.prbEntity))