def SetEntries(self, entries): scrolllist = [] entries = 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 PickProbes(self, pickBorder = False): mouseInsideProbes = [] borderPick = [] probeHandler = self.GetProbeHandler() if probeHandler: probeData = sm.StartService('scanSvc').GetProbeData() cameraPosition = geo2.Vec3Add(self.mapView.camera.pointOfInterest, self.mapView.camera._eyePosition) probes = probeHandler.GetProbeControls() for probeID, probeControl in probes.iteritems(): if probeID not in probeData or probeData[probeID].state != const.probeStateIdle: continue targetPlanePos = probeControl.GetWorldPosition() cameraDistance = geo2.Vec3Length(geo2.Vec3Subtract(cameraPosition, targetPlanePos)) rad = probeControl.GetRange() * SOLARSYSTEM_SCALE mousePositionOnCameraPlane = self.GetDotInCameraAlignedPlaneFromPosition(targetPlanePos) distanceFromCenter = geo2.Vec3Length(geo2.Vec3Subtract(targetPlanePos, mousePositionOnCameraPlane)) if pickBorder: pickRadiusPos = self.GetDotInCameraAlignedPlaneFromPosition(targetPlanePos, offsetMouse=(-10, 0)) pickRadius = geo2.Vec3Length(geo2.Vec3Subtract(pickRadiusPos, mousePositionOnCameraPlane)) if rad + pickRadius > distanceFromCenter > rad - pickRadius: borderPick.append((abs(rad - distanceFromCenter), probeControl)) elif distanceFromCenter <= rad: mouseInsideProbes.append((cameraDistance, probeControl)) if pickBorder: if borderPick: return SortListOfTuples(borderPick)[0] else: return None return SortListOfTuples(mouseInsideProbes)
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 = SortListOfTuples(temp) subitems = temp self.starColorGroups.append((label, (group, label, subitems))) self.starColorGroups = SortListOfTuples(self.starColorGroups) return self.starColorGroups
def GetPresetOptions(self): p = sm.GetService('overviewPresetSvc').GetAllPresets().keys() options = [] for name in p: defaultName = sm.GetService('overviewPresetSvc').GetDefaultOverviewName(name) if defaultName: options.append((' ' + defaultName.lower(), (defaultName, name))) else: displayName = sm.GetService('overviewPresetSvc').GetPresetDisplayName(name) options.append((displayName.lower(), (displayName, name))) options = SortListOfTuples(options) options.insert(0, (GetByLabel('UI/Inflight/Scanner/UseActiveOverviewSettings'), None)) return options
def GetPresetOptions(self): p = sm.GetService('overviewPresetSvc').GetAllPresets().keys() options = [] for name in p: defaultName = sm.GetService('overviewPresetSvc').GetDefaultOverviewName(name) if defaultName: options.append((' ' + defaultName.lower(), (defaultName, name))) else: displayName = sm.GetService('overviewPresetSvc').GetPresetDisplayName(name) options.append((displayName.lower(), (displayName, name))) options = SortListOfTuples(options) options.insert(0, (GetByLabel('UI/Inflight/Scanner/UseActiveOverviewSettings'), None)) return options
def GetRacesForGroup(self, nodedata): shipScrollist = [] fittingsByRaceID = nodedata.fittingsByRaceID shipsByRaceID = nodedata.shipsByRaceID for raceID, fittingsForRace in nodedata.groupItems.iteritems(): raceName = cfg.races.Get(raceID).raceName data = { 'GetSubContent': self.GetShipGroupSubContent, 'label': raceName, 'fittings': fittingsByRaceID[raceID], 'groupItems': fittingsForRace, 'allShips': shipsByRaceID[raceID], 'id': ('fittingMgmtScrollWndGroup', raceID), 'iconID': cfg.races.Get(raceID).iconID, 'state': 'locked', 'BlockOpenWindow': 1, 'DropData': self.onDropDataFunc, 'sublevel': 1, 'fittingNumByTypeID': nodedata.fittingNumByTypeID } groupEntry = (raceName, listentry.Get(entryType='Group', data=data)) shipScrollist.append(groupEntry) shipScrollist = SortListOfTuples(shipScrollist) return shipScrollist
def ShowGuests(self, condensed = None, *args): if self.selectedGroupButtonID != GUESTSPANEL: return if condensed is not None: settings.user.ui.Set('guestCondensedUserList', condensed) self.SetGuestEntryType() guests = sm.GetService('station').GetGuests() owners = [] for charID in guests.keys(): if charID not in owners: owners.append(charID) cfg.eveowners.Prime(owners) guestsNames = [ KeyVal(name=cfg.eveowners.Get(charID).name, charID=charID) for charID in guests ] guestFilter = self.quickFilter.GetValue() if len(guestFilter): guestsNames = NiceFilter(self.quickFilter.QuickFilter, guestsNames) if self.destroyed: return scrolllist = [] for guest in guestsNames: charID = guest.charID corpID, allianceID, warFactionID = guests[charID] charinfo = cfg.eveowners.Get(charID) scrolllist.append((charinfo.name.lower(), GetListEntry(self.userEntry, {'charID': charID, 'info': charinfo, 'label': charinfo.name, 'corpID': corpID, 'allianceID': allianceID, 'warFactionID': warFactionID}))) scrolllist = SortListOfTuples(scrolllist) self.guestScroll.Clear() self.guestScroll.AddNodes(0, scrolllist) self.UpdateGuestTabText()
def CheckMoveActiveState(self, topLevelLeaving = None): modal = self.GetModalWindow(topLevelLeaving) if modal: self.SetFocus(modal) else: if topLevelLeaving is None or topLevelLeaving == self.GetActive(): validWnds = self.GetValidWindows() if validWnds: sortedByIndex = SortListOfTuples([ (vwnd.parent.children.index(vwnd), vwnd) for vwnd in validWnds if not getattr(vwnd, 'isImplanted', False) ]) if sortedByIndex: self.SetFocus(sortedByIndex[0]) return focus = self.GetFocus() if focus and topLevelLeaving: if focus.IsUnder(topLevelLeaving): focus = None if focus is None: topLevels = [] def CrawlForTopLevelWindows(par): if self.IsTopLevelWindow(par): topLevels.append(par) for child in par.children: if hasattr(child, 'children') and child is not topLevelLeaving: CrawlForTopLevelWindows(child) CrawlForTopLevelWindows(uicore.desktop) if topLevels: for topLevel in topLevels: self.SetFocus(topLevel) focus = self.GetFocus() if focus and focus.IsUnder(topLevel): break
def GetShipGroupSubContent(self, nodedata, *args): scrolllist = [] fittingsByType = defaultdict(list) fittingNumByTypeID = nodedata.fittingNumByTypeID for fitting in nodedata.fittings: shipTypeID = fitting.shipTypeID if not evetypes.Exists(shipTypeID): log.LogError( 'Ship in stored fittings does not exist, shipID=%s, fittingID=%s' % (shipTypeID, fitting.fittingID)) continue fittingsByType[shipTypeID].append(fitting) allShips = nodedata.allShips for typeID in allShips: typeName = evetypes.GetName(typeID) numPersonal = fittingNumByTypeID[typeID][False] numCorp = fittingNumByTypeID[typeID][True] fittingsForType = fittingsByType.get(typeID, []) entry = self.GetShipTypeGroup(typeID, typeName, fittingsForType, numPersonal, numCorp) scrolllist.append((typeName, entry)) scrolllist = SortListOfTuples(scrolllist) return scrolllist
def LoadEvents(self, eventsThisDay, *args): self.sr.emptyDay.Flush() self.events = {} toSort = [((eventKV.eventTimeStamp, eventKV.eventTitle), eventKV) for eventKV in eventsThisDay.values()] eventsKVs = SortListOfTuples(toSort) from eve.client.script.ui.shared.eveCalendar import CalendarEventEntry 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 = 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 LoadGroup(self, groupID): myGroupInfo = self.controller.GetMyGroupInfo(groupID) if myGroupInfo is None: return self.groupMemberEntries = {} self.currentGroupID = groupID searchResults = self.controller.GetCurrentSearchResults() try: groupMembers = self.GetFilteredMembers(groupID, searchResults) except UserError as e: self.scroll.Load( contentList=[], noContentHint='UI/Structures/AccessGroups/MemberlistNotLoaded') eve.Message(e.msg, e.dict) return toPrime = groupMembers.keys() cfg.eveowners.Prime(toPrime) scrollList = [] for memberID, membershipType in groupMembers.iteritems(): node, sortValue = self.GetNodeAndSortValueForAccessEntry( groupID, memberID, membershipType) self.groupMemberEntries[memberID] = node scrollList.append((sortValue, node)) scrollList = SortListOfTuples(scrollList) if searchResults: noContentHint = GetByLabel( 'UI/Structures/AccessGroups/SearchNoContentHint') else: noContentHint = '' self.scroll.Load(contentList=scrollList, noContentHint=noContentHint)
def GetStations(self): solarsytemItems = sm.GetService('map').GetSolarsystemItems( session.solarsystemid2, True, False) stations = { i for i in solarsytemItems if i.groupID == const.groupStation } currentStation = session.stationid2 or session.structureid stationList = [] for eachStation in stations: if eachStation.itemID == currentStation: continue sortValue = (eachStation.celestialIndex, eachStation.orbitIndex, eachStation.itemName) stationList.append( (sortValue, (eachStation.itemName, eachStation.itemID))) stationList = SortListOfTuples(stationList) if currentStation: stationName = cfg.evelocations.Get(currentStation).name currentStationOption = (GetByLabel( 'UI/Market/MarketQuote/CurrentStation', stationName=stationName), currentStation) stationList = [currentStationOption] + stationList return stationList
def GetFittingEntriesForType(self, typeName, fittings, *args): scrolllist = [] for eachFitting in fittings: fittingName = eachFitting.name if eachFitting.ownerID == session.corpid: fakeOwnerType = 1 else: fakeOwnerType = 0 data = { 'label': fittingName, 'fittingID': eachFitting.fittingID, 'fitting': eachFitting, 'ownerID': session.charid, 'showinfo': 1, 'showicon': 'hide', 'sublevel': 3, 'ignoreRightClick': 1, 'OnClick': self.OnFittingClicked, 'OnDropData': self.onDropDataFunc, 'GetMenu': self.GetFittingMenu, 'ownerType': fakeOwnerType } sortBy = (fakeOwnerType, fittingName.lower()) entry = listentry.Get('FittingEntry', data=data) scrolllist.append((sortBy, entry)) scrolllist = SortListOfTuples(scrolllist) return scrolllist
def CrawlForTabstops(self, fromwhere): blueTypeName = 'trinity.Tr2Sprite2dContainer' sorted = [] current = [] done = [] tabstopgroups = [ wnd for wnd in fromwhere.Find(blueTypeName) if getattr(wnd, 'isTabOrderGroup', None) and wnd.IsVisible() ] for tabstopgroup in tabstopgroups: tabstops = [ wnd for wnd in tabstopgroup.Find(blueTypeName) if getattr(wnd, 'isTabStop', None) ] gAbs = tabstopgroup.GetAbsolute() for tabstop in tabstops: if tabstop.IsClickable(): if getattr(tabstop, 'hasFocus', None): current.append(tabstop) tAbs = tabstop.GetAbsolute() sorted.append(([gAbs[1], gAbs[0], tAbs[1], tAbs[0]], tabstop)) done.append(tabstop) tabstops = [ wnd for wnd in fromwhere.Find(blueTypeName) if getattr(wnd, 'isTabStop', None) ] for tabstop in tabstops: if tabstop not in done and tabstop.IsClickable(): if getattr(tabstop, 'hasFocus', None) == 1: current.append(tabstop) tAbs = tabstop.GetAbsolute() sorted.append(([tAbs[1], tAbs[0], tAbs[1], tAbs[0]], tabstop)) done.append(tabstop) if current: current = current[0] return (current, SortListOfTuples(sorted))
def GetFittingInfoScrollList(self, fitting): scrolllist = [] typesByRack = self.GetTypesByRack(fitting) for key, effectID in [('hiSlots', const.effectHiPower), ('medSlots', const.effectMedPower), ('lowSlots', const.effectLoPower), ('rigSlots', const.effectRigSlot), ('subSystems', const.effectSubSystem), ('serviceSlots', const.effectServiceSlot)]: slots = typesByRack[key] if len(slots) < 1: continue label = cfg.dgmeffects.Get(effectID).displayName scrolllist.append(listentry.Get('Header', {'label': label})) slotScrollList = [] for typeID, qty in slots.iteritems(): data = self._GetDataForFittingEntry(typeID, qty) data.singleton = 1 data.effectID = effectID entry = listentry.Get('FittingModuleEntry', data=data) slotScrollList.append((evetypes.GetGroupID(typeID), entry)) slotScrollList = SortListOfTuples(slotScrollList) scrolllist.extend(slotScrollList) for qtyByTypeIdDict, headerLabelPath, isValidGroup in ((typesByRack['charges'], 'UI/Generic/Charges', True), (typesByRack['ice'], 'UI/Inflight/MoonMining/Processes/Fuel', True), (typesByRack['drones'], 'UI/Drones/Drones', True), (typesByRack['fighters'], 'UI/Common/Fighters', True), (typesByRack['other'], 'UI/Fitting/FittingWindow/FittingManagement/OtherItems', False)): if len(qtyByTypeIdDict) > 0: scrolllist.append(listentry.Get('Header', {'label': localization.GetByLabel(headerLabelPath)})) scrolllist += self._GetFittingEntriesForGroup(qtyByTypeIdDict, isValidGroup) return scrolllist
def GetFittingScrolllist(self, *args): showPersonalFittings = settings.user.ui.Get( 'fitting_filter_ship_personalFittings', False) showCorpFittings = settings.user.ui.Get( 'fitting_filter_ship_corpFittings', False) filterOnFittings = showPersonalFittings or showCorpFittings personalFittings = self.fittingSvc.GetFittings(session.charid) corpFittings = self.fittingSvc.GetFittings(session.corpid) fittingNumByTypeID = self.GetNumShipsByTypeID(personalFittings, corpFittings) filterText = settings.user.ui.Get('fitting_fittingSearchField', '') filterTextLower = filterText.lower() fittings = self.FilterOutFittings(filterTextLower, personalFittings, corpFittings, showPersonalFittings, showCorpFittings) fittingsByGroupID, shipsByGroupID, shipGroups, shipsByGroupAndRaceIDs, fittingsByGroupAndRaceIDs = self.GetShipsAndGroups( filterTextLower, fittings) scrolllist = [] noFittingsFound = len(fittings) == 0 and filterOnFittings if noFittingsFound: scrolllist.append( listentry.Get( 'Generic', data={'label': GetByLabel('UI/Common/NothingFound')})) else: shipScrollist = [] for groupName, groupID in shipGroups: shipsForGroup = shipsByGroupAndRaceIDs[groupID] fittingsByRaceID = fittingsByGroupAndRaceIDs[groupID] data = { 'GetSubContent': self.GetRacesForGroup, 'label': groupName, 'groupItems': shipsForGroup, 'fittingsByRaceID': fittingsByRaceID, 'shipsByRaceID': shipsForGroup, 'id': ('fittingMgmtScrollWndGroup', groupName), 'showicon': 'hide', 'showlen': 0, 'state': 'locked', 'BlockOpenWindow': 1, 'DropData': self.onDropDataFunc, 'fittingNumByTypeID': fittingNumByTypeID } groupEntry = (groupName, listentry.Get(entryType='Group', data=data)) shipScrollist.append(groupEntry) shipScrollist = SortListOfTuples(shipScrollist) if shipScrollist: scrolllist.extend(shipScrollist) else: scrolllist.append( listentry.Get( 'Generic', data={'label': GetByLabel('UI/Common/NothingFound')})) return scrolllist
def ShowOffices(self): if self.selectedGroupButtonID != OFFICESPANEL: return self.LoadButtons() corpsWithOffices = sm.GetService('corp').GetCorporationsWithOfficesAtStation() cfg.corptickernames.Prime([ c.corporationID for c in corpsWithOffices ]) scrolllist = [] for corp in corpsWithOffices: data = KeyVal() data.corpName = corp.corporationName data.corpID = corp.corporationID data.corporation = corp scrolllist.append((data.corpName.lower(), GetListEntry('OfficeEntry', data=data))) scrolllist = SortListOfTuples(scrolllist) numUnrentedOffices = self.GetNumberOfUnrentedOffices() availOfficesLabel = localization.GetByLabel('UI/Station/Lobby/NumAvailableOffices', numOffices=numUnrentedOffices) scrolllist.insert(0, GetListEntry('Header', {'label': availOfficesLabel})) if not self.destroyed: self.officesScroll.Load(contentList=scrolllist)
def ShowOffices(self): if self.selectedGroupButtonID != OFFICESPANEL: return self.LoadButtons() corpsWithOffices = sm.GetService('corp').GetCorporationsWithOfficesAtStation() cfg.corptickernames.Prime([ c.corporationID for c in corpsWithOffices ]) scrolllist = [] for corp in corpsWithOffices: data = KeyVal() data.corpName = corp.corporationName data.corpID = corp.corporationID data.corporation = corp scrolllist.append((data.corpName.lower(), GetListEntry('OfficeEntry', data=data))) scrolllist = SortListOfTuples(scrolllist) numUnrentedOffices = self.GetNumberOfUnrentedOffices() availOfficesLabel = localization.GetByLabel('UI/Station/Lobby/NumAvailableOffices', numOffices=numUnrentedOffices) scrolllist.insert(0, GetListEntry('Header', {'label': availOfficesLabel})) if not self.destroyed: self.officesScroll.Load(contentList=scrolllist)
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 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 = SortListOfTuples(scrolllist, reverse=self.GetSortOrder()) self.LoadScroll(scrolllist) self.OnResize()
def LoadMaterialGroup(self, nodedata, *args): scrolllist = [] for typeID, quantity, hint in nodedata.groupItems: entry = listentry.Get( 'Item', { 'itemID': None, 'typeID': typeID, 'label': hint, 'getIcon': 1, 'sublevel': 2 }) scrolllist.append((typeID, entry)) scrolllist = SortListOfTuples(scrolllist) return scrolllist
def SetEntries(self, entries): scrolllist = [] entries = 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 LoadGroups(self, *args): myGroups = self.controller.GetMyGroups() searchResults = self.controller.GetCurrentSearchResults() groupIDs = set() nodesByMembership = defaultdict(list) for groupID, g in myGroups.iteritems(): groupIDs.add(groupID) groupName = g.name nodeData = Bunch(decoClass=AccessGroupEntry, controller=self.controller, groupInfo=g, isNormal=self.IsNormalGroup( groupID, searchResults)) node = (groupName.lower(), nodeData) if g.creatorID == session.corpid: myMembership = DEFAULT_CORP_GROUP else: myMembership = g.membershipType nodesByMembership[myMembership].append(node) scrollList = [] for eachMemberShipType in [DEFAULT_CORP_GROUP] + ACCESS_SORT_ORDER: nodes = nodesByMembership.get(eachMemberShipType) if nodes: sortedNodes = SortListOfTuples(nodes) scrollList += sortedNodes scrollList.append(listentry.Get('Space', {'height': 12})) self.scroll.Load(contentList=scrollList) groupID = None lastLoadedGroupID = settings.user.ui.Get('accessGroup_lastGroup', None) if lastLoadedGroupID in groupIDs: groupID = lastLoadedGroupID elif len(scrollList) > 1: firstNode = scrollList[0] groupID = firstNode.groupInfo.groupID self.controller.SelectGroup(groupID)
const.groupStructureRepairArray, const.groupTargetPaintingBattery } validCategories = (const.categoryStation, const.categoryShip, const.categoryEntity, const.categoryCelestial, const.categoryAsteroid, const.categoryDrone, const.categoryDeployable, const.categoryStarbase, const.categoryStructure, const.categoryCharge, const.categorySovereigntyStructure, const.categoryOrbital, const.categoryFighter) bombGroups = (const.groupBomb, const.groupBombECM, const.groupBombEnergy, const.groupScannerProbe, const.groupWarpDisruptionProbe, const.groupSurveyProbe, const.groupStructureAreaMissile) groups = [] for grpID in evetypes.IterateGroups(): categoryID = evetypes.GetCategoryIDByGroup(grpID) if categoryID == const.categoryCharge and grpID not in bombGroups: continue if categoryID not in validCategories: continue if grpID in filterGroups: continue groupName = evetypes.GetGroupNameByGroup(grpID) groups.append((groupName.lower(), (grpID, groupName))) groupList = SortListOfTuples(groups) groupIDs = set((each[0] for each in groupList)) def IsInteractableEntity(groupID): return groupID in groupIDs
def GetFittingInfoScrollList(self, fitting): scrolllist = [] typesByRack = self.GetTypesByRack(fitting) for key, effectID in [('hiSlots', const.effectHiPower), ('medSlots', const.effectMedPower), ('lowSlots', const.effectLoPower), ('rigSlots', const.effectRigSlot), ('subSystems', const.effectSubSystem)]: slots = typesByRack[key] if len(slots) > 0: label = cfg.dgmeffects.Get(effectID).displayName scrolllist.append(listentry.Get('Header', {'label': label})) slotScrollList = [] for typeID, qty in slots.iteritems(): typeInfo = cfg.invtypes.Get(typeID) data = util.KeyVal() data.typeID = typeID data.showinfo = 1 data.getIcon = True data.singleton = 1 data.effectID = effectID data.label = str( util.FmtAmt(qty)) + 'x ' + typeInfo.typeName entry = listentry.Get('FittingModuleEntry', data=data) slotScrollList.append((typeInfo.groupID, entry)) slotScrollList = SortListOfTuples(slotScrollList) scrolllist.extend(slotScrollList) charges = typesByRack['charges'] if len(charges) > 0: scrolllist.append( listentry.Get( 'Header', {'label': localization.GetByLabel('UI/Generic/Charges')})) for type, qty in charges.iteritems(): data = util.KeyVal() data.typeID = type data.showinfo = 1 data.getIcon = True data.label = str( util.FmtAmt(qty)) + 'x ' + cfg.invtypes.Get(type).typeName scrolllist.append( listentry.Get('FittingModuleEntry', data=data)) ice = typesByRack['ice'] if len(ice) > 0: scrolllist.append( listentry.Get( 'Header', { 'label': localization.GetByLabel( 'UI/Inflight/MoonMining/Processes/Fuel') })) for type, qty in ice.iteritems(): data = util.KeyVal() data.typeID = type data.showinfo = 1 data.getIcon = True data.label = str( util.FmtAmt(qty)) + 'x ' + cfg.invtypes.Get(type).typeName scrolllist.append( listentry.Get('FittingModuleEntry', data=data)) drones = typesByRack['drones'] if len(drones) > 0: scrolllist.append( listentry.Get( 'Header', {'label': localization.GetByLabel('UI/Drones/Drones')})) for type, qty in drones.iteritems(): data = util.KeyVal() data.typeID = type data.showinfo = 1 data.getIcon = True data.label = str( util.FmtAmt(qty)) + 'x ' + cfg.invtypes.Get(type).typeName scrolllist.append( listentry.Get('FittingModuleEntry', data=data)) return scrolllist
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetMinSize((500, 300)) main = self.GetMainArea() main.clipChildren = True options = Container(parent=main, align=uiconst.TOLEFT, width=180, padTop=4, padLeft=5) fontsParent = Container(parent=options) flagsParent = Container(parent=options) tabs = uicontrols.TabGroup(parent=options, tabs=[('Fonts', fontsParent, self, 'properties'), ('Load Flags', flagsParent, self, 'flags')], padBottom=6, idx=0) for each in (STYLECLASSES, CLIENTFONTS, WINDOWSFONTS): Checkbox(parent=fontsParent, text='Browse ' + each, groupname='browseType', checked=each == STYLECLASSES, callback=self.OnBrowseTypeChange, retval=each) import uicls clientLabelClasses = [] for className, cls in uicls.__dict__.iteritems(): try: if issubclass(cls, LabelCore) and cls is not LabelCore and getattr(cls, '__guid__', None) is not None: clientLabelClasses.append((className, (className, cls))) except: pass clientLabelClasses = SortListOfTuples(clientLabelClasses) self.styleClassesLabel = Label(parent=fontsParent, text='Style Classes', align=uiconst.TOTOP, padTop=10) self.styleClassesCombo = Combo(parent=fontsParent, align=uiconst.TOTOP, options=clientLabelClasses, callback=self.OnStyleClassChange) clientFaces = [] clientFonts = os.listdir(blue.paths.ResolvePathForWriting(u'res:') + '\\UI\\Fonts') clientFonts.sort() for fontName in clientFonts: if fontName.lower().endswith('.ttf') or fontName.lower().endswith('.otf'): clientFaces.append((fontName, 'res:/UI/Fonts/' + fontName)) self.clientFontsLabel = Label(parent=fontsParent, text='Client Fonts', align=uiconst.TOTOP, padTop=10) self.clientFontsCombo = typeFaceCombo = Combo(parent=fontsParent, align=uiconst.TOTOP, options=clientFaces, callback=self.OnTypeFaceChange) windowsFaces = [] windowsFonts = os.listdir(blue.win32.SHGetFolderPath(blue.win32.CSIDL_FONTS)) windowsFonts.sort() for fontName in windowsFonts: if fontName.lower().endswith('.ttf') or fontName.lower().endswith('.otf'): windowsFaces.append((fontName, blue.win32.SHGetFolderPath(blue.win32.CSIDL_FONTS) + '\\' + fontName)) self.windowsFontsLabel = Label(parent=fontsParent, text='Windows Fonts', align=uiconst.TOTOP, padTop=10) self.windowsFontsCombo = typeFaceCombo = Combo(parent=fontsParent, align=uiconst.TOTOP, options=windowsFaces, callback=self.OnTypeFaceChange) Label(parent=fontsParent, text='Fontsize', align=uiconst.TOTOP, padTop=10) self.fontSizeEdit = SinglelineEdit(ints=(6, 128), parent=fontsParent, align=uiconst.TOTOP, OnChange=self.OnFontSizeChange, setvalue=unicode(Label.default_fontsize)) Label(parent=fontsParent, text='Letterspace', align=uiconst.TOTOP, padTop=10) self.letterSpaceEdit = SinglelineEdit(ints=(-10, 10), parent=fontsParent, align=uiconst.TOTOP, OnChange=self.OnLetterSpaceChange, setvalue=unicode(Label.default_letterspace)) Label(parent=fontsParent, text='LineSpacing', align=uiconst.TOTOP, padTop=10) self.lineSpacingEdit = SinglelineEdit(floats=(-1.0, 1.0, 2), parent=fontsParent, align=uiconst.TOTOP, OnChange=self.OnLineSpacingChange, setvalue=unicode(0.0)) current = trinity.fontMan.loadFlag self.loadFlagCheckBoxes = [] for flagName, flagValue in loadFlags: active = current & flagValue == flagValue cb = Checkbox(parent=flagsParent, align=uiconst.TOTOP, text=flagName.replace('FT_LOAD_', ''), callback=self.OnLoadFlagChange, retval=flagValue, checked=active) cb.flagName = flagName cb.flagValue = flagValue self.loadFlagCheckBoxes.append(cb) Label(parent=flagsParent, text='Render flags', align=uiconst.TOTOP, padTop=10) self.renderFlagCheckBoxes = [] for flagName, flagValue in renderFlags: active = current & flagValue == flagValue cb = Checkbox(parent=flagsParent, align=uiconst.TOTOP, text=flagName.replace('FT_RENDER_MODE_', ''), groupname='renderFlag', callback=self.OnRenderFlagChange, retval=flagValue, checked=active) cb.flagName = flagName cb.flagValue = flagValue self.renderFlagCheckBoxes.append(cb) sampleSelectionParent = Container(parent=main, align=uiconst.TOTOP, height=38, padTop=20) Line(parent=main, align=uiconst.TOTOP, padTop=10, padRight=10, padLeft=10) self.sampleCombo = Combo(parent=sampleSelectionParent, align=uiconst.TOPLEFT, width=100, left=10, options=[('Lorem...', samplText), ('Ansi charset', ANSI), ('Cyrillic charset', CYRILLIC)], callback=self.OnSampleComboChange) orlabel = Label(parent=sampleSelectionParent, text='-or-', left=self.sampleCombo.left + self.sampleCombo.width + 5) self.sampleInput = EditPlainText(parent=sampleSelectionParent, align=uiconst.TOALL, padLeft=140, padRight=10, text='asdf sfdasfasfdasfd safd') self.sampleInput.OnChange = self.OnCustomTextChange self.samples = [] for typeFace in clientFonts[:1]: sampl = Label(parent=main, align=uiconst.TOTOP, text=samplText, padding=10) self.samples.append(sampl) self.LoadBrowseType(STYLECLASSES)
def ShowAgents(self): try: agentsSvc = sm.GetService('agents') journalSvc = sm.GetService('journal') facWarSvc = sm.StartService('facwar') standingSvc = sm.StartService('standing') epicArcStatusSvc = sm.RemoteSvc('epicArcStatus') if self.selectedGroupButtonID != AGENTSPANEL: return agentMissions = journalSvc.GetMyAgentJournalDetails()[:1][0] agentsInStation = agentsSvc.GetAgentsByStationID()[session.stationid2] relevantAgents = [] missionStateDict = {} for each in agentMissions: missionState, importantMission, missionType, missionName, agentID, expirationTime, bookmarks, remoteOfferable, remoteCompletable, contentID = each agent = agentsSvc.GetAgentByID(agentID) missionStateDict[agentID] = missionState if missionState not in (const.agentMissionStateAllocated, const.agentMissionStateOffered) or agent.agentTypeID in (const.agentTypeGenericStorylineMissionAgent, const.agentTypeStorylineMissionAgent, const.agentTypeEventMissionAgent, const.agentTypeCareerAgent, const.agentTypeEpicArcAgent): relevantAgents.append(agentID) localRelevantAgents = [] for agent in agentsInStation: if agent.agentID in relevantAgents: localRelevantAgents.append(agent.agentID) if self.destroyed: return scrolllist = [] sortlist = [] for agentID in relevantAgents: if not eve.rookieState or agentID in const.rookieAgentList: if agentID not in localRelevantAgents: missionState = missionStateDict.get(agentID) sortlist.append((cfg.eveowners.Get(agentID).name, GetListEntry('AgentEntry', {'charID': agentID, 'missionState': missionState}))) if sortlist: agentLabel = localization.GetByLabel('UI/Station/Lobby/AgentsOfInterest') scrolllist.append(GetListEntry('Header', {'label': agentLabel})) scrolllist += SortListOfTuples(sortlist) unavailableAgents = [] availableAgents = [] for agent in agentsInStation: if agent.agentID in const.rookieAgentList: continue if not eve.rookieState or agent.agentID in const.rookieAgentList: isLimitedToFacWar = False if agent.agentTypeID == const.agentTypeFactionalWarfareAgent and facWarSvc.GetCorporationWarFactionID(agent.corporationID) != session.warfactionid: isLimitedToFacWar = True if agent.agentTypeID in (const.agentTypeResearchAgent, const.agentTypeBasicAgent, const.agentTypeEventMissionAgent, const.agentTypeCareerAgent, const.agentTypeFactionalWarfareAgent): standingIsValid = standingSvc.CanUseAgent(agent.factionID, agent.corporationID, agent.agentID, agent.level, agent.agentTypeID) haveMissionFromAgent = agent.agentID in relevantAgents if not isLimitedToFacWar and (standingIsValid or haveMissionFromAgent): availableAgents.append(agent.agentID) else: unavailableAgents.append(agent.agentID) elif agent.agentTypeID == const.agentTypeEpicArcAgent: standingIsValid = standingSvc.CanUseAgent(agent.factionID, agent.corporationID, agent.agentID, agent.level, agent.agentTypeID) haveMissionFromAgent = agent.agentID in relevantAgents epicAgentAvailable = False if haveMissionFromAgent: epicAgentAvailable = True elif standingIsValid: if agent.agentID in relevantAgents or epicArcStatusSvc.AgentHasEpicMissionsForCharacter(agent.agentID): epicAgentAvailable = True if epicAgentAvailable: availableAgents.append(agent.agentID) else: unavailableAgents.append(agent.agentID) if agent.agentTypeID == const.agentTypeAura: if sm.GetService('experimentClientSvc').IsTutorialEnabled(): availableAgents.append(agent.agentID) elif agent.agentTypeID in (const.agentTypeGenericStorylineMissionAgent, const.agentTypeStorylineMissionAgent): if agent.agentID in localRelevantAgents: availableAgents.append(agent.agentID) else: unavailableAgents.append(agent.agentID) if availableAgents: availableLabel = localization.GetByLabel('UI/Station/Lobby/AvailableToYou') scrolllist.append(GetListEntry('Header', {'label': availableLabel})) sortlist = [] for agentID in availableAgents: missionState = missionStateDict.get(agentID) sortlist.append((cfg.eveowners.Get(agentID).name, GetListEntry('AgentEntry', {'charID': agentID, 'missionState': missionState}))) scrolllist += SortListOfTuples(sortlist) if unavailableAgents: unavailableLabel = localization.GetByLabel('UI/Station/Lobby/NotAvailableToYou') scrolllist.append(GetListEntry('Header', {'label': unavailableLabel})) sortlist = [] for agentID in unavailableAgents: missionState = missionStateDict.get(agentID) sortlist.append((cfg.eveowners.Get(agentID).name, GetListEntry('AgentEntry', {'charID': agentID, 'missionState': missionState}))) scrolllist += SortListOfTuples(sortlist) if self.destroyed: return self.agentScroll.Load(fixedEntryHeight=40, contentList=scrolllist) except: log.LogException() sys.exc_clear()