예제 #1
0
def TransferOwnership(itemID):
    members = sm.GetService('alliance').GetMembers()
    twit = sm.GetService('michelle')
    remotePark = twit.GetRemotePark()
    localPark = twit.GetBallpark()
    if itemID not in localPark.slimItems:
        return
    oldOwnerID = localPark.slimItems[itemID].ownerID
    owners = {member.corporationID for member in members.itervalues()}
    if len(owners):
        cfg.eveowners.Prime(owners)
    tmplist = []
    for member in members.itervalues():
        if oldOwnerID != member.corporationID:
            tmplist.append((cfg.eveowners.Get(member.corporationID).ownerName,
                            member.corporationID))

    ret = uix.ListWnd(
        tmplist, 'generic',
        localization.GetByLabel('UI/Corporations/Common/SelectCorporation'),
        None, 1)
    if ret is not None and len(ret):
        newOwnerID = ret[1]
        if remotePark is not None:
            remotePark.CmdChangeStructureOwner(itemID, oldOwnerID, newOwnerID)
예제 #2
0
    def SelectShipDlg(self):
        hangarInv = sm.GetService('invCache').GetInventory(
            const.containerHangar)
        items = hangarInv.List()
        tmplst = []
        activeShipID = util.GetActiveShip()
        for item in items:
            if item[const.ixCategoryID] == const.categoryShip and item[
                    const.ixSingleton]:
                tmplst.append((cfg.invtypes.Get(item[const.ixTypeID]).name,
                               item, item[const.ixTypeID]))

        if not tmplst:
            self.exitingstation = 0
            eve.Message('NeedShipToUndock')
            return
        ret = uix.ListWnd(tmplst, 'item',
                          localization.GetByLabel('UI/Station/SelectShip'),
                          None, 1)
        if ret is None or ret[1].itemID == activeShipID:
            self.exitingstation = 0
            return
        newActiveShip = ret[1]
        try:
            self.TryActivateShip(newActiveShip)
        except:
            self.exitingstation = 0
            raise
def SelectItemTypeDlg(itemTypes):
    """
    use:  t = SelectItemTypeDlg(types)
    pre:  'types' is valid and contains at least 1 text entry
    post: iff 't': 't' contains the typeID that the user selected
          else: A message box has popped up notifying the user of failure    
    """
    tmplst = []
    for typeID in itemTypes:
        t = cfg.invtypes.Get(typeID)
        c = cfg.invcategories.Get(t.categoryID)
        itemTypeRow = localization.GetByLabel('UI/Contracts/Util/ItemTypeLine',
                                              item=typeID,
                                              categoryName=c.categoryName)
        tmplst.append((itemTypeRow, typeID))

    if not tmplst:
        eve.Message('ConNoItemsFound')
        return
    elif len(tmplst) == 1:
        return tmplst[0][1]
    else:
        ret = uix.ListWnd(
            tmplst,
            'generic',
            localization.GetByLabel('UI/Contracts/Util/SelectItemType'),
            None,
            1,
            windowName='contractSelectItemTypeDlg')
        return ret and ret[1]
예제 #4
0
    def InviteClone(self, *args):
        if not sm.GetService('clonejump').HasCloneReceivingBay():
            eve.Message('InviteClone1')
            return
        godmaSM = sm.GetService('godma').GetStateManager()
        opDist = getattr(godmaSM.GetType(self.shipItem.typeID),
                         'maxOperationalDistance', 0)
        bp = sm.GetService('michelle').GetBallpark()
        if not bp:
            return
        charIDs = [
            slimItem.charID for slimItem in bp.slimItems.itervalues()
            if slimItem.charID and slimItem.charID != eve.session.charid and
            not util.IsNPC(slimItem.charID) and slimItem.surfaceDist <= opDist
        ]
        if not charIDs:
            eve.Message('InviteClone2')
            return
        lst = []
        for charID in charIDs:
            char = cfg.eveowners.Get(charID)
            lst.append((char.name, charID, char.typeID))

        chosen = uix.ListWnd(
            lst,
            'character',
            localization.GetByLabel('UI/Ship/ShipConfig/SelectAPilot'),
            None,
            1,
            minChoices=1,
            isModal=1)
        if chosen:
            sm.GetService('clonejump').OfferShipCloneInstallation(chosen[1])
