planetaryProductionPlanet.py (1860B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\info\panels\planetaryProductionPlanet.py 2 import evetypes 3 from carbonui.primitives.container import Container 4 from eve.client.script.ui.control.entries.header import Header 5 from eve.client.script.ui.control.entries.util import GetFromClass 6 from eve.client.script.ui.control.eveScroll import Scroll 7 from eve.client.script.ui.shared.planet import planetCommon 8 from eve.client.script.ui.shared.planet.planetItemEntry import PlanetItemEntry 9 from eve.common.lib import appConst as const 10 from localization import GetByLabel 11 from fsdBuiltData.common.planet import get_resource_type_ids_for_planet_type_id 12 13 class PanelPlanetaryProductionPlanet(Container): 14 15 def ApplyAttributes(self, attributes): 16 Container.ApplyAttributes(self, attributes) 17 self.typeID = attributes.typeID 18 self.isInitialized = False 19 20 def Load(self): 21 if self.isInitialized: 22 return 23 self.scroll = Scroll(name='scroll', parent=self, padding=const.defaultPadding) 24 scrolllist = self.GetScrollList() 25 self.scroll.Load(fixedEntryHeight=27, contentList=scrolllist) 26 self.isInitialized = True 27 28 def GetScrollList(self): 29 scrolllist = [] 30 resourceTypeIDs = sorted(get_resource_type_ids_for_planet_type_id(self.typeID, []), key=lambda typeID: evetypes.GetName(typeID)) 31 if resourceTypeIDs: 32 scrolllist.append(GetFromClass(Header, {'label': GetByLabel('UI/PI/Common/ExtractableResources')})) 33 for typeID in resourceTypeIDs: 34 scrolllist.append(GetFromClass(PlanetItemEntry, {'itemID': None, 35 'typeID': typeID, 36 'selectable': False, 37 'label': planetCommon.GetProductNameAndTier(typeID), 38 'getIcon': 1})) 39 40 return scrolllist