def _initialize(self): super(TrophyDeviceUpgradeConfirmDialogContent, self)._initialize() with self.getViewModel().transaction() as model: model.setTrophyBasicName(self.__trophyBasicModule.name) model.setTrophyBasicImg(self.__trophyBasicModule.getShopIcon(store=RES_SHOP, size=STORE_CONSTANTS.ICON_SIZE_SMALL)) for baseKpi, upgradedKpi in zip(self.__trophyBasicModule.getKpi(), self.__trophyUpgadedModule.getKpi()): if baseKpi.name != upgradedKpi.name: _logger.error('KPI in basic and upgraded module doesnt has same order') continue if baseKpi.value == upgradedKpi.value: continue bonus = TrophyDeviceConfirmBonusModel() bonus.setKpiName(baseKpi.name) bonus.setBaseValue(getKpiValueString(baseKpi, baseKpi.value)) bonus.setUpgradedValue(getKpiValueString(upgradedKpi, upgradedKpi.value)) model.getBonuses().addViewModel(bonus)
def __kpiFormat(self, kpi, value): return self.KPI_VALUE_TEMPLATE.format(getKpiValueString(kpi, value))