Пример #1
0
 def GetAgentPlacesScrollList(self):
     missiongroupState = uicore.registry.GetListGroupOpenState(
         ('missiongroups', 'agentmissions'))
     agentGroup = uicore.registry.GetLockedGroup(
         'missiongroups',
         'agentmissions',
         localization.GetByLabel('UI/PeopleAndPlaces/AgentMissions'),
         openState=missiongroupState)
     places = sm.GetService('bookmarkSvc').GetAgentBookmarks()
     data = {
         'GetSubContent':
         self.GetPlacesSubContent_AgentMissions,
         'RefreshScroll':
         self.RefreshWindow,
         'label':
         agentGroup['label'],
         'id':
         agentGroup['id'],
         'groupItems':
         places,
         'headers':
         self.placesHeaders,
         'showlen':
         0,
         'state':
         'locked',
         'allowGuids':
         ['listentry.PlaceEntry', 'xtriui.InvItem', 'listentry.InvItem'],
         'showicon':
         'hide'
     }
     groupEntry = listentry.Get('Group', data)
     scrolllist = []
     localizationUtil.Sort(scrolllist, key=lambda x: x.label)
     return [groupEntry] + scrolllist
Пример #2
0
    def GetAmmoMenu(self, shipID, itemID, existingChargeID, roomForReload):
        usedChargeType = self.godma.GetStateManager().GetAmmoTypeForModule(itemID)
        ammoInfoByTypeID = self.GetMatchingAmmo(shipID, itemID)
        try:
            minimumAmmoNeeded = len(self.GetModulesInBank(shipID, itemID))
        except TypeError:
            minimumAmmoNeeded = 1

        menu = []
        if usedChargeType in ammoInfoByTypeID and roomForReload:
            ammoInfo = ammoInfoByTypeID[usedChargeType]
            menuItems = self.AddToMenuFromAmmoInfo(itemID, usedChargeType, ammoInfo, minimumAmmoNeeded, ('UI/Inflight/ModuleRacks/ReloadUsed', 'UI/Inflight/ModuleRacks/Reload'))
            if menuItems:
                menu.extend(menuItems)
                menu.append((uiutil.MenuLabel('UI/Inflight/ModuleRacks/ReloadAll'), uicore.cmd.CmdReloadAmmo))
        if existingChargeID:
            menu.append((uiutil.MenuLabel('UI/Inflight/ModuleRacks/UnloadToCargo'), self.UnloadChargeToContainer, (shipID,
              existingChargeID,
              (shipID,),
              const.flagCargo)))
        otherChargeMenu = []
        for chargeTypeID in localizationUtil.Sort(ammoInfoByTypeID.keys(), key=lambda x: cfg.invtypes.Get(x).typeName):
            ammoInfo = ammoInfoByTypeID[chargeTypeID]
            if chargeTypeID == usedChargeType:
                continue
            otherChargeMenu.extend(self.AddToMenuFromAmmoInfo(itemID, chargeTypeID, ammoInfo, minimumAmmoNeeded, ('UI/Inflight/ModuleRacks/AmmoTypeAndStatus', 'UI/Inflight/ModuleRacks/AmmoTypeAndQuantity')))

        menu.extend(otherChargeMenu)
        return menu
Пример #3
0
    def SetEntries(self, entries):
        scrolllist = []
        asteroidTypes = {}
        headers = [localization.GetByLabel('UI/Common/Ore'), localization.GetByLabel('UI/Common/Quantity'), localization.GetByLabel('UI/Common/Distance')]
        for ballID, (typeID, qty) in entries.iteritems():
            if not asteroidTypes.has_key(typeID):
                asteroidTypes[typeID] = [(ballID, qty)]
            else:
                asteroidTypes[typeID].append((ballID, qty))

        scrolllist = []
        for asteroidType in asteroidTypes:
            label = cfg.invtypes.Get(asteroidType).name
            data = {'GetSubContent': self.GetTypeSubContent,
             'label': label,
             'id': ('TypeSel', asteroidType),
             'groupItems': asteroidTypes[asteroidType],
             'typeID': asteroidType,
             'showlen': 1,
             'sublevel': 0,
             'state': 'locked'}
            scrolllist.append(listentry.Get('Group', data))

        scrolllist = localizationUtil.Sort(scrolllist, key=lambda x: x.label)
        self.sr.scroll.Load(contentList=scrolllist, headers=headers)
