class AbilityIcon(Container): default_width = 48 default_height = 48 default_align = uiconst.TOPLEFT default_state = uiconst.UI_NORMAL tooltipPanelClassInfo = SquadronTooltipModuleWrapper() def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.activeCurve = None self.activationPendingCurve = None self.deactivationCurve = None self.ramp_active = False self.buttonDisabled = False self.shipFighterState = GetShipFighterState() self.crimewatchSvc = sm.GetService('crimewatchSvc') self.innerCont = Container(name='innerCont', parent=self, align=uiconst.TOBOTTOM, height=self.height) self.stateLabel = EveLabelSmall(parent=self.innerCont, align=uiconst.CENTER) self.controller = attributes.controller self.slotID = self.controller.slotID self.fighterID = attributes.fighterID self.fighterTypeID = attributes.fighterTypeID ability = self.GetAbilityInfo() self.abilityNameID = ability.displayNameID iconID = ability.iconID self.abilityIcon = Icon(parent=self.innerCont, align=uiconst.CENTER, width=32, height=32, icon=iconID, state=uiconst.UI_DISABLED) self.hilite = Sprite( parent=self.innerCont, name='hilite', width=44, height=44, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/ShipUI/slotHilite.png', blendMode=trinity.TR2_SBM_ADDX2) self.hilite.display = False bgSprite = Sprite( parent=self.innerCont, align=uiconst.CENTER, width=64, height=64, texturePath= 'res:/UI/Texture/classes/ShipUI/Fighters/slotFighterAbility.png', state=uiconst.UI_DISABLED) self.abilityIcon.SetSize(32, 32) self.DrawQtyCont() self.DrawTimer() self.DrawCoolDownTimer() self.DrawSafetyGlow() self.targetMode = ability.targetMode abilityID = GetAbilityIDForSlot(self.fighterTypeID, self.slotID) effectID = GetDogmaEffectIDForAbilityID(abilityID) self.abilityEffect = cfg.dgmeffects.Get(effectID) self.OnAbilityStatusUpdated(self.fighterID, self.slotID) self.shipFighterState.signalOnAbilityActivationStatusUpdate.connect( self.OnAbilityStatusUpdated) def GetSafetyWarning(self): requiredSafetyLevel = self.GetRequiredSafetyLevel() if self.crimewatchSvc.CheckUnsafe(requiredSafetyLevel): return requiredSafetyLevel else: return None def GetRequiredSafetyLevel(self): requiredSafetyLevel = self.crimewatchSvc.GetRequiredSafetyLevelForEffect( self.abilityEffect) return requiredSafetyLevel def OnMouseEnter(self, *args): self.hilite.display = True requiredSafetyLevel = self.GetSafetyWarning() if requiredSafetyLevel is not None: if requiredSafetyLevel == const.shipSafetyLevelNone: color = crimewatchConst.Colors.Criminal else: color = crimewatchConst.Colors.Suspect self.safetyGlow.color.SetRGBA(*color.GetRGBA()) self.safetyGlow.display = True def OnMouseExit(self, *args): self.hilite.display = False self.safetyGlow.display = False def DrawSafetyGlow(self): self.safetyGlow = Sprite( parent=self.innerCont, name='safetyGlow', width=64, height=64, padding=2, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/ShipUI/slotGlow.png', color=crimewatchConst.Colors.Yellow.GetRGBA()) self.safetyGlow.display = False def DrawTimer(self): self.glow = Sprite( parent=self.innerCont, name='glow', width=64, height=64, padding=2, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/ShipUI/slotGlow.png', color=GLOWCOLOR) self.glow.display = False self.busy = Sprite( parent=self.innerCont, name='busy', width=64, height=64, padding=2, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/ShipUI/slotGlow.png', color=BUSYCOLOR) self.busy.display = False self.ramps = ShipModuleButtonRamps(parent=self.innerCont, idx=0, top=-8) self.ramps.display = False def DrawCoolDownTimer(self): self.coolDownRamps = ShipModuleReactivationTimer(parent=self.innerCont, name='coolDown', idx=-1) self.coolDownRamps.display = False def DrawQtyCont(self): self.quantityParent = Container(parent=self.innerCont, name='quantityParent', pos=(16, 6, 24, 10), align=uiconst.BOTTOMRIGHT, state=uiconst.UI_DISABLED, idx=0) self.chargeCountLabel = Label(text='', parent=self.quantityParent, fontsize=9, letterspace=1, left=3, width=30, state=uiconst.UI_DISABLED) underlay = Sprite( parent=self.quantityParent, align=uiconst.TOALL, state=uiconst.UI_DISABLED, texturePath= 'res:/UI/Texture/classes/ShipUI/slotQuantityUnderlay.png', color=(0, 0, 0, 1)) def GetAbilityInfo(self): ability = self.controller.GetAbilityInfo() return ability def OnAbilityStatusUpdated(self, fighterID, slotID): if fighterID == self.fighterID and slotID == self.slotID: abilityActivationStatus = self.shipFighterState.GetAbilityActivationStatus( self.fighterID, self.slotID) if abilityActivationStatus: if abilityActivationStatus.isPending: self._StartActivationPendingAnimation() else: self._StopActivationPendingAnimation() if abilityActivationStatus.isDeactivating: self._StartDeactivationAnimation() else: self._StopDeactivationAnimation() if not abilityActivationStatus.isPending and not abilityActivationStatus.isDeactivating: self._StartActiveAnimation() self.buttonDisabled = False else: self._StopActiveAnimation() self.buttonDisabled = True if abilityActivationStatus.startTime and abilityActivationStatus.durationMs: self._StartCycleAnimation( abilityActivationStatus.startTime, abilityActivationStatus.durationMs) else: self._StopCycleAnimation() else: self._StopActivationPendingAnimation() self._StopDeactivationAnimation() self._StopActiveAnimation() self._StopCycleAnimation() cooldown = self.shipFighterState.GetAbilityCooldown( self.fighterID, self.slotID) if cooldown is not None: self.buttonDisabled = True uthread.new(self._StartCoolDownAnimation, cooldown) else: self.buttonDisabled = False self._UpdateChargeCountLabel() def _UpdateChargeCountLabel(self): maxChargeCount = GetChargeCountForTypeAndSlot(self.fighterTypeID, self.slotID) if maxChargeCount is not None: currentChargeCount = self.shipFighterState.GetAbilityChargeCount( self.fighterID, self.slotID) self.quantityParent.Show() self.chargeCountLabel.SetText(currentChargeCount) else: self.quantityParent.Hide() def _StartCycleAnimation(self, startTime, durationMs): if self.ramp_active: return uthread.new(self._StartCycleAnimationThread, startTime, durationMs) def _StartCycleAnimationThread(self, startTime, durationMs): duration = durationMs * MSEC self.ramp_active = True self.ramps.display = True self.coolDownRamps.display = False while self.ramp_active: now = blue.os.GetSimTime() portionDone = (now - startTime) / duration if portionDone > 1: iterations = int(portionDone) startTime += long(duration * iterations) portionDone -= iterations self.ramps.SetRampValues(portionDone) blue.pyos.synchro.Yield() def _StopCycleAnimation(self): self.ramp_active = False self.ramps.display = False def _StartCoolDownAnimation(self, cooldown): self.coolDownRamps.display = True startTime, endTime = cooldown coolDownTime = int(endTime - startTime) self.coolDownRamps.AnimateTimer(startTime, coolDownTime) if endTime <= blue.os.GetSimTime(): self.coolDownRamps.display = False self.buttonDisabled = False def _StartActiveAnimation(self): self.glow.display = True self.activeCurve = animations.FadeTo(self.glow, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_WAVE) animations.SyncPlayback(self.activeCurve) def _StopActiveAnimation(self): self.glow.display = False if self.activeCurve: self.activeCurve.Stop() self.activeCurve = None def _StartActivationPendingAnimation(self): self.activationPendingCurve = animations.FadeTo( self.abilityIcon, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_WAVE) animations.SyncPlayback(self.activationPendingCurve) def _StopActivationPendingAnimation(self): if self.activationPendingCurve: self.activationPendingCurve.Stop() self.activationPendingCurve = None animations.FadeIn(self.abilityIcon) def _StartDeactivationAnimation(self): self.busy.display = True self.deactivationCurve = animations.FadeTo(self.busy, loops=uiconst.ANIM_REPEAT, curveType=uiconst.ANIM_WAVE) animations.SyncPlayback(self.deactivationCurve) def _StopDeactivationAnimation(self): self.busy.display = False if self.deactivationCurve: self.deactivationCurve.Stop() self.deactivationCurve = None def OnClick(self, *args): if self.buttonDisabled: return self.controller.OnAbilityClick(self.targetMode) def Close(self): self._StopActiveAnimation() self._StopActivationPendingAnimation() self._StopDeactivationAnimation() self.shipFighterState.signalOnAbilityActivationStatusUpdate.disconnect( self.OnAbilityStatusUpdated) super(AbilityIcon, self).Close() def OnMouseDown(self, *args): if self.buttonDisabled: return self.innerCont.top = 2 def OnMouseUp(self, *args): if self.buttonDisabled: return self.innerCont.top = 0
class SellItemContainer(BuySellItemContainerBase): __guid__ = 'uicls.SellItemContainer' belowColor = '<color=0xffff5050>' aboveColor = '<color=0xff00ff00>' totaLabelPath = 'UI/Market/MarketQuote/AskTotal' def ApplyAttributes(self, attributes): self.item = attributes.item self.typeID = self.item.typeID BuySellItemContainerBase.ApplyAttributes(self, attributes) self.adjustQtyAndPriceTimer = None self.isUpdating = False self.singleton = self.item.singleton self.itemID = self.item.itemID self.itemName = evetypes.GetName(self.typeID) self.brokersFee = 0.0 self.salesTax = 0.0 self.totalSum = 0.0 self.stationID = attributes.stationID self.limits = self.quoteSvc.GetSkillLimits(self.stationID) self.solarSystemID = attributes.solarSystemID self.regionID = self.GetRegionID() self.locationID = self.item.locationID self.bestBid = attributes.bestBid self.bestPrice = attributes.bestPrice self.totalStrikethroughLine = None self.priceAmountWarning = None self.deltaCont = Container(parent=self, align=uiconst.TORIGHT, width=30) theRestCont = Container(name='theRestCont', parent=self, align=uiconst.TOALL) self.totalCont = Container(name='totalCont', parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.3) self.priceCont = Container(name='priceCont', parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.22) self.qtyCont = Container(name='qtyCont', parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.15) self.itemCont = Container(name='itemCont', parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.33) self.deleteCont = Container(name='deleteCont', parent=self.itemCont, align=uiconst.TORIGHT, width=24) self.deleteButton = ButtonIcon( texturePath='res:/UI/Texture/Icons/73_16_210.png', pos=(0, 0, 16, 16), align=uiconst.CENTERRIGHT, parent=self.deleteCont, hint=GetByLabel('UI/Generic/RemoveItem'), idx=0, func=self.RemoveItem) self.deleteCont.display = False self.textCont = Container(name='textCont', parent=self.itemCont, align=uiconst.TOALL) self.errorBg = ErrorFrame(bgParent=self) self.DrawItem() self.DrawQty() self.DrawPrice() self.DrawTotal() self.DrawDelta() self.estimatedSellCount = self.GetSellCountEstimate() self.SetTotalSumAndLabel() self.brokersFeePerc = self.limits.GetBrokersFeeForLocation( self.stationID) self.UpdateBrokersFee() self.GetSalesTax() self.ShowNoSellOrders() self.UpdateOrderStateInUI() def GetRegionID(self): return cfg.mapSystemCache.Get(session.solarsystemid2).regionID def OnDurationChanged(self, duration): self.OnChange() def ShowNoSellOrders(self, force=False): if self.IsImmediateOrder() and (self.bestBid is None or force): uicore.animations.FadeIn(self.errorBg, 0.35, duration=0.3) def GetDuration(self): from eve.client.script.ui.shared.market.sellMulti import SellItems wnd = SellItems.GetIfOpen() if not wnd: return return wnd.durationCombo.GetValue() def DrawQty(self): qty = self.item.stacksize self.qtyEdit = SinglelineEdit(name='qtyEdit', parent=self.qtyCont, align=uiconst.TOTOP, top=11, padLeft=4) self.qtyEdit.IntMode(*(1, long(qty))) self.qtyEdit.SetValue(qty) self.qtyEdit.OnChange = self.OnChange self.qtyEdit.hint = GetByLabel('UI/Common/Quantity') def DrawPrice(self): self.priceEdit = SinglelineEdit(name='priceEdit', parent=self.priceCont, align=uiconst.TOTOP, top=11, padLeft=8) self.priceEdit.FloatMode(*(0.01, 9223372036854.0, 2)) self.priceEdit.SetValue(self.bestPrice) self.priceEdit.OnChange = self.OnChange self.priceEdit.hint = GetByLabel('UI/Market/MarketQuote/AskPrice') def DrawDelta(self): self.deltaContainer = SellDeltaContainer(parent=self.deltaCont, delta=self.GetDelta(), func=self.OpenMarket, align=uiconst.CENTERRIGHT) self.deltaContainer.LoadTooltipPanel = self.LoadDeltaTooltip self.UpdateDelta() def GetTradeWndClass(self): from eve.client.script.ui.shared.market.sellMulti import SellItems return SellItems def LoadDeltaTooltip(self, tooltipPanel, *args): tooltipPanel.LoadGeneric2ColumnTemplate() tooltipPanel.cellPadding = (4, 1, 4, 1) tooltipPanel.AddLabelLarge( text=GetByLabel('UI/Market/MarketQuote/AskPrice')) tooltipPanel.AddLabelLarge(text=FmtISK(self.priceEdit.GetValue()), align=uiconst.CENTERRIGHT) tooltipPanel.AddSpacer(1, 8, colSpan=tooltipPanel.columns) tooltipPanel.AddLabelMedium( text='%s %s' % (GetByLabel('UI/Market/MarketQuote/RegionalAdverage'), self.GetDeltaText())) tooltipPanel.AddLabelMedium(text=FmtISK(self.averagePrice), align=uiconst.CENTERRIGHT) tooltipPanel.AddLabelMedium( text=GetByLabel('UI/Market/MarketQuote/BestRegional')) bestMatch = tooltipPanel.AddLabelMedium(text='', align=uiconst.CENTERRIGHT) bestMatchDetails = tooltipPanel.AddLabelSmall( text='', align=uiconst.CENTERRIGHT, colSpan=tooltipPanel.columns) if not self.bestBid: bestMatch.text = GetByLabel('UI/Contracts/ContractEntry/NoBids') bestMatchDetails.text = GetByLabel( 'UI/Market/MarketQuote/ImmediateWillFail') bestMatch.color = (1.0, 0.275, 0.0, 1.0) bestMatchDetails.color = (1.0, 0.275, 0.0, 1.0) else: bestMatch.text = FmtISK(self.bestBid.price) bestMatchText, volRemaining = self.GetBestMatchText() bestMatchDetails.text = bestMatchText bestMatchDetails.SetAlpha(0.6) if volRemaining: vol = tooltipPanel.AddLabelSmall(text=volRemaining, align=uiconst.CENTERRIGHT, colSpan=tooltipPanel.columns) vol.SetAlpha(0.6) def GetBestMatchText(self): jumps = max(self.bestBid.jumps - max(0, self.bestBid.range), 0) minVolumeText = None if jumps == 0 and self.stationID == self.bestBid.stationID: jumpText = GetByLabel('UI/Market/MarketQuote/ItemsInSameStation') else: jumpText = GetByLabel('UI/Market/MarketQuote/JumpsFromThisSystem', jumps=jumps) if self.bestBid.minVolume > 1 and self.bestBid.volRemaining >= self.bestBid.minVolume: minVolumeText = GetByLabel( 'UI/Market/MarketQuote/SimpleMinimumVolume', min=self.bestBid.minVolume) return (GetByLabel('UI/Market/MarketQuote/SellQuantity', volRemaining=long(self.bestBid.volRemaining), jumpText=jumpText), minVolumeText) def DrawItem(self): iconCont = Container(parent=self.textCont, align=uiconst.TOLEFT, width=32, padding=4) self.iconInnerCont = Container(name='iconInnerCont', parent=iconCont, align=uiconst.CENTERLEFT, pos=(0, 0, 32, 32)) self.wheel = LoadingWheel(parent=self.iconInnerCont, pos=(0, 0, 48, 48), align=uiconst.CENTER, idx=0) self.wheel.display = False self.techIcon = Sprite(parent=self.iconInnerCont, pos=(0, 0, 16, 16), align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL) self.icon = Icon(parent=self.iconInnerCont, typeID=self.typeID, state=uiconst.UI_DISABLED, ignoreSize=True, pos=(0, 0, 32, 32)) GetTechLevelIcon(self.techIcon, 1, self.typeID) itemName = GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=self.itemName, info=('showinfo', self.typeID, self.item.itemID)) self.itemNameLabel = Label(text=itemName, parent=self.textCont, left=40, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, autoFadeSides=35, fontsize=12) def UpdateBrokersFee(self): fee = self.quoteSvc.BrokersFee(self.stationID, self.totalSum, self.brokersFeePerc) feeAmount = fee.amt self.brokersFee = feeAmount def GetSalesTax(self): tax = self.totalSum * self.limits['acc'] self.salesTax = tax def GetTotalSum(self): self.GetTotalSumAndDisplaySum() return self.totalSum def GetTotalSumAndDisplaySum(self): price = self.GetPrice() qty = self.GetQty() sumToDisplay = price * qty totalSum = sumToDisplay if self.IsImmediateOrder(): if self.estimatedSellCount == 0: totalSum = 0 elif self.estimatedSellCount < qty: sumToDisplay = self.estimatedSellCount * price totalSum = sumToDisplay self.totalSum = totalSum return (totalSum, sumToDisplay) def UpdateTotalSumLabel(self, totalSum, sumToDisplay): self.totalLabel.text = FmtISK(sumToDisplay) if sumToDisplay != totalSum: self.ConstructTotalStrikethroughLine() self.totalStrikethroughLine.width = self.totalLabel.textwidth else: self.ChangeTotalStrikethroughDisplay(display=False) def OnChange(self, *args): if self.adjustQtyAndPriceTimer: self.adjustQtyAndPriceTimer.KillTimer() self.adjustQtyAndPriceTimer = AutoTimer(200, self.AdjustQtyAndPrice_thread, *args) self.SetItemLoading() def AdjustQtyAndPrice_thread(self, *args): self.adjustQtyTimer = None if self.destroyed: return self.estimatedSellCount = self.GetSellCountEstimate() self.SetTotalSumAndLabel() self.UpdateBrokersFee() self.GetSalesTax() self.deltaContainer.display = True self.UpdateDelta() self.wheel.display = False self.isUpdating = False if self.parentEditFunc: self.parentEditFunc(args) self.UpdateOrderStateInUI() def SetItemLoading(self): self.totalLabel.text = NA_CHAR self.deltaContainer.display = False self.wheel.display = True self.isUpdating = True def SetTotalSumAndLabel(self): totalSum, displaySum = self.GetTotalSumAndDisplaySum() self.UpdateTotalSumLabel(totalSum, displaySum) def UpdateOrderStateInUI(self): duration = self.GetDuration() if duration != 0: self.ChangePriceAmountWarningDisplay(display=False) self.HideNoSellOrders() return qty = self.GetQty() if self.estimatedSellCount == 0: self.ShowNoSellOrders(force=True) self.ChangePriceAmountWarningDisplay(display=False) elif self.estimatedSellCount < qty: self.HideNoSellOrders() self.PrepareWarningInfo(self.estimatedSellCount, qty) else: self.HideNoSellOrders() self.ChangePriceAmountWarningDisplay(display=False) def PrepareWarningInfo(self, estimatedSellCount, qtyToSell): self.ConstructPriceAmountWarning() self.ConstructQtyBg() self.ChangePriceAmountWarningDisplay(display=True) self.priceAmountWarning.info = (estimatedSellCount, qtyToSell) def GetPrice(self): price = self.priceEdit.GetValue() return price def GetQty(self): qty = self.qtyEdit.GetValue() return qty def GetQtyToSell(self): qty = self.GetQty() if self.IsImmediateOrder(): return min(self.estimatedSellCount, qty) else: return qty def IsImmediateOrder(self): isImmediate = self.GetDuration() == 0 return isImmediate def SetQtyAndPrice(self, newQty, newPrice): self.qtyEdit.SetValue(newQty) self.priceEdit.SetValue(newPrice) self.OnChange() def GetSellCountEstimate(self): return self.quoteSvc.GetSellCountEstimate(self.typeID, self.stationID, self.GetPrice(), self.GetQty()) def MakeSingle(self): self.height = 80 self.qtyCont.width = 0 self.itemCont.width = 0.42 self.totalCont.width = 0.36 self.itemNameLabel.fontsize = 14 self.totalLabel.fontsize = 14 self.itemNameLabel.left = 72 self.icon.SetSize(64, 64) self.wheel.SetSize(64, 64) self.iconInnerCont.SetSize(64, 64) self.priceEdit.padLeft = 4 self.priceEdit.align = uiconst.TOBOTTOM self.qtyEdit.top = 20 self.priceEdit.top = 20 self.qtyEdit.SetParent(self.priceCont) if self.priceAmountWarning: self.priceAmountWarning.top = -10 def RemoveSingle(self): self.height = 40 self.qtyCont.width = 0.15 self.itemCont.width = 0.33 self.totalCont.width = 0.3 self.itemNameLabel.fontsize = 12 self.totalLabel.fontsize = 12 self.itemNameLabel.left = 40 self.icon.SetSize(32, 32) self.wheel.SetSize(48, 48) self.iconInnerCont.SetSize(32, 32) self.priceEdit.align = uiconst.TOTOP self.qtyEdit.top = 11 self.priceEdit.top = 11 self.priceEdit.padLeft = 8 self.qtyEdit.SetParent(self.qtyCont) if self.priceAmountWarning: self.priceAmountWarning.top = 0 def ConstructPriceAmountWarning(self): if self.priceAmountWarning: return None cont = Container(name='priceAmountWarning', parent=self.itemCont, align=uiconst.TORIGHT, left=-4, width=16, idx=0) self.priceAmountWarning = Sprite( parent=cont, pos=(0, 0, 16, 16), align=uiconst.CENTER, texturePath='res:/ui/texture/icons/44_32_7.png') self.priceAmountWarning.SetRGB(1.0, 0.3, 0.3, 0.8) self.priceAmountWarning.info = (None, None) self.priceAmountWarning.GetHint = self.GetWarningHint def ConstructQtyBg(self): if getattr(self.qtyEdit, 'warningBg', None): return warningBg = Fill(bgParent=self.qtyEdit, color=(1, 0, 0, 0.3)) self.qtyEdit.warningBg = warningBg def ConstructTotalStrikethroughLine(self): if self.totalStrikethroughLine: return self.totalStrikethroughLine = Line(parent=self.totalCont, align=uiconst.CENTERRIGHT, pos=(2, 0, 0, 1), idx=0, color=(1, 1, 1, 0.8)) def ChangeTotalStrikethroughDisplay(self, display=False): if self.totalStrikethroughLine: self.totalStrikethroughLine.display = display def ChangePriceAmountWarningDisplay(self, display=False): if self.priceAmountWarning: self.priceAmountWarning.display = display if getattr(self.qtyEdit, 'warningBg', None): self.qtyEdit.warningBg.display = display def GetWarningHint(self): estimatedSellCount, qtyToSell = self.priceAmountWarning.info if estimatedSellCount is None or qtyToSell is None: return txt = GetByLabel('UI/Market/MarketQuote/QtyPriceWarning', estimatedSellNum=int(estimatedSellCount), tryingToSellNum=qtyToSell) return txt
class SellItemContainer(Container): __guid__ = 'uicls.SellItemContainer' default_height = 40 default_align = uiconst.TOTOP default_state = uiconst.UI_NORMAL def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.parentFunc = attributes.parentFunc self.padding = (0, 2, 0, 2) self.item = attributes.item self.singleton = self.item.singleton self.parentEditFunc = attributes.editFunc self.typeID = self.item.typeID self.itemID = self.item.itemID self.invType = cfg.invtypes.Get(self.typeID) self.itemName = self.invType.name self.brokersFee = 0.0 self.salesTax = 0.0 self.totalSum = 0.0 self.quote = sm.GetService('marketQuote') self.limits = self.quote.GetSkillLimits() self.stationID, officeFolderID, officeID = sm.GetService( 'invCache').GetStationIDOfficeFolderIDOfficeIDOfItem(self.item) self.located = None if officeFolderID is not None: self.located = [officeFolderID, officeID] station = sm.GetService('ui').GetStation(self.stationID) self.solarSystemID = station.solarSystemID self.regionID = self.GetRegionID(self.stationID) self.averagePrice = self.quote.GetAveragePrice(self.typeID) self.bestBid = self.quote.GetBestBid(self.typeID, locationID=self.solarSystemID) self.GetBestPrice() self.deltaCont = Container(parent=self, align=uiconst.TORIGHT, width=30) theRestCont = Container(parent=self, align=uiconst.TOALL) self.totalCont = Container(parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.3) self.priceCont = Container(parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.22) self.qtyCont = Container(parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.15) self.itemCont = Container(parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.33) self.deleteCont = Container(parent=self.itemCont, align=uiconst.TORIGHT, width=24) self.deleteButton = ButtonIcon( texturePath='res:/UI/Texture/Icons/73_16_210.png', pos=(0, 0, 16, 16), align=uiconst.CENTERRIGHT, parent=self.deleteCont, hint=GetByLabel('UI/Generic/RemoveItem'), idx=0, func=self.RemoveItem) self.deleteCont.display = False self.textCont = Container(parent=self.itemCont, align=uiconst.TOALL) self.errorBg = ErrorFrame(bgParent=self) self.DrawItem() self.DrawQty() self.DrawPrice() self.DrawTotal() self.DrawDelta() self.GetTotalSum() self.GetBrokersFee() self.GetSalesTax() self.ShowNoSellOrders() def RemoveItem(self, *args): self.parentFunc(self, *args) def GetRegionID(self, stationID): regionID = cfg.evelocations.Get(stationID).Station().regionID return regionID def ShowNoSellOrders(self): wnd = SellItems.GetIfOpen() if not wnd: return if wnd.durationCombo.GetValue() == 0 and self.bestBid is None: uicore.animations.FadeIn(self.errorBg, 0.35, duration=0.3) def HideNoSellOrders(self): uicore.animations.FadeOut(self.errorBg, duration=0.3) def DrawQty(self): qty = self.item.stacksize self.qtyEdit = SinglelineEdit(name='qtyEdit', parent=self.qtyCont, align=uiconst.TOTOP, top=11, padLeft=4) self.qtyEdit.IntMode(*(1, long(qty))) self.qtyEdit.SetValue(qty) self.qtyEdit.OnChange = self.OnChange self.qtyEdit.hint = GetByLabel('UI/Common/Quantity') def DrawTotal(self): self.totalLabel = EveLabelMediumBold(text=self.totalSum, parent=self.totalCont, left=4, align=uiconst.CENTERRIGHT, state=uiconst.UI_NORMAL, autoFadeSides=35) self.totalLabel.hint = GetByLabel('UI/Market/MarketQuote/AskTotal') def DrawPrice(self): self.priceEdit = SinglelineEdit(name='priceEdit', parent=self.priceCont, align=uiconst.TOTOP, top=11, padLeft=8) self.priceEdit.FloatMode(*(0.01, 9223372036854.0, 2)) self.priceEdit.SetValue(self.bestPrice) self.priceEdit.OnChange = self.OnChange self.priceEdit.hint = GetByLabel('UI/Market/MarketQuote/AskPrice') def DrawDelta(self): self.deltaContainer = DeltaContainer(parent=self.deltaCont, delta=self.GetDelta(), func=self.OpenMarket, align=uiconst.CENTERRIGHT) self.deltaContainer.LoadTooltipPanel = self.LoadDeltaTooltip self.UpdateDelta() def OnMouseEnter(self, *args): self.mouseovertimer = AutoTimer(1, self.UpdateMouseOver) self.deleteCont.display = True def UpdateMouseOver(self): mo = uicore.uilib.mouseOver if mo in (self.itemNameLabel, self, self.deleteCont, self.deleteButton, self.totalLabel): return self.mouseovertimer = None self.deleteCont.display = False def Close(self, *args): self.mouseovertimer = None self.parentFunc = None Container.Close(self, *args) def OpenMarket(self, *args): sm.GetService('marketutils').ShowMarketDetails(self.typeID, None) wnd = SellItems.GetIfOpen() wnd.SetOrder(0) def LoadDeltaTooltip(self, tooltipPanel, *args): tooltipPanel.LoadGeneric2ColumnTemplate() tooltipPanel.cellPadding = (4, 1, 4, 1) tooltipPanel.AddLabelLarge( text=GetByLabel('UI/Market/MarketQuote/AskPrice')) tooltipPanel.AddLabelLarge(text=FmtISK(self.priceEdit.GetValue()), align=uiconst.CENTERRIGHT) tooltipPanel.AddSpacer(1, 8, colSpan=tooltipPanel.columns) tooltipPanel.AddLabelMedium( text='%s %s' % (GetByLabel('UI/Market/MarketQuote/RegionalAdverage'), self.GetDeltaText())) tooltipPanel.AddLabelMedium(text=FmtISK(self.averagePrice), align=uiconst.CENTERRIGHT) tooltipPanel.AddLabelMedium( text=GetByLabel('UI/Market/MarketQuote/BestRegional')) bestMatch = tooltipPanel.AddLabelMedium(text='', align=uiconst.CENTERRIGHT) bestMatchDetails = tooltipPanel.AddLabelSmall( text='', align=uiconst.CENTERRIGHT, colSpan=tooltipPanel.columns) if not self.bestBid: bestMatch.text = GetByLabel('UI/Contracts/ContractEntry/NoBids') bestMatchDetails.text = GetByLabel( 'UI/Market/MarketQuote/ImmediateWillFail') bestMatch.color = (1.0, 0.275, 0.0, 1.0) bestMatchDetails.color = (1.0, 0.275, 0.0, 1.0) else: bestMatch.text = FmtISK(self.bestBid.price) bestMatchText, volRemaining = self.GetBestMatchText() bestMatchDetails.text = bestMatchText bestMatchDetails.SetAlpha(0.6) if volRemaining: vol = tooltipPanel.AddLabelSmall(text=volRemaining, align=uiconst.CENTERRIGHT, colSpan=tooltipPanel.columns) vol.SetAlpha(0.6) def GetDeltaText(self): price = self.GetPrice() percentage = (price - self.averagePrice) / self.averagePrice if percentage < 0: color = '<color=0xffff5050>' else: color = '<color=0xff00ff00>' percText = '%s%s</color>' % ( color, GetByLabel('UI/Common/Percentage', percentage=FmtAmt(percentage * 100, showFraction=1))) return percText def GetBestMatchText(self): jumps = max(self.bestBid.jumps - max(0, self.bestBid.range), 0) minVolumeText = None if jumps == 0 and self.stationID == self.bestBid.stationID: jumpText = GetByLabel('UI/Market/MarketQuote/ItemsInSameStation') else: jumpText = GetByLabel('UI/Market/MarketQuote/JumpsFromThisSystem', jumps=jumps) if self.bestBid.minVolume > 1 and self.bestBid.volRemaining >= self.bestBid.minVolume: minVolumeText = GetByLabel( 'UI/Market/MarketQuote/SimpleMinimumVolume', min=self.bestBid.minVolume) return (GetByLabel('UI/Market/MarketQuote/SellQuantity', volRemaining=long(self.bestBid.volRemaining), jumpText=jumpText), minVolumeText) def GetDelta(self): price = self.GetPrice() percentage = (price - self.averagePrice) / self.averagePrice return percentage def UpdateDelta(self): delta = self.GetDelta() self.deltaContainer.UpdateDelta(delta) def DrawItem(self): iconCont = Container(parent=self.textCont, align=uiconst.TOLEFT, width=32, padding=4) self.icon = Icon(parent=iconCont, typeID=self.typeID, state=uiconst.UI_DISABLED) self.icon.SetSize(32, 32) itemName = GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=self.itemName, info=('showinfo', self.typeID, self.item.itemID)) self.itemNameLabel = Label(text=itemName, parent=self.textCont, left=40, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, autoFadeSides=35, fontsize=12) def GetBestPrice(self): bestMatchableBid = self.quote.GetBestMatchableBid( self.typeID, self.stationID, self.item.stacksize) if bestMatchableBid: self.bestPrice = bestMatchableBid.price else: self.bestPrice = self.averagePrice def GetBrokersFee(self): fee = self.quote.BrokersFee(self.stationID, self.totalSum, self.limits['fee']) feeAmount = fee.amt self.brokersFee = feeAmount def GetSalesTax(self): tax = self.totalSum * self.limits['acc'] self.salesTax = tax def GetTotalSum(self): price = self.GetPrice() qty = self.GetQty() self.totalSum = price * qty self.totalLabel.text = FmtISK(self.totalSum) return self.totalSum def OnChange(self, *args): self.GetTotalSum() self.GetBrokersFee() self.GetSalesTax() self.UpdateDelta() if self.parentEditFunc: self.parentEditFunc(args) def GetPrice(self): price = self.priceEdit.GetValue() return price def GetQty(self): qty = self.qtyEdit.GetValue() return qty def MakeSingle(self): self.height = 80 self.qtyCont.width = 0 self.itemCont.width = 0.42 self.totalCont.width = 0.36 self.itemNameLabel.fontsize = 14 self.totalLabel.fontsize = 14 self.itemNameLabel.left = 72 self.icon.SetSize(64, 64) self.icon.top = 4 self.priceEdit.padLeft = 4 self.priceEdit.align = uiconst.TOBOTTOM self.qtyEdit.top = 20 self.priceEdit.top = 20 self.qtyEdit.SetParent(self.priceCont) def RemoveSingle(self): self.height = 40 self.qtyCont.width = 0.15 self.itemCont.width = 0.33 self.totalCont.width = 0.3 self.itemNameLabel.fontsize = 12 self.totalLabel.fontsize = 12 self.itemNameLabel.left = 40 self.icon.SetSize(32, 32) self.icon.top = 0 self.priceEdit.align = uiconst.TOTOP self.qtyEdit.top = 11 self.priceEdit.top = 11 self.priceEdit.padLeft = 8 self.qtyEdit.SetParent(self.qtyCont)
class FittingServiceSlot(FittingSlotBase): SLOT_SIZE = 48 default_align = uiconst.BOTTOMLEFT default_height = SLOT_SIZE default_width = SLOT_SIZE isDragObject = True underlayTexturePath = 'res:/UI/Texture/classes/Fitting/stationServiceSlotFrame.png' def ApplyAttributes(self, attributes): FittingSlotBase.ApplyAttributes(self, attributes) self.sr.underlay = Sprite(bgParent=self, name='underlay', state=uiconst.UI_DISABLED, padding=(0, 0, 0, 0), texturePath=self.underlayTexturePath) self.flagIcon = Icon(parent=self, name='flagIcon', align=uiconst.CENTER, state=uiconst.UI_DISABLED, width=self.width, height=self.height) self.UpdateFitting() def UpdateFitting(self): if not self.controller.SlotExists() and not self.controller.GetModule( ): self.DisableSlot() return self.EnableSlot() self.SetDragState() self.PrepareUtilButtons() iconSize = int(self.SLOT_SIZE * GetScaleFactor()) self.flagIcon.SetSize(iconSize, iconSize) if self.controller.GetModule(): self.flagIcon.LoadIconByTypeID(self.controller.GetModule().typeID, ignoreSize=True) else: slotIcon = 'res:/UI/Texture/classes/Fitting/stationServiceSlot.png' self.flagIcon.LoadIcon(slotIcon, ignoreSize=True) if self.controller.GetModule(): self.tooltipPanelClassInfo = TooltipModuleWrapper() modulehint = evetypes.GetName(self.controller.GetModuleTypeID()) if not self.controller.SlotExists(): modulehint = GetByLabel('UI/Fitting/SlotDoesNotExist') self.hint = modulehint else: self.tooltipPanelClassInfo = None self.hint = self._emptyHint self.Hilite(0) self.UpdateOnlineDisplay() def OnDropData(self, dragObj, nodes): if self.controller.GetModule( ) is not None and not self.controller.SlotExists(): return items = self.GetDroppedItems(nodes) for item in items: if not getattr(item, 'typeID', None): return uthread.new(self.AddItem, item) def AddItem(self, item, sourceLocation=None): if not getattr(item, 'typeID', None): return validFitting = False for effect in cfg.dgmtypeeffects.get(item.typeID, []): if effect.effectID in (const.effectServiceSlot, ): validFitting = True if effect.effectID == self.controller.GetPowerType(): self.controller.FitModule(item) return uicore.Message( 'ItemDoesntFitPower', { 'item': evetypes.GetName(item.typeID), 'slotpower': cfg.dgmeffects.Get( self.controller.GetPowerType()).displayName, 'itempower': cfg.dgmeffects.Get(effect.effectID).displayName }) if not validFitting: raise UserError('ItemNotHardware', {'itemname': item.typeID}) def OnMouseEnter(self, *args): if self.controller.GetModule() is not None: self.ShowUtilButtons() else: self.hint = self._emptyHint self.Hilite(1) uicore.Message('ListEntryEnter') def OnMouseExit(self, *args): if not self.controller.GetModule(): self.Hilite(0) def PrepareUtilButtons(self): for btn in self.utilButtons: btn.Close() self.utilButtons = [] if not self.controller.GetModule(): return btns = self.GetUtilBtns() i = 0 for btnData in btns: left = int(self.left + self.width / 2.0 - 8) top = self.height + 20 + i * 16 utilBtn = FittingUtilBtn(parent=self.parent, icon=btnData.iconPath, left=left, top=top, btnData=btnData, mouseOverFunc=self.ShowUtilButtons, align=uiconst.BOTTOMLEFT, controller=self.controller) if btnData.onlineBtn == 1: self.sr.onlineButton = utilBtn self.utilButtons.append(utilBtn) i += 1 def GetUtilBtns(self): btns = [] isRig = False for effect in cfg.dgmtypeeffects.get(self.controller.GetModuleTypeID(), []): if effect.effectID == const.effectRigSlot: isRig = True break isOnlinable = self.controller.IsOnlineable() if isRig: btns += self.GetRigsBtns() else: btns = self.GetModuleBtns(isOnlinable) return btns
class BuyItemContainer(BuySellItemContainerBase): __guid__ = 'uicls.BuytemContainer' default_height = 52 belowColor = '<color=0xff00ff00>' aboveColor = '<color=0xffff5050>' totaLabelPath = 'UI/Market/MarketQuote/PayTotal' def ApplyAttributes(self, attributes): self.blinkBG = None self.typeID = attributes.typeID self.dropParentFunc = attributes.dropParentFunc BuySellItemContainerBase.ApplyAttributes(self, attributes) self.adjustQtyTimer = None self.isUpdating = False self.totalSum = 0.0 self.orderMultiplier = attributes.orderMultiplier self.qty = attributes.qty self.stationID = attributes.stationID self.newBestPrice, self.numOrders = self.quoteSvc.GetBestAskPriceInStationAndNumberOrders( self.typeID, self.stationID, self.qty) self.DrawUI() self.UpdateUIElements() self.GetBestPrice() def DrawUI(self): self.errorBg = ErrorFrame(bgParent=self) self.deltaCont = Container(parent=self, align=uiconst.TORIGHT, width=30) theRestCont = Container(parent=self, align=uiconst.TOALL) self.totalCont = Container(parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.3) self.priceCont = Container(parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.22) self.qtyCont = Container(parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.15) self.itemCont = Container(parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.33) self.deleteCont = Container(parent=self.itemCont, align=uiconst.TORIGHT, width=24) self.deleteButton = ButtonIcon( texturePath='res:/UI/Texture/Icons/73_16_210.png', pos=(0, 0, 16, 16), align=uiconst.CENTERRIGHT, parent=self.deleteCont, hint=GetByLabel('UI/Generic/RemoveItem'), idx=0, func=self.RemoveItem) self.deleteCont.display = False self.textCont = Container(parent=self.itemCont, align=uiconst.TOALL) self.DrawItem() self.DrawQty() self.DrawPrice() self.DrawTotal() self.DrawDelta() def UpdateUIElements(self): self.UpdateOrderStateInUI() self.GetBestPrice() self.SetPrice() self.UpdateDelta() def GetBestOrderInRange(self): stationID = self.stationID bidRange = None return self.quoteSvc.GetBestAskInRange(typeID=self.typeID, stationID=stationID, bidRange=bidRange, amount=self.qty) def ShowNoSellOrders(self): if self.newBestPrice is None: uicore.animations.FadeIn(self.errorBg, 0.35, duration=0.3) def DrawQty(self): self.qtySubCont = ContainerAutoSize(name='qtySubCont', parent=self.qtyCont, align=uiconst.TOTOP, callback=self.PositionQtyContainer) qty = self.qty self.qtyEdit = SinglelineEdit(name='qtyEdit', parent=self.qtySubCont, align=uiconst.TOTOP, padLeft=4, ints=[1, None], setvalue=qty, OnChange=self.OnChange, hint=GetByLabel('UI/Common/Quantity')) self.qtyEdit.OnMouseWheel = self.OnMouseWheelForQtyEdit self.qtyTotal = EveLabelMediumBold(text='', parent=self.qtySubCont, padLeft=8, padTop=6, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, autoFadeSides=35) self.SetTotalQtyText() def OnMouseWheelForQtyEdit(self, *args): if uicore.registry.GetFocus() != self.qtyEdit: return SinglelineEdit.MouseWheel(self.qtyEdit, *args) def PositionQtyContainer(self): subContTop = self.height / 2.0 - self.qtySubCont.GetAutoSize()[1] / 2.0 self.qtySubCont.top = int(subContTop) def DrawPrice(self): self.priceLabel = EveLabelMediumBold(name='priceLabel', text='', parent=self.priceCont, left=4, align=uiconst.CENTERRIGHT, state=uiconst.UI_NORMAL) def DrawDelta(self): self.deltaContainer = BuyDeltaContainer(parent=self.deltaCont, delta=self.GetDelta(), func=self.OpenMarket, align=uiconst.CENTERRIGHT) self.deltaContainer.LoadTooltipPanel = self.LoadDeltaTooltip def DrawItem(self): iconCont = Container(name='iconCont', parent=self.textCont, align=uiconst.TOLEFT, width=32, padding=4) iconInnerCont = Container(name='iconInnerCont', parent=iconCont, align=uiconst.CENTER, pos=(0, 0, 32, 32)) self.wheel = LoadingWheel(parent=iconCont, pos=(0, 0, 48, 48), align=uiconst.CENTER, idx=0) self.wheel.display = False self.techIcon = Sprite(parent=iconInnerCont, pos=(0, 0, 16, 16), align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL) GetTechLevelIcon(self.techIcon, 1, self.typeID) self.icon = Icon(parent=iconInnerCont, typeID=self.typeID, state=uiconst.UI_DISABLED, align=uiconst.CENTER) self.icon.SetSize(32, 32) itemName = GetShowInfoLink(typeID=self.typeID, text=evetypes.GetName(self.typeID)) self.itemNameLabel = Label(text=itemName, parent=self.textCont, left=40, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, autoFadeSides=35, fontsize=12) def SetPrice(self): self.priceLabel.text = self.GetPriceText() def GetPriceText(self): if self.newBestPrice: return FmtISK(self.newBestPrice) else: return NA_CHAR def GetBestPrice(self): totalQty = self.qty * self.orderMultiplier self.newBestPrice, self.numOrders = self.quoteSvc.GetBestAskPriceInStationAndNumberOrders( self.typeID, self.stationID, totalQty) self.UpdateOrderStateInUI() def UpdateOrderStateInUI(self): if self.newBestPrice: self.HideNoSellOrders() else: self.ShowNoSellOrders() def GetTotalSum(self): price = self.GetPrice() or 0 totalQty = self.GetQty() * self.orderMultiplier self.totalSum = price * totalQty self.SetTotalText(self.totalSum) return self.totalSum def SetTotalText(self, totalSum): if totalSum: self.totalLabel.text = FmtISK(totalSum) else: self.totalLabel.text = NA_CHAR def UpdateOrderMultiplier(self, multiplier): self.orderMultiplier = multiplier self.OnChange() def UpdateStationID(self, stationID): self.stationID = stationID self.UpdateUIElements() def OnChange(self, *args): if self.adjustQtyTimer: self.adjustQtyTimer.KillTimer() self.adjustQtyTimer = AutoTimer(1000, self.AdjustQty_thread, *args) self.SetItemLoading() def SetItemLoading(self): self.wheel.display = True self.qtyTotal.text = '' self.totalLabel.text = '' self.priceLabel.text = NA_CHAR self.deltaContainer.display = False self.totalLabel.text = NA_CHAR self.isUpdating = True def AdjustQty_thread(self, *args): self.adjustQtyTimer = None if self.destroyed: return self.qty = self.GetQty() self.SetTotalQtyText() self.GetBestPrice() self.SetPrice() self.deltaContainer.display = True self.UpdateDelta() self.GetTotalSum() self.wheel.display = False self.isUpdating = False if self.parentEditFunc: self.parentEditFunc(args) def SetTotalQtyText(self): totalQty = self.GetTotalQty() if totalQty is None: self.qtyTotal.text = '' self.qtyTotal.hint = '' elif self.orderMultiplier > 1: self.qtyTotal.display = True self.qtyTotal.text = '= %s' % FmtAmt(totalQty) self.qtyTotal.hint = GetByLabel( 'UI/Market/MarketQuote/TotalAmountToBuy', numOrders=self.orderMultiplier, qty=self.GetQty()) else: self.qtyTotal.display = False def GetPrice(self): return self.newBestPrice def GetQty(self): qty = self.qtyEdit.GetValue() return qty def GetTotalQty(self): qty = self.GetQty() return self.orderMultiplier * qty def GetTradeWndClass(self): from eve.client.script.ui.shared.market.buyMultiFromBase import MultiBuy return MultiBuy def GetDiffFromAvgText(self): return '%s %s' % (GetByLabel('UI/Market/MarketQuote/RegionalAdverage'), self.GetDeltaText()) def LoadDeltaTooltip(self, tooltipPanel, *args): tooltipPanel.LoadGeneric2ColumnTemplate() tooltipPanel.cellPadding = (4, 1, 4, 1) tooltipPanel.AddLabelLarge( text=GetByLabel('UI/Market/Marketbase/PricePerUnit')) tooltipPanel.AddLabelLarge(text=self.GetPriceText(), align=uiconst.CENTERRIGHT) bestMatchDetails = tooltipPanel.AddLabelSmall( text='', align=uiconst.CENTERRIGHT, colSpan=tooltipPanel.columns) tooltipPanel.AddSpacer(1, 8, colSpan=tooltipPanel.columns) tooltipPanel.AddLabelMedium(text=self.GetDiffFromAvgText(), align=uiconst.CENTERRIGHT) tooltipPanel.AddLabelMedium(text=FmtISK(self.averagePrice), align=uiconst.CENTERRIGHT) tooltipPanel.AddSpacer(1, 8, colSpan=tooltipPanel.columns) tooltipPanel.AddLabelMedium( text=GetByLabel('UI/Market/MarketQuote/BestInStation')) stationBestPrice = self.GetBestMatchText(rangeStation) tooltipPanel.AddLabelMedium(text=stationBestPrice, align=uiconst.CENTERRIGHT) tooltipPanel.AddLabelMedium( text=GetByLabel('UI/Market/MarketQuote/BestInSystem')) stationBestPrice = self.GetBestMatchText(rangeSolarSystem) tooltipPanel.AddLabelMedium(text=stationBestPrice, align=uiconst.CENTERRIGHT) tooltipPanel.AddLabelMedium( text=GetByLabel('UI/Market/MarketQuote/BestRegional')) regBestPrice = self.GetBestMatchText(rangeRegion) tooltipPanel.AddLabelMedium(text=regBestPrice, align=uiconst.CENTERRIGHT) if not self.newBestPrice: bestMatchDetails.text = GetByLabel( 'UI/Market/MarketQuote/NoMatchForOrder') bestMatchDetails.color = (1.0, 0.275, 0.0, 1.0) else: bestMatchDetails.text = GetByLabel( 'UI/Market/MarketQuote/FromNumberOfOrders', numOrders=self.numOrders) bestMatchDetails.SetAlpha(0.6) def GetBestMatchText(self, orderRange): bestOrder = self.quoteSvc.GetBestAskInRange(self.typeID, self.stationID, orderRange) if bestOrder: return FmtISK(bestOrder.price) return NA_CHAR def AddQtyToEntry(self, extraQty): self.Blink() qty = self.qtyEdit.GetValue() newQty = extraQty + qty self.qtyEdit.SetValue(newQty) def Blink(self): self.ConstructBlinkBG() uicore.animations.FadeTo(self.blinkBG, 0.0, 0.25, duration=0.25, curveType=uiconst.ANIM_WAVE, loops=2) def ConstructBlinkBG(self): if self.blinkBG is None: self.blinkBG = Sprite( name='blinkBg', bgParent=self, align=uiconst.TOALL, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/InvItem/bgSelected.png', opacity=0.0, idx=0) def OnDropData(self, dragSource, dragData): if self.dropParentFunc: self.dropParentFunc(dragSource, dragData)