Exemple #1
0
 def updateStatus(self):
     if g_currentPreviewVehicle.hasModulesToSelect():
         if g_currentPreviewVehicle.isModified():
             icon = icons.makeImageTag(
                 backport.image(
                     R.images.gui.maps.icons.library.info_yellow()), 24, 24,
                 -7, -4)
             text = text_styles.neutral('%s%s' % (backport.text(
                 R.strings.vehicle_preview.modulesPanel.status.text()),
                                                  icon))
         else:
             icon = icons.makeImageTag(
                 backport.image(R.images.gui.maps.icons.library.info()), 24,
                 24, -7, -4)
             text = text_styles.stats('%s%s' % (backport.text(
                 R.strings.vehicle_preview.modulesPanel.Label()), icon))
         tooltip = TOOLTIPS.VEHICLEPREVIEW_MODULS
     else:
         icon = icons.makeImageTag(
             backport.image(R.images.gui.maps.icons.library.info()), 24, 24,
             -7, -4)
         text = text_styles.stats('%s%s' % (backport.text(
             R.strings.vehicle_preview.modulesPanel.noModulesOptions()),
                                            icon))
         tooltip = TOOLTIPS.VEHICLEPREVIEW_MODULSNOMODULES
     self.as_setStatusInfoS(text,
                            tooltip,
                            g_currentPreviewVehicle.getVehiclePreviewType(),
                            needToShowAnim=self.__showAnimation())
 def __makeStatusInfo(cls):
     textRes = R.strings.vehicle_preview.modulesPanel
     iconRes = R.images.gui.maps.icons.library
     if g_currentPreviewVehicle.hasModulesToSelect():
         if g_currentPreviewVehicle.isModified():
             makeTextData = (textRes.status.text, iconRes.info_yellow, text_styles.neutral)
         else:
             makeTextData = (textRes.Label, iconRes.info, text_styles.stats)
         tooltip = TOOLTIPS.VEHICLEPREVIEW_MODULS
     else:
         makeTextData = (textRes.noModulesOptions, iconRes.info, text_styles.stats)
         tooltip = TOOLTIPS.VEHICLEPREVIEW_MODULSNOMODULES
     return (_makeStatusText(*makeTextData),
      tooltip,
      g_currentPreviewVehicle.getVehiclePreviewType(),
      cls.__needToShowAnim())
 def _update(self):
     if g_currentPreviewVehicle.isPresent():
         item = g_currentPreviewVehicle.item
         if item.buyPrices.itemPrice.defPrice.get(Currency.GOLD):
             maxDescriptionLength = _MAX_LENGTH_FULL_DESCRIPTION_WITH_KPI
             bonuses = []
             if not (self.__isFrontlineCreditsOffer()
                     or item.isOnlyForEpicBattles):
                 bonuses.append({
                     'iconSrc':
                     backport.image(
                         R.images.gui.maps.shop.kpi.star_icon_benefits()),
                     'labelStr':
                     text_styles.concatStylesToMultiLine(
                         text_styles.highTitle(
                             backport.text(
                                 R.strings.vehicle_preview.infoPanel.
                                 premium.freeExpMultiplier())),
                         text_styles.main(
                             backport.text(
                                 R.strings.vehicle_preview.infoPanel.
                                 premium.freeExpText())))
                 })
             if not (item.isSpecial or self.__isFrontlineCreditsOffer()
                     or item.isOnlyForEpicBattles):
                 bonuses.append({
                     'iconSrc':
                     backport.image(
                         R.images.gui.maps.shop.kpi.money_benefits()),
                     'labelStr':
                     text_styles.concatStylesToMultiLine(
                         text_styles.highTitle(
                             backport.text(
                                 R.strings.vehicle_preview.infoPanel.
                                 premium.creditsMultiplier())),
                         text_styles.main(
                             backport.text(
                                 R.strings.vehicle_preview.infoPanel.
                                 premium.creditsText())))
                 })
             if item.isEarnCrystals:
                 bonuses.append({
                     'iconSrc':
                     backport.image(
                         R.images.gui.maps.shop.kpi.bons_benefits()),
                     'labelStr':
                     text_styles.concatStylesToMultiLine(
                         text_styles.highTitle(
                             backport.text(R.strings.vehicle_preview.
                                           infoPanel.premium.bonsTitle())),
                         text_styles.main(
                             backport.text(R.strings.vehicle_preview.
                                           infoPanel.premium.bonsText())))
                 })
             if not item.isCrewLocked:
                 bonuses.append({
                     'iconSrc':
                     backport.image(
                         R.images.gui.maps.shop.kpi.crow_benefits()),
                     'labelStr':
                     text_styles.concatStylesToMultiLine(
                         text_styles.highTitle(
                             backport.text(
                                 R.strings.vehicle_preview.infoPanel.
                                 premium.crewTransferTitle())),
                         text_styles.main(
                             backport.text(
                                 R.strings.vehicle_preview.infoPanel.
                                 premium.crewTransferText())))
                 })
             builtInEquipmentIDs = item.getBuiltInEquipmentIDs()
             builtInCount = len(
                 builtInEquipmentIDs) if builtInEquipmentIDs else 0
             if builtInCount > 0:
                 if builtInCount == 1:
                     equipment = self.itemsCache.items.getItemByCD(
                         builtInEquipmentIDs[0])
                     mainText = equipment.userName
                 else:
                     mainText = backport.text(
                         R.strings.vehicle_preview.infoPanel.premium.
                         builtInEqupmentText(),
                         value=builtInCount)
                 bonuses.append({
                     'iconSrc':
                     backport.image(
                         R.images.gui.maps.shop.kpi.infinity_benefits()),
                     'labelStr':
                     text_styles.concatStylesToMultiLine(
                         text_styles.highTitle(
                             backport.text(
                                 R.strings.vehicle_preview.infoPanel.
                                 premium.builtInEqupmentTitle())),
                         text_styles.main(mainText))
                 })
         else:
             maxDescriptionLength = _MAX_LENGTH_FULL_DESCRIPTION_NO_KPI
             bonuses = None
         description = item.fullDescription.decode('utf-8')
         hasTooltip = len(description) > maxDescriptionLength
         if hasTooltip:
             description = description[:maxDescriptionLength - 3] + '...'
         icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_INFO, 24,
                                   24, -7, -4)
         self.as_setDataS({
             'historicReferenceTxt':
             text_styles.main(description),
             'needDisclaimer':
             item.hasDisclaimer(),
             'showTooltip':
             hasTooltip,
             'vehicleType':
             g_currentPreviewVehicle.getVehiclePreviewType(),
             'titleInfo':
             '%s%s' %
             (_ms(VEHICLE_PREVIEW.INFOPANEL_TAB_ELITEFACTSHEET_INFO), icon),
             'benefitsData':
             bonuses
         })
     return