Пример #4
0
    def GetGroupContent(self, nodedata, newitems=0):
        scrollList = []
        if nodedata.sublevel == 0:
            if nodedata.droneState == 'inbay':
                dronebay = {}
                for drone in self.GetDronesInBay():
                    dronebay[drone.itemID] = drone

            subGroups = {}
            for droneID in nodedata.groupItems:
                group = self.GetDroneGroup(droneID)
                if group:
                    subGroups.setdefault(group['label'], []).append(droneID)
                    continue
                if nodedata.droneState == 'inbay':
                    if dronebay.has_key(droneID):
                        scrollList.append(
                            self.GetBayDroneEntry(dronebay[droneID],
                                                  nodedata.sublevel,
                                                  nodedata.droneState))
                else:
                    scrollList.append(
                        self.GetSpaceDroneEntry(self.GetSpaceDrone(droneID),
                                                nodedata.sublevel,
                                                nodedata.droneState))

            for groupName, droneIDs in subGroups.iteritems():
                group = self.GetSubGroup(groupName)
                if group:
                    scrollList.append(
                        self.GetSubGroupListEntry(group, nodedata.droneState,
                                                  droneIDs))

        elif nodedata.sublevel == 1:
            subGroupInfo = self.GetSubGroup(nodedata.groupName)
            if nodedata.droneState == 'inbay':
                drones = self.GetDronesInBay()
                for drone in drones:
                    if drone.itemID in subGroupInfo['droneIDs']:
                        scrollList.append(
                            self.GetBayDroneEntry(drone, 1,
                                                  nodedata.droneState))

            elif nodedata.droneState == 'inlocalspace':
                drones = self.GetDronesInLocalSpace()
                for drone in drones:
                    if drone.droneID in subGroupInfo['droneIDs']:
                        scrollList.append(
                            self.GetSpaceDroneEntry(drone, 1,
                                                    nodedata.droneState))

            else:
                drones = self.GetDronesInDistantSpace()
                for drone in drones:
                    if drone.droneID in subGroupInfo['droneIDs']:
                        scrollList.append(
                            self.GetSpaceDroneEntry(drone, 1,
                                                    nodedata.droneState))

        return localizationUtil.Sort(scrollList, key=lambda x: x.label)
Пример #5
0
 def GetAllSkillGroups(self):
     if not self.skillGroups:
         skillgroups = [
             g for g in cfg.invgroups if g.categoryID == const.categorySkill
             and g.groupID not in [const.groupFakeSkills]
         ]
         skillgroups = localizationUtil.Sort(
             skillgroups, key=operator.attrgetter('groupName'))
         self.skillGroups = skillgroups
     return self.skillGroups
Пример #6
0
def GetMenuForBookmarks(bookmarks):
    CelestialMenu = lambda bookmark: sm.GetService('menu').CelestialMenu(
        bookmark.itemID, None, None, 0, None, None, bookmark)
    menu = []
    for bookmark in bookmarks:
        hint, comment = sm.GetService('addressbook').UnzipMemo(bookmark.memo)
        hint = hint if len(hint) < 25 else hint[:25]
        menu.append((hint, ('isDynamic', CelestialMenu, (bookmark, ))))

    menu = localizationUtil.Sort(menu, key=lambda x: x[0])
    return menu
Пример #7
0
    def GetPlacesFolders(self, nodedata, newitems=0):
        ownerID = nodedata.ownerID
        groupKey = nodedata.id[0]
        bookmarkFolders = sm.GetService(
            'bookmarkSvc').GetBookmarksInFoldersForOwner(ownerID)
        entries = []
        for folder in localizationUtil.Sort(
                bookmarkFolders.values(),
                key=lambda folder: folder.folderName):
            if folder.folderID is not None:
                entries.append(self.GetFolderEntry(folder, groupKey))

        entries.extend(
            self.GetPlacesScrollList(bookmarkFolders[None].bookmarks,
                                     (groupKey, None),
                                     sublevel=1))
        return entries