예제 #5
0
def AwardDecoration(charIDs):
    if not charIDs:
        return
    if not type(charIDs) == list:
        charIDs = [charIDs]
    info, graphics = sm.GetService('medals').GetAllCorpMedals(session.corpid)
    options = [(medal.title, medal.medalID) for medal in info]
    if len(options) <= 0:
        raise UserError('MedalCreateToAward')
    cfg.eveowners.Prime(charIDs)
    hintLen = 5
    hint = ', '.join(
        [cfg.eveowners.Get(charID).name for charID in charIDs[:hintLen]])
    if len(charIDs) > hintLen:
        hint += ', ...'
    ret = uix.ListWnd(
        options,
        'generic',
        localization.GetByLabel(
            'UI/Corporations/Common/AwardCorpMemberDecoration'),
        isModal=1,
        ordered=1,
        scrollHeaders=[
            localization.GetByLabel('UI/Inventory/InvItemNameShort')
        ],
        hint=hint)
    if ret:
        medalID = ret[1]
        sm.StartService('medals').GiveMedalToCharacters(medalID, charIDs)
예제 #6
0
    def SelectAlternativeSolarSystem(self,
                                     charID,
                                     solarSystemID,
                                     secondChoiceID=None):
        neighbors = self.mapSvc.GetNeighbors(solarSystemID)
        if secondChoiceID is None:
            selectText = localization.GetByLabel(
                'UI/CharacterSelection/SelectAlternativeSystem')
        else:
            selectText = localization.GetByLabel(
                'UI/CharacterSelection/SelectAnotherAlternativeSystem')
            secondChoiceNeighbors = self.mapSvc.GetNeighbors(secondChoiceID)
            neighbors.extend(secondChoiceNeighbors)
        systemSecClass = self.mapSvc.GetSecurityClass(solarSystemID)
        validNeighbors = []
        for ssid in neighbors:
            if ssid == secondChoiceID or ssid == solarSystemID:
                continue
            if self.mapSvc.GetSecurityClass(ssid) != systemSecClass:
                continue
            systemItem = self.mapSvc.GetItem(ssid)
            regionID = self.mapSvc.GetRegionForSolarSystem(ssid)
            regionItem = self.mapSvc.GetItem(regionID)
            factionID = systemItem.factionID
            factionName = ''
            if factionID:
                factionName = cfg.eveowners.Get(factionID).ownerName
            label = '%s<t>%s<t>%s<t>%s' % (
                systemItem.itemName, regionItem.itemName,
                self.mapSvc.GetSecurityStatus(ssid), factionName)
            validNeighborTuple = (label, ssid, None)
            validNeighbors.append(validNeighborTuple)

        loadingSvc = sm.StartService('loading')
        self.HideLoading()
        loadingSvc.FadeOut()
        scrollHeaders = [
            localization.GetByLabel('UI/Common/LocationTypes/SolarSystem'),
            localization.GetByLabel('UI/Common/LocationTypes/Region'),
            localization.GetByLabel('UI/Common/Security'),
            localization.GetByLabel('UI/Sovereignty/Sovereignty')
        ]
        ret = uix.ListWnd(
            validNeighbors,
            None,
            localization.GetByLabel('UI/CharacterSelection/SystemCongested'),
            selectText,
            1,
            scrollHeaders=scrollHeaders,
            minw=555)
        if ret:
            self.__Confirm(charID, ret[1])
        else:
            sm.StartService('jumpQueue').PrepareQueueForCharID(None)
            self.ready = True
