def __formatBlueprintBalance(self):
     bpRequester = self._itemsCache.items.blueprints
     self.__intelligenceAmount = bpRequester.getIntelligenceData()
     self.__nationalFragmentsData = bpRequester.getAllNationalFragmentsData(
     )
     selectedNation = SelectedNation.getIndex()
     nationalAmount = self.__nationalFragmentsData.get(selectedNation, 0)
     balanceStr = text_styles.main(
         backport.text(
             R.strings.blueprints.blueprintScreen.resourcesOnStorage()))
     intFragmentVO = {
         'iconPath':
         backport.image(R.images.gui.maps.icons.blueprints.fragment.small.
                        intelligence()),
         'title':
         backport.getIntegralFormat(self.__intelligenceAmount),
         'fragmentCD':
         BlueprintTypes.INTELLIGENCE_DATA
     }
     natFragmentVO = {
         'iconPath':
         backport.image(
             R.images.gui.maps.icons.blueprints.fragment.small.dyn(
                 SelectedNation.getName())()),
         'title':
         backport.getIntegralFormat(nationalAmount),
         'fragmentCD':
         getNationalFragmentCD(selectedNation)
     }
     balanceVO = {
         'balanceStr': balanceStr,
         'internationalItemVO': intFragmentVO,
         'nationalItemVO': natFragmentVO
     }
     return balanceVO
 def _initialize(self, *args, **kwargs):
     super(FragmentsBalanceContent, self)._initialize(*args, **kwargs)
     intelligenceFragments, nationalFragments = self.__getFragmentCount()
     nationName = self.__vehicle.nationName if self.__vehicle is not None else ''
     if not nationName:
         logger.warning('Can not get a vehicle object and nation name')
     g_clientUpdateManager.addCallbacks(
         {'blueprints': self.__onUpdateBlueprints})
     with self.viewModel.transaction() as model:
         item = FragmentItemModel()
         item.setValue(
             self.gui.systemLocale.getNumberFormat(intelligenceFragments))
         item.setIcon(R.images.gui.maps.icons.blueprints.fragment.small.
                      intelligence())
         item.setFragmentCD(BlueprintTypes.INTELLIGENCE_DATA)
         model.currency.addViewModel(item)
         item = FragmentItemModel()
         item.setValue(
             self.gui.systemLocale.getNumberFormat(nationalFragments))
         item.setIcon(
             R.images.gui.maps.icons.blueprints.fragment.small.dyn(
                 nationName)())
         nationId = nations.INDICES.get(nationName, nations.NONE_INDEX)
         nationTooltipData = getNationalFragmentCD(nationId)
         item.setFragmentCD(nationTooltipData)
         model.currency.addViewModel(item)
         model.currency.invalidate()
     return
Exemple #3
0
    def _initialize(self, *args, **kwargs):
        super(FragmentsBalanceContent, self)._initialize(*args, **kwargs)
        intelligenceFragments, nationalFragments = self.__getFragmentCount()
        nationName = self.__vehicle.nationName if self.__vehicle is not None else ''
        if not nationName:
            logger.warning('Can not get a vehicle object and nation name')
        g_clientUpdateManager.addCallbacks(
            {'blueprints': self.__onUpdateBlueprints})
        with self.viewModel.transaction() as model:
            nationId = nations.INDICES[nationName]
            allianceId = nations.NATION_TO_ALLIANCE_IDS_MAP[nationId]
            model.setAllianceName(
                nations.ALLIANCES_TAGS_ORDER[allianceId].replace('-', '_'))
            item = model.intelligenceBalance
            item.setValue(
                self.gui.systemLocale.getNumberFormat(intelligenceFragments))
            item.setIcon(R.images.gui.maps.icons.blueprints.fragment.special.
                         intelligence())
            item.setFragmentCD(BlueprintTypes.INTELLIGENCE_DATA)
            for nationID, fragmentsCoout in nationalFragments.iteritems():
                nationName = nations.MAP[nationID]
                item = FragmentItemModel()
                item.setValue(
                    self.gui.systemLocale.getNumberFormat(fragmentsCoout))
                item.setIcon(
                    R.images.gui.maps.icons.blueprints.fragment.special.dyn(
                        nationName)())
                nationId = nations.INDICES.get(nationName, nations.NONE_INDEX)
                nationTooltipData = getNationalFragmentCD(nationId)
                item.setFragmentCD(nationTooltipData)
                model.currency.addViewModel(item)

            model.currency.invalidate()
        return
