Ejemplo n.º 1
0
 def OnUpgradeBarValueChanged(self, oldValue, newValue):
     self.newLevel = newValue
     txt = localization.GetByLabel(
         'UI/PI/Common/UpgradeFromLevelXToY',
         currLevel=util.IntToRoman(self.currLevel + 1),
         newLevel=util.IntToRoman(self.newLevel + 1))
     skill = sm.GetService('skills').GetMySkillsFromTypeID(
         const.typeCommandCenterUpgrade)
     commandCenterSkillLevel = 0
     if skill is not None:
         commandCenterSkillLevel = skill.skillLevel
     if commandCenterSkillLevel < newValue:
         skillType = cfg.invtypes.Get(const.typeCommandCenterUpgrade)
         hint = localization.GetByLabel(
             'UI/PI/Common/NeedSkillToUpgrade',
             skillLevel=util.IntToRoman(newValue),
             skillName=skillType.typeName)
         txt = localization.GetByLabel(
             'UI/PI/Common/InsufficientSkillForUpgrade')
         self.upgradeButton.Disable()
     else:
         hint = ''
         self.upgradeButton.Enable()
     self.upgradeText.SetCaption(txt)
     self.upgradeText.hint = hint
     newPowerOutput = planetCommon.GetPowerOutput(self.newLevel)
     self.upgradePowerGauge.SetValue(gaugeNum=1,
                                     value=newPowerOutput /
                                     self.maxPowerOutput)
     self.upgradePowerGauge.hint = self._GetPowerGaugeHint(newPowerOutput)
     self._SetPowerGaugeSubText(newPowerOutput)
     newCPUOutput = planetCommon.GetCPUOutput(self.newLevel)
     self.upgradeCPUGauge.SetValue(gaugeNum=1,
                                   value=newCPUOutput / self.maxCPUOutput)
     self.upgradeCPUGauge.hint = self._GetCPUGaugeHint(newCPUOutput)
     self._SetCPUGaugeSubText(newCPUOutput)
     iskCost = util.FmtISK(planetCommon.GetUpgradeCost(
         self.currLevel, self.newLevel),
                           showFractionsAlways=0)
     self.costText.SetSubtext(iskCost)