예제 #7
0
    def DoSearch(self, key, val):
        self.itemID = None
        self.typeID = None
        id = None
        name = ''
        if key == 'type':
            if getattr(self, 'markettypes', None) == None:
                from contractutils import GetMarketTypes
                self.markettypes = GetMarketTypes()
            itemTypes = []
            for t in self.markettypes:
                if t.typeName.lower().find(val.lower()) >= 0:
                    itemTypes.append(
                        (evetypes.GetName(t.typeID), None, t.typeID))

            if not itemTypes:
                eve.Message('NoItemTypesFound')
                return
            id = uix.ListWnd(
                itemTypes, 'item',
                localization.GetByLabel('UI/Common/SelectItemType'), None, 1)
        else:
            group = None
            hideNPC = 0
            if key == 'solarsystem':
                group = const.groupSolarSystem
            elif key == 'station':
                group = const.groupStation
            elif key == 'char':
                group = const.groupCharacter
            elif key == 'corp':
                group = const.groupCorporationOwner
            id = uix.Search(val, group, hideNPC=hideNPC, listType='Generic')
        name = ''
        if id:
            self.itemID = id
            self.typeID = 0
            if key in ('char', 'corp'):
                o = cfg.eveowners.Get(id)
                self.typeID = o.typeID
                name = o.name
            elif key == 'solarsystem':
                l = cfg.evelocations.Get(id)
                self.typeID = l.typeID
                name = l.name
            elif key == 'station':
                self.typeID = sm.GetService('ui').GetStation(id).stationTypeID
                l = cfg.evelocations.Get(id)
                name = l.name
            elif key == 'type':
                self.typeID = id[2]
                self.itemID = None
                name = id[0]
        return name
예제 #8
0
    def DoSearch(self, key, val):
        self.itemID = None
        self.typeID = None
        id = None
        name = ''
        val = '%s*' % val
        if key == 'type':
            itemTypes = []
            results = searchUtil.QuickSearch(val,
                                             [const.searchResultInventoryType])
            if results is not None:
                for typeID in results:
                    typeRec = cfg.invtypes.Get(typeID)
                    itemTypes.append((typeRec.name, None, typeID))

            if not itemTypes:
                eve.Message('NoItemTypesFound')
                return
            id = uix.ListWnd(
                itemTypes, 'item',
                localization.GetByLabel('UI/Common/SelectItemType'), None, 1)
        else:
            group = None
            hideNPC = 0
            if key == 'solarsystem':
                group = const.groupSolarSystem
            elif key == 'station':
                group = const.groupStation
            elif key == 'char':
                group = const.groupCharacter
            elif key == 'corp':
                group = const.groupCorporation
            id = uix.Search(val, group, hideNPC=hideNPC, listType='Generic')
        name = ''
        if id:
            self.itemID = id
            self.typeID = 0
            if key in ('char', 'corp'):
                o = cfg.eveowners.Get(id)
                self.typeID = o.typeID
                name = o.name
            elif key == 'solarsystem':
                self.typeID = const.typeSolarSystem
                l = cfg.evelocations.Get(id)
                name = l.name
            elif key == 'station':
                self.typeID = sm.GetService('ui').GetStation(id).stationTypeID
                l = cfg.evelocations.Get(id)
                name = l.name
            elif key == 'type':
                self.typeID = id[2]
                self.itemID = None
                name = id[0]
        return name
예제 #9
0
    def ShipPicker(self):
        hangarInv = sm.GetService('invCache').GetInventory(const.containerHangar)
        items = hangarInv.List()
        tmplst = []
        for item in items:
            if item[const.ixCategoryID] == const.categoryShip and item[const.ixSingleton]:
                tmplst.append((cfg.invtypes.Get(item[const.ixTypeID]).name, item[const.ixItemID], item[const.ixTypeID]))

        ret = uix.ListWnd(tmplst, 'item', localization.GetByLabel('UI/Station/SelectShip'), None, 1)
        if ret is None:
            return
        return ret[1]
예제 #10
0
파일: dna.py 프로젝트: connoryang/1v1dec
    def ShowCargo(self, id = None, *args):
        cargoContents = []
        try:
            if id:
                itemID = id
            else:
                itemID = self.deferred[0]
        except:
            return

        for cargo in sm.GetService('invCache').GetInventoryFromId(itemID).ListCargo():
            if cargo.categoryID != const.categoryOwner:
                cargoContents.append(('%s<t>%s' % (evetypes.GetName(cargo.typeID), cargo.stacksize), cargo))

        uix.ListWnd(cargo, listtype='generic', caption='Cargo loaded with %d items' % len(cargoContents), isModal=0, minChoices=0, scrollHeaders=[u'Type', u'Quantity'])
    def TransferStation(self, *args):
        members = sm.GetService('alliance').GetMembers()
        owners = []
        for member in members.itervalues():
            if member.corporationID not in owners:
                owners.append(member.corporationID)

        if len(owners):
            cfg.eveowners.Prime(owners)
        tmplist = []
        for member in members.itervalues():
            if self.station.ownerID != member.corporationID:
                tmplist.append((cfg.eveowners.Get(member.corporationID).ownerName, member.corporationID))

        ret = uix.ListWnd(tmplist, 'generic', localization.GetByLabel('UI/Corporations/Common/SelectCorporation'), None, 1)
        if ret is not None and len(ret):
            self.corpStationMgr.UpdateStationOwner(ret[1])
            self.CloseByUser()
