Esempio n. 1
0
 def __makeRentBlock(self, price, currencySetting, days, percent=0):
     _int = BigWorld.wg_getIntegralFormat
     settings = _getCurrencySetting(currencySetting)
     if settings is None:
         return
     else:
         valueFormatted = settings.textStyle(_int(price))
         settingsFrame = settings.frame
         if settingsFrame in Currency.ALL:
             newPrice = MONEY_UNDEFINED.replace(settingsFrame, price)
         else:
             newPrice = Money(credits=price)
         if days == 1:
             text = text_styles.main(
                 _ms(TOOLTIPS.ACTIONPRICE_RENTPRICE_1DAY,
                     value=text_styles.expText(percent)))
         elif days == 3:
             text = text_styles.main(
                 _ms(TOOLTIPS.ACTIONPRICE_RENTPRICE_3DAY,
                     value=text_styles.expText(percent)))
         else:
             text = text_styles.main(
                 _ms(TOOLTIPS.ACTIONPRICE_RENTPRICE_DAYS,
                     days=days,
                     value=text_styles.expText(percent)))
         return formatters.packActionTextParameterBlockData(
             name=text,
             value=valueFormatted,
             icon=_getCurrencySetting(currencySetting).frame,
             padding=formatters.packPadding(left=20, bottom=-20),
             currency=newPrice.getCurrency())
Esempio n. 2
0
 def _makePriceBlock(self,
                     price,
                     currencySetting,
                     percent=0,
                     valueWidth=-1):
     _int = BigWorld.wg_getIntegralFormat
     hasAction = percent != 0
     settings = _getCurrencySetting(currencySetting)
     if settings is None:
         return
     else:
         valueFormatted = settings.textStyle(_int(price))
         if hasAction:
             settingsFrame = settings.frame
             if settingsFrame in Currency.ALL:
                 newPrice = MONEY_UNDEFINED.replace(settingsFrame, price)
             else:
                 newPrice = Money(credits=price)
             return formatters.packActionTextParameterBlockData(
                 name=text_styles.main(
                     _ms(TOOLTIPS.ACTIONPRICE_BUYPRICE_ACTIONPRICE,
                         value=text_styles.expText(percent))),
                 value=valueFormatted,
                 icon=_getCurrencySetting(currencySetting).frame,
                 padding=formatters.packPadding(left=20, bottom=-20),
                 currency=newPrice.getCurrency(),
                 valueWidth=valueWidth)
         return formatters.packTextParameterWithIconBlockData(
             name=text_styles.main(self._getDefaultPriceLabelConst()),
             value=valueFormatted,
             icon=settings.frame,
             valueWidth=valueWidth)
         return