def PanelShowStats(self, *args): cont = uiprimitives.Container(parent=self.actionCont, state=uiconst.UI_HIDDEN) self.statsScroll = scroll = uicontrols.Scroll(parent=cont, name='StatsScroll', align=uiconst.TOALL) scrolllist = [] link = self.pin.link strCpuUsage = localization.GetByLabel('UI/PI/Common/TeraFlopsAmount', amount=int(link.GetCpuUsage())) data = util.KeyVal( label='%s<t>%s' % (localization.GetByLabel('UI/PI/Common/CpuUsage'), strCpuUsage)) scrolllist.append(listentry.Get('Generic', data=data)) strPowerUsage = localization.GetByLabel('UI/PI/Common/MegaWattsAmount', amount=int( link.GetPowerUsage())) data = util.KeyVal(label='%s<t>%s' % (localization.GetByLabel('UI/PI/Common/PowerUsage'), strPowerUsage)) scrolllist.append(listentry.Get('Generic', data=data)) scroll.Load(contentList=scrolllist, headers=[ localization.GetByLabel('UI/PI/Common/Attribute'), localization.GetByLabel('UI/Common/Value') ]) return cont
def GetCloneImplants(self, nodedata, *args): scrolllist = [] godma = sm.GetService('godma') implants = SortListOfTuples([ (getattr(godma.GetType(implant.typeID), 'implantness', None), implant) for implant in sm.GetService( 'clonejump').GetImplantsForClone(nodedata.jumpCloneID) ]) if implants: for cloneImplantRow in implants: scrolllist.append( entries.Get( 'ImplantEntry', { 'implant_booster': cloneImplantRow, 'label': evetypes.GetName(cloneImplantRow.typeID), 'sublevel': 1 })) else: noImplantsString = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/JumpCloneScroll/NoImplantsInstalled' ) scrolllist.append( entries.Get('Text', { 'label': noImplantsString, 'text': noImplantsString })) scrolllist.append( entries.Get( 'CloneButtons', { 'locationID': nodedata.locationID, 'jumpCloneID': nodedata.jumpCloneID })) return scrolllist
def GetFittingSlotEntry(self, slotInfo, moduleCount): slotCount = self.GetTotalSlotCount(slotInfo) if slotCount <= 0 and moduleCount <= 0: return else: isMyActiveShip = self.itemID is not None and util.GetActiveShip( ) == self.itemID isOwnedByMe = self.item is not None and self.item.ownerID == session.charid if isMyActiveShip or isOwnedByMe: data = { 'label': self.GetFittingSlotEntryLabel(slotInfo), 'text': GetByLabel('UI/InfoWindow/FittingSlotsUsedAndTotal', usedSlots=moduleCount, slotCount=slotCount), 'iconID': cfg.dgmattribs.Get(slotInfo['attributeID']).iconID, 'line': 1 } entry = listentry.Get(decoClass=FittingSlotEntry, data=data) return entry data = { 'label': self.GetFittingSlotEntryLabel(slotInfo), 'text': util.FmtAmt(slotCount), 'iconID': cfg.dgmattribs.Get(slotInfo['attributeID']).iconID, 'line': 1 } entry = listentry.Get('LabelTextSides', data) return entry
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 GetSolarSystemInfo(self, solarSystemID): contentList = [] data = KeyVal() data.label = self.GetSystemNameText(solarSystemID) headerEntry = listentry.Get(decoClass=SystemNameHeader, data=data) contentList.append(headerEntry) sovStructuresInfo = self.sovSvc.GetSovStructuresInfoForSolarSystem( solarSystemID) structureInfosByTypeID = GetSovStructureInfoByTypeID(sovStructuresInfo) tcuInfo = structureInfosByTypeID[typeTerritorialClaimUnit] isCapital = tcuInfo.get('isCapital', False) sovInfo = self.sovSvc.GetSovInfoForSolarsystem(solarSystemID, isCapital) multiplierInfo = self.GetMultiplierInfo(sovInfo, isCapital) statusEntry = listentry.Get(entryType=None, data=multiplierInfo, decoClass=SovSystemStatusEntry) contentList.append(statusEntry) if sovStructuresInfo: for structureTypeID, structureInfo in structureInfosByTypeID.iteritems( ): if not structureInfo.get('itemID', None): continue entryData = KeyVal(structureInfo=structureInfo) structureEntry = listentry.Get( entryType=None, data=entryData, decoClass=SovStructureStatusEntry) contentList.append(structureEntry) return contentList
def LoadPanel(self, *args): scrolllist = [] killRights = sm.GetService('bountySvc').GetMyKillRights() currentTime = blue.os.GetWallclockTime() myKillRights = filter(lambda x: x.fromID == session.charid and currentTime < x.expiryTime, killRights) otherKillRights = filter(lambda x: x.toID == session.charid and currentTime < x.expiryTime, killRights) charIDsToPrime = set() for eachKR in myKillRights: charIDsToPrime.add(eachKR.toID) for eachKR in otherKillRights: charIDsToPrime.add(eachKR.fromID) cfg.eveowners.Prime(charIDsToPrime) if myKillRights: scrolllist.append(entries.Get('Header', {'label': GetByLabel('UI/InfoWindow/CanKill'), 'hideLines': True})) for killRight in myKillRights: scrolllist.append(entries.Get('KillRightsEntry', {'charID': killRight.toID, 'expiryTime': killRight.expiryTime, 'killRight': killRight, 'isMine': True})) if otherKillRights: scrolllist.append(entries.Get('Header', {'label': GetByLabel('UI/InfoWindow/CanBeKilledBy'), 'hideLines': True})) for killRight in otherKillRights: scrolllist.append(entries.Get('KillRightsEntry', {'charID': killRight.fromID, 'expiryTime': killRight.expiryTime, 'killRight': killRight, 'isMine': False})) self.scroll.sr.id = 'charsheet_killrights' self.scroll.Load(contentList=scrolllist, noContentHint=GetByLabel('UI/CharacterSheet/CharacterSheetWindow/KillsTabs/NoKillRightsFound'))
def OnCompetitorTrackingStart(self, competitorsByShipID): scrolllist = [] for shipData in competitorsByShipID.values(): data = util.KeyVal() data.shipID = shipData.shipID data.texts = EntryRow(character=shipData.ownerName, groupName=shipData.groupName, typeName=shipData.typeName, maxDistance='%.1f km' % (shipData.maxDistance * 0.001), distance='%.1f km' % (shipData.distance * 0.001)) data.sortData = EntryRow(character=shipData.ownerName, groupName=shipData.groupName, typeName=shipData.typeName, maxDistance=shipData.maxDistance, distance=shipData.distance) data.columnID = 'AtCompetitorsScroll' data.isSelected = False data.GetMenu = lambda x: sm.GetService('menu').GetMenuFormItemIDTypeID(shipData.shipID, shipData.typeID) iconPar = uiprimitives.Container(name='iconParent', parent=None, align=uiconst.TOPLEFT, width=16, height=16, state=uiconst.UI_HIDDEN) icon = uicontrols.Icon(parent=iconPar, icon='ui_38_16_182', pos=(0, 0, 16, 16), align=uiconst.RELATIVE) icon.hint = 'Destroy Ship' icon.shipID = shipData.shipID icon.OnClick = (self.DestroyShip, icon) data.overlay = iconPar entry = listentry.Get('AtCompetitorEntry', data=data) scrolllist.append(entry) scrolllist = listentry.SortColumnEntries(scrolllist, 'AtCompetitorsScroll') data = util.KeyVal() data.texts = ('Character', 'Group', 'Type', 'Max Distance', 'Distance') data.columnID = 'AtCompetitorsScroll' data.editable = True data.showBottomLine = True data.selectable = False data.hilightable = False scrolllist.insert(0, listentry.Get('AtCompetitorEntry', data=data)) if scrolllist: listentry.InitCustomTabstops('AtCompetitorsScroll', scrolllist) self.scroll.LoadContent(contentList=scrolllist)
def PanelShowStats(self, *args): """ Show stats of current pin, kinda like showinfo """ cont = uiprimitives.Container(parent=self.actionCont, pos=(0, 0, 0, 175), align=uiconst.TOTOP, state=uiconst.UI_HIDDEN) self.statsScroll = scroll = uicontrols.Scroll(parent=cont, name='StatsScroll', align=uiconst.TOTOP, height=170) scroll.HideUnderLay() uicontrols.Frame(parent=scroll, color=(1.0, 1.0, 1.0, 0.2)) scrolllist = [] link = self.pin.link strCpuUsage = localization.GetByLabel('UI/PI/Common/TeraFlopsAmount', amount=int(link.GetCpuUsage())) data = util.KeyVal( label='%s<t>%s' % (localization.GetByLabel('UI/PI/Common/CpuUsage'), strCpuUsage)) scrolllist.append(listentry.Get('Generic', data=data)) strPowerUsage = localization.GetByLabel('UI/PI/Common/MegaWattsAmount', amount=int( link.GetPowerUsage())) data = util.KeyVal(label='%s<t>%s' % (localization.GetByLabel('UI/PI/Common/PowerUsage'), strPowerUsage)) scrolllist.append(listentry.Get('Generic', data=data)) scroll.Load(contentList=scrolllist, headers=[ localization.GetByLabel('UI/PI/Common/Attribute'), localization.GetByLabel('UI/Common/Value') ]) return cont
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 DrawFittings(self, *args): scrolllist = [] fittings = self.fittingSvc.GetFittings(self.ownerID).items() self.EnableExportButton(len(fittings) > 0) maxFittings = None if self.ownerID == session.charid: maxFittings = const.maxCharFittings elif self.ownerID == session.corpid: maxFittings = const.maxCorpFittings fittingsByGroupID = {} shipGroups = [] if self.wordFilter is not None: for fittingID, fitting in fittings[:]: if self.wordFilter.lower() not in fitting.name.lower(): fittings.remove((fittingID, fitting)) hideRight = True for fittingID, fitting in fittings: if self.fitting is not None and self.fitting.fittingID == fittingID: hideRight = False shipTypeID = fitting.shipTypeID if not evetypes.Exists(shipTypeID): log.LogError( 'Ship in stored fittings does not exist, shipID=%s, fittingID=%s' % (shipTypeID, fittingID)) continue groupID = evetypes.GetGroupID(shipTypeID) if groupID not in fittingsByGroupID: fittingsByGroupID[groupID] = [] fittingsByGroupID[groupID].append(fitting) groupName = evetypes.GetGroupNameByGroup(groupID) if (groupName, groupID) not in shipGroups: shipGroups.append((groupName, groupID)) if len(fittings) == 0 and self.wordFilter is not None: data = {'label': localization.GetByLabel('UI/Common/NothingFound')} scrolllist.append(listentry.Get('Generic', data)) if hideRight is None: self.HideRightPanel() shipGroups.sort() if maxFittings is not None: label = localization.GetByLabel( 'UI/Fitting/FittingWindow/FittingManagement/FittingsListHeader', numFittings=len(fittings), maxFittings=maxFittings) scrolllist.append(listentry.Get('Header', {'label': label})) for groupName, groupID in shipGroups: data = { 'GetSubContent': self.GetShipGroupSubContent, 'label': groupName, 'fittings': fittingsByGroupID[groupID], 'groupItems': fittingsByGroupID[groupID], 'id': ('fittingMgmtScrollWndGroup', groupName), 'showicon': 'hide', 'state': 'locked', 'BlockOpenWindow': 1 } scrolllist.append(listentry.Get('Group', data)) self.sr.scroll.Load(contentList=scrolllist, scrolltotop=0)
def GetSubContentMyAllianceSystems(self, nodedata, *args): subcontent = [] systems = sm.RemoteSvc('stationSvc').GetSystemsForAlliance(session.allianceid) if systems: map = sm.GetService('map') toPrime = set() systemInfoList = [] for row in systems: x, regionID, constellationID, solarSystemID, xx = map.GetParentLocationID(row.solarSystemID) toPrime.update(set([regionID, constellationID, solarSystemID])) systemInfoList.append((regionID, constellationID, solarSystemID)) cfg.evelocations.Prime(list(toPrime)) for regionID, constellationID, solarSystemID in systemInfoList: solarSystemName = cfg.evelocations.Get(solarSystemID).name regionName = cfg.evelocations.Get(regionID).name constellationName = cfg.evelocations.Get(constellationID).name label = '%s / %s / %s' % (regionName, constellationName, solarSystemName) subcontent.append(listentry.Get('Generic', {'label': label, 'solarSystemID': solarSystemID, 'GetMenu': self.GetAllianceSystemMenu})) if len(subcontent) == 0: noSettledSystemsLabel = localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/Home/NoSettledSystems') subcontent.append(listentry.Get('Generic', {'label': noSettledSystemsLabel})) else: subcontent.sort(key=lambda x: x.label) return subcontent
def GetStatsEntries(self): scrolllist = [] if self.pin.GetCpuUsage() > 0: data = util.KeyVal( label='%s<t>%s' % (localization.GetByLabel('UI/PI/Common/CpuUsage'), localization.GetByLabel('UI/PI/Common/TeraFlopsAmount', amount=self.pin.GetCpuUsage()))) scrolllist.append(listentry.Get('Generic', data=data)) if self.pin.GetCpuOutput() > 0: data = util.KeyVal( label='%s<t>%s' % (localization.GetByLabel('UI/PI/Common/CpuOutput'), localization.GetByLabel('UI/PI/Common/TeraFlopsAmount', amount=self.pin.GetCpuOutput()))) scrolllist.append(listentry.Get('Generic', data=data)) if self.pin.GetPowerUsage() > 0: data = util.KeyVal( label='%s<t>%s' % (localization.GetByLabel('UI/PI/Common/PowerUsage'), localization.GetByLabel('UI/PI/Common/MegaWattsAmount', amount=self.pin.GetPowerUsage()))) scrolllist.append(listentry.Get('Generic', data=data)) if self.pin.GetPowerOutput() > 0: data = util.KeyVal( label='%s<t>%s' % (localization.GetByLabel('UI/PI/Common/PowerOutput'), localization.GetByLabel('UI/PI/Common/MegaWattsAmount', amount=self.pin.GetPowerOutput()))) scrolllist.append(listentry.Get('Generic', data=data)) return scrolllist
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 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 _AddChargeCountEntry(self, contentList, typeAbility): if typeAbility.charges is not None: chargeCountData = {'label': GetByLabel('UI/Fighters/AbilityChargeCount'), 'text': typeAbility.charges.chargeCount, 'iconID': '22_21'} contentList.append(listentry.Get('LabelTextSides', chargeCountData)) rearmTimeData = {'label': GetByLabel('UI/Fighters/RearmTimePerCharge'), 'text': FmtFSDTimeAttribute(typeAbility.charges.rearmTimeSeconds), 'iconID': '22_16'} contentList.append(listentry.Get('LabelTextSides', rearmTimeData))
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 LoadLeftSide(self): scrolllist = self.GetStaticLabelsGroups() scrolllist.insert(1, listentry.Get('Space', {'height': 16})) scrolllist.append(listentry.Get('Space', {'height': 16})) data = { 'GetSubContent': self.GetLabelsSubContent, 'MenuFunction': self.LabelGroupMenu, 'label': localization.GetByLabel('UI/PeopleAndPlaces/Labels'), 'cleanLabel': localization.GetByLabel('UI/PeopleAndPlaces/Labels'), 'id': ('contacts', 'Labels', localization.GetByLabel('UI/PeopleAndPlaces/Labels')), 'state': 'locked', 'BlockOpenWindow': 1, 'showicon': 'ui_73_16_9', 'showlen': 0, 'groupName': 'labels', 'groupItems': [], 'updateOnToggle': 0 } scrolllist.append(listentry.Get('Group', data)) self.sr.leftScroll.Load(contentList=scrolllist) if self.contactType == 'contact': lastViewedID = settings.char.ui.Get('contacts_lastselected', None) elif self.contactType == 'corpcontact': lastViewedID = settings.char.ui.Get('corpcontacts_lastselected', None) elif self.contactType == 'alliancecontact': lastViewedID = settings.char.ui.Get( 'alliancecontacts_lastselected', None) for entry in self.sr.leftScroll.GetNodes(): groupID = entry.groupID if groupID is None: continue if groupID == lastViewedID: panel = entry.panel if panel is not None: panel.OnClick() return if len(self.sr.leftScroll.GetNodes()) > 0: entry = self.sr.leftScroll.GetNodes()[0] panel = entry.panel if panel is not None: panel.OnClick()
def LoadProductScroll(self): scrolllist = [] colony = self.planetUISvc.planet.GetColony(session.charid) if colony is None or colony.colonyData is None: raise RuntimeError( 'Cannot load product scroll for pin on a planet that has no colony' ) sourcedRoutes = colony.colonyData.GetSourceRoutesForPin(self.pin.id) routesByTypeID = {} for route in sourcedRoutes: typeID = route.GetType() if typeID not in routesByTypeID: routesByTypeID[typeID] = [] routesByTypeID[typeID].append(route) for typeID, amount in self.pin.GetProductMaxOutput().iteritems(): typeName = evetypes.GetName(typeID) for route in routesByTypeID.get(typeID, []): qty = route.GetQuantity() amount -= qty data = util.KeyVal( label='%s<t>%s<t>%s' % (qty, typeName, localization.GetByLabel('UI/PI/Common/Routed')), typeID=typeID, itemID=None, getIcon=True, routeID=route.routeID, OnMouseEnter=self.OnRouteEntryHover, OnMouseExit=self.OnRouteEntryExit, OnClick=self.OnProductEntryClicked, OnDblClick=self.OnProductEntryDblClicked) scrolllist.append(listentry.Get('Item', data=data)) if amount > 0: data = util.KeyVal() data.label = '%s<t>%s<t>%s' % (amount, evetypes.GetName( typeID), localization.GetByLabel('UI/PI/Common/NotRouted')) data.typeID = typeID data.amount = amount data.itemID = None data.getIcon = True data.OnClick = self.OnProductEntryClicked data.OnDblClick = self.OnProductEntryDblClicked scrolllist.append(listentry.Get('Item', data=data)) self.productScroll.Load( contentList=scrolllist, noContentHint=localization.GetByLabel( 'UI/PI/Common/NoProductsPresent'), headers=[ localization.GetByLabel('UI/Common/Amount'), localization.GetByLabel('UI/PI/Common/Type'), '' ])
def _AddRestrictionEntries(self, contentList, ability): if ability.disallowInHighSec: disallowInHighSecLabel = {'label': GetByLabel('UI/Fighters/AbilityDisallowedInHighSec'), 'text': '', 'iconID': '77_12'} contentList.append(listentry.Get('LabelTextSides', disallowInHighSecLabel)) if ability.disallowInLowSec: disallowInHighLowLabel = {'label': GetByLabel('UI/Fighters/AbilityDisallowedInLowSec'), 'text': '', 'iconID': '77_12'} contentList.append(listentry.Get('LabelTextSides', disallowInHighLowLabel))
def AddEntry(self, info): confirmOnDblClick = self.minChoices == self.maxChoices == 1 if self.listtype in ('character', 'corporation', 'alliance', 'faction', 'owner'): typeinfo = None if info[2]: typeinfo = cfg.invtypes.Get(info[2]) if typeinfo is None: owner = cfg.eveowners.GetIfExists(info[1]) if owner: typeinfo = cfg.invtypes.Get(owner.typeID) if typeinfo is not None: charID = info[1] if util.IsCharacter(charID) and util.IsNPC(charID): entryType = 'AgentEntry' else: entryType = 'User' return (40, listentry.Get( entryType, { 'charID': charID, 'OnDblClick': self.DblClickEntry, 'OnClick': self.ClickEntry, 'dblconfirm': confirmOnDblClick })) else: if self.listtype in ('pickStation', ): data = info data.confirmOnDblClick = confirmOnDblClick data.OnDblClick = self.DblClickEntry data.OnClick = self.ClickEntry return (32, listentry.Get('Generic', data=data)) if self.listtype == 'generic': name, listvalue = info data = util.KeyVal() data.confirmOnDblClick = confirmOnDblClick data.label = name data.listvalue = info data.OnDblClick = self.DblClickEntry data.OnClick = self.ClickEntry return (32, listentry.Get('Generic', data=data)) name, itemID, typeID = info data = util.KeyVal() data.confirmOnDblClick = confirmOnDblClick data.label = name data.itemID = itemID data.typeID = typeID data.listvalue = [name, itemID, typeID] data.isStation = self.listtype == 'station' data.getIcon = self.listtype == 'item' data.OnDblClick = self.DblClickEntry data.OnClick = self.ClickEntry return (24, listentry.Get('Generic', data=data))
def GetStatsEntries(self): scrolllist = BasePinContainer.GetStatsEntries(self) if self.pin.programType is not None: label = '%s<t>%s' % ( localization.GetByLabel('UI/PI/Common/Extracting'), evetypes.GetName(self.pin.programType)) scrolllist.append(listentry.Get('Generic', {'label': label})) else: label = '%s<t>%s' % ( localization.GetByLabel('UI/PI/Common/Extracting'), localization.GetByLabel('UI/PI/Common/NothingExtracted')) scrolllist.append(listentry.Get('Generic', {'label': label})) return scrolllist
def RefreshDestinationPinInfo(self): self.sr.destPinSubText.state = uiconst.UI_HIDDEN self.sr.destPinSubGauge.state = uiconst.UI_HIDDEN if not self.destPin: self.sr.destPinText.text = localization.GetByLabel('UI/PI/Common/NoOriginSelected') self.sr.destPinSubText.text = '' self.sr.destPinSubText.state = uiconst.UI_DISABLED self.sr.destPinListScroll.Load(contentList=[], noContentHint=localization.GetByLabel('UI/PI/Common/NoOriginSelected')) return self.sr.destPinText.text = localization.GetByLabel('UI/PI/Common/TransferDestinationName', typeName=planetCommon.GetGenericPinName(self.destPin.typeID, self.destPin.id)) scrollHeaders = [] scrollContents = [] scrollNoContentText = '' if self.destPin.IsConsumer(): self.sr.destPinSubText.state = uiconst.UI_DISABLED if self.destPin.schematicID is None: self.sr.destPinSubText.text = localization.GetByLabel('UI/PI/Common/NoSchematicInstalled') scrollNoContentText = localization.GetByLabel('UI/PI/Common/NoSchematicInstalled') else: self.sr.destPinSubText.text = localization.GetByLabel('UI/PI/Common/SchematicName', schematicName=cfg.schematics.Get(self.destPin.schematicID).schematicName) scrollHeaders = [] demands = self.destPin.GetConsumables() for typeID, qty in demands.iteritems(): remainingSpace = self.destPin.CanAccept(typeID, -1) load = qty - remainingSpace fraction = load / float(qty) data = {'label': cfg.invtypes.Get(typeID).name, 'text': localization.GetByLabel('UI/PI/Common/UnitQuantityAndDemand', quantity=load, demand=qty), 'value': fraction, 'iconID': cfg.invtypes.Get(typeID).iconID} entry = listentry.Get('StatusBar', data=data) scrollContents.append(entry) elif self.destPin.IsStorage(): self.sr.destPinSubGauge.state = uiconst.UI_DISABLED self.sr.destPinSubGauge.SetText(localization.GetByLabel('UI/PI/Common/Capacity')) usageRatio = self.destPin.capacityUsed / self.destPin.GetCapacity() self.sr.destPinSubGauge.SetSubText(localization.GetByLabel('UI/PI/Common/CapacityProportionUsed', capacityUsed=self.destPin.capacityUsed, capacityMax=self.destPin.GetCapacity(), percentage=usageRatio * 100.0)) self.sr.destPinSubGauge.SetValue(usageRatio) scrollHeaders = [localization.GetByLabel('UI/Common/Type'), localization.GetByLabel('UI/Common/Name'), localization.GetByLabel('UI/Common/Quantity')] contents = self.destPin.GetContents() for typeID, qty in contents.iteritems(): lbl = '<t>%s<t>%d' % (cfg.invtypes.Get(typeID).name, qty) scrollContents.append(listentry.Get('DraggableItem', {'itemID': None, 'typeID': typeID, 'label': lbl, 'getIcon': 1, 'quantity': qty})) scrollNoContentText = localization.GetByLabel('UI/PI/Common/StorehouseIsEmpty') self.sr.destPinListScroll.Load(contentList=scrollContents, headers=scrollHeaders, noContentHint=scrollNoContentText)
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 GetChargesScrollList(self, moduleTypeID, chargeTypeIDs): godma = sm.GetService('godma') scrolllist = [] factionChargeIDs = set() otherChargeIDs = set() for eachTypeID in chargeTypeIDs: metaGroup = godma.GetTypeAttribute(eachTypeID, const.attributeMetaGroupID) if metaGroup == const.metaGroupFaction: factionChargeIDs.add(eachTypeID) else: otherChargeIDs.add(eachTypeID) if chargeTypeIDs: label = 'Favorites' data = { 'GetSubContent': self._GetFavoritesContent, 'label': label, 'id': ('ammobrowser', 'favorites'), 'showlen': 0, 'chargeTypeIDs': chargeTypeIDs, 'sublevel': 0, 'showicon': 'hide', 'state': 'locked', 'BlockOpenWindow': True, 'DropData': self._DropOnFavorites, 'moduleTypeID': moduleTypeID } scrolllist.append(listentry.Get('Group', data=data)) scrolllist.append( listentry.Get(data=KeyVal(height=6), decoClass=HorizontalLine)) scrolllist += self._GetScrollListFromTypeList(moduleTypeID, otherChargeIDs) if factionChargeIDs: label = cfg.invmetagroups.Get(const.metaGroupFaction).metaGroupName data = { 'GetSubContent': self._GetAmmoSubContent, 'label': label, 'id': ('ammobrowser', 'factionChargeIDs'), 'showlen': 0, 'chargeTypeIDs': factionChargeIDs, 'sublevel': 0, 'showicon': uix.GetTechLevelIconID(const.metaGroupFaction), 'state': 'locked', 'BlockOpenWindow': True, 'moduleTypeID': moduleTypeID } scrolllist.append(listentry.Get('Group', data=data)) return scrolllist
def AddCheckBox(self, config, scrolllist, group = None, usecharsettings = 0, sublevel = 0): cfgname, retval, desc, default = config data = util.KeyVal() data.label = desc data.checked = default data.cfgname = cfgname data.retval = retval data.group = group data.sublevel = sublevel data.OnChange = self.CheckBoxChange data.usecharsettings = usecharsettings if scrolllist is not None: scrolllist.append(listentry.Get('Checkbox', data=data)) else: return listentry.Get('Checkbox', data=data)
def _OnRenderJob(self, _, __, value): if value == self._renderJob: return if self._renderJob: for step in self._renderJob.steps: step.debugCaptureCpuTime = False step.debugCaptureGpuTime = False self._renderJob = value contentList = [] if value: for step in value.steps: step.debugCaptureCpuTime = True step.debugCaptureGpuTime = True contentList.append( listentry.Get( 'Generic', { 'label': '%s<t><t>' % (step.name or type(step).__name__), 'step': step })) self._scroll.Load(contentList=contentList, headers=['Step', 'CPU Time', 'GPU Time'], fixedEntryHeight=18)
def LoadTutorialVideos(self, panel, *args): if self.tutorialVideosLoaded: return def LoadIcon(icon, *args): icon.LoadIcon('res:/ui/texture/icons/bigplay_64.png') def GetSubContent(group): scrolllist = [] for each in TUTORIAL_VIDEOS_INDEX.get_videos_in_group(group.index): node = dict(each) node['LoadIcon'] = LoadIcon scrolllist.append( listentry.Get(data=node, decoClass=_TutorialVideoItem)) return scrolllist scrolllist = [] for index, each in TUTORIAL_VIDEOS_INDEX.get_groups(): data = { 'GetSubContent': GetSubContent, 'BlockOpenWindow': True, 'label': each, 'showicon': 'hide', 'showlen': 0, 'index': index, 'state': 'locked', 'id': ('tutorialvideo', 'tutorialvideocat_%s' % index) } scrolllist.append(listentry.Get('Group', data)) scroll = uicontrols.Scroll(parent=panel, align=uiconst.TOALL) scroll.LoadContent(contentList=scrolllist) self.tutorialVideosLoaded = True
def LoadFilters(self): scrolllist = [] for name, labelName in fleetbr.broadcastNames.iteritems(): data = KeyVal() if name == 'Event': rngName = '' else: rng = fleetbr.GetBroadcastWhere(name) rngName = fleetbr.GetBroadcastWhereName(rng) data.label = localization.GetByLabel(labelName) data.props = None data.checked = bool( settings.user.ui.Get('listenBroadcast_%s' % name, True)) data.cfgname = name data.retval = None data.hint = '%s:<br>%s' % (localization.GetByLabel( 'UI/Fleet/FleetBroadcast/RecipientRange'), rngName) data.colorcoded = settings.user.ui.Get( 'fleet_broadcastcolor_%s' % name, None) data.OnChange = self.Filter_OnCheckBoxChange scrolllist.append( listentry.Get(entryType=None, data=data, decoClass=BroadcastSettingsEntry)) self.sr.scrollBroadcasts.sr.id = 'scrollBroadcasts' self.sr.scrollBroadcasts.Load(contentList=scrolllist)
def __AddToList(self, member, scrolllist): data = util.KeyVal() data.label = self.__GetLabel(member.corporationID) data.member = member data.GetMenu = self.GetMemberMenu data.corporationID = member.corporationID scrolllist.append(listentry.Get('Corporation', data=data))
def GetStarColorGroups(self): self.GetStarColorGroupsSorted() starscolorby = settings.user.ui.Get('starscolorby', mapcommon.STARMODE_SECURITY) scrolllist = self.GetStarColorEntries('Root') activeGroup, activeLabel = self.GetActiveStarColorMode() for groupName, groupLabel, subitems in self.starColorGroups: id = ('mappalette', groupName) uicore.registry.SetListGroupOpenState(id, 0) data = {'GetSubContent': self.GetSubContent, 'label': groupLabel, 'id': id, 'groupItems': subitems, 'iconMargin': 32, 'showlen': 0, 'state': 'locked', 'BlockOpenWindow': 1, 'key': groupName} if activeGroup == groupName: data['posttext'] = localization.GetByLabel('UI/Map/MapPallet/lblActiveColorCategory', activeLabel=activeLabel) elif activeGroup is not None and activeGroup.startswith(groupName + '_'): for subgroupName, subgroupLabel, subsubitems in subitems: if activeGroup == subgroupName: data['posttext'] = localization.GetByLabel('UI/Map/MapPallet/lblActiveColorCategory', activeLabel=subgroupLabel) scrolllist.append(listentry.Get('Group', data)) return scrolllist