Ejemplo n.º 2
0
 def PanelUpgrade(self):
     cont = Container(parent=self.actionCont, state=uiconst.UI_HIDDEN)
     self.currLevel = self.planetUISvc.planet.GetCommandCenterLevel(
         session.charid)
     self.newLevel = self.currLevel
     self.currPowerOutput = self.pin.GetPowerOutput()
     self.maxPowerOutput = float(
         planetCommon.GetPowerOutput(
             level=planetCommonUI.PLANET_COMMANDCENTERMAXLEVEL))
     self.currCPUOutput = self.pin.GetCpuOutput()
     self.maxCPUOutput = float(
         planetCommon.GetCPUOutput(
             level=planetCommonUI.PLANET_COMMANDCENTERMAXLEVEL))
     colorDict = {
         uicls.ClickableBoxBar.COLOR_BELOWMINIMUM:
         planetCommonUI.PLANET_COLOR_CURRLEVEL,
         uicls.ClickableBoxBar.COLOR_SELECTED:
         planetCommonUI.PLANET_COLOR_UPGRADELEVEL,
         uicls.ClickableBoxBar.COLOR_UNSELECTED:
         util.Color.GetGrayRGBA(0.4, alpha=0.7),
         uicls.ClickableBoxBar.COLOR_ABOVEMAXIMUM: (1.0, 0.0, 0.0, 0.25)
     }
     boxBarCont = Container(parent=cont,
                            align=uiconst.TOTOP,
                            state=uiconst.UI_PICKCHILDREN,
                            height=33)
     upgradeSkill = sm.GetService('skills').GetSkill(
         const.typeCommandCenterUpgrade)
     upgradeSkillLevel = 0
     if upgradeSkill is not None:
         upgradeSkillLevel = upgradeSkill.skillLevel
     boxBar = uicls.ClickableBoxBar(
         align=uiconst.CENTERTOP,
         width=280,
         height=16,
         parent=boxBarCont,
         numBoxes=6,
         boxValues=range(0, 6),
         boxWidth=45,
         boxHeight=14,
         readonly=False,
         backgroundColor=(0.0, 0.0, 0.0, 0.0),
         colorDict=colorDict,
         minimumValue=self.currLevel + 1,
         hintformat=None,
         maximumValue=upgradeSkillLevel,
         aboveMaxHint=localization.GetByLabel(
             'UI/PI/Common/UpgradeFailedInsufficientSkill',
             skillName=evetypes.GetName(const.typeCommandCenterUpgrade)))
     boxBar.OnValueChanged = self.OnUpgradeBarValueChanged
     boxBar.OnAttemptBoxClicked = self.OnUpgradeBarBoxClicked
     self.upgradeText = EveLabelSmall(
         parent=boxBarCont,
         text=localization.GetByLabel('UI/PI/Common/NoUpgradeSelected'),
         align=uiconst.CENTERBOTTOM)
     if self.currLevel == planetCommonUI.PLANET_COMMANDCENTERMAXLEVEL:
         self.upgradeText.SetText(
             localization.GetByLabel(
                 'UI/PI/Common/MaximumUpgradeLevelReached'))
         return cont
     bottomCont = Container(name='bottomCont',
                            align=uiconst.TOTOP,
                            parent=cont,
                            height=50,
                            padTop=16)
     leftBottomCont = Container(name='leftBottomCont',
                                align=uiconst.TOLEFT_PROP,
                                width=0.5,
                                parent=bottomCont)
     rightBottomCont = Container(name='rightBottomCont',
                                 align=uiconst.TOLEFT_PROP,
                                 width=0.5,
                                 parent=bottomCont)
     powerValue = float(self.currPowerOutput) / self.maxPowerOutput
     self.upgradePowerGauge = uicls.GaugeMultiValue(
         parent=leftBottomCont,
         value=0.0,
         colors=[
             planetCommonUI.PLANET_COLOR_POWER,
             planetCommonUI.PLANET_COLOR_POWERUPGRADE
         ],
         values=[powerValue, 0.0],
         label=localization.GetByLabel('UI/PI/Common/PowerOutput'))
     self.upgradePowerGauge.ShowMarker(value=powerValue,
                                       color=util.Color.GetGrayRGBA(
                                           0.0, 0.5))
     self.costText = CaptionAndSubtext(
         parent=leftBottomCont,
         caption=localization.GetByLabel('UI/Common/Cost'),
         subtext=localization.GetByLabel('UI/PI/Common/NoCost'),
         top=42)
     cpuValue = float(self.currCPUOutput) / self.maxCPUOutput
     self.upgradeCPUGauge = uicls.GaugeMultiValue(
         parent=rightBottomCont,
         colors=[
             planetCommonUI.PLANET_COLOR_CPU,
             planetCommonUI.PLANET_COLOR_CPUUPGRADE
         ],
         values=[cpuValue, 0.0],
         label=localization.GetByLabel('UI/PI/Common/CpuOutput'))
     self.upgradeCPUGauge.ShowMarker(value=cpuValue,
                                     color=util.Color.GetGrayRGBA(0.0, 0.5))
     btns = [(localization.GetByLabel('UI/PI/Common/Upgrade'),
              self._ApplyUpgrade, None)]
     btnGroup = uicontrols.ButtonGroup(btns=btns,
                                       parent=cont,
                                       line=False,
                                       alwaysLite=True)
     self.upgradeButton = btnGroup.GetBtnByLabel(
         localization.GetByLabel('UI/PI/Common/Upgrade'))
     self.upgradeButton.Disable()
     return cont
Ejemplo n.º 3
0
 def GetCpuOutput(self):
     level = self.eventHandler.level
     return planetCommon.GetCPUOutput(level)
