def BuildUI(self): inv = sm.GetService('invCache').GetInventoryFromId(self.structureID) item = inv.GetItem() stationName = cfg.evelocations.Get(self.structureID).name or evetypes.GetName(item.typeID) stationText = GetShowInfoLink(item.typeID, stationName, itemID=self.structureID) self.nameLabel = EveLabelMedium(name='nameLabel', parent=self.sr.main, text=stationText, padLeft=10, align=uiconst.TOTOP, state=uiconst.UI_NORMAL) ownerText = GetShowInfoLink(const.typeCorporation, cfg.eveowners.Get(item.ownerID).name, itemID=item.ownerID) self.ownerLabel = EveLabelMedium(name='ownerLabel', parent=self.sr.main, text=ownerText, padLeft=10, align=uiconst.TOTOP, state=uiconst.UI_NORMAL) Button(parent=self.sr.main, align=uiconst.TOTOP, label='_Take control', func=self.TakeControl, padding=(10, 2, 10, 2)) self.AddCurrentShip() Button(parent=self.sr.main, align=uiconst.TOTOP, label='_Undock', func=self.Undock, padding=(10, 2, 10, 2))
def LoadContentCont(self): self.contentCont.Flush() groupDesc = self.groupInfo['description'] admins = self.groupInfo['admins'] if groupDesc: EveLabelMedium(parent=self.contentCont, text=groupDesc, padTop=6, align=uiconst.TOTOP) else: descText = GetByLabel( 'UI/Structures/AccessGroups/NoGroupDescription') EveLabelMedium(parent=self.contentCont, text=descText, align=uiconst.TOTOP, padTop=6, italic=True) for adminID in admins: ownerInfo = cfg.eveowners.Get(adminID) charName = ownerInfo.name charText = GetShowInfoLink(ownerInfo.typeID, charName, itemID=adminID) text = GetByLabel('UI/Structures/AccessGroups/GroupOwner', ownerName=charText) EveLabelMedium(parent=self.contentCont, text=text, align=uiconst.TOTOP, padTop=6, state=uiconst.UI_NORMAL)
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 BuildHintTextList(self, itemList, labelPath): hintTextList = [] if len(itemList): text = '<b>%s</b>' % GetByLabel(labelPath) hintTextList.append(text) for item in itemList: typeName = evetypes.GetName(item.typeID) typeLink = GetShowInfoLink(item.typeID, typeName) hintTextList.append(typeLink) return hintTextList
def SetText(self, systemStations): solarSystemName = GetShowInfoLink(const.typeSolarSystem, cfg.evelocations.Get(self.solarSystemID).name, self.solarSystemID) now = blue.os.GetWallclockTime() timeUntilAuto = FormatTimeIntervalShortWritten(long(max(0, self.autoDeliveryTimestamp - now))) nearestNPCStationText = GetShowInfoLink(self.nearestNPCStationInfo['typeID'], self.nearestNPCStationInfo['name'], self.nearestNPCStationInfo['itemID']) stationsInSystem = len(systemStations) if self.manualDeliveryTimestamp - now < 0: if stationsInSystem: path = 'UI/Inventory/AssetSafety/DeliveryExplanationText' else: path = 'UI/Inventory/AssetSafety/DeliveryExplanationTextNoStations' text = GetByLabel(path, solarSystemName=solarSystemName, npcStationName=nearestNPCStationText, timeUntil=timeUntilAuto) else: timeUntilManual = FormatTimeIntervalShortWritten(long(max(0, self.manualDeliveryTimestamp - now))) if stationsInSystem: path = 'UI/Inventory/AssetSafety/DeliveryNotAvailableNowExplanationText' else: path = 'UI/Inventory/AssetSafety/DeliveryNotAvailableTextNoStations' text = GetByLabel(path, solarSystemName=solarSystemName, timUntilManualDelivery=timeUntilManual, npcStationName=nearestNPCStationText, timeUntilAutoDelivery=timeUntilAuto) self.explanationLabel.text = text
def AddStation(self, station, buttonIsDisabled): parent = self.sameSolarSystem container = ContainerAutoSize(parent=parent, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, bgColor=(0.2, 0.2, 0.2, 0.3)) container.DisableAutoSize() label = GetShowInfoLink(station['typeID'], station['name'], station['itemID']) EveLabelMediumBold(parent=container, height=30, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, text=label, padding=(7, 8, 140, 5)) btn = Button(parent=container, label=GetByLabel('UI/Inventory/AssetSafety/DeliverBtn'), align=uiconst.CENTERRIGHT, fontsize=13, fixedwidth=140, fixedheight=25, pos=(5, 0, 0, 0), func=self.DoDeliver, args=station['itemID']) if buttonIsDisabled: btn.Disable() Line(parent=parent, align=uiconst.TOTOP, color=self.LINE_COLOR) container.EnableAutoSize()
def AddCurrentShip(self): activeShipID = GetActiveShip() if not activeShipID: return inv = sm.GetService('invCache').GetInventoryFromId(activeShipID) item = inv.GetItem() shipName = GetShowInfoLink(item.typeID, cfg.evelocations.Get(activeShipID).name, itemID=activeShipID) self.ownerLabel = EveLabelMedium(name='ownerLabel', parent=self.sr.main, text=shipName, padLeft=10, align=uiconst.TOTOP, state=uiconst.UI_NORMAL) texturePath = evetypes.inventorycommon.typeHelpers.GetHoloIconPath(item.typeID) cont = Container(parent=self.sr.main, name='shipCont', align=uiconst.TOTOP, height=128) sprite = Sprite(name='shipSprite', parent=cont, pos=(0, 0, 128, 128), align=uiconst.CENTER, texturePath=texturePath) sprite.GetMenu = (self.GetShipMenu, item) sprite.OnDblClick = self.DoubleClickShip
def ShowFailedToLoadMsg(self, failedToLoad): textList = [] for typeID, qty in failedToLoad: if qty > 0: typeName = evetypes.GetName(typeID) link = GetShowInfoLink(typeID, typeName) textList.append((typeName.lower(), '%sx %s' % (qty, link))) if textList: textList = SortListOfTuples(textList) text = '<br>'.join(textList) text = localization.GetByLabel('UI/Fitting/MissingItems', types=text) eve.Message('CustomInfo', {'info': text}, modal=False)
def LoadWindow(self, fitting, qty=1): self.fitting = fitting self.shipCounter.missingDict = {} self.equipmentCounter.missingDict = {} shipTypeID = fitting.shipTypeID self.shipIcon.LoadIconByTypeID(shipTypeID) uix.GetTechLevelIcon(self.techSprite, typeID=shipTypeID) self.numToFitEdit.text = qty self.fitNameEdit.SetValue(fitting.name) self.shipNameLabel.text = GetShowInfoLink(shipTypeID, evetypes.GetName(shipTypeID)) self.SetInventoryStatus() self.missingLayoutGrid.RefreshGridLayout() self.layoutGrid.RefreshGridLayout() layoutWidth, layoutHeight = self.layoutGrid.GetSize() newHeight = layoutHeight + self.fitBtn.height + self.progressCont.height + self.sr.topParent.height + 20 self.height = max(newHeight, self.default_height) self.width = max(layoutWidth + 20, self.default_width)
def GetName(self): if self.systemAndStructureName: return self.systemAndStructureName locationName = cfg.evelocations.Get(self.GetSolarSystemID()).name structureName = cfg.evelocations.Get(self.GetItemID()).name if evetypes.GetCategoryID(self.GetTypeID()) == const.categoryStation: stationInfo = cfg.stations.GetIfExists(self.GetItemID()) if stationInfo: locationName = cfg.evelocations.Get(stationInfo.orbitID).name structureName = structureName.replace(locationName, '') structureName = structureName.replace(' - ', '', 1) if not structureName: structureName = evetypes.GetName(self.GetTypeID()) solarsystemName = cfg.evelocations.Get(self.GetSolarSystemID()).name solarsystemLink = GetShowInfoLink(const.typeSolarSystem, solarsystemName, self.GetSolarSystemID()) locationName = locationName.replace(solarsystemName, solarsystemLink) systemAndStructureName = '<br>'.join([locationName, structureName]) self.systemAndStructureName = systemAndStructureName return self.systemAndStructureName
def AddColumnAssetSafetyTimers(self): colContainer = self.AddColumnContainer() timerSprite = Sprite( name='timerSprite', parent=colContainer, align=uiconst.CENTERLEFT, pos=(0, 0, 24, 24), texturePath='res:/UI/Texture/classes/Inventory/hourglass.png') timerSprite.hint = GetByLabel( 'UI/Inventory/AssetSafety/AutoDeliveryHint') self.autoTimeLeft = EveLabelMedium(parent=colContainer, align=uiconst.CENTERLEFT, left=timerSprite.left + timerSprite.width + 4) stationText = GetShowInfoLink(self.nearestNPCStationInfo['typeID'], self.nearestNPCStationInfo['name'], self.nearestNPCStationInfo['itemID']) self.nearestNPCStationLabel = EveLabelMedium(parent=colContainer, align=uiconst.CENTERLEFT, text=stationText, left=135, state=uiconst.UI_NORMAL)
def ApplyAttributes(self, attributes): BaseListEntryCustomColumns.ApplyAttributes(self, attributes) self.sr.label = EveLabelMedium(parent=self) self.sr.label.display = False safetyData = self.node.safetyData self.solarSystemID = safetyData['solarSystemID'] self.assetWrapID = safetyData['assetWrapID'] wrapName, systemName = AssetSafetyEntry.GetNameAndSystem(safetyData) solarSystemName = GetShowInfoLink(const.typeSolarSystem, systemName, self.solarSystemID) self.ejectTime = safetyData['ejectTime'] self.daysUntilCanDeliverConst = safetyData['daysUntilCanDeliverConst'] self.manualDeliveryTimestamp = self.ejectTime + self.daysUntilCanDeliverConst * const.DAY self.autoDeliveryTimestamp = self.ejectTime + safetyData[ 'daysUntilAutoMoveConst'] * const.DAY self.nearestNPCStationInfo = safetyData['nearestNPCStationInfo'] self.AddColumnText(wrapName) t = self.AddColumnText(solarSystemName) t.state = uiconst.UI_NORMAL self.AddColumnAssetSafetyDeliverButton() self.AddColumnAssetSafetyTimers() self.UpdateProgress()
def GetWarningForOneGroup(errorKey, memberIDs): errorLabel = errorDict.get(errorKey, None) if errorLabel is None: return sortNumber = errorDict.keys().index(errorKey) memberList = [] for eachMemberID in memberIDs: try: if eachMemberID is None: continue ownerInfo = cfg.eveowners.Get(eachMemberID) charName = ownerInfo.name text = GetShowInfoLink(ownerInfo.typeID, charName, itemID=eachMemberID) memberList.append((charName.lower(), text)) except KeyError as e: pass if not memberList: return memberList = SortListOfTuples(memberList) memberText = '<br>'.join(memberList) return (sortNumber, (errorLabel, {'memberList': memberText}))
def GetLinkForCharacter(charID): charInfo = cfg.eveowners.Get(charID) charText = GetShowInfoLink(charInfo.typeID, charInfo.name, itemID=charID) return charText
def OnLSC(self, channelID, estimatedMemberCount, method, identityInfo, args): # logmodule.general.Log("AutoAlert Processing....method:%s chID:%s id:%s"%(method,channelID,identityInfo),logmodule.LGNOTICE) AllianceID, CorpID, CfgLine, Role, CorpRole, WarFac = identityInfo Charname = None SolarsystemID = None #self.__timer=AutoTimer(5000,self.__SendMessage) if type(CfgLine) == types.IntType: CharID = CfgLine else: CharID = CfgLine[0] Charname = CfgLine[1] if method == "JoinChannel" and self.__alertchannel != 0: #logmodule.general.Log("Detected ID:%s(%s) entering" % (Charname, CharID), logmodule.LGNOTICE) # 判断是否为本地 if type(channelID) == types.IntType: #logmodule.general.Log("Not Local CH", logmodule.LGNOTICE) return if channelID[0][0] != "solarsystemid2": #logmodule.general.Log("Not Local CH", logmodule.LGNOTICE) return SolarsystemID = channelID[0][1] if self.Ishostile(CharID): # 判断声望 #logmodule.general.Log("Sending Alert Message", logmodule.LGNOTICE) charInfo = cfg.eveowners.Get(CharID) charText = GetShowInfoLink(charInfo.typeID, charInfo.name, itemID=CharID) systemText = GetShowInfoLink( const.typeSolarSystem, cfg.evelocations.Get(SolarsystemID).name, SolarsystemID) msg = "%s %s" % (charText, systemText) #TODO:消息需要定时检查发送,不能直接发送 sm.GetService('LSC').SendMessage(self.__alertchannel, msg) # 往服务器发送 sm.GetService('LSC').GetChannelWindow( self.__alertchannel).Speak(msg, eve.session.charid, localEcho=True) # 本地聊天框刷新 #self.__AddMessage(charText,systemText) #logmodule.general.Log("Cached Alert Message", logmodule.LGNOTICE) else: pass #logmodule.general.Log("Safe", logmodule.LGNOTICE) elif method == "SendMessage": if CharID == session.charid: # 发言的是自己才有效 if args[0] == ".startalert": if type(channelID) != types.IntType: return if self.__alertchannel != 0: sm.GetService('LSC').GetChannelWindow( self.__alertchannel).Speak( u"AutoAlert:Alert havs already started", eve.session.charid, localEcho=True) self.__alertchannel = channelID #logmodule.general.Log(u"Alert Channel Set. CH is %s" % str(self.__alertchannel), logmodule.LGNOTICE) sm.GetService('LSC').GetChannelWindow( self.__alertchannel).Speak(u"AutoAlert:Alert started", eve.session.charid, localEcho=True) # 本地聊天框刷新 elif args[0] == ".stopalert": if self.__alertchannel == 0: sm.GetService('LSC').GetChannelWindow( self.__alertchannel).Speak( u"AutoAlert:Alert has already stopped", eve.session.charid, localEcho=True) return sm.GetService('LSC').GetChannelWindow( self.__alertchannel).Speak(u"AutoAlert:Alert stopped", eve.session.charid, localEcho=True) self.__alertchannel = 0