def __setBottomContent(self): bottomContent = self.bottomContentViewModel year, collectionName = new_year.getCollectionByIntID( self.__collectionID) price = getCollectionCost(year, collectionName) bottomContent.setValue(str(price)) self.__updateIsEnough(price)
def _setTitle(self, template): _, collectionName = getCollectionByIntID(self.__collectionID) title = backport.text(R.strings.ny.dialogs.buyFullCollection.title(), settingName=backport.text( R.strings.ny.settings.dyn(collectionName)())) template.setSubView(DefaultDialogPlaceHolders.TITLE, SimpleTextTitle(title))
def __setTitle(self, model): model.setTitle(R.strings.ny.dialogs.buyFullCollection.title()) _, settingName = getCollectionByIntID(self.__collectionID) titleArgs = model.getTitleFmtArgs() titleArgs.addViewModel( FmtArg(backport.text( R.strings.ny.settingsWithCollection.dyn(settingName)()), 'settingName', hardSpace=True)) titleArgs.invalidate()
def _successHandler(self, code, ctx=None): year, collectionStr = getCollectionByIntID(self.__collectionID) collection = backport.text(R.strings.ny.settings.dyn(collectionStr)()) if collectionStr == ToySettings.MEGA_TOYS: msgId = R.strings.ny.systemMessage.infoMegaCollection() else: msgId = R.strings.ny.systemMessage.infoCollection() year = backport.text(R.strings.ny.systemMessage.dyn(year)()) msg = backport.text(msgId, collection=collection, year=year) return makeSuccess(userMsg=msg, auxData=ctx)
def __setRewards(self, collectionStrID, rewards): rewards = self.__getRewards(rewards) collectionIntID = YEARS_INFO.getCollectionIntID(collectionStrID) with self.getViewModel().transaction() as model: year, collectionName = getCollectionByIntID(collectionIntID) model.setStyleStr('{}_{}'.format(collectionName, year)) model.setIsMega(collectionName == ToySettings.MEGA_TOYS) rewardsList = model.getRewards() rewardsList.clear() for index, reward in enumerate(rewards): incIndex = index + 1 formatter = getRewardRendererModelPresenter(reward) rewardRender = formatter.getModel(reward, incIndex) rewardsList.addViewModel(rewardRender) self.__tooltipData[incIndex] = createTooltipDataByDict(reward) rewardsList.invalidate()
def __updateCollections(self, model): collectionPresenter = COLLECTION_PRESENTER_REGESTRY.get( self.__yearName) styleTabsModel = model.getStyleTabs() styleTabsModel.clear() for collectionID in collectionPresenter.getCollectionSettingsIDs( useMega=True): _, collectionName = new_year.getCollectionByIntID(collectionID) collectionModel = NewYearCollectionStyleTab() collectionModel.setName(collectionName) collectionModel.setYear(self.__yearName) collectionModel.setCount( sum(self.__itemsCache.items.festivity. getCollectionDistributions()[collectionID])) collectionModel.setTotal( new_year.g_cache.toyCountByCollectionID[collectionID]) collectionModel.setIsSelected( self.__collectionName == collectionName) styleTabsModel.addViewModel(collectionModel) styleTabsModel.invalidate()
def _setPrice(self, template, price=None): year, collectionName = getCollectionByIntID(self.__collectionID) super(AlbumCollectionDialogBuilder, self)._setPrice(template, getCollectionCost(year, collectionName))
def __onUpdated(self, keys): if SyncDataKeys.TOY_FRAGMENTS in keys: year, collectionName = new_year.getCollectionByIntID( self.__collectionID) self.__updateIsEnough(getCollectionCost(year, collectionName)) self.__setBalanceContent()