def _TimeUpdater(self): self.currentTimeLabel.SetText( 'Time: current: %s' % FmtDate(gametime.GetWallclockTime(), 'nl')) self.lastUpdateTimeLabel.SetText('tick: %s' % FmtDate(self.lastUpdateTime, 'nl')) self.lastResetTimeLabel.SetText('reset: %s' % FmtDate(self.lastResetTime, 'nl'))
def GetStructureStatusString(structureInfo, getTimeString=False): structureTypeID = structureInfo['typeID'] typeString = dashboardConst.STRUCTURELABEL_BY_TYPEID[structureTypeID] typeLabel = GetByLabel(typeString) timeText = None structureStatus = CalculateStructureStatusFromStructureInfo(structureInfo) if structureStatus == dashboardConst.STATUS_VULNERABLE: text = GetByLabel('UI/Sovereignty/Status/VulnerableNowType', typeName=typeLabel) vulnerabilityState = structureInfo.get('vulnerabilityState', None) startTime, endTime = vulnerabilityState timeText = FormatCountDownTime(endTime) elif structureStatus == dashboardConst.STATUS_VULNERABLE_OVERTIME: text = GetByLabel('UI/Sovereignty/Status/VulnerableType', typeName=typeLabel) timeText = GetByLabel('UI/Sovereignty/Status/Overtime') elif structureStatus == dashboardConst.STATUS_REINFORCED: text = GetByLabel('UI/Sovereignty/Status/ReinforcedType', typeName=typeLabel) campaignState = structureInfo.get('campaignState', None) eventType, defenderID, startTime, scoreByTeamID = campaignState timeText = FormatCountDownTime(startTime) elif structureStatus == dashboardConst.STATUS_INVULNERABLE: text = GetByLabel('UI/Sovereignty/Status/InvulnerableType', typeName=typeLabel) vulnerabilityState = structureInfo.get('vulnerabilityState', None) if vulnerabilityState is None: timeText = GetByLabel('UI/Sovereignty/Status/Unknown') else: startTime, endTime = vulnerabilityState if startTime - gametime.GetWallclockTime() > DAY: startDateFormat = 'ls' else: startDateFormat = 'ns' startTimeText = FmtDate(startTime, startDateFormat) endTimeText = FmtDate(endTime, 'ns') timeText = '%s<br>%s-%s' % ( GetByLabel('UI/Sovereignty/Status/VulnerabilityWindow'), startTimeText, endTimeText) elif structureStatus == dashboardConst.STATUS_NODEFIGHT: text = GetByLabel('UI/Sovereignty/Status/ContestedType', typeName=typeLabel) timeText = GetByLabel('UI/Sovereignty/StatusOngoing') else: text = '' if getTimeString: return (text, timeText) return text
def CreateBlackboard(self, scopeText, channels, scope): grid = LayoutGrid(columns=3, parent=self.blackboardScroll, align=uiconst.TOTOP, cellPadding=3, cellSpacing=4) row = grid.AddRow(bgColor=(1, 1, 1, 0.1)) headerLabel = eveLabel.EveLabelMediumBold(text=scopeText, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL) headerLabel.GetMenu = lambda: [( 'Copy Scope', blue.pyos.SetClipboardData(str(scope)))] row.AddCell(cellObject=headerLabel, colSpan=3, bpColor=(1, 1, 1, 0.05)) for message, time, value in sorted(channels): row = grid.AddRow(bgColor=(1, 1, 1, 0.05)) row.AddCell(cellObject=CopyLabelSmallBold(text=message, align=uiconst.CENTERLEFT, color=(0.4, 0.8, 1.0), messageName=message, messageValue=value, wnd=self, blackboardScope=scope)) row.AddCell(cellObject=eveLabel.EveLabelSmallBold( text=FmtDate(time, 'nl') if time else str(time), align=uiconst.CENTERLEFT)) row.AddCell(cellObject=CopyLabelSmallBold(text=str(value), align=uiconst.CENTERLEFT, color=(0.4, 0.8, 1.0), messageName=message, messageValue=value, wnd=self, blackboardScope=scope)) Container(parent=self.blackboardScroll, height=16, align=uiconst.TOTOP)
def GetAttributeInfo(godmaService, typeID, attributes, instance, localization): attributeEntries = [ EntryData( 'Header', localization.GetByLabel( 'UI/Inflight/SpaceComponents/Reinforce/InfoAttributesHeader' )), EntryData( 'LabelTextSides', localization.GetByLabel( 'UI/Inflight/SpaceComponents/Reinforce/DurationLabel'), FmtTimeInterval(long(attributes.durationSeconds * SEC), breakAt='sec'), iconID=TIMER_ICON) ] if instance: attributeEntries.append( EntryData( 'LabelTextSides', localization.GetByLabel( 'UI/Inflight/SpaceComponents/Reinforce/ReinforcedLabel' ), FmtYesNo(instance.isReinforced))) if instance.isReinforced and instance.reinforceTimestamp > instance.GetWallclockTime( ): attributeEntries.append( EntryData( 'LabelTextSides', localization.GetByLabel( 'UI/Inflight/SpaceComponents/Reinforce/ExitReinforcementLabel' ), FmtDate(instance.reinforceTimestamp, 'ss'), iconID=TIMER_ICON)) return attributeEntries
def SetTimeLeft(self, *args): while self and not self.destroyed: timeNow = blue.os.GetWallclockTimeNow() timeUntil = self.expiryTime - timeNow if timeUntil > 0: self.timeLeft.text = FmtDate(timeUntil, 'ss') else: self.node.scroll.RemoveNodes([self.node]) blue.pyos.synchro.SleepWallclock(1000)
def SetPrimeTime(self, *args): primeTimeNewValue = self.primeTimeCombo.GetValue() if self.primeTimeInfo and self.primeTimeInfo.newPrimeHour: newPrimeHour = self.primeTimeInfo.newPrimeHour validAfter = self.primeTimeInfo.newPrimeHourValidAfter newerPrimeHour = blue.os.GetWallclockTime( ) + CHANGE_PRIMETIME_DELAY if eve.Message( 'updateNewPrimeTime', { 'currentPendingTime': '%s:00' % newPrimeHour, 'currentPendingDate': FmtDate(validAfter, 'ss'), 'newPendingTime': '%s:00' % primeTimeNewValue, 'newPendingDate': FmtDate(newerPrimeHour, 'ss') }, uiconst.YESNO) != uiconst.ID_YES: return sm.GetService('alliance').SetPrimeHour(primeTimeNewValue) self.UpdatePrimeInfo() self.primeTimeMenu.CloseMenu()
def PopulateFuelColumn(self): self.fuelColumn.Flush() fuelExpires = self.controller.GetFuelExpiry() if fuelExpires: text = FmtDate(fuelExpires - blue.os.GetWallclockTime(), 'ns') Label(parent=self.fuelColumn, text=text, align=uiconst.CENTERLEFT, left=6)
def FormatCountDownTime(targetTime): now = gametime.GetWallclockTime() if targetTime > now: diff = targetTime - now timeText = FmtTime(diff) timeText += '<br>%s' % FmtDate(targetTime, 'ls') else: timeText = GetByLabel('UI/Sovereignty/Status/Overtime') return timeText
def AddBarGraph(self): data = [x[4] for x in self.data] hints = [ FmtDate(point[0], 'ln') + '\nOrders: ' + FmtAmt(point[5], 'sn') + '\nQuantity: ' + FmtAmt(point[4], 'sn') for point in self.data ] self.barGraph = BarGraph(parent=self.graphCont, graphContainer=self.graphClipper, barSizeMinMax=(2, 20), data=data, axis=self.rightAxis, hints=hints, zoom=self.zoom, color=(0.5, 1.0, 0.5, 0.5))
def ExportToDisk(self, header, rows, fileNameExtension): date = FmtDate(blue.os.GetWallclockTime()) f = blue.classes.CreateInstance('blue.ResFile') directory = blue.sysinfo.GetUserDocumentsDirectory( ) + '/EVE/logs/Fleetlogs/' filename = '%s - %s.txt' % (fileNameExtension, date.replace(':', '.')) fullPath = directory + filename if not f.Open(fullPath, 0): f.Create(fullPath) f.Write('%s\r\n' % header) for r in rows: row = '' for col in r: row += '%s\t' % unicode(col).encode('utf-8') f.Write('%s\r\n' % row) f.Write('\r\n') f.Close() eve.Message('FleetExportInfo', { 'filename': filename, 'folder': directory })
def AddMiniMap(self): data = [x[3] for x in self.data] lines = [] for i, point in enumerate(self.data): if FmtDate(point[0], fmt='ln').endswith('01'): lines.append(i) self.miniMap = MiniMap(name='MiniMap', parent=self, align=uiconst.TOBOTTOM, height=60, data=data, range=self.range, zoom=self.zoom, lines=lines)
def ExportLootHistory(self): lootHistory = sm.GetService('fleet').GetLootHistory() rows = [] for kv in lootHistory: row = [ FmtDate(kv.time, 'ss'), cfg.eveowners.Get(kv.charID).name, evetypes.GetName(kv.typeID), kv.quantity, evetypes.GetGroupName(kv.typeID) ] rows.append(row) fileNameExtension = 'Loot' header = 'Time\tCharacter\tItem Type\tQuantity\tItem Group' self.ExportToDisk(header, rows, fileNameExtension)
def AddMedianPoints(self): data = [x[3] for x in self.data] hints = [ FmtDate(point[0], 'ln') + '\n' + FmtAmt(point[3], 'sn') for point in self.data ] self.median = PointGraph(parent=self.graphCont, graphContainer=self.graphClipper, data=data, hints=hints, zoom=self.zoom, axis=self.leftAxis, pointSizeMinMax=(5, 10), animation=ANIM_BOTTOM_FROM_LEFT) self.rebuildOnResize.append(self.median)
def LoadPanel(self, *args): crimewatchSvc = sm.GetService('crimewatchSvc') data = crimewatchSvc.GetSecurityStatusTransactions() self.scroll.Clear() scrolllist = [] for transaction in data: if transaction.eventTypeID == logConst.eventSecStatusGmModification: subject = GetByLabel('UI/Generic/FormatStandingTransactions/subjectSetBySlashCmd') body = GetByLabel('UI/Generic/FormatStandingTransactions/messageResetBySlashCmd') elif transaction.eventTypeID == logConst.eventSecStatusGmRollback: subject = GetByLabel('UI/Generic/FormatStandingTransactions/subjectSetBySlashCmd') body = GetByLabel('UI/Generic/FormatStandingTransactions/messageResetBySlashCmd') elif transaction.eventTypeID == logConst.eventSecStatusIllegalAggression: cfg.eveowners.Prime([transaction.otherOwnerID]) cfg.evelocations.Prime([transaction.locationID]) subject = GetByLabel('UI/Generic/FormatStandingTransactions/subjectCombatAgression') body = GetByLabel('UI/Generic/FormatStandingTransactions/messageCombatAgression', locationID=transaction.locationID, ownerName=cfg.eveowners.Get(transaction.otherOwnerID).name, typeID=transaction.otherTypeID) elif transaction.eventTypeID == logConst.eventSecStatusKillPirateNpc: subject = GetByLabel('UI/Generic/FormatStandingTransactions/subjectLawEnforcmentGain') body = GetByLabel('UI/Generic/FormatStandingTransactions/messageLawEnforcmentGain', name=cfg.eveowners.Get(transaction.otherOwnerID).name) elif transaction.eventTypeID == logConst.eventSecStatusHandInTags: subject = GetByLabel('UI/Generic/FormatStandingTransactions/subjectHandInTags') body = GetByLabel('UI/Generic/FormatStandingTransactions/messageHandInTags') if transaction.modification is not None: modification = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SecurityStatusScroll/Persentage', value=transaction.modification * 100.0, decimalPlaces=4) else: modification = '' text = '%s<t>%s<t><right>%s</right><t>%s' % (FmtDate(transaction.eventDate, 'ls'), modification, localization.formatters.FormatNumeric(transaction.newValue, decimalPlaces=2), subject) hint = '%s<br>%s' % (localization.formatters.FormatNumeric(transaction.newValue, decimalPlaces=4), subject) scrolllist.append(entries.Get('StandingTransaction', {'sort_%s' % GetByLabel('UI/Common/Date'): transaction.eventDate, 'sort_%s' % GetByLabel('UI/Common/Change'): transaction.modification, 'line': 1, 'text': text, 'hint': hint, 'details': body, 'isNPC': True})) headers = [GetByLabel('UI/Common/Date'), GetByLabel('UI/Common/Change'), GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SecurityStatus'), GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SecurityStatusScroll/Subject')] noChangesHint = GetByLabel('UI/CharacterSheet/CharacterSheetWindow/SecurityStatusScroll/NoSecurityStatusChanges') self.scroll.Load(contentList=scrolllist, headers=headers, noContentHint=noChangesHint)
def GetCopyData(cls, node): timeStamp = FmtDate(node.eventInfo.logDate) text, texturePath = cls.GetTextAndTextureForEvent(node.eventInfo) eventText = node.eventInfo.newText or '' return '<t>'.join([timeStamp, text, eventText])
def Load(self, node): timeStamp = FmtDate(node.eventInfo.logDate) text, texturePath = self.GetTextAndTextureForEvent(node.eventInfo) self.logLabel.text = ' '.join([timeStamp, text]) self.changeSprite.SetTexturePath(texturePath)
def LoadPanel(self, *args): jumpCloneSvc = sm.GetService('clonejump') jumpClones = jumpCloneSvc.GetClones() scrolllist = [] lastJump = jumpCloneSvc.LastCloneJumpTime() hoursLimit = sm.GetService('godma').GetItem( session.charid).cloneJumpCoolDown if lastJump: jumpTime = lastJump + hoursLimit * const.HOUR nextJump = jumpTime > blue.os.GetWallclockTime() else: nextJump = False nextAvailableLabel = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/JumpCloneScroll/NextCloneJump' ) availableNow = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/JumpCloneScroll/Now') if nextJump: scrolllist.append( entries.Get( 'TextTimer', { 'line': 1, 'label': nextAvailableLabel, 'text': FmtDate(lastJump), 'iconID': const.iconDuration, 'countdownTime': int(jumpTime), 'finalText': availableNow })) else: scrolllist.append( entries.Get( 'TextTimer', { 'line': 1, 'label': nextAvailableLabel, 'text': availableNow, 'iconID': const.iconDuration, 'countdownTime': 0 })) if jumpClones: d = OrderedDict([('station', {}), ('shipOrStructure', {})]) primeLocs = [] for jc in jumpClones: jumpCloneID = jc.jumpCloneID locationID = jc.locationID cloneName = jc.cloneName primeLocs.append(locationID) destinationType = 'station' if IsStation( locationID) else 'shipOrStructure' d[destinationType][locationID] = (jumpCloneID, locationID, cloneName) cfg.evelocations.Prime(primeLocs) for locInfo in d.itervalues(): locIDs = locInfo.keys() locNames = self.GetLocNames(locIDs) locNames = localization.util.Sort(locNames, key=lambda x: x[0]) for _, locationString, locationID in locNames: infoForLocation = locInfo[locationID] cloneName = infoForLocation[2] label = '%s - %s' % (cloneName, locationString ) if cloneName else locationString groupID = infoForLocation data = { 'GetSubContent': self.GetCloneImplants, 'label': label, 'id': groupID, 'jumpCloneID': infoForLocation[0], 'locationID': infoForLocation[1], 'cloneName': cloneName, 'state': 'locked', 'iconMargin': 18, 'showicon': 'res:/ui/Texture/WindowIcons/jumpclones.png', 'sublevel': 0, 'MenuFunction': self.JumpCloneMenu, 'showlen': 0 } scrolllist.append(entries.Get('Group', data)) self.scroll.sr.id = 'charsheet_jumpclones' noClonesFoundHint = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/JumpCloneScroll/NoJumpClonesFound' ) self.scroll.Load(contentList=scrolllist, noContentHint=noClonesFoundHint)
def GetCombatEntries(recent, filterText=''): showAsCondensed = settings.user.ui.Get('charsheet_condensedcombatlog', 0) if showAsCondensed: headers = [ GetByLabel('UI/Common/Date'), GetByLabel('UI/Common/Type'), GetByLabel('UI/Common/Name'), GetByLabel('UI/Common/Corporation'), GetByLabel('UI/Common/Alliance'), GetByLabel('UI/Common/Faction') ] else: headers = [] primeEveOwners = set() primeEveLocations = set() primeCorps = set() primeAlliances = set() ret = [] unknownShipLabel = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/KillsTabs/UnknownShip') unknownNameLabel = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/KillsTabs/UnknownName') unknownCorporationLabel = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/KillsTabs/UnknownCorporation') unknownAllianceLabel = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/KillsTabs/UnknownAlliance') unknownFactionLabel = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/KillsTabs/UnknownFaction') for kill in recent: primeEveLocations.add(kill.solarSystemID) primeEveLocations.add(kill.moonID) primeEveOwners.add(kill.victimCharacterID) primeEveOwners.add(kill.victimCorporationID) primeCorps.add(kill.victimCorporationID) primeEveOwners.add(kill.victimAllianceID) primeAlliances.add(kill.victimAllianceID) primeEveOwners.add(kill.victimFactionID) primeEveOwners.add(kill.finalCharacterID) primeEveOwners.add(kill.finalCorporationID) primeCorps.add(kill.finalCorporationID) primeEveOwners.add(kill.finalAllianceID) primeAlliances.add(kill.finalAllianceID) primeEveOwners.add(kill.finalFactionID) cfg.eveowners.Prime(filter(None, primeEveOwners)) cfg.evelocations.Prime(filter(None, primeEveLocations)) cfg.corptickernames.Prime(filter(None, primeCorps)) cfg.allianceshortnames.Prime(filter(None, primeAlliances)) def GetOwnerName(ownerID): owner = cfg.eveowners.GetIfExists(ownerID) return getattr(owner, 'name', '') def GetTypeName(typeID): try: return evetypes.GetName(typeID) except evetypes.TypeNotFoundException: return '' def FilterOut(kill): if not filterText: return False if GetTypeName(kill.victimShipTypeID).lower().find(filterText) >= 0: return False for ownerID in [ kill.victimCharacterID, kill.victimCorporationID, kill.victimAllianceID ]: ownerName = GetOwnerName(ownerID) if ownerName.lower().find(filterText) >= 0: return False return True for kill in recent: if FilterOut(kill): continue if showAsCondensed: data = KeyVal() timeOfKill = FmtDate(kill.killTime) shipOfCharacterKilled = GetTypeName( kill.victimShipTypeID) or unknownShipLabel characterKilled = GetOwnerName( kill.victimCharacterID) or unknownNameLabel corporationOfCharacterKilled = GetOwnerName( kill.victimCorporationID) or unknownCorporationLabel allianceOfCharacterKilled = GetOwnerName( kill.victimAllianceID) or unknownAllianceLabel factionOfCharacterKilled = GetOwnerName( kill.victimFactionID) or unknownFactionLabel labelList = [ timeOfKill, shipOfCharacterKilled, characterKilled, corporationOfCharacterKilled, allianceOfCharacterKilled, factionOfCharacterKilled ] data.label = '<t>'.join(labelList) data.GetMenu = GetCombatMenu data.OnDblClick = (GetCombatDblClick, data) data.kill = kill data.mail = kill ret.append(entries.Get('KillMailCondensed', data=data)) else: ret.append(entries.Get('KillMail', {'mail': kill})) return (ret, headers)
def ShowMySkillHistory(self): def GetPts(lvl): return charskills.GetSPForLevelRaw(stc, lvl) self.topCont.Hide() self.scroll.sr.id = 'charsheet_skillhistory' rs = sm.GetService('skills').GetSkillHistory() scrolllist = [] actions = { const.skillEventClonePenalty: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillClonePenalty' ), const.skillEventTrainingStarted: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillTrainingStarted' ), const.skillEventTrainingComplete: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillTrainingComplete' ), const.skillEventTrainingCancelled: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillTrainingCanceled' ), const.skillEventGMGive: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/GMGiveSkill' ), const.skillEventQueueTrainingCompleted: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillTrainingComplete' ), const.skillEventFreeSkillPointsUsed: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillPointsApplied' ), const.skillEventSkillExtracted: GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillLevelExtracted' ) } for r in rs: skill = sm.GetService('skills').GetSkill(r.skillTypeID) if skill: stc = skill.skillRank levels = [ 0, GetPts(1), GetPts(2), GetPts(3), GetPts(4), GetPts(5) ] level = 5 for i in range(len(levels)): if levels[i] > r.absolutePoints: level = i - 1 break data = KeyVal() data.label = FmtDate(r.logDate, 'ls') + '<t>' data.label += evetypes.GetName(r.skillTypeID) + '<t>' data.label += actions.get( r.eventTypeID, GetByLabel('UI/Generic/Unknown')) + '<t>' data.label += FormatNumeric(level) data.Set('sort_%s' % GetByLabel('UI/Common/Date'), r.logDate) data.id = r.skillTypeID data.level = level data.GetMenu = self.GetItemMenu data.MenuFunction = self.GetItemMenu data.OnDblClick = (self.DblClickShowInfo, data) addItem = entries.Get('Generic', data=data) scrolllist.append(addItem) self.scroll.Load( contentList=scrolllist, headers=[ GetByLabel('UI/Common/Date'), GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/Skill'), GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/Action'), GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/Level') ], noContentHint=GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/NoRecordsFound' ), reversesort=True)