def getLevelStr(): levelsRange = getAvailableVehicleRange() if len(levelsRange) == 1: level = formatRomanNumber(levelsRange[0]) else: level = backport.text(R.strings.ny.vehiclesView.levelsStr(), minLevel=formatRomanNumber(levelsRange[0]), maxLevel=formatRomanNumber(levelsRange[-1])) return level
def _onLoading(self, *args, **kwargs): level = NewYearAtmospherePresenter.getLevel() leftLevel = level if level != new_year.CONSTS.MAX_ATMOSPHERE_LVL else level - 1 currentPoints, nextPoints = NewYearAtmospherePresenter.getLevelProgress() lastState = AccountSettings.getUIFlag(NY_LAST_SEEN_LEVEL_INFO) delta = lastState['points'] if lastState['level'] == leftLevel else 0 fillBonusFormula(self.viewModel.bonusFormula) with self.viewModel.transaction() as tx: tx.setCurrentLevel(formatRomanNumber(leftLevel)) tx.setNextLevel(formatRomanNumber(leftLevel + 1)) tx.setCurrentPoints(currentPoints) tx.setNextPoints(nextPoints) tx.setDeltaFromPoints(delta) self.__createMultipliersTable(tx, level) AccountSettings.setUIFlag(NY_LAST_SEEN_LEVEL_INFO, {'level': leftLevel, 'points': currentPoints})
def _initModel(self, model, toyInfo): model.setRankRoman(formatRomanNumber(toyInfo.getRank())) model.setRankNumber(str(toyInfo.getRank())) model.setToyDesc(toyInfo.getDesc()) model.setToyIcon(toyInfo.getIcon()) model.setToyName(toyInfo.getName()) model.setIsInCollection(toyInfo.isInCollection()) model.setSetting(toyInfo.getSetting())
def initialize(self, *args, **kwargs): super(NyVehiclesViewPresenter, self).initialize(*args, **kwargs) NewYearSoundsManager.setHangarFilteredState(True) self.__subscribe() self.__startNotifier() levelStr = backport.text( R.strings.ny.vehiclesView.levelsStr(), minLevel=formatRomanNumber(NY_BRANCH_MIN_LEVEL), maxLevel=formatRomanNumber(NY_BRANCH_MAX_LEVEL)) with self.viewModel.transaction() as tx: tx.setIsRomanNumbersAllowed(IS_ROMAN_NUMBERS_ALLOWED) tx.setIsPostEvent(self.__nyController.isPostEvent()) tx.setLevelStr(levelStr) tx.setCurrentAtmosphereLvl( self.__itemsCache.items.festivity.getMaxLevel()) self.__createVehiclesList(tx) self.__updateIntroStatus(tx)
def _extendTemplate(self, template): super(VehicleHintDialogBuilder, self)._extendTemplate(template) levelNum = self.__itemsCache.items.festivity.getMaxLevel() title = backport.text(R.strings.ny.dialogs.vehicleHint.title(), level=formatRomanNumber(levelNum)) template.setSubView(DefaultDialogPlaceHolders.TITLE, SimpleTextTitle(title)) template.setSubView(DefaultDialogPlaceHolders.CONTENT, LevelsRange()) template.addButton( CancelButton(R.strings.ny.dialogs.vehicleHint.submit(), DialogButtons.CANCEL, ButtonType.PRIMARY))
def __createMultipliersTable(self, tx, currentLevel): multipliersList = getBonusConfig().getAtmosphereMultipliers() rangedMultipliersList = [ (multi, i + 1, i + multipliersList.count(multi)) for i, multi in enumerate(multipliersList) if multi != multipliersList[i - 1] ] for multiplierRange in rangedMultipliersList: multiplier, fromLevel, toLevel = multiplierRange singleLevel = fromLevel == toLevel levelInterval = formatRomanNumber(fromLevel) if singleLevel else backport.text(R.strings.ny.widgetTooltip.levelsPattern(), lower=formatRomanNumber(fromLevel), higher=formatRomanNumber(toLevel)) tableRow = NyMultiplierValue() tableRow.setMultiplier(int(multiplier)) tableRow.setLevels(levelInterval) tableRow.setIsEnabled(fromLevel <= currentLevel <= toLevel) tx.multipliersTable.addViewModel(tableRow)
from gui.impl import backport from gui.impl.gen import R from gui.impl.new_year.new_year_helper import formatRomanNumber from items.components.ny_constants import CustomizationObjects, MAX_TOY_RANK RANDOM_TOY_PARAM = 'random' TOY_PLACES_STRINGS = { RANDOM_TOY_PARAM: R.strings.ny.craftView.objectTitle.random.place(), CustomizationObjects.FIR: R.strings.ny.craftView.objectTitle.Fir(), CustomizationObjects.FAIR: R.strings.ny.craftView.objectTitle.Fair(), CustomizationObjects.INSTALLATION: R.strings.ny.craftView.objectTitle.Installation() } TOY_RANKS_STRINGS = tuple([(formatRomanNumber(i) if i > 0 else backport.text( R.strings.ny.craftView.objectTitle.random.level())) for i in xrange(MAX_TOY_RANK + 1)]) TOY_SETTING_STRINGS = tuple([ R.strings.ny.craftView.objectTitle.random.collection(), R.strings.ny.craftView.monitor.setting.NewYear(), R.strings.ny.craftView.monitor.setting.Christmas(), R.strings.ny.craftView.monitor.setting.Oriental(), R.strings.ny.craftView.monitor.setting.Fairytale() ]) TOY_TYPE_STRINGS = tuple([ R.strings.ny.decorationTypes.typeDisplay.random(), R.strings.ny.decorationTypes.top(), R.strings.ny.decorationTypes.garland_fir(), R.strings.ny.decorationTypes.ball(), R.strings.ny.decorationTypes.floor(),
def updateRenderer(self, renderer): with renderer.transaction() as tx: tx.setIsCurrentLevel(self.__levelInfo.isCurrent()) tx.setIsLevelAchieved(self.__levelInfo.isAchieved()) tx.setLevelText(formatRomanNumber(self.__levelInfo.level()))