Пример #8
0
def GetSearchKeywords():
    keywords = [KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordType'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionType'), None, MatchType),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordGroup'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionGroup'), None, MatchGroup),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordCategory'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionCategory'), None, MatchCategory),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordMinimumQuantity'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionMinimumQuantity'), None, MatchMinimumQuantity),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordMaximumQuantity'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionMaximumQuantity'), None, MatchMaximumQuantity),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordMetalevel'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionMetalevel'), None, MatchMetalevel),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordMetagroup'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionMetagroup'), localizationUtil.Sort([ cfg.invmetagroups.Get(groupID).metaGroupName.lower() for groupID in const.metaGroupsUsed ]), MatchMetagroup),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordTechLevel'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionTechLevel'), ['1', '2', '3'], MatchTechlevel),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordMinSecurityLevel'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionMinSecurityLevel'), None, MatchMinSecurity),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordMaxSecurityLevel'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionMaxSecurityLevel'), None, MatchMaxSecurity),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordSecurityClass'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionSecurityClass'), localizationUtil.Sort([localization.GetByLabel('UI/Inventory/AssetSearch/OptionSecurityHigh'),
      localization.GetByLabel('UI/Inventory/AssetSearch/OptionSecurityEmpire'),
      localization.GetByLabel('UI/Inventory/AssetSearch/OptionSecurityLow'),
      localization.GetByLabel('UI/Inventory/AssetSearch/OptionSecurityNull'),
      localization.GetByLabel('UI/Inventory/AssetSearch/OptionSecurityZero')]), MatchSecurityClass),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordSolarSystem'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionSolarSystem'), None, MatchSolarSystem),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordConstellation'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionConstellation'), None, MatchConstellation),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordRegion'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionRegion'), None, MatchRegion),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordStationName'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionStationName'), None, MatchStationName),
     KeywordOption(localization.GetByLabel('UI/Inventory/AssetSearch/KeywordBlueprint'), localization.GetByLabel('UI/Inventory/AssetSearch/DescriptionBlueprint'), localizationUtil.Sort([localization.GetByLabel('UI/Inventory/AssetSearch/OptionBlueprintCopy'), localization.GetByLabel('UI/Inventory/AssetSearch/OptionBlueprintOriginal')]), MatchBlueprint)]
    return localizationUtil.Sort(keywords, key=lambda x: x.keyword)
Пример #9
0
def GetFolderedMenu(bookmarksByFolder, folders, label, isSubMenu=True):
    ret = []
    nonFolderedBookmarks = []
    for folderID, bookmarks in bookmarksByFolder.iteritems():
        if folderID is None:
            continue
        subMenu = GetMenuForBookmarks(bookmarks)
        try:
            folderName = folders[folderID].folderName
        except KeyError:
            nonFolderedBookmarks.extend(GetMenuForBookmarks(bookmarks))
            continue

        ret.append((folderName, subMenu))

    ret = localizationUtil.Sort(ret, key=lambda x: x[0][0])
    nonFolderedBookmarks.extend(GetMenuForBookmarks(bookmarksByFolder[None]))
    ret.extend(nonFolderedBookmarks)
    if isSubMenu:
        ret = [None, (label, ret), None]
    else:
        ret = [None, (label, lambda *args: None)] + ret + [None]
    return ret
Пример #10
0
    def GetAgentsSubContent(self, nodedata, newitems=0):
        if not len(nodedata.groupItems):
            return []
        charsToPrime = []
        for charID in nodedata.groupItems:
            charsToPrime.append(charID)

        cfg.eveowners.Prime(charsToPrime)
        agents = sm.GetService('addressbook').GetAgents()
        scrolllist = []
        for charID in nodedata.groupItems:
            if charID in agents:
                scrolllist.append(
                    listentry.Get(
                        'AgentEntry', {
                            'listGroupID': nodedata.id,
                            'charID': charID,
                            'info': cfg.eveowners.Get(charID)
                        }))

        scrolllist = localizationUtil.Sort(scrolllist,
                                           key=lambda x: x['info'].ownerName)
        return scrolllist
Пример #11
0
    def GetCatSubContent(self, nodedata, newitems=0):
        scrolllist = []
        for groupID, groupName in nodedata.groupItems:
            if groupID == const.groupCosmicSignature:
                signatureType = groupName
                name = localization.GetByLabel(
                    const.EXPLORATION_SITE_TYPES[signatureType])
                checked = self.tempState.get((groupID, signatureType), 0)
                retval = (groupID, signatureType)
            else:
                name = groupName
                checked = self.tempState.get(groupID, 0)
                retval = groupID
            data = util.KeyVal()
            data.label = name
            data.checked = checked
            data.cfgname = 'probeScannerFilters'
            data.retval = retval
            data.OnChange = self.CheckBoxChange
            data.sublevel = 0
            scrolllist.append(listentry.Get('Checkbox', data=data))

        return localizationUtil.Sort(scrolllist, key=lambda x: x.label)