def GetAgentMissions(self, *args): allMissionsList = [] missions = sm.GetService('journal').GetMyAgentJournalDetails()[0] HOMEBASE = 0 NOTHOMEBASE = 1 if missions: for mission in missions: missionState, importantMission, missionType, missionNameID, agentID, expirationTime, bookmarks, remoteOfferable, remoteCompletable, contentID = mission if missionState != const.agentMissionStateAccepted or expirationTime and expirationTime < blue.os.GetWallclockTime( ): continue homeBaseBms = [] otherBms = [] foundHomeBaseBm = False for bm in bookmarks: if bm.locationType == 'agenthomebase': homeBaseBms.append((HOMEBASE, bm)) elif 'isAgentBase' in bm.__dict__ and bm.isAgentBase: foundHomeBaseBm = True otherBms.append((HOMEBASE, bm)) else: otherBms.append((NOTHOMEBASE, bm)) bookmarksIwant = otherBms if not foundHomeBaseBm: bookmarksIwant.extend(homeBaseBms) bookmarksIwant = uiutil.SortListOfTuples(bookmarksIwant) bmInfo = uiutil.Bunch(missionNameID=missionNameID, bookmarks=bookmarksIwant, agentID=agentID) allMissionsList.append((expirationTime, bmInfo)) allMissionsList = uiutil.SortListOfTuples(allMissionsList) return allMissionsList
def ShowIndexLevels(self): locationHeader, sovitems, fwitems = self.GetHeaderAndPrimedItems() facwarSvc = sm.GetService('facwar') scrolllist = [] fwscrolllist = [] for item in sovitems: locationName = cfg.evelocations.Get(item.locationID).name data = util.KeyVal(label=locationName, locationID=item.locationID, scope=self.locationScope) if facwarSvc.IsFacWarSystem(item.locationID): if item.locationID in fwitems: data.upgradePoints = fwitems[item.locationID].loyaltyPoints else: data.upgradePoints = 0 entry = listentry.Get('UpgradeEntry', data) fwscrolllist.append((locationName, entry)) else: data.militaryPoints = item.militaryPoints data.industrialPoints = item.industrialPoints data.claimedFor = item.claimedFor entry = listentry.Get('IndexEntry', data) scrolllist.append((locationName, entry)) scrolllist = uiutil.SortListOfTuples(scrolllist) fwscrolllist = uiutil.SortListOfTuples(fwscrolllist) if len(scrolllist) > 0: scrolllist.insert( 0, listentry.Get( 'HeaderEntry', { 'systemHeader': locationHeader, 'militaryHeader': localization.GetByLabel('UI/Sovereignty/Military'), 'industryHeader': localization.GetByLabel('UI/Sovereignty/Industry'), 'claimTimeHeader': localization.GetByLabel('UI/Sovereignty/Strategic') })) if len(fwscrolllist) > 0: fwscrolllist.insert( 0, listentry.Get( 'FWHeaderEntry', { 'systemHeader': localization.GetByLabel( 'UI/Common/LocationTypes/FacWarSystem'), 'upgradesHeader': localization.GetByLabel('UI/Sovereignty/UpgradeLevel') })) if len(scrolllist) > 0: fwscrolllist.insert(0, listentry.Get('Push', {'height': 10})) self.sr.infrastructurehubsScroll.Load(contentList=scrolllist + fwscrolllist)
def GetStarColorGroupsSorted(self): if not self.starColorGroups: starColorGroups = [ ('Personal', localization.GetByLabel( 'UI/Map/MapPallet/hdrStarsMyInformation'), []), ('Services', localization.GetByLabel('UI/Map/MapPallet/hdrStarsServices'), []), ('Statistics', localization.GetByLabel( 'UI/Map/MapPallet/hdrStarsStatistics'), []), ('Sovereignty', localization.GetByLabel( 'UI/Map/MapPallet/hdrStarsSovereignty'), [('Sovereignty_FactionalWarfare', localization.GetByLabel( 'UI/Map/MapPallet/hdrStarsSovereigntyFacWar'), []), ('Sovereignty_Sovereignty', localization.GetByLabel( 'UI/Map/MapPallet/hdrStarsSovereignty'), []), ('Sovereignty_Changes', localization.GetByLabel( 'UI/Map/MapPallet/hdrStarsSovereigntyChanges'), []), ('Sovereignty_Development_Indices', localization.GetByLabel( 'UI/Map/MapPallet/hdrStarsSovereigntyIndixes'), [])]), ('Autopilot', localization.GetByLabel('UI/Map/MapPallet/hdrStarsAutoPilot'), []), ('Planets', localization.GetByLabel('UI/Map/MapPallet/hdrStarsPlanets'), []), ('Industry', localization.GetByLabel('UI/Map/MapPallet/hdrStarsIndustry'), [('Industry_Jobs', localization.GetByLabel('UI/Map/MapPallet/hdrIndustryJobs'), []), ('Industry_CostModifier', localization.GetByLabel( 'UI/Map/MapPallet/hdrIndustryCostModifier'), [])]) ] for group, label, subitems in starColorGroups: if subitems: temp = [] for _group, _label, _subitems in subitems: temp.append((_label, (_group, _label, _subitems))) temp = uiutil.SortListOfTuples(temp) subitems = temp self.starColorGroups.append((label, (group, label, subitems))) self.starColorGroups = uiutil.SortListOfTuples( self.starColorGroups) return self.starColorGroups
def GetSolarSystemOptions(): import uiutil, util, listentry validGroups = GetValidSolarsystemGroups() wantedGroups = GetVisibleSolarsystemBrackets() wantedHints = GetHintsOnSolarsystemBrackets() scrolllist = [] for groupID in validGroups: data = util.KeyVal() data.visible = groupID in wantedGroups data.showhint = groupID in wantedHints data.groupID = groupID if type(groupID) in types.StringTypes: cerbString = { 'bookmark': 'UI/Map/MapPallet/cbSolarSystem_bookmark', 'scanresult': 'UI/Map/MapPallet/cbSolarSystem_scanresult' }[groupID] data.label = localization.GetByLabel(cerbString) else: data.label = evetypes.GetGroupNameByGroup(groupID) scrolllist.append( (data.label, listentry.Get('BracketSelectorEntry', data=data))) if scrolllist: scrolllist = uiutil.SortListOfTuples(scrolllist) return scrolllist
def GetSubGroupContent(self, nodedata, newitems = 0): scrollList = [] subGroupInfo = self.GetSubGroup(nodedata.groupName) if nodedata.droneState == 'inbay': drones = self.GetDronesInBay() for drone in drones: if drone.itemID in subGroupInfo['droneIDs']: entry = self.GetBayDroneEntry(drone, 1, nodedata.droneState) scrollList.append(((entry.subLevel, entry.label), entry)) elif nodedata.droneState == 'inlocalspace': drones = self.GetDronesInLocalSpace() for drone in drones: if drone.droneID in subGroupInfo['droneIDs']: entry = self.GetSpaceDroneEntry(drone, 1, nodedata.droneState) scrollList.append(((entry.subLevel, entry.label), entry)) else: drones = self.GetDronesInDistantSpace() for drone in drones: if drone.droneID in subGroupInfo['droneIDs']: entry = self.GetSpaceDroneEntry(drone, 1, nodedata.droneState) scrollList.append(((entry.subLevel, entry.label), entry)) if not scrollList: noItemEntry = self.GetNoItemEntry(sublevel=2, droneState=nodedata.droneState) scrollList.append((0, noItemEntry)) return uiutil.SortListOfTuples(scrollList)
def GetGroupContent(self, nodedata, newitems = 0): scrollList = [] if nodedata.droneState == 'inbay': dronebay = {} for drone in self.GetDronesInBay(): dronebay[drone.itemID] = drone subGroups = {} for droneID in nodedata.groupItems: group = self.GetDroneGroup(droneID) if group: subGroups.setdefault(group['label'], []).append(droneID) continue if nodedata.droneState == 'inbay': if dronebay.has_key(droneID): entry = self.GetBayDroneEntry(dronebay[droneID], nodedata.sublevel, nodedata.droneState) scrollList.append(((0, entry.label.lower()), entry)) else: entry = self.GetSpaceDroneEntry(self.GetSpaceDrone(droneID), nodedata.sublevel, nodedata.droneState) scrollList.append(((0, entry.label.lower()), entry)) for groupName, droneIDs in subGroups.iteritems(): group = self.GetSubGroup(groupName) if group: entry = self.GetSubGroupListEntry(group, nodedata.droneState, droneIDs) scrollList.append(((1, entry.label.lower()), entry)) if not scrollList: noItemEntry = self.GetNoItemEntry(sublevel=1, droneState=nodedata.droneState) scrollList.append((0, noItemEntry)) return uiutil.SortListOfTuples(scrollList)
def GetSchematicData(processorTypeID): schematicsData = cfg.schematicsByPin[processorTypeID] if len(schematicsData) == 0: log.LogTraceback( 'Authoring error: No schematics found for processor pin with typeID %s' % processorTypeID) schematics = [] for s in schematicsData: try: schematic = cfg.schematics.Get(s.schematicID) except: log.LogTraceback('Authoring error: No schematic found with id=%s' % s.schematicID) raise inputs, outputs = _GetSchematicInputsAndOutputs(schematic.schematicID) outputsDict = {} for o in outputs: outputsDict[o.typeID] = o.quantity volumePerCycle = planetCommon.GetCommodityTotalVolume(outputsDict) volumePerHour = planetCommon.GetBandwidth( volumePerCycle, schematic.cycleTime * const.SEC) sData = util.KeyVal(name=schematic.schematicName, schematicID=schematic.schematicID, cycleTime=schematic.cycleTime, outputs=outputs, inputs=inputs, outputVolume=volumePerHour) schematics.append((sData.name, sData)) return uiutil.SortListOfTuples(schematics)
def LoadLinkScroll(self): scrolllist = [] planet = sm.GetService('planetUI').GetCurrentPlanet() colony = planet.GetColony(session.charid) links = colony.colonyData.GetLinksForPin(self.pin.id) for linkedPinID in links: link = colony.GetLink(self.pin.id, linkedPinID) linkedPin = colony.GetPin(linkedPinID) distance = link.GetDistance() bandwidthUsed = link.GetBandwidthUsage() percentageUsed = 100 * (bandwidthUsed / link.GetTotalBandwidth()) data = util.KeyVal() data.label = '%s<t>%s<t>%s' % (planetCommon.GetGenericPinName( linkedPin.typeID, linkedPin.id), util.FmtDist(distance), localization.GetByLabel( 'UI/Common/Percentage', percentage=percentageUsed)) data.hint = '' data.OnMouseEnter = self.OnLinkEntryHover data.OnMouseExit = self.OnLinkEntryExit data.OnDblClick = self.OnLinkListentryDblClicked data.id = (link.endpoint1.id, link.endpoint2.id) sortBy = linkedPinID scrolllist.append((sortBy, listentry.Get('Generic', data=data))) scrolllist = uiutil.SortListOfTuples(scrolllist) self.linkScroll.Load( contentList=scrolllist, noContentHint=localization.GetByLabel( 'UI/PI/Common/NoLinksPresent'), headers=[ localization.GetByLabel('UI/PI/Common/Destination'), localization.GetByLabel('UI/Common/Distance'), localization.GetByLabel('UI/PI/Common/CapacityUsed') ])
def LoadEvents(self, eventsThisDay, *args): self.sr.emptyDay.Flush() self.events = {} toSort = [((eventKV.eventTimeStamp, eventKV.eventTitle), eventKV) for eventKV in eventsThisDay.values()] eventsKVs = uiutil.SortListOfTuples(toSort) for eventInfo in eventsKVs: onDblClick = (self.OpenEvent, eventInfo) iconPath, response = sm.GetService( 'calendar').GetMyResponseIconFromID(eventInfo.eventID, long=1) if response == const.eventResponseDeleted or response == const.eventResponseDeclined and not settings.user.ui.Get( 'calendar_showDeclined', 1): continue tagIcon = self.GetTagIcon(eventInfo.flag) entry = uicls.CalendarEventEntry(name='calendarEventEntry', parent=self.sr.emptyDay, align=uiconst.TOTOP, pos=(0, 0, 0, self.eventHeight), padding=(1, 1, 1, 0), state=uiconst.UI_NORMAL, eventInfo=eventInfo, onDblClick=onDblClick, responseIconPath=iconPath, tagIcon=tagIcon, response=response) entry.MenuFunction = self.GetEventMenu self.events[eventInfo.eventID] = eventInfo self.CheckEventsClipped()
def LoadStructureScroll(self, buildEntry, groupEnabled, color): scrolllist = [] if buildEntry.groupID == const.groupPlanetaryLinks: data = util.KeyVal(label=localization.GetByLabel('UI/PI/Common/CreateLink'), createLink=True, hideLines=1, fontColor=(self.COLOR_DISABLED, self.COLOR_ENABLED)[groupEnabled], OnClick=self.OnBuildEntryClicked, ignoreRightClick=True) scrolllist.append(('', listentry.Get('Generic', data=data))) else: for typeID in self.GetStructuresForGroup(buildEntry.groupID): typeObj = cfg.invtypes.Get(typeID) if not typeObj.published: continue data = util.KeyVal(label=cfg.invtypes.Get(typeID).name, typeID=typeID, hideLines=1, ignoreRightClick=True) isEnabled, hint = self.IsBuildEntryEnabled(buildEntry.groupID, typeID, groupEnabled) if isEnabled: data.OnClick = self.OnBuildEntryClicked data.fontColor = self.COLOR_ENABLED else: data.fontColor = self.COLOR_DISABLED data.hint = hint if buildEntry.groupID == const.groupCommandPins: sortBy = typeObj.basePrice else: sortBy = data.label.lower() scrolllist.append((sortBy, listentry.Get('Generic', data=data))) scrolllist = uiutil.SortListOfTuples(scrolllist) buildEntry.structureScroll.Load(contentList=scrolllist)
def TryPickSphereBorder(self): matches = [] scannerWnd = Scanner.GetIfOpen() if scannerWnd: x, y = uicore.ScaleDpi(uicore.uilib.x), uicore.ScaleDpi(uicore.uilib.y) ray, start = GetRayAndPointFromScreen(x, y) pickRadiusRay, pickRadiusStart = GetRayAndPointFromScreen(x - 30, y) camera = sm.GetService('sceneManager').GetRegisteredCamera('systemmap') if camera is None: return viewDir = geo2.QuaternionTransformVector(camera.rotationAroundParent, (0.0, 0.0, 1.0)) viewDir = geo2.Vec3Normalize(viewDir) targetPlaneNormal = geo2.Vector(*viewDir) scanSvc = sm.StartService('scanSvc') probeData = scanSvc.GetProbeData() probes = scannerWnd.GetProbeSpheres() for probeID, probeControl in probes.iteritems(): if probeID not in probeData or probeData[probeID].state != const.probeStateIdle: continue targetPlanePos = geo2.Vector(probeControl.locator.worldTransform[3][0], probeControl.locator.worldTransform[3][1], probeControl.locator.worldTransform[3][2]) rad = list(probeControl.sphere.scaling)[0] * SYSTEMMAP_SCALE pos = RayToPlaneIntersection(start, ray, targetPlanePos, targetPlaneNormal) picRadiusPos = RayToPlaneIntersection(pickRadiusStart, pickRadiusRay, targetPlanePos, targetPlaneNormal) pickRad = (trinity.TriVector(*picRadiusPos) - trinity.TriVector(*pos)).Length() diffFromPickToSphereBorder = (trinity.TriVector(*targetPlanePos) - trinity.TriVector(*pos)).Length() if rad + pickRad > diffFromPickToSphereBorder > rad - pickRad: matches.append((abs(rad - diffFromPickToSphereBorder), probeControl)) if matches: matches = uiutil.SortListOfTuples(matches) return matches[0]
def GetPresetsMenu(self): p = self.allPresets.copy() for name in self.GetDefaultOverviewNameList(): if name in p: del p[name] m = [] dm = [] for label in p: dm.append((label.lower(), (label, self.DeletePreset, (label, )))) overview = form.OverView.GetIfOpen() m.append( (localization.GetByLabel('UI/Overview/AddTab'), overview.AddTab)) if dm: m.append(None) dm = uiutil.SortListOfTuples(dm) m.append((uiutil.MenuLabel('UI/Common/Delete'), dm)) bracketMgr = sm.GetService('bracket') if not bracketMgr.ShowingAll(): m.append((uiutil.MenuLabel('UI/Overview/ShowAllBrackets'), bracketMgr.ShowAll)) else: m.append((uiutil.MenuLabel('UI/Tactical/StopSowingAllBrackets'), bracketMgr.StopShowingAll)) if not bracketMgr.ShowingNone(): m.append((uiutil.MenuLabel('UI/Tactical/HideAllBrackets'), bracketMgr.ShowNone)) else: m.append((uiutil.MenuLabel('UI/Tactical/StopHidingAllBrackets'), bracketMgr.StopShowingNone)) m += [None] m += [(uiutil.MenuLabel('UI/Commands/OpenOverviewSettings'), sm.GetService('tactical').OpenSettings)] return m
def StoreImplants(self, *args): INSIDERDIR = sm.GetService('insider').GetInsiderDir() TARGET = os.path.join(INSIDERDIR, IMPLANTFILE) godma = sm.GetService('godma') mygodma = godma.GetItem(eve.session.charid) if not mygodma: return imps = uiutil.SortListOfTuples([(getattr(godma.GetType(implant.typeID), 'implantness', None), implant) for implant in mygodma.implants]) ret = uix.NamePopup('Save Implant Set', 'Enter name for set', setvalue='New', maxLength=32) if not ret: return name = ret['name'] if name.lower() in self.implants: ret = sm.GetService('gameui').MessageBox( title='Overwrite set?', text= "An implant set named '%s' already exists.<br><br>Click OK to overwrite the old set." % name, buttons=uiconst.OKCANCEL, icon=uiconst.WARNING) if ret[0] != uiconst.ID_OK: return key = 'IMP:' + ':'.join([str(row.typeID) for row in imps]) self.implants[name.lower()] = (name, key) self.Save(self.implants, TARGET)
def SetEntries(self, entries): scrolllist = [] entries = uiutil.SortListOfTuples([ (celestialID, (celestialID, products)) for celestialID, products in entries.iteritems() ]) for celestialID, products in entries: data = { 'GetSubContent': self.GetSubContent, 'MenuFunction': self.GetMenu, 'label': cfg.evelocations.Get(celestialID).name, 'groupItems': products, 'id': ('moon', celestialID), 'tabs': [], 'state': 'locked', 'showlen': 0 } scrolllist.append(listentry.Get('Group', data)) scrolllist.append(listentry.Get('Space', {'height': 64})) pos = self.sr.scroll.GetScrollProportion() self.sr.scroll.Load( contentList=scrolllist, headers=[ localization.GetByLabel('UI/Inflight/Scanner/MoonProduct'), localization.GetByLabel('UI/Inflight/Scanner/Abundance') ], scrollTo=pos)
def Load(self): self.Flush() fittingScroll = Scroll(name='fittingScroll', parent=self, padding=const.defaultPadding) turretSlotsUsed = 0 launcherSlotsUsed = 0 entryList = [] inventory = self.GetShipContents() for slotKey, slotInfo in enumerate(FITTING_SLOT_INFO): modulesByType = collections.defaultdict(list) chargesByFlag = collections.defaultdict(list) for item in filter(lambda item: item.flagID in slotInfo['flags'], inventory): if IsCharge(item): chargesByFlag[item.flagID].append(item) else: modulesByType[item.typeID].append(item) usedSlotCount = 0 for typeID, items in modulesByType.iteritems(): if HasEffect(typeID, slotInfo['effectID']): usedSlotCount += len(items) if HasEffect(typeID, const.effectTurretFitted): turretSlotsUsed += len(items) if HasEffect(typeID, const.effectLauncherFitted): launcherSlotsUsed += len(items) lowestFlagID = min((item.flagID for item in items)) sortKey = (slotKey, lowestFlagID) entry = self.GetFittingEntry(typeID, len(items)) entryList.append((sortKey, entry)) chargeQuantityByType = collections.defaultdict(int) for charge in itertools.chain.from_iterable( (chargesByFlag[item.flagID] for item in items)): chargeQuantityByType[charge.typeID] += max( charge.quantity, 1) for chargeType, chargeQuantity in chargeQuantityByType.iteritems( ): sortKey = (slotKey, lowestFlagID, chargeType) entry = self.GetFittingEntry(chargeType, chargeQuantity, isCharge=True) entryList.append((sortKey, entry)) sortKey = (slotKey, ) entry = self.GetFittingSlotEntry(slotInfo, usedSlotCount) entryList.append((sortKey, entry)) sortedEntryList = sm.GetService('info').GetAttributeScrollListForItem( itemID=self.itemID, typeID=self.typeID, attrList=[ const.attributeCpuOutput, const.attributePowerOutput, const.attributeUpgradeCapacity ]) sortedEntryList.append( self.GetHardpointsEntry(turretSlotsUsed, launcherSlotsUsed)) sortedEntryList.extend(uiutil.SortListOfTuples(entryList)) fittingScroll.Load(contentList=filter(None, sortedEntryList))
def LoadStorageContentScroll(self): scrolllist = [] for typeID, amount in self.pin.contents.iteritems(): data = util.KeyVal() volume = cfg.invtypes.Get(typeID).volume * amount data.label = '<t>%s<t>%s<t>%s' % (cfg.invtypes.Get(typeID).name, amount, volume) data.amount = amount data.typeID = typeID data.itemID = None data.getIcon = (True, ) data.OnDblClick = self.OnStorageEntryDblClicked sortBy = amount scrolllist.append((sortBy, listentry.Get('Item', data=data))) scrolllist = uiutil.SortListOfTuples(scrolllist) self.storageContentScroll.Load( contentList=scrolllist, noContentHint=localization.GetByLabel( 'UI/PI/Common/NoContentsPresent'), headers=[ '', localization.GetByLabel('UI/PI/Common/Type'), localization.GetByLabel('UI/Common/Amount'), localization.GetByLabel('UI/Common/Volume') ])
def GetAll(self, key, blueprintOnly = 0, isCorp = 0, keyID = None, sortKey = 0): stations = self.GetStations(blueprintOnly, isCorp) sortlocations = [] mapSvc = sm.StartService('map') uiSvc = sm.StartService('ui') for station in stations: blue.pyos.BeNice() solarsystemID = uiSvc.GetStation(station.stationID).solarSystemID loc = self.locationCache.get(solarsystemID, None) if loc is None: constellationID = mapSvc.GetParent(solarsystemID) loc = self.locationCache.get(constellationID, None) if loc is None: regionID = mapSvc.GetParent(constellationID) loc = (solarsystemID, constellationID, regionID) else: regionID = loc[2] self.locationCache[solarsystemID] = loc self.locationCache[constellationID] = loc self.locationCache[regionID] = loc else: constellationID = loc[1] regionID = loc[2] if key == 'allitems': sortlocations.append((cfg.evelocations.Get(station.stationID).name, (solarsystemID, station))) elif key == 'sysitems': if solarsystemID == (keyID or eve.session.solarsystemid2): sortlocations.append((cfg.evelocations.Get(station.stationID).name, (solarsystemID, station))) elif key == 'conitems' and constellationID == (keyID or eve.session.constellationid): sortlocations.append((cfg.evelocations.Get(station.stationID).name, (solarsystemID, station))) elif key == 'regitems' and regionID == (keyID or eve.session.regionid): sortlocations.append((cfg.evelocations.Get(station.stationID).name, (solarsystemID, station))) sortlocations = uiutil.SortListOfTuples(sortlocations) return sortlocations
def _ReloadScrolls(self): scrolllist = [] for typeID, amount in self.contentsCommodities.iteritems(): data = util.KeyVal() data.label = '<t>%s<t>%s' % (cfg.invtypes.Get(typeID).name, amount) data.typeID = typeID data.itemID = None data.getIcon = True sortBy = amount scrolllist.append((sortBy, listentry.Get('Item', data=data))) scrolllist = uiutil.SortListOfTuples(scrolllist) self.contentsScroll.Load( contentList=scrolllist, noContentHint=localization.GetByLabel( 'UI/PI/Common/StorehouseIsEmpty'), headers=[ '', localization.GetByLabel('UI/PI/Common/Type'), localization.GetByLabel('UI/Common/Quantity') ]) scrolllist = [] for typeID, amount in self.payloadCommodities.iteritems(): data = util.KeyVal() data.label = '<t>%s<t>%s' % (cfg.invtypes.Get(typeID).name, amount) data.typeID = typeID data.itemID = None data.getIcon = True sortBy = amount scrolllist.append((sortBy, listentry.Get('Item', data=data))) scrolllist = uiutil.SortListOfTuples(scrolllist) self.payloadScroll.Load( contentList=scrolllist, noContentHint=localization.GetByLabel( 'UI/PI/Common/PayloadIsEmpty'), headers=[ '', localization.GetByLabel('UI/PI/Common/Type'), localization.GetByLabel('UI/Common/Quantity') ]) self.costText.text = localization.GetByLabel( 'UI/PI/Common/LaunchCost', iskAmount=util.FmtISK( self.pin.GetExportTax(self.payloadCommodities)))
def LoadScrollList(self): scrolllist = [] subSystemsByGroupID = self.GetSubSystemsByGroup() subSystemGroups = [] for subSystemGroupID in subSystemsByGroupID: if self.groupIDs is not None and subSystemGroupID in self.groupIDs: continue subSystemGroup = cfg.invgroups.Get(subSystemGroupID) subSystemGroups.append((subSystemGroup.groupName, subSystemGroup)) subSystemGroups = uiutil.SortListOfTuples(subSystemGroups) godma = sm.GetService('godma') for groupRow in cfg.groupsByCategories.get(const.categorySubSystem, []): groupID = groupRow.groupID if self.groupIDs is not None and groupID in self.groupIDs: continue group = cfg.invgroups.Get(groupID) scrolllist.append( listentry.Get('Header', {'label': group.groupName})) types = [] typeIDs = [] if group.groupID in subSystemsByGroupID: for subSystemTypeID, subSystemItemID in subSystemsByGroupID[ group.groupID]: if subSystemTypeID not in typeIDs: subSystemType = cfg.invtypes.Get(subSystemTypeID) types.append((subSystemType.typeName, subSystemType, subSystemItemID)) typeIDs.append(subSystemTypeID) types.sort() first = True for typeName, type, itemID in types: data = util.KeyVal() data.label = type.typeName data.typeID = type.typeID data.showinfo = 1 data.itemID = itemID data.OnClick = self.ClickEntry if groupID in self.startSubSystems and type.typeID == self.startSubSystems[ groupID] or not self.startSubSystems and first: data.isSelected = 1 else: data.isSelected = 0 if data.isSelected: slotFlag = int( godma.GetTypeAttribute(type.typeID, const.attributeSubSystemSlot)) self.subSystems[slotFlag] = itemID self.selectedSubSystemsByFlag[slotFlag] = itemID first = False scrolllist.append(listentry.Get('AssembleShipEntry', data=data)) self.UpdateHint() self.scroll.Load(contentList=scrolllist, scrolltotop=0)
def GetUserEntries(self, lst): scrolllist = [] for info in lst: if type(info) in [types.StringType, types.UnicodeType]: continue entryTuple = self.GetUserEntryTuple(info[1]) scrolllist.append(entryTuple) scrolllist = uiutil.SortListOfTuples(scrolllist) return scrolllist
def LoadContacts(self, *args): allContacts = sm.GetService('addressbook').GetContacts() contacts = allContacts.contacts.values() scrolllist = [] for contact in contacts: if util.IsNPC(contact.contactID) or not util.IsCharacter(contact.contactID): continue entryTuple = self.GetUserEntryTuple(contact.contactID, contact) scrolllist.append(entryTuple) scrolllist = uiutil.SortListOfTuples(scrolllist) self.sr.contactsScroll.Load(contentList=scrolllist, headers=[], noContentHint=localization.GetByLabel('UI/AddressBook/NoContacts'))
def LoadChar(self, charID): self.charID = charID if util.IsEvePlayerCharacter(charID): self.security = self.crimewatchSvc.GetCharacterSecurityStatus( self.charID) self.memberinfo = self.charMgr.GetPrivateInfo(self.charID) self.corporation = self.corp.GetCorporation(eve.session.corpid) grantableRoles, grantableRolesAtHQ, grantableRolesAtBase, grantableRolesAtOther = self.corp.GetMyGrantableRoles( ) self.myGrantableRoles = grantableRoles self.myGrantableRolesAtHQ = grantableRolesAtHQ self.myGrantableRolesAtBase = grantableRolesAtBase self.myGrantableRolesAtOther = grantableRolesAtOther self.isCEOorEq = const.corpRoleDirector & eve.session.corprole == const.corpRoleDirector self.userIsCEO = self.corp.UserIsCEO() self.member = self.corp.GetMember(self.charID) if not self.member: return self.divisionalRoles = self.corp.GetDivisionalRoles() self.divisions = self.corp.GetDivisionNames() self.locationalRoles = self.corp.GetLocationalRoles() self.playerIsCEO = self.corporation.ceoID == self.charID self.playerIsDirector = 0 if const.corpRoleDirector & self.member.roles == const.corpRoleDirector: self.playerIsDirector = 1 self.roles = self.member.roles self.grantableRoles = self.member.grantableRoles self.title = self.member.title self.rolesAtHQ = self.member.rolesAtHQ self.grantableRolesAtHQ = self.member.grantableRolesAtHQ self.rolesAtBase = self.member.rolesAtBase self.grantableRolesAtBase = self.member.grantableRolesAtBase self.rolesAtOther = self.member.rolesAtOther self.grantableRolesAtOther = self.member.grantableRolesAtOther self.baseID = self.member.baseID self.titleMask = self.member.titleMask self.offices = self.corp.GetMyCorporationsOffices() self.offices.Fetch(0, len(self.offices)) self.bases = [( localization.GetByLabel('UI/Corporations/EditMemberDialog/NoBase'), None)] rows = self.offices if rows and len(rows): stations = [] for row in rows: stationName = localization.GetByLabel( 'UI/Corporations/EditMemberDialog/CorpMemberBase', station=row.stationID) stations.append((stationName, (stationName, row.stationID))) stations = uiutil.SortListOfTuples(stations) self.bases += stations self.roleGroupings = sm.GetService('corp').GetRoleGroupings()
def GetMasteryScrollEntries(self, level): certificates = sm.GetService( 'certificates').GetCertificatesForShipByMasteryLevel( self.typeID, level) scrolllist = [] for cert in certificates: data = sm.GetService('info').GetCertEntry(cert, level) scrolllist.append((data.get('label', ''), listentry.Get(settings=data, decoClass=listentry.CertEntry))) return uiutil.SortListOfTuples(scrolllist)
def GetStationServiceInfo(self, sortBy=None, stationInfo=None): if not self.station and eve.session.stationid: self.GetStation() services = [] for service, info in self.GetStationServices().iteritems(): sortItem = info.index if sortBy == 'name': sortItem = info.label services.append(((sortItem, service), info)) services = uiutil.SortListOfTuples(services) return services
def GetStats_Systems(self): systemsThatWillSwitchNextDownTime = self.GetSystemsConqueredThisRun() cfg.evelocations.Prime( [d['solarsystemID'] for d in systemsThatWillSwitchNextDownTime]) cfg.eveowners.Prime( [d['occupierID'] for d in systemsThatWillSwitchNextDownTime]) tempList = [] for each in systemsThatWillSwitchNextDownTime: tempList.append((each.get('taken'), each)) systemsThatWillSwitchNextDownTime = uiutil.SortListOfTuples(tempList, reverse=1) return systemsThatWillSwitchNextDownTime
def GetKills(self, scroll, shipGroup=None): sortedScrolllist = [] myDate = None killValue = self.killsFilterCombo.GetValue() kills = self.warStatisticMoniker.GetKills(killValue, shipGroup) validGroupIDs = None if shipGroup is not None: validGroupIDs = cfg.GetShipGroupByClassType()[shipGroup] for kill in kills: if self.attackerID in (kill.finalCorporationID, kill.finalAllianceID): attackerKill = True else: attackerKill = False if killValue == 'attacker' and attackerKill == False: continue elif killValue == 'defender' and attackerKill == True: continue data = util.KeyVal() data.label = '' data.killID = kill.killID data.killTime = kill.killTime data.finalCharacterID = kill.finalCharacterID data.finalCorporationID = kill.finalCorporationID data.finalAllianceID = kill.finalAllianceID data.victimCharacterID = kill.victimCharacterID data.victimCorporationID = kill.victimCorporationID data.victimAllianceID = kill.victimAllianceID data.victimShipTypeID = kill.victimShipTypeID data.attackerKill = attackerKill data.mail = kill sortedScrolllist.append( (kill.killTime, listentry.Get('WarKillEntry', data=data))) sortedScrolllist = uiutil.SortListOfTuples(sortedScrolllist, reverse=True) scrolllist = [] for entry in sortedScrolllist: if myDate is None or myDate != util.FmtDate(entry.killTime, 'sn'): scrolllist.append( listentry.Get( 'Header', {'label': util.FmtDate(entry.killTime, 'sn')})) myDate = util.FmtDate(entry.killTime, 'sn') scrolllist.append(entry) scroll.Load(contentList=scrolllist, headers=[], noContentHint=localization.GetByLabel( 'UI/Corporations/Wars/NoKillsFound'))
def GetStaticLabelsGroups(self): scrolllist = [] lastViewedID = settings.char.ui.Get('mail_lastnotification', None) for groupID, labelPath in notificationUtil.groupNamePaths.iteritems(): label = localization.GetByLabel(labelPath) entry = self.GetGroupEntry(groupID, label, groupID == lastViewedID) strippedLabel = uiutil.StripTags(label, stripOnly=['localized']) scrolllist.append((strippedLabel.lower(), entry)) scrolllist = uiutil.SortListOfTuples(scrolllist) entry = self.GetGroupEntry(const.notificationGroupUnread, localization.GetByLabel('UI/Mail/Unread'), const.notificationGroupUnread == lastViewedID) scrolllist.insert(0, entry) scrolllist.insert(1, listentry.Get('Space', {'height': 12})) return scrolllist
def ExpandTypeMenu(self, items): typemenu = [] for item in items: if item.groupID == const.groupStation: name = cfg.evelocations.Get(item.itemID).name entryName = uix.EditStationName(name, 1) else: entryName = cfg.evelocations.Get(item.itemID).name or item.itemName or 'no name!' escapeSorter = roman = typeName = None sequence = '' typemenu.append(((item.celestialIndex, item.orbitIndex, entryName), (entryName, ('isDynamic', self.ExpandCelestial, (item,))))) typemenu = uiutil.SortListOfTuples(typemenu) return typemenu
def CreateLayout(self): legend = ResourceLegend(parent=self) planetUI = sm.GetService('planetUI') self.resourceList = ResourceList(parent=self) planetObject = sm.GetService('planetSvc').GetPlanet(planetUI.planetID) resourceInfo = planetObject.remoteHandler.GetPlanetResourceInfo() sortedList = [] for typeID, quality in resourceInfo.iteritems(): name = cfg.invtypes.Get(typeID).name sortedList.append((name, (typeID, quality))) sortedList = uiutil.SortListOfTuples(sortedList) for typeID, quality in sortedList: qualityRemapped = quality / MAX_DISPLAY_QUALTY self.resourceList.AddItem(typeID, quality=max(0, min(1.0, qualityRemapped)))
def LoadNextEvents(self, *args): nextEvents = self.GetEvents() scrolllist = [] self.events = {} for eventID, eventKV in nextEvents.iteritems(): eventEntryTuple = self.GetEventEntryTuple(eventKV) if eventEntryTuple is None: continue self.events[eventID] = eventKV scrolllist.append(eventEntryTuple) scrolllist = uiutil.SortListOfTuples(scrolllist, reverse=self.GetSortOrder()) self.LoadScroll(scrolllist) self.OnResize()