Ejemplo n.º 4
0
 def PanelUpgrade(self):
     """
     Upgrade command center
     """
     cont = uiprimitives.Container(parent=self.actionCont,
                                   pos=(0, 0, 0, 140),
                                   align=uiconst.TOTOP,
                                   state=uiconst.UI_HIDDEN)
     self.currLevel = self.planetUISvc.planet.GetCommandCenterLevel(
         session.charid)
     self.newLevel = self.currLevel
     self.currPowerOutput = self.pin.GetPowerOutput()
     self.maxPowerOutput = float(
         planetCommon.GetPowerOutput(
             level=planetCommonUI.PLANET_COMMANDCENTERMAXLEVEL))
     self.currCPUOutput = self.pin.GetCpuOutput()
     self.maxCPUOutput = float(
         planetCommon.GetCPUOutput(
             level=planetCommonUI.PLANET_COMMANDCENTERMAXLEVEL))
     colorDict = {
         uicls.ClickableBoxBar.COLOR_BELOWMINIMUM:
         planetCommonUI.PLANET_COLOR_CURRLEVEL,
         uicls.ClickableBoxBar.COLOR_SELECTED:
         planetCommonUI.PLANET_COLOR_UPGRADELEVEL,
         uicls.ClickableBoxBar.COLOR_UNSELECTED:
         util.Color.GetGrayRGBA(0.4, alpha=0.7),
         uicls.ClickableBoxBar.COLOR_ABOVEMAXIMUM: (1.0, 0.0, 0.0, 0.25)
     }
     boxBarCont = uiprimitives.Container(parent=cont,
                                         align=uiconst.TOPLEFT,
                                         state=uiconst.UI_PICKCHILDREN,
                                         pos=(0, 0, self.width - 15, 18))
     upgradeSkill = sm.GetService('skills').GetMySkillsFromTypeID(
         const.typeCommandCenterUpgrade)
     upgradeSkillLevel = 0
     if upgradeSkill is not None:
         upgradeSkillLevel = upgradeSkill.skillLevel
     boxBar = uicls.ClickableBoxBar(
         parent=boxBarCont,
         numBoxes=6,
         boxValues=range(0, 6),
         boxWidth=(self.width - 20) / 6,
         boxHeight=boxBarCont.height - 4,
         readonly=False,
         backgroundColor=(0.0, 0.0, 0.0, 0.0),
         colorDict=colorDict,
         minimumValue=self.currLevel + 1,
         hintformat=None,
         maximumValue=upgradeSkillLevel,
         aboveMaxHint=localization.GetByLabel(
             'UI/PI/Common/UpgradeFailedInsufficientSkill',
             skillName=cfg.invtypes.Get(
                 const.typeCommandCenterUpgrade).name))
     boxBar.OnValueChanged = self.OnUpgradeBarValueChanged
     boxBar.OnAttemptBoxClicked = self.OnUpgradeBarBoxClicked
     self.upgradeText = CaptionAndSubtext(
         parent=cont,
         caption=localization.GetByLabel('UI/PI/Common/NoUpgradeSelected'),
         top=boxBarCont.height + 2,
         width=self.width)
     if self.currLevel == planetCommonUI.PLANET_COMMANDCENTERMAXLEVEL:
         self.upgradeText.SetCaption(
             localization.GetByLabel(
                 'UI/PI/Common/MaximumUpgradeLevelReached'))
         cont.height = 40
         return cont
     powerValue = float(self.currPowerOutput) / self.maxPowerOutput
     self.upgradePowerGauge = uicls.GaugeMultiValue(
         parent=cont,
         value=0.0,
         colors=[
             planetCommonUI.PLANET_COLOR_POWER,
             planetCommonUI.PLANET_COLOR_POWERUPGRADE
         ],
         values=[powerValue, 0.0],
         label=localization.GetByLabel('UI/PI/Common/PowerOutput'),
         top=boxBarCont.height + 23)
     self.upgradePowerGauge.ShowMarker(value=powerValue,
                                       color=util.Color.GetGrayRGBA(
                                           0.0, 0.5))
     self.costText = CaptionAndSubtext(
         parent=cont,
         caption=localization.GetByLabel('UI/Common/Cost'),
         subtext=localization.GetByLabel('UI/PI/Common/NoCost'),
         top=boxBarCont.height + 65)
     cpuValue = float(self.currCPUOutput) / self.maxCPUOutput
     self.upgradeCPUGauge = uicls.GaugeMultiValue(
         parent=cont,
         colors=[
             planetCommonUI.PLANET_COLOR_CPU,
             planetCommonUI.PLANET_COLOR_CPUUPGRADE
         ],
         values=[cpuValue, 0.0],
         label=localization.GetByLabel('UI/PI/Common/CpuOutput'),
         left=self.infoContRightColAt,
         top=boxBarCont.height + 23)
     self.upgradeCPUGauge.ShowMarker(value=cpuValue,
                                     color=util.Color.GetGrayRGBA(0.0, 0.5))
     btns = [(localization.GetByLabel('UI/PI/Common/Upgrade'),
              self._ApplyUpgrade, None)]
     btnGroup = uicontrols.ButtonGroup(btns=btns,
                                       parent=cont,
                                       line=False,
                                       alwaysLite=True)
     self.upgradeButton = btnGroup.GetBtnByLabel(
         localization.GetByLabel('UI/PI/Common/Upgrade'))
     self.upgradeButton.Disable()
     return cont