def DoGetContainerContents(itemID, stationID, hasFlag, name, invCacheSvc):
    contents = invCacheSvc.GetInventoryMgr().GetContainerContents(
        itemID, stationID)
    lst = []
    for c in contents:
        flag = c.flagID
        if flag == const.flagPilot:
            continue
        locationName = util.GetShipFlagLocationName(flag)
        t = cfg.invtypes.Get(c.typeID)
        if hasFlag:
            txt = '%s<t>%s<t>%s<t>%s' % (t.name, cfg.invgroups.Get(
                t.groupID).name, locationName, c.stacksize)
        else:
            txt = '%s<t>%s<t>%s' % (t.name, cfg.invgroups.Get(
                t.groupID).name, c.stacksize)
        lst.append([txt, c.itemID, c.typeID])

    if hasFlag:
        hdr = [
            localization.GetByLabel('UI/Inventory/InvItemNameShort'),
            localization.GetByLabel('UI/Inventory/ItemGroup'),
            localization.GetByLabel('UI/Common/Location'),
            localization.GetByLabel('UI/Common/Quantity')
        ]
    else:
        hdr = [
            localization.GetByLabel('UI/Inventory/InvItemNameShort'),
            localization.GetByLabel('UI/Inventory/ItemGroup'),
            localization.GetByLabel('UI/Common/Quantity')
        ]
    hint1 = localization.GetByLabel('UI/Menusvc/ItemsInContainerHint')
    hint2 = localization.GetByLabel('UI/Menusvc/ItemsInContainerHint2',
                                    containerName=name)
    uix.ListWnd(lst,
                'item',
                hint1,
                hint=hint2,
                isModal=0,
                minChoices=0,
                scrollHeaders=hdr,
                minw=500,
                windowName='containerContents')
예제 #13
0
    def PickTicker(self, *args):
        corpName = self.sr.corpNameEdit.GetValue()
        if len(corpName.strip()) == 0:
            eve.Message('EnterCorporationName')
            return
        suggestions = sm.GetService('corp').GetSuggestedTickerNames(corpName)
        if not suggestions or len(suggestions) == 0:
            eve.Message('NoCorpTickerNameSuggestions')
            return
        tmplist = []
        for each in suggestions:
            tmplist.append((each.tickerName, each.tickerName))

        ret = uix.ListWnd(
            tmplist, 'generic',
            localization.GetByLabel(
                'UI/Corporations/CorpDetails/SelectTicker'), None, 1)
        if ret is not None and len(ret):
            self.sr.corpTickerEdit.SetValue(ret[0])
예제 #14
0
def DeliverToCorpMember(invItems, invCacheSvc):
    if len(invItems) == 0:
        return
    CheckItemsInSamePlace(invItems)
    corpMemberIDs = sm.GetService('corp').GetMemberIDs()
    cfg.eveowners.Prime(corpMemberIDs)
    memberslist = []
    for memberID in corpMemberIDs:
        if util.IsDustCharacter(memberID):
            continue
        who = cfg.eveowners.Get(memberID)
        memberslist.append([who.ownerName, memberID, who.typeID])

    doSplit = uicore.uilib.Key(
        uiconst.VK_SHIFT) and len(invItems) == 1 and invItems[0].stacksize > 1
    stationID = invCacheSvc.GetStationIDOfItem(invItems[0])
    if stationID is None:
        raise UserError('CanOnlyDoInStations')
    ownerID = invItems[0].ownerID
    flagID = invItems[0].flagID
    itemIDs = [item.itemID for item in invItems]
    res = uix.ListWnd(
        memberslist, 'character',
        localization.GetByLabel('UI/Corporations/Common/SelectCorpMember'),
        localization.GetByLabel(
            'UI/Corporations/Common/SelectCorpMemberToDeliverTo'), 1)
    if res:
        corporationMemberID = res[1]
        qty = None
        if doSplit:
            invItem = invItems[0]
            ret = uix.QtyPopup(
                invItem.stacksize, 1, 1, None,
                localization.GetByLabel(
                    'UI/Inventory/ItemActions/DivideItemStack'))
            if ret is not None:
                qty = ret['qty']
        invCacheSvc.GetInventoryMgr().DeliverToCorpMember(
            corporationMemberID, stationID, itemIDs, qty, ownerID, flagID)
        InvalidateItemLocation(ownerID, stationID, flagID, invCacheSvc)
        if ownerID == session.corpid:
            sm.ScatterEvent('OnCorpAssetChange', invItems, stationID)