Exemple #4
0
    def __setBalanceBlock(self, fragmentsBalance):
        nationName = self.__vehicle.nationName if self.__vehicle is not None else ''
        nationId = nations.INDICES[nationName]
        allianceId = nations.NATION_TO_ALLIANCE_IDS_MAP[nationId]
        fragmentsBalance.setAllianceName(
            nations.ALLIANCES_TAGS_ORDER[allianceId])
        fragmentCount = self.__blueprints.getIntelligenceCount()
        item = fragmentsBalance.intelligenceBalance
        item.setValue(self.gui.systemLocale.getNumberFormat(fragmentCount))
        item.setIcon(
            R.images.gui.maps.icons.blueprints.fragment.special.intelligence())
        item.setFragmentCD(BlueprintTypes.INTELLIGENCE_DATA)
        fragmentsBalance.currency.clearItems()
        for nId, fragmentCount in self.__allyFragmentsBalance.iteritems():
            item = FragmentItemModel()
            item.setValue(self.gui.systemLocale.getNumberFormat(fragmentCount))
            nationName = nations.MAP[nId]
            item.setIcon(
                R.images.gui.maps.icons.blueprints.fragment.special.dyn(
                    nationName)())
            item.setFragmentCD(getNationalFragmentCD(nId))
            fragmentsBalance.currency.addViewModel(item)

        fragmentsBalance.currency.invalidate()
        return
Exemple #5
0
    def __setUsedFragmentsPrice(self, mainPriceModel, usedAdditionalPrice):
        _, intelligenceValue = self.__blueprints.getRequiredIntelligenceAndNational(
            self.__vehicle.level)
        mainPriceModel.setValue(int(self.__fragmentsCount * intelligenceValue))
        mainPriceModel.setIcon(
            R.images.gui.maps.icons.blueprints.fragment.special.intelligence())
        mainPriceModel.setTooltipId(BlueprintScreenTooltips.TOOLTIP_BLUEPRINT)
        mainPriceModel.setItemCD(BlueprintTypes.INTELLIGENCE_DATA)
        nationUsedDict = self.__getInitialNationalUsageCounts()
        usedAdditionalPrice.clear()
        for nId in self.__allyFragmentsBalance:
            nationName = nations.MAP[nId]
            price = BlueprintPrice()
            price.setNationName(nationName)
            price.setValue(int(nationUsedDict[nId]))
            price.setIcon(
                R.images.gui.maps.icons.blueprints.fragment.special.dyn(
                    nationName)())
            price.setIconBig(
                R.images.gui.maps.icons.blueprints.fragment.c_102x102.dyn(
                    nationName)())
            price.setTooltipId(BlueprintScreenTooltips.TOOLTIP_BLUEPRINT)
            price.setItemCD(getNationalFragmentCD(nId))
            usedAdditionalPrice.addViewModel(price)

        usedAdditionalPrice.invalidate()
Exemple #6
0
 def __getModelForNationalFragment(self, nationName, value):
     item = FragmentItemModel()
     item.setFragmentCD(getNationalFragmentCD(nations.INDICES[nationName]))
     item.setValue(backport_system_locale.getIntegralFormat(value))
     item.setIcon(
         R.images.gui.maps.icons.blueprints.fragment.small.dyn(nationName)
         ())
     item.setSpecialIcon(
         R.images.gui.maps.icons.blueprints.fragment.big.dyn(nationName)())
     return item
Exemple #7
0
    def __updateNationFragments(self):
        result = []
        fragments = self._itemsCache.items.blueprints.getAllNationalFragmentsData(
        )
        for nationName in GUI_NATIONS:
            nationId = nations.INDICES.get(nationName, nations.NONE_INDEX)
            nationTooltipData = getNationalFragmentCD(nationId)
            result.append(
                self.__makeFragmentVO(fragments.get(nationId, 0), nationName,
                                      nationTooltipData))

        self.as_updateNationalFragmentsS(result)