def Load(self): self.Flush() toggleButtonCont = Container(name='btnGroupCont', parent=self, align=uiconst.TOTOP, height=35) btnGroup = ToggleButtonGroup(parent=toggleButtonCont, align=uiconst.CENTER, height=toggleButtonCont.height, width=300, padding=(10, 4, 10, 3), callback=self.LoadRequiredForLevel) for level in xrange(1, 6): hint = localization.GetByLabel( 'UI/InfoWindow/RequiredForLevelButtonHint', skillName=cfg.invtypes.Get(self.typeID).name, level=level) isDisabled = not bool( cfg.GetTypesRequiredBySkill(self.typeID).get(level, None)) btnGroup.AddButton(btnID=level, label=uiutil.IntToRoman(level), hint=hint, isDisabled=isDisabled) self.scroll = Scroll(name='scroll', parent=self, padding=const.defaultPadding) btnGroup.SelectFirst()
def _GetInfoCont(self): p = self.infoContPad infoCont = self._DrawAlignTopCont(55, 'infoCont', padding=(p, p, p, p)) link = self.pin.link totalBandwidth = localization.GetByLabel( 'UI/PI/Common/CapacityAmount', amount=link.GetTotalBandwidth()) bandwidthUsed = localization.GetByLabel( 'UI/PI/Common/CapacityAmount', amount=link.GetBandwidthUsage()) self.totalBandwidth = planet.ui.CaptionAndSubtext( parent=infoCont, caption=localization.GetByLabel('UI/PI/Common/LinkMaxCapacity'), subtext=totalBandwidth) self.bandwidthUsed = planet.ui.CaptionAndSubtext( parent=infoCont, caption=localization.GetByLabel('UI/PI/Common/CapacityUsed'), subtext=bandwidthUsed, top=30) left = self.infoContRightColAt self.bandwidthGauge = uicls.Gauge( parent=infoCont, value=link.GetBandwidthUsage() / link.GetTotalBandwidth(), color=planetCommon.PLANET_COLOR_BANDWIDTH, label=localization.GetByLabel('UI/PI/Common/CapacityUsed'), left=left) levelStr = localization.GetByLabel( 'UI/PI/Common/LinkUpgradeLevelAndName', upgradeLevel=uiutil.IntToRoman(link.level), upgradeLevelName=self.GetCaptionForUpgradeLevel(link.level)) self.upgradeLevel = planet.ui.CaptionAndSubtext( parent=infoCont, caption=localization.GetByLabel('UI/PI/Common/UpgradeLevel'), subtext=levelStr, top=30, left=left) return infoCont
def _GetInfoCont(self): link = self.pin.link totalBandwidth = localization.GetByLabel( 'UI/PI/Common/CapacityAmount', amount=link.GetTotalBandwidth()) bandwidthUsed = localization.GetByLabel( 'UI/PI/Common/CapacityAmount', amount=link.GetBandwidthUsage()) self.totalBandwidth = CaptionAndSubtext( parent=self.infoContLeft, caption=localization.GetByLabel('UI/PI/Common/LinkMaxCapacity'), subtext=totalBandwidth) self.bandwidthUsed = CaptionAndSubtext( parent=self.infoContLeft, caption=localization.GetByLabel('UI/PI/Common/CapacityUsed'), subtext=bandwidthUsed, top=30) self.bandwidthGauge = uicls.Gauge( parent=self.infoContRight, value=link.GetBandwidthUsage() / link.GetTotalBandwidth(), color=planetCommonUI.PLANET_COLOR_BANDWIDTH, label=localization.GetByLabel('UI/PI/Common/CapacityUsed')) levelStr = localization.GetByLabel( 'UI/PI/Common/LinkUpgradeLevelAndName', upgradeLevel=uiutil.IntToRoman(link.level), upgradeLevelName=self.GetCaptionForUpgradeLevel(link.level)) self.upgradeLevel = CaptionAndSubtext( parent=self.infoContRight, caption=localization.GetByLabel('UI/PI/Common/UpgradeLevel'), subtext=levelStr, top=30)
def _UpdateInfoCont(self): if not self or self.destroyed: return link = self.pin.link totalBandwidth = localization.GetByLabel( 'UI/PI/Common/CapacityAmount', amount=link.GetTotalBandwidth()) bandwidthUsed = localization.GetByLabel( 'UI/PI/Common/CapacityAmount', amount=link.GetBandwidthUsage()) self.totalBandwidth.SetSubtext(totalBandwidth) self.bandwidthUsed.SetSubtext(bandwidthUsed) levelStr = localization.GetByLabel( 'UI/PI/Common/LinkUpgradeLevelAndName', upgradeLevel=uiutil.IntToRoman(link.level), upgradeLevelName=self.GetCaptionForUpgradeLevel(link.level)) self.upgradeLevel.SetSubtext(levelStr) self.bandwidthGauge.SetValue(link.GetBandwidthUsage() / link.GetTotalBandwidth())
def GetLevelName(self): if self.level == 6: return localization.GetByLabel('UI/FactionWarfare/IHub/Buffer') return uiutil.IntToRoman(self.level)