예제 #15
0
    def ChoosePathStep(self, defaultPathStepID, pathSteps, namesByDungeonID):
        deadEndLabel = 'Dead end'
        l = []
        for pathStep in pathSteps:
            l.append(
                ('%s<t>%s<t>%s' %
                 (pathStep.pathStepID,
                  namesByDungeonID.get(pathStep.destDungeonID, deadEndLabel),
                  ['No', 'Yes'][pathStep.pathStepID == defaultPathStepID]),
                 pathStep.pathStepID))

        windowTitle = 'GMH EP Choice'
        listTitle = 'Select the next step in the escalating path. If you do not choose a step, or do not choose one within a reasonable amount of time, the random pick will be chosen for you.'
        choice = uix.ListWnd(l,
                             'generic',
                             windowTitle,
                             hint=listTitle,
                             isModal=1,
                             scrollHeaders=['ID', 'Dungeon', 'Default'],
                             minw=180)
        if choice:
            choice = choice[1]
        return choice
예제 #16
0
def SelectItemTypeDlg(itemTypes):
    tmplst = []
    for typeID in itemTypes:
        itemTypeRow = localization.GetByLabel(
            'UI/Contracts/Util/ItemTypeLine',
            item=typeID,
            categoryName=evetypes.GetCategoryName(typeID))
        tmplst.append((itemTypeRow, typeID))

    if not tmplst:
        eve.Message('ConNoItemsFound')
        return
    elif len(tmplst) == 1:
        return tmplst[0][1]
    else:
        ret = uix.ListWnd(
            tmplst,
            'generic',
            localization.GetByLabel('UI/Contracts/Util/SelectItemType'),
            None,
            1,
            windowName='contractSelectItemTypeDlg')
        return ret and ret[1]
