def __init__(self, memberData, groupChildren = False, label = None, forceCollapsed = True, *args, **kw): if label is None: label = localization.GetByLabel('UI/Inventory/MemberHangars') self.memberData = memberData self.groupChildren = groupChildren self.memberData.sort(key=lambda x: cfg.eveowners.Get(x[0]).name.lower()) self.forceCollapsed = forceCollapsed TreeData.__init__(self, label=label, *args, **kw)
def __init__(self, treeID = None, showLinksTo = True, iconsPerRow = 3, *args, **kw): TreeData.__init__(self, *args, **kw) self._isLocked = None self._isRestricted = None self._isPathToElite = None self.showLinksTo = showLinksTo self.treeID = treeID self._boundingBox = None self._position = (0, 0) self._iconsPerRow = iconsPerRow
def __init__(self, treeID=None, showLinksTo=True, iconsPerRow=3, *args, **kw): TreeData.__init__(self, *args, **kw) self._isLocked = None self._isRestricted = None self._isPathToElite = None self.showLinksTo = showLinksTo self.treeID = treeID self._boundingBox = None self._position = (0, 0) self._iconsPerRow = iconsPerRow
def GetGroupEntry(self, fakeID, groupName): from eve.client.script.ui.control.treeData import TreeData rawNotificationList = notificationConst.groupTypes[fakeID] groupSettings = {} self.AppendEntryData( data=groupSettings, visibilityChecked=self.notificationSettingHandler. GetVisibilityStatusForGroup(fakeID, self.notificationSettingData), showPopupChecked=self.notificationSettingHandler. GetShowPopupStatusForGroup(fakeID, self.notificationSettingData), isGroup=True, id=fakeID) childrenData = [] for notification in rawNotificationList: settingLabel = notificationConst.notificationToSettingDescription.get( notification, None) settingName = localization.GetByLabel(settingLabel) params = {} setting = self.notificationSettingData[notification] self.AppendEntryData(data=params, visibilityChecked=setting.showAtAll, showPopupChecked=setting.showPopup, isGroup=False, id=notification) notificationData = TreeData(label=settingName, parent=None, isRemovable=False, settings=params, settingsID=notification) childrenData.append(notificationData) childrenData.sort(key=lambda childData: childData.GetLabel().lower()) data = TreeData(label=groupName, parent=None, children=childrenData, icon=None, isRemovable=False, settings=groupSettings) entry = TreeViewSettingsItem(level=0, eventListener=self, data=data, settingsID=fakeID, defaultExpanded=False) return entry
def GetChildren(self): shipData = [] itemID = self.invController.itemID typeID = self.typeID if itemID == util.GetActiveShip(): cmdName = 'OpenDroneBayOfActiveShip' else: cmdName = None godmaType = sm.GetService('godma').GetType(typeID) if godmaType.droneCapacity or IsModularShip(typeID): shipData.append(TreeDataInv(parent=self, clsName='ShipDroneBay', itemID=itemID, cmdName=cmdName)) if godmaType.fighterCapacity: shipData.append(TreeDataInv(parent=self, clsName='ShipFighterBay', itemID=itemID, cmdName=cmdName)) godmaSM = sm.GetService('godma').GetStateManager() if bool(godmaSM.GetType(typeID).hasShipMaintenanceBay): shipData.append(TreeDataShipMaintenanceBay(parent=self, clsName='ShipMaintenanceBay', itemID=itemID)) if bool(godmaSM.GetType(typeID).hasFleetHangars): shipData.append(TreeDataFleetHangar(parent=self, clsName='ShipFleetHangar', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialFuelBayCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipFuelBay', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialOreHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipOreHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialGasHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipGasHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialMineralHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipMineralHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialSalvageHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipSalvageHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialShipHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipShipHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialSmallShipHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipSmallShipHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialMediumShipHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipMediumShipHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialLargeShipHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipLargeShipHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialIndustrialShipHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipIndustrialShipHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialAmmoHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipAmmoHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialCommandCenterHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipCommandCenterHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialPlanetaryCommoditiesHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipPlanetaryCommoditiesHold', itemID=itemID)) if bool(godmaSM.GetType(typeID).specialQuafeHoldCapacity): shipData.append(TreeDataInv(parent=self, clsName='ShipQuafeHold', itemID=itemID)) invController = invCtrl.ShipCargo(itemID=itemID) shipData += GetContainerDataFromItems(invController.GetItems(), parent=self) if not shipData: shipData.append(TreeData(parent=self, label=localization.GetByLabel('UI/Inventory/NoAdditionalBays'), id='none_%s' % itemID)) return shipData
def GetInvLocationTreeDataTemp(self, rootInvID = None): data = [] tmpLocations = sm.GetService('inv').GetTemporaryInvLocations().copy() for invName, itemID in tmpLocations: if rootInvID in tmpLocations and rootInvID != (invName, itemID): continue if itemID == util.GetActiveShip(): sm.GetService('inv').RemoveTemporaryInvLocation((invName, itemID)) continue else: cls = GetTreeDataClassByInvName(invName) data.append(cls(invName, itemID=itemID, isRemovable=True)) return TreeData(children=data)
def GetControlData(): ret = [] path = os.path.dirname(__file__) path += '\\controls' for groupName in os.listdir(path): children = [] groupPath = path + '\\' + groupName for fileName in os.listdir(groupPath): filePath = groupPath + '\\' + fileName children.append(ControlData(filePath)) ret.append(TreeData(groupName, children=children)) return ret
def GetChildren(self): if self._children: return self._children data = [] maxNumPerLevel = 50 numMembers = len(self.memberData) if not self.groupChildren or numMembers <= maxNumPerLevel: for itemID, ownerID in self.memberData: if itemID == session.charid: continue if util.IsDustCharacter(itemID): continue if itemID == ownerID: data.append(TreeDataInv(parent=self, clsName='StationCorpMember', itemID=itemID, ownerID=ownerID)) else: data.append(TreeDataInv(parent=self, clsName='StationOwnerView', itemID=itemID, ownerID=ownerID)) else: currLetter = None levelData = [] for itemID, ownerID in self.memberData: letter = cfg.eveowners.Get(ownerID).name[0].upper() if letter != currLetter: if levelData: data.append(TreeDataCorpMembers(label=currLetter, memberData=levelData)) currLetter = letter levelData = [] levelData.append((itemID, ownerID)) if levelData: data.append(TreeDataCorpMembers(label=currLetter, memberData=levelData)) if not data: data.append(TreeData(label=localization.GetByLabel('UI/Inventory/NoCorpHangars'))) self.forceCollapsed = False self._children = data return data
def __init__(self, label, parent = None, children = None): TreeData.__init__(self, label, parent, children)
def GetChildren(self): data = GetContainerDataFromItems(self.invController.GetItems(), parent=self) if not data: data = [TreeData(parent=self, label=localization.GetByLabel('UI/Inventory/NoNestedContainers'), id='none_%s' % self.invController.itemID)] return data
def __init__(self, clsName, parent = None, children = None, label = None, isRemovable = False, cmdName = None, iconName = None, **kw): TreeData.__init__(self, parent=parent, children=children, label=label, isRemovable=isRemovable, **kw) self.clsName = clsName self.cmdName = cmdName self.iconName = iconName self.invController = getattr(invCtrl, clsName)(**kw)
def GetInvLocationTreeData(self, rootInvID = None): """ Returns a tree of all inventory locations currently accessible to the player """ data = [] shipID = util.GetActiveShip() typeID = None if shipID: if session.stationid2: activeShip = invCtrl.StationShips().GetActiveShip() if activeShip: typeID = activeShip.typeID else: godmaLoc = sm.GetService('clientDogmaIM').GetDogmaLocation() if shipID in godmaLoc.dogmaItems: typeID = godmaLoc.dogmaItems[shipID].typeID if typeID: data.append(TreeDataShip(clsName='ShipCargo', itemID=shipID, typeID=typeID, cmdName='OpenCargoHoldOfActiveShip')) if session.stationid2: shipsData = [] activeShipID = util.GetActiveShip() singletonShips = [ ship for ship in invCtrl.StationShips().GetItems() if ship.singleton == 1 and ship.itemID != activeShipID ] cfg.evelocations.Prime([ ship.itemID for ship in singletonShips ]) for ship in singletonShips: shipsData.append(TreeDataShip(clsName='ShipCargo', itemID=ship.itemID, typeID=ship.typeID)) SortData(shipsData) data.append(TreeDataInv(clsName='StationShips', itemID=session.stationid2, children=shipsData, cmdName='OpenShipHangar')) containersData = GetContainerDataFromItems(invCtrl.StationItems().GetItems()) data.append(TreeDataInv(clsName='StationItems', itemID=session.stationid2, children=containersData, cmdName='OpenHangarFloor')) if sm.GetService('corp').GetOffice() is not None: forceCollapsedMembers = not (rootInvID and rootInvID[0] in ('StationCorpMember', 'StationCorpMembers')) forceCollapsed = not (rootInvID and rootInvID[0] in ('StationCorpHangar', 'StationCorpHangars')) data.append(TreeDataStationCorp(forceCollapsed=forceCollapsed, forceCollapsedMembers=forceCollapsedMembers)) deliveryRoles = const.corpRoleAccountant | const.corpRoleJuniorAccountant | const.corpRoleTrader if session.corprole & deliveryRoles > 0: data.append(TreeDataInv(clsName='StationCorpDeliveries', itemID=session.stationid2, cmdName='OpenCorpDeliveries')) elif session.solarsystemid: starbaseData = [] defensesData = [] industryData = [] hangarData = [] infrastrcutureData = [] bp = sm.GetService('michelle').GetBallpark() if bp: for slimItem in bp.slimItems.values(): itemID = slimItem.itemID groupID = slimItem.groupID if HasCargoBayComponent(slimItem.typeID): if slimItem.ownerID == session.charid or cfg.spaceComponentStaticData.GetAttributes(slimItem.typeID, CARGO_BAY).allowFreeForAll: data.append(TreeDataInv(clsName='SpaceComponentInventory', itemID=itemID)) haveAccess = bool(slimItem) and (slimItem.ownerID == session.charid or slimItem.ownerID == session.corpid or session.allianceid and slimItem.allianceID == session.allianceid) isAnchored = not bp.balls[itemID].isFree if not haveAccess or not isAnchored: continue if groupID == const.groupControlTower: towerData = [TreeDataInv(clsName='POSStrontiumBay', itemID=itemID), TreeDataInv(clsName='POSFuelBay', itemID=itemID)] starbaseData.append(TreeDataCelestialParent(clsName='BaseCelestialContainer', itemID=itemID, children=towerData, iconName='ui_7_64_10')) elif groupID == const.groupCorporateHangarArray: hangarData.append(TreeDataPOSCorp(slimItem=slimItem)) elif groupID == const.groupAssemblyArray: industryData.append(TreeDataPOSCorp(slimItem=slimItem)) elif groupID == const.groupMobileLaboratory: industryData.append(TreeDataPOSCorp(slimItem=slimItem)) elif groupID == const.groupJumpPortalArray: infrastrcutureData.append(TreeDataInv(clsName='POSJumpBridge', itemID=itemID)) elif groupID in (const.groupMobileMissileSentry, const.groupMobileProjectileSentry, const.groupMobileHybridSentry): defensesData.append(TreeDataInv(clsName='POSStructureCharges', itemID=itemID)) elif groupID == const.groupMobileLaserSentry: sentryData = [TreeDataInv(clsName='POSStructureChargeCrystal', itemID=itemID), TreeDataInv(clsName='POSStructureChargesStorage', itemID=itemID)] defensesData.append(TreeDataCelestialParent(clsName='BaseCelestialContainer', itemID=itemID, children=sentryData, iconName='ui_13_64_9')) elif groupID == const.groupShipMaintenanceArray: hangarData.append(TreeDataInv(clsName='POSShipMaintenanceArray', itemID=itemID)) elif groupID == const.groupSilo: industryData.append(TreeDataInv(clsName='POSSilo', itemID=itemID)) elif groupID == const.groupMobileReactor: industryData.append(TreeDataInv(clsName='POSMobileReactor', itemID=itemID)) elif groupID == const.groupReprocessingArray: industryData.append(TreeDataInv(clsName='POSRefinery', itemID=itemID)) elif groupID == const.groupCompressionArray: industryData.append(TreeDataInv(clsName='POSCompression', itemID=itemID)) elif groupID in (const.groupConstructionPlatform, const.groupStationUpgradePlatform, const.groupStationImprovementPlatform): industryData.append(TreeDataInv(clsName='POSConstructionPlatform', itemID=itemID)) elif groupID == const.groupPersonalHangar: hangarData.append(TreeDataInv(clsName='POSPersonalHangar', itemID=itemID)) if industryData: SortData(industryData) starbaseData.append(TreeDataInvFolder(label=localization.GetByLabel('UI/Inventory/POSGroupIndustry'), children=industryData, icon='res:/UI/Texture/WindowIcons/industry.png')) if hangarData: SortData(hangarData) starbaseData.append(TreeDataInvFolder(label=localization.GetByLabel('UI/Inventory/POSGroupStorage'), children=hangarData, icon='ui_26_64_13')) if infrastrcutureData: SortData(infrastrcutureData) starbaseData.append(TreeDataInvFolder(label=localization.GetByLabel('UI/Inventory/POSGroupInfrastructure'), children=infrastrcutureData, icon='res:/ui/Texture/WindowIcons/sovereignty.png')) if defensesData: SortData(defensesData) starbaseData.append(TreeDataInvFolder(label=localization.GetByLabel('UI/Inventory/POSGroupDefenses'), children=defensesData, icon='ui_5_64_13')) if starbaseData: data.append(TreeDataInvFolder(label=localization.GetByLabel('UI/Inventory/StarbaseStructures'), children=starbaseData, icon='ui_3_64_13')) return TreeData(children=data)
def __init__(self, slimItem, **kw): TreeData.__init__(self, **kw) self.slimItem = slimItem self.invController = invCtrl.POSCorpHangar(self.slimItem.itemID)
def GetInvLocationTreeData(self, rootInvID=None): data = [] if session.shipid: if session.shipid == session.structureid: data.append( TreeDataStructure(clsName='Structure', itemID=session.structureid)) else: data.append( TreeDataShip(clsName='ShipCargo', itemID=session.shipid, typeID=ShipCargo(session.shipid).GetTypeID(), cmdName='OpenCargoHoldOfActiveShip')) if session.stationid2: data.append( TreeDataShipHangar(clsName='StationShips', itemID=session.stationid2, cmdName='OpenShipHangar')) data.append( TreeDataItemHangar(clsName='StationItems', itemID=session.stationid2, cmdName='OpenHangarFloor')) if self._HangarHasAssetSafetyWrap(): data.append( TreeDataAssetSafety(clsName='AssetSafetyDeliveries', itemID=session.stationid2)) if sm.GetService('corp').GetOffice() is not None: forceCollapsedMembers = not (rootInvID and rootInvID[0] in ( 'StationCorpMember', 'StationCorpMembers')) forceCollapsed = not (rootInvID and rootInvID[0] in ( 'StationCorpHangar', 'StationCorpHangars')) data.append( TreeDataStationCorp( forceCollapsed=forceCollapsed, forceCollapsedMembers=forceCollapsedMembers)) if HasCorpDeliveryRoles(): data.append( TreeDataInv(clsName='StationCorpDeliveries', itemID=session.stationid2, cmdName='OpenCorpDeliveries')) elif session.structureid: data.append( TreeDataShipHangar(clsName='StructureShipHangar', itemID=session.structureid, cmdName='OpenShipHangar')) data.append( TreeDataItemHangar(clsName='StructureItemHangar', itemID=session.structureid, cmdName='OpenHangarFloor')) data.append( TreeDataItemHangar(clsName='StructureDeliveriesHangar', itemID=session.structureid)) if self._HangarHasAssetSafetyWrap(): data.append( TreeDataAssetSafety(clsName='AssetSafetyDeliveries', itemID=session.structureid)) if sm.GetService('structureOffices').HasOffice(): data.append( TreeDataStructureCorp(clsName='StructureCorpHangar', itemID=session.structureid)) if HasCorpDeliveryRoles(): data.append( TreeDataInv(clsName='StationCorpDeliveries', itemID=session.structureid, cmdName='OpenCorpDeliveries')) elif session.solarsystemid: starbaseData = [] defensesData = [] industryData = [] hangarData = [] infrastrcutureData = [] bp = sm.GetService('michelle').GetBallpark() if bp: for slimItem in bp.slimItems.values(): itemID = slimItem.itemID groupID = slimItem.groupID categoryID = slimItem.categoryID if HasCargoBayComponent(slimItem.typeID): if slimItem.ownerID == session.charid or cfg.spaceComponentStaticData.GetAttributes( slimItem.typeID, CARGO_BAY).allowFreeForAll: data.append( TreeDataInv(clsName='SpaceComponentInventory', itemID=itemID)) haveAccess = bool(slimItem) and ( slimItem.ownerID == session.charid or slimItem.ownerID == session.corpid or session.allianceid and slimItem.allianceID == session.allianceid) isAnchored = not bp.balls[itemID].isFree if not haveAccess or not isAnchored: continue if groupID == const.groupControlTower: towerData = [ TreeDataInv(clsName='POSStrontiumBay', itemID=itemID), TreeDataInv(clsName='POSFuelBay', itemID=itemID) ] starbaseData.append( TreeDataCelestialParent( clsName='BaseCelestialContainer', itemID=itemID, children=towerData, iconName= 'res:/UI/Texture/windowIcons/corporation.png')) elif groupID == const.groupCorporateHangarArray: hangarData.append(TreeDataPOSCorp(slimItem=slimItem)) elif groupID == const.groupAssemblyArray: industryData.append(TreeDataPOSCorp(slimItem=slimItem)) elif groupID == const.groupMobileLaboratory: industryData.append(TreeDataPOSCorp(slimItem=slimItem)) elif groupID == const.groupJumpPortalArray: infrastrcutureData.append( TreeDataInv(clsName='POSJumpBridge', itemID=itemID)) elif groupID in (const.groupMobileMissileSentry, const.groupMobileProjectileSentry, const.groupMobileHybridSentry): defensesData.append( TreeDataInv(clsName='POSStructureCharges', itemID=itemID)) elif groupID == const.groupMobileLaserSentry: sentryData = [ TreeDataInv(clsName='POSStructureChargeCrystal', itemID=itemID), TreeDataInv(clsName='POSStructureChargesStorage', itemID=itemID) ] defensesData.append( TreeDataCelestialParent( clsName='BaseCelestialContainer', itemID=itemID, children=sentryData, iconName='ui_13_64_9')) elif groupID == const.groupShipMaintenanceArray: hangarData.append( TreeDataInv(clsName='POSShipMaintenanceArray', itemID=itemID)) elif groupID == const.groupSilo: industryData.append( TreeDataInv(clsName='POSSilo', itemID=itemID)) elif groupID == const.groupMobileReactor: industryData.append( TreeDataInv(clsName='POSMobileReactor', itemID=itemID)) elif groupID == const.groupReprocessingArray: industryData.append( TreeDataInv(clsName='POSRefinery', itemID=itemID)) elif groupID == const.groupCompressionArray: industryData.append( TreeDataInv(clsName='POSCompression', itemID=itemID)) elif groupID in (const.groupConstructionPlatform, const.groupStationUpgradePlatform, const.groupStationImprovementPlatform): industryData.append( TreeDataInv(clsName='POSConstructionPlatform', itemID=itemID)) elif groupID == const.groupPersonalHangar: hangarData.append( TreeDataInv(clsName='POSPersonalHangar', itemID=itemID)) if industryData: SortData(industryData) starbaseData.append( TreeDataInvFolder( label=localization.GetByLabel( 'UI/Inventory/POSGroupIndustry'), children=industryData, icon='res:/UI/Texture/WindowIcons/industry.png')) if hangarData: SortData(hangarData) starbaseData.append( TreeDataInvFolder( label=localization.GetByLabel( 'UI/Inventory/POSGroupStorage'), children=hangarData, icon='res:/ui/Texture/WindowIcons/cargo.png')) if infrastrcutureData: SortData(infrastrcutureData) starbaseData.append( TreeDataInvFolder( label=localization.GetByLabel( 'UI/Inventory/POSGroupInfrastructure'), children=infrastrcutureData, icon='res:/ui/Texture/WindowIcons/sovereignty.png')) if defensesData: SortData(defensesData) starbaseData.append( TreeDataInvFolder(label=localization.GetByLabel( 'UI/Inventory/POSGroupDefenses'), children=defensesData, icon='ui_5_64_13')) if starbaseData: data.append( TreeDataInvFolder( label=localization.GetByLabel( 'UI/Inventory/StarbaseStructures'), children=starbaseData, icon='res:/ui/Texture/WindowIcons/station.png')) return TreeData(children=data)