Exemple #1
0
 def _packBlocks(self, *args, **kwargs):
     items = super(NotRecruitedTooltipData, self)._packBlocks()
     item = self.context.buildItem(*args)
     self.item = item
     blocks = list()
     blocks.append(
         formatters.packImageTextBlockData(
             title=text_styles.highTitle(item.getFullUserName()),
             desc=text_styles.main(item.getLabel())))
     blocks.append(
         formatters.packImageBlockData(
             img=item.getBigIcon(),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
     blocks.append(formatters.packSeparatorBlockData())
     blocks.append(
         formatters.packTextBlockData(
             text_styles.main(item.getDescription()),
             useHtml=True,
             padding=formatters.packPadding(top=20, bottom=7)))
     if item.getLearntSkills():
         blocks.append(
             formatters.packTextBlockData(text_styles.middleTitle(
                 TOOLTIPS.NOTRECRUITEDTANKMAN_SKILLSTITLE),
                                          useHtml=True,
                                          padding=formatters.packPadding(
                                              top=10, bottom=10)))
         skills = item.getLearntSkills()
         blocks.append(
             formatters.packImageListParameterBlockData(
                 listIconSrc=[
                     Tankman.getSkillIconPath(skillName=skillName,
                                              size='big')
                     for skillName in skills
                 ],
                 columnWidth=52,
                 rowHeight=52,
                 verticalGap=10,
                 horizontalGap=10,
                 padding=formatters.packPadding(bottom=10)))
     expiryTime = item.getExpiryTime()
     if expiryTime:
         blocks.append(
             formatters.packTextBlockData(text_styles.middleTitle(
                 TOOLTIPS.NOTRECRUITEDTANKMAN_EXPIRETITLE),
                                          useHtml=True,
                                          padding=formatters.packPadding(
                                              top=10, bottom=2)))
         expireDateStr = makeString(TOOLTIPS.NOTRECRUITEDTANKMAN_USEBEFORE,
                                    date=expiryTime)
         blocks.append(
             formatters.packTextParameterWithIconBlockData(
                 name=text_styles.premiumVehicleName(expireDateStr),
                 value='',
                 icon=ICON_TEXT_FRAMES.RENTALS,
                 padding=formatters.packPadding(left=-60, bottom=-18),
                 iconYOffset=3))
     items.append(
         formatters.packBuildUpBlockData(
             blocks, padding=formatters.packPadding(bottom=-10)))
     return items
 def _packBlocks(self, *args, **kwargs):
     items = super(NotRecruitedTooltipData, self)._packBlocks()
     item = self.context.buildItem(*args)
     self.item = item
     blocks = list()
     blocks.append(
         formatters.packImageTextBlockData(
             title=text_styles.highTitle(item.getFullUserName()),
             desc=text_styles.main(item.getLabel())))
     specialIcon = item.getSpecialIcon()
     blocks.append(
         formatters.packImageBlockData(
             img=specialIcon
             if specialIcon is not None else item.getBigIcon(),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             width=350 if specialIcon is not None else -1,
             height=238 if specialIcon is not None else -1))
     blocks.append(
         formatters.packSeparatorBlockData(paddings=formatters.packPadding(
             top=-40)))
     descrStr = i18n.makeString(item.getDescription())
     hasDescr = descrStr != EMPTY_STRING
     if hasDescr:
         blocks.append(
             formatters.packTextBlockData(
                 text_styles.main(descrStr),
                 useHtml=True,
                 padding=formatters.packPadding(top=18)))
     howToGetStr = i18n.makeString(item.getHowToGetInfo())
     hasHowToGetStr = howToGetStr != EMPTY_STRING
     if hasHowToGetStr:
         blocks.append(
             formatters.packTextBlockData(text_styles.middleTitle(
                 backport.text(
                     R.strings.tooltips.notrecruitedtankman.howToGet())),
                                          useHtml=True,
                                          padding=formatters.packPadding(
                                              top=17 if hasDescr else 18,
                                              bottom=5)))
         blocks.append(
             formatters.packTextBlockData(text_styles.main(howToGetStr),
                                          useHtml=True,
                                          padding=formatters.packPadding()))
     skills = item.getLearntSkills()
     if skills:
         blocks.append(
             formatters.packTextBlockData(text_styles.middleTitle(
                 TOOLTIPS.NOTRECRUITEDTANKMAN_SKILLSTITLE),
                                          useHtml=True,
                                          padding=formatters.packPadding(
                                              top=17 if hasDescr else 18,
                                              bottom=10)))
         blocks.append(
             formatters.packImageListParameterBlockData(listIconSrc=[
                 formatters.packImageListIconData(
                     Tankman.getSkillIconPath(skillName=skillName,
                                              size='big'))
                 for skillName in skills
             ],
                                                        columnWidth=52,
                                                        rowHeight=52,
                                                        verticalGap=10,
                                                        horizontalGap=10))
     expiryTime = item.getExpiryTime()
     if expiryTime:
         blocks.append(
             formatters.packTextBlockData(
                 text_styles.middleTitle(
                     TOOLTIPS.NOTRECRUITEDTANKMAN_EXPIRETITLE),
                 useHtml=True,
                 padding=formatters.packPadding(top=20 if skills else
                                                (17 if hasDescr else 16),
                                                bottom=2)))
         expireDateStr = makeString(TOOLTIPS.NOTRECRUITEDTANKMAN_USEBEFORE,
                                    date=expiryTime)
         blocks.append(
             formatters.packTextParameterWithIconBlockData(
                 name=text_styles.premiumVehicleName(expireDateStr),
                 value='',
                 icon=ICON_TEXT_FRAMES.RENTALS,
                 padding=formatters.packPadding(left=-60, bottom=-18),
                 iconYOffset=3))
     items.append(
         formatters.packBuildUpBlockData(
             blocks, padding=formatters.packPadding(bottom=-5)))
     return items