예제 #17
0
    def PickNewHomeStation(self, *args):
        if getattr(self, 'picking', 0):
            return
        try:
            self.picking = 1
            homeStationID = self.GetHomeStation()
            stations = self.GetPotentialHomeStations()
            stationTypeIDbyStationID = {}
            for station in stations:
                stationTypeIDbyStationID[station.stationID] = (
                    station.typeID, station.serviceMask)

            cfg.evelocations.Prime(stationTypeIDbyStationID.keys())
            stationsWithMedical = []
            stationsWithoutMedical = []
            mapSvc = sm.GetService('map')
            uiSvc = sm.GetService('ui')
            for stationID, stationData in stationTypeIDbyStationID.iteritems():
                typeID, serviceMask = stationData
                station = cfg.evelocations.Get(stationID)
                systemID = uiSvc.GetStation(stationID).solarSystemID
                regionID = mapSvc.GetRegionForSolarSystem(systemID)
                sec = mapSvc.GetSecurityStatus(systemID)
                secStatus = util.FmtSystemSecStatus(sec)
                region = cfg.evelocations.Get(regionID)
                data = util.KeyVal()
                data.label = '%s<t>%s<t>%s' % (
                    station.name,
                    localization.GetByLabel(
                        'UI/Medical/Clone/NewHomeSecStatusEntry',
                        securityStatus=secStatus), region.name)
                data.itemID = stationID
                data.typeID = typeID
                data.listvalue = [station.name, stationID]
                data.sublevel = 1
                if serviceMask & const.stationServiceCloning == const.stationServiceCloning:
                    stationsWithMedical.append(data)
                else:
                    stationsWithoutMedical.append(data)

            groupWithMedical = util.KeyVal()
            groupWithMedical.label = localization.GetByLabel(
                'UI/Medical/Clone/StationsWithCloning')
            groupWithMedical.id = ('clonePicker', 1)
            groupWithMedical.showicon = 'hide'
            groupWithMedical.BlockOpenWindow = 1
            groupWithMedical.state = 'locked'
            groupWithMedical.showlen = 1
            groupWithMedical.sublevel = 0
            groupWithMedical.groupItems = stationsWithMedical
            groupWithoutMedical = util.KeyVal()
            groupWithoutMedical.label = localization.GetByLabel(
                'UI/Medical/Clone/StationsWithoutCloning')
            groupWithoutMedical.id = ('clonePicker', 2)
            groupWithoutMedical.showicon = 'hide'
            groupWithoutMedical.BlockOpenWindow = 1
            groupWithoutMedical.state = 'locked'
            groupWithoutMedical.showlen = 1
            groupWithoutMedical.sublevel = 0
            groupWithoutMedical.groupItems = stationsWithoutMedical
            scrollHeaders = [
                localization.GetByLabel('UI/Medical/Clone/Station'),
                localization.GetByLabel('UI/Medical/Clone/SecurityStatus'),
                localization.GetByLabel('UI/Common/LocationTypes/Region')
            ]
            ret = uix.ListWnd(
                [groupWithMedical, groupWithoutMedical],
                'station',
                localization.GetByLabel('UI/Medical/Clone/SelectHomeStation'),
                None,
                1,
                windowName='newHomeStationWindow',
                lstDataIsGrouped=1,
                scrollHeaders=scrollHeaders)
            if ret:
                if not stationTypeIDbyStationID[ret[1]][
                        1] & const.stationServiceCloning == const.stationServiceCloning:
                    if eve.Message('AskSetHomeStationWithoutMedical',
                                   buttons=uiconst.YESNO,
                                   default=uiconst.ID_NO) != uiconst.ID_YES:
                        self.picking = 0
                        return
                newHomeStationID = ret[1]
            else:
                self.picking = 0
                return
            if newHomeStationID == homeStationID:
                raise UserError(
                    'MedicalYouAlreadyHaveACloneContractAtThatStation')
            newHomeStationTypeID = stationTypeIDbyStationID[newHomeStationID][
                0]
            if sm.GetService('godma').GetType(
                    newHomeStationTypeID).isPlayerOwnable == 1:
                if eve.Message('AskSetHomeStationAtPOS', {},
                               uiconst.YESNO) != uiconst.ID_YES:
                    self.picking = 0
                    return
            if eve.Message('AskAcceptCloneContractCost',
                           {'cost': const.costCloneContract},
                           uiconst.YESNO) != uiconst.ID_YES:
                self.picking = 0
                return
            self.SetHomeStation(newHomeStationID)
        finally:
            self.picking = 0
