class BadgeContainer(Container): def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes=attributes) self.badgeLabel = EveLabelMedium(name='myLabel', parent=self, align=uiconst.CENTER, bold=True, text='1') self.width = self.badgeLabel.width + 10 self.left = -self.badgeLabel.width - 20 self.top = self.parent.height / 2 - self.parent.height / 2 self.pointFromLeft = attributes.Get('pointfromleft', True) self.pointerframe = FrameWithPointer( bgParent=self, skinName=FRAME_WITH_POINTER_SKIN_BADGE) def updateBadgePointerPosition(self): if self.pointFromLeft: positionFlag = uiconst.POINT_RIGHT_2 else: positionFlag = uiconst.POINT_LEFT_2 self.pointerframe.UpdatePointerPosition(positionFlag=positionFlag) def ShowBadge(self): if self.opacity < 1: uicore.animations.FadeIn(self, duration=0.25, callback=None) def UpdateAlignment(self, *args, **kwds): retval = Container.UpdateAlignment(self, *args, **kwds) self.updateBadgePointerPosition() return retval def SetBadgeValue(self, value): self.badgeLabel.SetText(str(value)) self.width = self.badgeLabel.width + 10 self.left = -self.badgeLabel.width - 20 uthread.new(self.updateBadgePointerPosition) def HideBadge(self): uicore.animations.FadeOut(self, duration=0.25, callback=None)
class MultiTrainingOverlay(Container): SUPPRESS_KEY = 'suppress.MultiplePilotTrainingPromotion' CONTENT_LEFT = 140 CHARACTERS_LEFT = -180 default_align = uiconst.TOALL default_clipChildren = True default_state = uiconst.UI_HIDDEN def ApplyAttributes(self, attributes): super(MultiTrainingOverlay, self).ApplyAttributes(attributes) self.Layout() def Layout(self): self.compactMode = False Frame(bgParent=self, texturePath='res:/UI/Texture/classes/Monetization/vignette.png', cornerSize=150) self.characters = Sprite( parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, left=self.CHARACTERS_LEFT, top=10, texturePath='res:/UI/Texture/classes/Monetization/characters.png', width=299, height=355) self.content = ContainerAutoSize(parent=self, align=uiconst.CENTER, left=self.CONTENT_LEFT, width=340) EveCaptionLarge( parent=self.content, align=uiconst.TOTOP, text=localization.GetByLabel( 'UI/SkillQueue/MultiTrainingOverlay/MultiplePilotTraining')) EveLabelMedium( parent=self.content, align=uiconst.TOTOP, top=4, text=localization.GetByLabel( 'UI/SkillQueue/MultiTrainingOverlay/MultiTrainingMessageTop')) itemCont = ContainerAutoSize(parent=self.content, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, top=12) Frame(bgParent=itemCont, texturePath= 'res:/UI/Texture/classes/Monetization/item_well_frame.png', cornerSize=2) itemIconCont = ContainerAutoSize(parent=itemCont, align=uiconst.TOLEFT, padding=(8, 8, 0, 8)) Icon(parent=itemIconCont, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, size=64, typeID=typeMultiTrainingToken) Sprite(parent=itemIconCont, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/InvItem/bgNormal.png', width=64, height=64) EveLabelLargeBold(parent=itemCont, align=uiconst.TOTOP, padding=(8, 8, 24, 0), text=evetypes.GetName(typeMultiTrainingToken)) InfoIcon(parent=itemCont, align=uiconst.TOPRIGHT, top=8, left=8, typeID=typeMultiTrainingToken) self.estimatePriceLabel = EveLabelMedium(parent=itemCont, align=uiconst.TOTOP, padding=(8, 0, 8, 6), color=Color.GRAY5) buyButtonCont = FlowContainer(parent=itemCont, align=uiconst.TOTOP, padding=(8, 0, 8, 8), contentSpacing=(8, 0)) MultiTrainingBuyButtonIsk(parent=buyButtonCont, align=uiconst.NOALIGN, typeID=typeMultiTrainingToken) MultiTrainingBuyButtonAur(parent=buyButtonCont, align=uiconst.NOALIGN, types=[typeMultiTrainingToken]) EveLabelMedium( parent=self.content, align=uiconst.TOTOP, top=12, text=localization.GetByLabel( 'UI/SkillQueue/MultiTrainingOverlay/MultiTrainingMessageBottom' )) dismissCont = FlowContainer(parent=self.content, align=uiconst.TOTOP, padding=(8, 24, 8, 0), contentAlignment=CONTENT_ALIGN_CENTER, contentSpacing=(8, 4)) Button(parent=dismissCont, align=uiconst.NOALIGN, label=localization.GetByLabel( 'UI/SkillQueue/MultiTrainingOverlay/Dismiss'), func=lambda *args: self.Dismiss()) self.suppressCheckbox = Checkbox( parent=dismissCont, align=uiconst.NOALIGN, width=200, text=localization.GetByLabel('UI/Common/SuppressionShowMessage'), checked=self.suppressed, callback=self.OnSuppressChanged) def OnSuppressChanged(self, checkbox): self.suppressed = self.suppressCheckbox.GetValue() @classmethod def IsSuppressed(cls): return settings.user.suppress.Get(cls.SUPPRESS_KEY, False) @property def suppressed(self): return self.IsSuppressed() @suppressed.setter def suppressed(self, suppressed): if suppressed: settings.user.suppress.Set(self.SUPPRESS_KEY, suppressed) else: settings.user.suppress.Delete(self.SUPPRESS_KEY) sm.GetService('settings').SaveSettings() def ShouldDisplay(self): if self.suppressed: return False if sm.GetService('skillqueue').SkillInTraining() is not None: return False queues = sm.GetService( 'skillqueue').GetMultipleCharacterTraining().items() characterData = sm.GetService('cc').GetCharacterSelectionData() activeQueues = 1 + len(queues) usedQueues = 0 for characterDetails in characterData.details.values(): isTraining = characterDetails.GetSkillInTrainingInfo( )['currentSkill'] is not None if characterDetails.charID != session.charid and isTraining: usedQueues += 1 return usedQueues == activeQueues def Display(self): self.Load() self.Enable() self.AnimShow() def Load(self): self.UpdateEstimatedPrice() self.suppressCheckbox.SetValue(self.suppressed) def UpdateEstimatedPrice(self): try: tokenAveragePrice = GetAveragePrice(typeMultiTrainingToken) except KeyError: tokenAveragePrice = None if not tokenAveragePrice: text = localization.GetByLabel( 'UI/SkillQueue/MultiTrainingOverlay/EstimatedPriceUnknown') else: amount = RoundISK(tokenAveragePrice) text = localization.GetByLabel( 'UI/SkillQueue/MultiTrainingOverlay/EstimatedPrice', amount=amount) self.estimatePriceLabel.SetText(text) def Dismiss(self): self.Disable() self.AnimHide() def AnimShow(self): self.Show() animations.FadeTo(self, duration=0.4) if not self.compactMode: animations.FadeTo(self.characters, timeOffset=0.3) animations.FadeTo(self.content, timeOffset=0.3) def AnimHide(self): animations.FadeOut(self, duration=0.4) def EnterCompactMode(self): if self.compactMode: return self.compactMode = True animations.FadeOut(self.characters, duration=0.2) animations.MorphScalar(self.characters, 'left', startVal=self.characters.left, endVal=self.CHARACTERS_LEFT - 60, duration=0.3) animations.MorphScalar(self.content, 'left', startVal=self.content.left, endVal=0, duration=0.3) def ExitCompactMode(self): if not self.compactMode: return self.compactMode = False animations.FadeIn(self.characters, duration=0.2) animations.MorphScalar(self.characters, 'left', startVal=self.characters.left, endVal=self.CHARACTERS_LEFT, duration=0.3) animations.MorphScalar(self.content, 'left', startVal=self.content.left, endVal=self.CONTENT_LEFT, duration=0.3) def UpdateAlignment(self, budgetLeft=0, budgetTop=0, budgetWidth=0, budgetHeight=0, updateChildrenOnly=False): if budgetWidth < 640: self.EnterCompactMode() else: self.ExitCompactMode() return super(MultiTrainingOverlay, self).UpdateAlignment(budgetLeft, budgetTop, budgetWidth, budgetHeight, updateChildrenOnly)
class SkillInjectorBanner(ContainerAutoSize): __notifyevents__ = ['OnFreeSkillPointsChanged_Local'] PAD_TOP = 4 PAD_BOTTOM = 4 default_height = 30 default_showHilite = False def ApplyAttributes(self, attributes): super(SkillInjectorBanner, self).ApplyAttributes(attributes) self.Layout() self.Load() sm.RegisterNotify(self) def Close(self): super(SkillInjectorBanner, self).Close() sm.UnregisterNotify(self) def Layout(self): RaisedUnderlay(bgParent=self) topCont = ContainerAutoSize(parent=self, align=uiconst.TOTOP, alignMode=uiconst.TOPLEFT, top=4) Icon(parent=topCont, align=uiconst.TOPLEFT, top=4, left=4, typeID=invconst.typeSkillInjector, size=32, state=uiconst.UI_DISABLED) EveLabelMedium(parent=topCont, align=uiconst.TOPLEFT, top=4, left=40, text=evetypes.GetName(invconst.typeSkillInjector)) self.priceLabel = EveLabelMedium(parent=topCont, align=uiconst.TOPLEFT, top=18, left=40, color=Color.GRAY4) InfoIcon(parent=topCont, align=uiconst.CENTERRIGHT, left=4, typeID=invconst.typeSkillInjector) ShowMarketDetailsButton(parent=topCont, align=uiconst.CENTERRIGHT, left=24, width=16, height=16, typeID=invconst.typeSkillInjector) textCont = ContainerAutoSize(parent=self, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, padding=(8, 4, 8, 4)) self.mainLabel = EveLabelMedium(parent=textCont, align=uiconst.TOTOP) bottomCont = ContainerAutoSize(parent=self, align=uiconst.TOTOP, padding=(0, 0, 4, 4)) Button(parent=bottomCont, align=uiconst.TOPRIGHT, label=localization.GetByLabel('UI/SkillTrading/Dismiss'), func=self.Dismiss) def Load(self): freePoints = sm.GetService('skills').GetFreeSkillPoints() if freePoints: self.HideImmediately() else: self._UpdateEstimatedInjectorPrice() self._UpdateMainText() def Update(self): freePoints = sm.GetService('skills').GetFreeSkillPoints() if freePoints: uthread.new(self.AnimHide) else: self._UpdateEstimatedInjectorPrice() self._UpdateMainText() uthread.new(self.AnimShow) def _UpdateEstimatedInjectorPrice(self): price = inventorycommon.typeHelpers.GetAveragePrice( invconst.typeSkillInjector) if price is None or price <= 0: price = localization.GetByLabel('UI/Common/Unknown') else: price = FmtISKAndRound(price, False) text = localization.GetByLabel('UI/SkillTrading/EstimatedPrice', price=price) self.priceLabel.SetText(text) def _UpdateMainText(self): injectorType = invconst.typeSkillInjector points = sm.GetService('skills').GetSkillPointAmountFromInjectors( injectorType, quantity=1) color = Color.RGBtoHex(1.0, 0.8, 0.0, 1.0) text = localization.GetByLabel( 'UI/SkillTrading/InjectorBannerMainText', injector=injectorType, points=points, color=color) self.mainLabel.SetText(text) def Dismiss(self, button): button.Disable() SetSkillInjectorBannerDismissed() self.AnimHide() def AnimHide(self): for child in self.children: animations.FadeOut(child, duration=0.3) self.DisableAutoSize() animations.MorphScalar(self, 'height', startVal=self.height, endVal=0, timeOffset=0.1, duration=0.3) animations.MorphScalar(self, 'padTop', startVal=self.padTop, endVal=0, timeOffset=0.1, duration=0.3) animations.MorphScalar(self, 'padBottom', startVal=self.padBottom, endVal=0, timeOffset=0.1, duration=0.3) def AnimShow(self): for child in self.children: animations.FadeIn(child, duration=0.3, timeOffset=0.1) self.EnableAutoSize() self.DisableAutoSize() animations.MorphScalar(self, 'height', startVal=0, endVal=self.height, duration=0.3) animations.MorphScalar(self, 'padTop', startVal=0, endVal=self.PAD_TOP, duration=0.3) animations.MorphScalar(self, 'padBottom', startVal=0, endVal=self.PAD_BOTTOM, duration=0.3, sleep=True) self.EnableAutoSize() def HideImmediately(self): for child in self.children: child.opacity = 0.0 self.DisableAutoSize() self.height = 0 self.padTop = 0 self.padBottom = 0 def OnFreeSkillPointsChanged_Local(self): self.Update()
class ContainerContentWindow(Window): __guid__ = 'ContainerContentWindow' default_width = 500 default_height = 400 default_minSize = (500, 256) default_windowID = 'containerContentWindow' default_captionLabelPath = 'UI/Menusvc/ItemsInContainerHint' def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(0) self.topHint = EveLabelMedium(text='', parent=self.sr.main, top=4, state=uiconst.UI_DISABLED, align=uiconst.TOTOP, padding=4) self.scroll = Scroll( parent=self.sr.main, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding), id='containerContentWindow') def LoadContent(self, itemID, hasFlag, stationID, typeName, invCacheSvc): hint = '<center>' + GetByLabel('UI/Menusvc/ItemsInContainerHint2', containerName=typeName) self.topHint.SetText(hint) if hasFlag: hdr = [ GetByLabel('UI/Inventory/InvItemNameShort'), GetByLabel('UI/Inventory/ItemGroup'), GetByLabel('UI/Common/Location'), GetByLabel('UI/Common/Quantity') ] else: hdr = [ GetByLabel('UI/Inventory/InvItemNameShort'), GetByLabel('UI/Inventory/ItemGroup'), GetByLabel('UI/Common/Quantity') ] contentList = self.GetContentsList(itemID, hasFlag, stationID, invCacheSvc) self.scroll.Load(contentList=contentList, headers=hdr, noContentHint=GetByLabel('UI/Common/NothingFound')) def GetContentsList(self, itemID, hasFlag, stationID, invCacheSvc): contents = invCacheSvc.GetInventoryMgr().GetContainerContents( itemID, stationID) lst = [] for c in contents: flag = c.flagID if flag == const.flagPilot: continue locationName = GetShipFlagLocationName(flag) typeName = evetypes.GetName(c.typeID) groupID = evetypes.GetGroupID(c.typeID) if hasFlag: txt = '%s<t>%s<t>%s<t><right>%s' % ( typeName, evetypes.GetGroupNameByGroup(groupID), locationName, c.stacksize) else: txt = '%s<t>%s<t><right>%s' % ( typeName, evetypes.GetGroupNameByGroup(groupID), c.stacksize) data = { 'label': txt, 'typeID': c.typeID, 'itemID': c.itemID, 'getIcon': True } entry = listentry.Get(entryType='Item', data=data) lst.append(entry) return lst
class ReprocessingWnd(Window): __guid__ = 'form.ReprocessingWnd' default_width = 600 default_height = 400 default_minSize = (default_width, default_height) default_windowID = 'reprocessingWindow' default_descriptionLabelPath = 'Tooltips/StationServices/ReprocessingPlant_description' default_captionLabelPath = 'UI/Station/ReprocessingPlant' default_iconNum = 'res:/UI/Texture/WindowIcons/Reprocess.png' def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(0) self.preSelectedItems = attributes.selectedItems self.outputPrice = 0 self.outputItemsCount = 0 mainCont = Container(name='mainCont', parent=self.sr.main, padding=const.defaultPadding) self.bottomContainer = bottomCont = Container(name='bottomCont', parent=mainCont, align=uiconst.TOBOTTOM, height=36) reprocessingCont = Container(name='reprocessingCont', parent=mainCont, align=uiconst.TOALL) inputCont = Container(name='inputCont', parent=reprocessingCont, align=uiconst.TOLEFT_PROP, width=0.48) centerCont = Container(name='centerCont', parent=reprocessingCont, align=uiconst.TOLEFT_PROP, width=0.02) outputCont = Container(name='outputCont', parent=reprocessingCont, align=uiconst.TORIGHT_PROP, width=0.48) self.inputInfoCont = ReprocessInputContainer( name='inputInfo', parent=inputCont, dropFunc=self.AddItemByDrag, removeFunc=self.RemoveItem) self.outputInfoCont = ReprocessOutputContainer(name='outputInfo', parent=outputCont) self.loadingOverlay = Container(parent=self.inputInfoCont, idx=0) Fill(bgParent=self.loadingOverlay, color=(0.0, 0.0, 0.0, 0.3)) LoadingWheel(name='loadingWheel', parent=self.loadingOverlay, align=uiconst.CENTER, width=80, height=80, state=uiconst.UI_DISABLED) self.loadingOverlay.opacity = 0.0 self.controller = CreateReprocessingWindowController( self, self.inputInfoCont, self.outputInfoCont, sm.GetService('invCache'), sm.GetService('reprocessing'), GetActiveShip) self.inputInfoCont.captionLabel.text = GetByLabel( 'UI/Reprocessing/ReprocessingWindow/InputMaterials') self.outputInfoCont.captionLabel.text = GetByLabel( 'UI/Reprocessing/ReprocessingWindow/OutputResults') btnCont = Container(name='buttonCont', parent=bottomCont, align=uiconst.TOBOTTOM, height=36, idx=0, padding=(-4, 3, -4, -2)) GradientThemeColored(bgParent=btnCont) self.reprocessButton = Button( parent=btnCont, label=GetByLabel( 'UI/Reprocessing/ReprocessingWindow/ReprocessButton'), func=self.ReprocessItems, align=uiconst.CENTERRIGHT, fixedheight=28, left=8) left = self.reprocessButton.left + self.reprocessButton.width self.totalIskCostLabel = EveLabelMedium(parent=btnCont, text='', align=uiconst.CENTERRIGHT, left=left + 8, color=COL_RED) self.cancelButton = Button( parent=btnCont, label=GetByLabel('UI/Common/Buttons/Cancel'), func=self.Cancel, align=uiconst.CENTERLEFT, fixedheight=28, left=8) self.DisableReprocessButton(disable=True) if self.preSelectedItems: start_tasklet(self.AddPreselectedItems, self.preSelectedItems) def ShowInputLoading(self): self.inputInfoCont.overlayCont.display = False uicore.animations.FadeIn(self.loadingOverlay, endVal=1.0, duration=0.2) def HideInputLoading(self): uicore.animations.FadeOut(self.loadingOverlay, duration=0.2) def DisableReprocessButton(self, disable): if disable: self.reprocessButton.Disable() self.reprocessButton.hint = GetByLabel( 'UI/Reprocessing/ReprocessingWindow/NoReprocessableItems') else: self.reprocessButton.Enable() self.reprocessButton.hint = '' def AddPreselectedItems(self, items): self.controller.AddItems(items) outputItems = self.outputInfoCont.GetItems() if self.reprocessButton.disabled and len(outputItems): self.DisableReprocessButton(disable=False) def RemoveItem(self, itemID): self.controller.RemoveItem(itemID) outputItems = self.controller.GetOutputItems() if len(outputItems) == 0: self.DisableReprocessButton(True) def AddItemByDrag(self, dragObj, nodes): self.controller.AddItems(NodesToItems(nodes)) outputItems = self.outputInfoCont.GetItems() if self.reprocessButton.disabled and len(outputItems): self.DisableReprocessButton(disable=False) self.cancelButton.SetLabel(GetByLabel('UI/Common/Buttons/Cancel')) def IsValid(self, item): activeShipID = GetActiveShip() if item.flagID == const.flagReward: return False if item.groupID == const.groupMineral: return False if item.itemID in (activeShipID, session.charid): return False return True def Cancel(self, *args): self.CloseByUser() def GetOutputItems(self): return [] def ReprocessItems(self, *args): ret = self.controller.Reprocess() self.DisableReprocessButton(disable=True) self.cancelButton.SetLabel(GetByLabel('UI/Common/Buttons/Cancel')) self.outputInfoCont.AnimateOutputItems() self.outputInfoCont.FadeOutOutputItems() self.outputInfoCont.FadeHeaders() self.outputInfoCont.overlayCont.display = True return ret def UpdateTotalIskCost(self, iskCost): self.totalIskCostLabel.SetText(FmtISK(-iskCost))