예제 #18
0
def Search(searchStr, groupIDList, exact = 0, getWindow = 1, searchWndName = 'mySearch', corpMemberIDs = None):
    import listentry
    searchStr = searchStr.replace('*', '')
    if len(searchStr) < 1:
        sm.GetService('loading').StopCycle()
        raise UserError('LookupStringMinimum', {'minimum': 1})
    else:
        if len(searchStr) >= 100:
            sm.GetService('loading').StopCycle()
            eve.Message('CustomInfo', {'info': localization.GetByLabel('UI/Common/SearchStringTooLong')})
            return
        if exact == const.searchByPartialTerms and not localization.util.IsSearchTextIdeographic(session.languageID, searchStr):
            if len([ x for x in searchStr.split() if len(x) >= const.searchMinWildcardLength ]) == 0:
                eve.Message('PartialSearchLessThanMinLength', {'minChars': const.searchMinWildcardLength})
                exact = const.searchByExactTerms
    query = searchStr.strip()
    s = sm.ProxySvc('search')
    resultsDict = s.Query(query, groupIDList, exact=exact)
    if resultsDict is None:
        resultsDict = {}
    resultHeaders = [(const.searchResultAgent, 'UI/Search/UniversalSearch/Agents'),
     (const.searchResultCharacter, 'UI/Search/UniversalSearch/Characters'),
     (const.searchResultFaction, 'UI/Search/UniversalSearch/Factions'),
     (const.searchResultCorporation, 'UI/Search/UniversalSearch/Corporations'),
     (const.searchResultAlliance, 'UI/Search/UniversalSearch/Alliances'),
     (const.searchResultRegion, 'UI/Search/UniversalSearch/Regions'),
     (const.searchResultSolarSystem, 'UI/Search/UniversalSearch/SolarSystems'),
     (const.searchResultStation, 'UI/Common/LocationTypes/Stations'),
     (const.searchResultStructure, 'UI/Common/LocationTypes/Structures'),
     (const.searchResultConstellation, 'UI/Search/UniversalSearch/Constellations'),
     (const.searchResultInventoryType, 'UI/Search/UniversalSearch/Types'),
     ('ASSETS', 'UI/Search/UniversalSearch/Assets')]
    if const.searchResultAgent in groupIDList:
        auraNames = [localization.GetByLabel('UI/Agents/AuraAgentName').lower(), localization.GetByLabel('UI/Agents/AuraAgentName', localization.const.LOCALE_SHORT_ENGLISH).lower()]
        queryCheck = query.lower()
        if exact == const.searchByPartialTerms:
            for name in auraNames:
                if name.startswith(queryCheck):
                    AddAuraToResults(resultsDict)
                    break

        else:
            for name in auraNames:
                if queryCheck == name:
                    AddAuraToResults(resultsDict)
                    break

    scrolllist = []
    totalResults = 0
    ownerPrime = []
    corpTickersToPrime = []
    for k, label in resultHeaders:
        lst = resultsDict.get(k, [])
        entryList = []
        if lst:
            entryList = []
            lst = resultsDict[k]
            if k == const.searchResultAgent:
                entryType = 'AgentEntry'
                for agentID in lst:
                    entryList.append({'charID': agentID})

            elif k in (const.searchResultCorporation,
             const.searchResultAlliance,
             const.searchResultFaction,
             const.searchResultCharacter):
                entryType = 'User'
                ownerPrime.extend(lst)
                if k == const.searchResultCorporation:
                    corpTickersToPrime.extend(lst)
                for ownerID in lst:
                    if corpMemberIDs and ownerID not in corpMemberIDs:
                        continue
                    entryList.append({'charID': ownerID})

            elif k == const.searchResultSolarSystem:
                entryType = 'Generic'
                for itemID in lst:
                    data = {'itemID': itemID,
                     'typeID': const.typeSolarSystem,
                     'label': cfg.evelocations.Get(itemID).name,
                     'sublevel': 1}
                    entryList.append(data)

            elif k == const.searchResultConstellation:
                entryType = 'Generic'
                for itemID in lst:
                    data = {'itemID': itemID,
                     'typeID': const.typeConstellation,
                     'label': cfg.evelocations.Get(itemID).name,
                     'sublevel': 1}
                    entryList.append(data)

            elif k == const.searchResultRegion:
                entryType = 'Generic'
                for itemID in lst:
                    data = {'itemID': itemID,
                     'typeID': const.typeRegion,
                     'label': cfg.evelocations.Get(itemID).name,
                     'sublevel': 1}
                    entryList.append(data)

            elif k == const.searchResultStructure:
                entryType = 'Generic'
                for itemID in lst:
                    info = sm.GetService('structureDirectory').GetStructureInfo(itemID)
                    data = {'itemID': itemID,
                     'sublevel': 1,
                     'typeID': info.typeID,
                     'label': '{0} ({1})'.format(info.itemName, cfg.evelocations.Get(info.solarSystemID).name)}
                    entryList.append(data)

            elif k == const.searchResultStation:
                entryType = 'Generic'
                for itemID in lst:
                    data = {'itemID': itemID,
                     'typeID': cfg.stations.Get(itemID).stationTypeID,
                     'label': cfg.evelocations.Get(itemID).name,
                     'sublevel': 1}
                    entryList.append(data)

            elif k == const.searchResultInventoryType:
                entryType = 'Item'
                for typeID in lst:
                    data = {'itemID': None,
                     'typeID': typeID,
                     'getIcon': 1,
                     'label': evetypes.GetName(typeID)}
                    entryList.append(data)

        elif k == 'ASSETS' and const.searchResultInventoryType in resultsDict:
            lst = resultsDict[const.searchResultInventoryType]
            if lst:
                entryType = 'ItemWithLocation'
                entryList = []
        if entryList:
            totalResults += len(entryList)
            sectionHeader = localization.GetByLabel('UI/Search/UniversalSearch/SectionHeader', resultType=localization.GetByLabel(label), numberReturned=len(entryList))
            data = {'GetSubContent': GetSearchSubContent,
             'label': sectionHeader,
             'groupItems': (entryType, entryList),
             'id': ('search_cat', k),
             'sublevel': 0,
             'showlen': 0,
             'showicon': 'hide',
             'cat': k,
             'state': 'locked'}
            scrolllist.append(listentry.Get('Group', data))

    cfg.eveowners.Prime(ownerPrime)
    cfg.corptickernames.Prime(corpTickersToPrime)
    if len(scrolllist) >= 1:
        sm.GetService('loading').StopCycle()
    if getWindow:
        header = localization.GetByLabel('UI/Common/Search')
        if totalResults >= const.searchMaxResults:
            top = localization.GetByLabel('UI/Search/UniversalSearch/WindowHeaderOverMax', maxNumber=const.searchMaxResults)
        else:
            top = localization.GetByLabel('UI/Search/UniversalSearch/WindowHeaderNumResults', numResults=totalResults)
        chosen = uix.ListWnd(scrolllist, 'generic', header, top, 0, isModal=0, minChoices=0, windowName=searchWndName, lstDataIsGrouped=1, unstackable=1, noContentHint=localization.GetByLabel('UI/Search/UniversalSearch/NoResultsReturned'))
        if chosen:
            return chosen[1]
    else:
        return scrolllist
예제 #19
0
    def PickNewCloneType(self, *args):
        if getattr(self, 'picking', 0):
            return
        try:
            self.picking = 1
            cloneList = []
            currentCloneGodmaInfo = sm.GetService('godma').GetType(
                self.GetCloneTypeID())
            for typeInfo in cfg.typesByGroups.get(const.groupClone, []):
                godmaInfo = sm.GetService('godma').GetType(typeInfo.typeID)
                if godmaInfo.skillPointsSaved <= currentCloneGodmaInfo.skillPointsSaved:
                    continue
                price = facwarCommon.GetAdjustedClonePrice(
                    session.solarsystemid2, session.warfactionid,
                    typeInfo.basePrice)
                cloneList.append(
                    [typeInfo.typeID, godmaInfo.skillPointsSaved, price])

            if len(cloneList) == 0:
                raise UserError('MedicalAlreadyHaveBestCloneType')
            cloneList.sort(lambda a, b: -(a[1] > b[1]))
            cloneDisplayList = []
            currentSkillPoints = sm.GetService('skills').GetSkillPoints()
            for clone in cloneList:
                typeID = clone[0]
                skillPointsSaved = clone[1]
                basePrice = clone[2]
                text = localization.GetByLabel(
                    'UI/Medical/Clone/SkillPointsKept',
                    cloneType=typeID,
                    skillPointsSaved=util.FmtAmt(skillPointsSaved),
                    cloneCost=util.FmtISK(basePrice))
                if skillPointsSaved < currentSkillPoints:
                    text = localization.GetByLabel(
                        'UI/Medical/Clone/InsufficientClone',
                        skillPointsKept=text)
                cloneDisplayList.append([text, typeID, typeID])

            hint = localization.GetByLabel(
                'UI/Medical/Clone/CurrentSkillPoints',
                skillPoints=util.FmtAmt(currentSkillPoints))
            ret = uix.ListWnd(
                cloneDisplayList,
                'type',
                localization.GetByLabel('UI/Medical/Clone/SelectCloneType'),
                hint,
                0,
                420,
                windowName='cloneUpgradesListWnd')
            if ret:
                newCloneTypeID = ret[2]
            else:
                self.picking = 0
                return
            if sm.GetService('godma').GetType(
                    newCloneTypeID).skillPointsSaved < sm.GetService(
                        'godma').GetType(
                            self.GetCloneTypeID()).skillPointsSaved:
                raise UserError('MedicalThisCloneIsWorse')
            price = facwarCommon.GetAdjustedClonePrice(
                session.solarsystemid2, session.warfactionid,
                cfg.invtypes.Get(newCloneTypeID).basePrice)
            if eve.Message('AskAcceptCloneTypeCost', {'cost': price},
                           uiconst.YESNO) != uiconst.ID_YES:
                self.picking = 0
                return
            self.SetCloneTypeID(newCloneTypeID)
        finally:
            self.picking = 0