Example #1
0
    def LoadProfileList(self):
        selectedProfileID = self.structureBrowserController.GetSelectedProfileID(
        )
        profileControllers = self.allStructuresProfileController.GetProfiles()
        scrollList = []
        for profileID, eachProfileController in profileControllers.iteritems():
            nodeData = Bunch(
                decoClass=StructureProfileEntry,
                profileController=eachProfileController,
                allStructuresProfileController=self.
                allStructuresProfileController,
                structureBrowserController=self.structureBrowserController,
                isSelected=profileID == selectedProfileID)
            sortValue = eachProfileController.GetProfileName().lower()
            scrollList.append((sortValue, nodeData))

        scrollList = SortListOfTuples(scrollList)
        anyProfileText = GetByLabel('UI/Structures/Browser/AnyProfile')
        anyProfileDesc = GetByLabel('UI/StructureProfiles/AnyProfileDesc')
        controllerForShowAll = SlimStructureAllProfilesController(
            ALL_PROFILES,
            profileData=KeyVal(name=anyProfileText,
                               description=anyProfileDesc))
        nodeData = Bunch(
            decoClass=StructureAllProfilesEntry,
            profileController=controllerForShowAll,
            allStructuresProfileController=self.allStructuresProfileController,
            structureBrowserController=self.structureBrowserController,
            isSelected=ALL_PROFILES == selectedProfileID)
        scrollList.insert(0, nodeData)
        self.scroll.Load(contentList=scrollList)
Example #2
0
    def ShowOffices(self):
        if self.selectedGroupButtonID != OFFICESPANEL:
            return
        self.LoadButtons()
        corpsWithOffices = self.controller.CorpsWithOffices()
        cfg.corptickernames.Prime([c.corporationID for c in corpsWithOffices])
        scrolllist = []
        for corp in corpsWithOffices:
            corpName = corp.corporationName
            data = KeyVal(corpName=corpName,
                          corpID=corp.corporationID,
                          corporation=corp)
            entry = GetListEntry(data=data, decoClass=OfficeEntry)
            scrolllist.append((corpName.lower(), entry))

        scrolllist = SortListOfTuples(scrolllist)
        numUnrentedOffices = self.controller.GetNumberOfUnrentedOffices()
        if numUnrentedOffices is not None:
            availOfficesLabel = GetByLabel(
                'UI/Station/Lobby/NumAvailableOffices',
                numOffices=numUnrentedOffices)
            scrolllist.insert(
                0, GetListEntry('Header', {'label': availOfficesLabel}))
        if not self.destroyed:
            self.officesScroll.Load(contentList=scrolllist)
Example #3
0
    def LoadCounterTooltip(self,
                           tooltipPanel,
                           missingDict,
                           text,
                           singleGroupShowing=True):
        tooltipPanel.LoadGeneric1ColumnTemplate()
        tooltipPanel.state = uiconst.UI_NORMAL
        if singleGroupShowing:
            tooltipPanel.AddLabelLarge(text=text, padBottom=8)
        typeList = []
        for eachTypeID, eachQty in missingDict.iteritems():
            typeName = evetypes.GetName(eachTypeID)
            typeList.append((typeName.lower(), (eachTypeID, eachQty)))

        typeList = SortListOfTuples(typeList)
        for eachTypeID, eachQty in typeList[:MAX_TOOLTIP_ENTRIES]:
            typeCont = TooltipEntry(parent=tooltipPanel,
                                    typeID=eachTypeID,
                                    qty=eachQty)

        if len(typeList) > MAX_TOOLTIP_ENTRIES:
            numItemsNotDisplayed = len(typeList) - MAX_TOOLTIP_ENTRIES
            text = GetByLabel(
                'UI/Fitting/FittingWindow/FittingManagement/MoreItemTypesMissing',
                numMoreItems=numItemsNotDisplayed)
            tooltipPanel.AddLabelMedium(text=text, align=uiconst.CENTERLEFT)
        if singleGroupShowing:
            self.AddBuyAllBtn(tooltipPanel, missingDict)
Example #4
0
    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
Example #5
0
    def _GetScrollListFromTypeList(self,
                                   moduleTypeID,
                                   chargeTypeIDs,
                                   sublevel=0,
                                   isFavorite=False):
        scrolllist = []
        godma = sm.GetService('godma')
        for eachTypeID in chargeTypeIDs:
            label = evetypes.GetName(eachTypeID)
            data = KeyVal(label=label,
                          typeID=eachTypeID,
                          itemID=None,
                          getIcon=1,
                          OnDropData=self.onDropDataFunc,
                          OnDblClick=(self.dblClickFunc, moduleTypeID,
                                      eachTypeID),
                          sublevel=sublevel,
                          GetMenu=self._GetChargeMenu,
                          isFavorite=isFavorite,
                          ignoreRightClick=isFavorite)
            techLevel = godma.GetTypeAttribute(eachTypeID,
                                               const.attributeTechLevel)
            scrolllist.append(
                ((techLevel, label), listentry.Get('Item', data=data)))

        scrolllist = SortListOfTuples(scrolllist)
        return scrolllist
Example #6
0
def GetTextForWarning(failedInfo):
    warningInfo = GetWarningInfo(failedInfo)
    textList = []
    for errorKey, memberIDs in warningInfo.iteritems():
        groupWarning = GetWarningForOneGroup(errorKey, memberIDs)
        if groupWarning:
            textList.append(groupWarning)

    textList = SortListOfTuples(textList)
    return textList
Example #7
0
    def GetMenuForMember(self, groupID, nodes, myMemberShipType,
                         parentController, corpOwnedGroup):
        characterListDict = defaultdict(list)
        nodesByMemberID = {}
        for eachNode in nodes:
            memberID = eachNode.memberID
            nodesByMemberID[memberID] = eachNode
            for eachMembershipType in [
                    MEMBERSHIP_TYPE_MANAGER, MEMBERSHIP_TYPE_ADMIN,
                    MEMBERSHIP_TYPE_EXCLUDED
            ]:
                if not self._CanModifyOther(myMemberShipType,
                                            eachMembershipType):
                    continue
                if eachNode.membershipType == eachMembershipType:
                    memberShipKey = (eachMembershipType, True)
                else:
                    memberShipKey = (eachMembershipType, False)
                characterListDict[memberShipKey].append(memberID)

        m = []
        for eachMembershipType, memberIDs in characterListDict.iteritems():
            membershipType, haveLevel = eachMembershipType
            charIDs = self._GetFilteredCharIDsBasedOnMembership(
                myMemberShipType, nodesByMemberID, doTypeCheck=True)
            label = GetByLabel(MENU_LABEL_PATH_DICT.get(eachMembershipType))
            if not charIDs:
                continue
            if len(charIDs) > 1:
                label += ' (%s)' % len(charIDs)
            sortValue = ACCESS_SORT_ORDER.index(membershipType)
            if haveLevel:
                newMembershipType = MEMBERSHIP_TYPE_MEMBER
            else:
                newMembershipType = membershipType
            m.append(((sortValue, label.lower()),
                      (label, parentController.UpdateMembershipTypes,
                       (groupID, charIDs, newMembershipType))))

        m = SortListOfTuples(m)
        removeText = GetByLabel('UI/Structures/AccessGroups/RemoveMember')
        removableMemberIDs = self._GetFilteredCharIDsBasedOnMembership(
            myMemberShipType, nodesByMemberID)
        if session.charid in nodesByMemberID:
            removableMemberIDs.add(session.charid)
        if not corpOwnedGroup and removableMemberIDs:
            if len(removableMemberIDs) > 1:
                removeText += ' (%s)' % len(removableMemberIDs)
            m += [(removeText, parentController.RemoveMembers,
                   (groupID, removableMemberIDs))]
        memberMenuOptions = self._GetGenericMemberMenuOptions(nodesByMemberID)
        if memberMenuOptions:
            m += [None] + memberMenuOptions
        return m
Example #8
0
    def LoadTypes(self, typeIDsAndQty):
        scrolllist = []
        for eachTypeID, qty in typeIDsAndQty.iteritems():
            typeName = evetypes.GetName(eachTypeID)
            label = '%sx %s' % (qty, typeName)
            data = KeyVal(label=label,
                          typeID=eachTypeID,
                          itemID=None,
                          getIcon=1)
            scrolllist.append((typeName, listentry.Get('Item', data=data)))

        scrolllist = SortListOfTuples(scrolllist)
        self.typeScroll.Load(contentList=scrolllist)
        self.height = self.GetNewHeight()
Example #9
0
def GetSortedStationList(solarSystemID, systemStations):
    stations = [ s for s in systemStations if evetypes.GetCategoryID(s['typeID']) == const.categoryStation ]
    solarsystemItems = {s.itemID:s for s in sm.GetService('map').GetSolarsystemItems(solarSystemID)}
    sortedStations = []
    for eachStation in stations:
        stationInfo = solarsystemItems.get(eachStation['itemID'], None)
        if stationInfo is None:
            continue
        eachStation['name'] = stationInfo.itemName
        sortValue = (stationInfo.celestialIndex, stationInfo.orbitIndex, stationInfo.itemName.lower())
        sortedStations.append((sortValue, eachStation))

    sortedStations = SortListOfTuples(sortedStations)
    return sortedStations
Example #10
0
    def _GetMyGroupsMenu(self, myGroups):
        m = []
        groupsWithSetting = self.structureProfileController.GetGroupsBySettingID(
            self.settingID)
        groupIDs = {g.groupID for g in groupsWithSetting}
        for groupID, g in myGroups.iteritems():
            if groupID in groupIDs:
                continue
            groupName = g.name
            m.append(
                (groupName.lower(), (groupName, self.AddGroupsToSettingSection,
                                     ([groupID], ))))

        m = SortListOfTuples(m)
        return m
Example #11
0
    def GetHardware(self):
        dogmaLocation = self.controller.GetDogmaLocation()
        shipDogmaItem = dogmaLocation.GetShip()
        hardwareDict = {}
        for module in shipDogmaItem.GetFittedItems().itervalues():
            typeID = module.typeID
            if self.IsCharge(typeID):
                continue
            flagID = module.flagID
            flagInHardware = hardwareDict.get(typeID, None)
            if flagInHardware:
                flagID = min(flagInHardware, flagID)
            hardwareDict[typeID] = flagID

        hardwareList = [(flagID, typeID)
                        for typeID, flagID in hardwareDict.iteritems()]
        return SortListOfTuples(hardwareList, reverse=True)
Example #12
0
    def _GetProfilesMenu(self, selectedNodes):
        selectedStructureIDs = [
            x.controller.GetItemID() for x in selectedNodes
        ]
        allStructureProfileController = sm.GetService(
            'structureControllers').GetAllStructuresProfileController()
        allCorpProfiles = allStructureProfileController.GetProfiles()

        def UpdateProfileIDForStructures(profileID):
            allStructureProfileController.UpdateProfileIDForStructures(
                profileID, selectedStructureIDs)

        m = []
        for profileID, profileController in allCorpProfiles.iteritems():
            name = profileController.GetProfileName()
            m.append((name.lower(), (name, UpdateProfileIDForStructures,
                                     (profileID, ))))

        m = SortListOfTuples(m)
        return m
Example #13
0
    def _GetModifyMenuOptions(self, selectedNodes):
        selectedControllers = [x.controller for x in selectedNodes]
        controllersByHours = defaultdict(list)
        for eachController in selectedControllers:
            controllersByHours[eachController.GetRequiredHours()].append(
                eachController)

        modifyOptions = []
        for requiredHours, controllers in controllersByHours.iteritems():
            infoOnStructures = [(x.GetItemID(), x.GetSolarSystemID(),
                                 x.GetCurrentSchedule(),
                                 x.GetNextWeekSchedule()) for x in controllers]
            menuLabel = MenuLabel('UI/StructureBrowser/ModifySchedule',
                                  {'numHours': requiredHours})
            funcArgs = (requiredHours, infoOnStructures)
            modifyOptions.append(
                (requiredHours, (menuLabel, self.ModifyVulnerability,
                                 funcArgs)))

        numOptions = SortListOfTuples(modifyOptions)
        return numOptions
Example #14
0
    def ShowGuests(self, *args):
        if self.selectedGroupButtonID != GUESTSPANEL:
            return
        guests = self.controller.GetGuests()
        ownerIDs = guests.keys()
        cfg.eveowners.Prime(ownerIDs)
        guestFilter = self.quickFilter.GetValue()
        if len(guestFilter):
            filterData = [
                KeyVal(name=cfg.eveowners.Get(charID).name, charID=charID)
                for charID in ownerIDs
            ]
            filterGuests = NiceFilter(self.quickFilter.QuickFilter, filterData)
            ownerIDs = [each.charID for each in filterGuests]
        if self.destroyed:
            return
        scrolllist = []
        for charID in ownerIDs:
            if charID not in guests:
                continue
            corpID, allianceID, warFactionID = guests[charID]
            charinfo = cfg.eveowners.Get(charID)
            sortValue = charinfo.name.lower()
            data = {
                'charID': charID,
                'info': charinfo,
                'label': charinfo.name,
                'corpID': corpID,
                'allianceID': allianceID,
                'warFactionID': warFactionID
            }
            entry = GetListEntry(self.userEntry, data)
            scrolllist.append((sortValue, entry))

        scrolllist = SortListOfTuples(scrolllist)
        self.guestScroll.Clear()
        self.guestScroll.AddNodes(0, scrolllist)
        self.UpdateGuestTabText()
Example #15
0
def GetWarningForOneGroup(errorKey, memberIDs):
    errorLabel = errorDict.get(errorKey, None)
    if errorLabel is None:
        return
    sortNumber = errorDict.keys().index(errorKey)
    memberList = []
    for eachMemberID in memberIDs:
        try:
            if eachMemberID is None:
                continue
            ownerInfo = cfg.eveowners.Get(eachMemberID)
            charName = ownerInfo.name
            text = GetShowInfoLink(ownerInfo.typeID,
                                   charName,
                                   itemID=eachMemberID)
            memberList.append((charName.lower(), text))
        except KeyError as e:
            pass

    if not memberList:
        return
    memberList = SortListOfTuples(memberList)
    memberText = '<br>'.join(memberList)
    return (sortNumber, (errorLabel, {'memberList': memberText}))
Example #16
0
    def LoadGroups(self):
        self.sectionCont.Flush()
        canHaveGroups = CanHaveGroups(self.settingID)
        if not canHaveGroups:
            return
        sgControllers = self.structureProfileController.GetGroupsBySettingID(
            self.settingID)
        if sgControllers:
            accessGroupsController = sm.GetService(
                'structureControllers').GetAccessGroupController()
            groupIDs = [c.GetGroupID() for c in sgControllers]
            accessGroupsController.PopulatePublicGroupInfo(groupIDs)
            toSort = []
            for c in sgControllers:
                groupInfo = accessGroupsController.GetGroupInfoFromID(
                    c.GetGroupID())
                if groupInfo is None:
                    continue
                nameLower = groupInfo['name'].lower()
                toSort.append((nameLower, (c, groupInfo)))

            sortedControllers = SortListOfTuples(toSort)
            for c, groupInfo in sortedControllers:
                GroupEntry(
                    parent=self.sectionCont,
                    groupID=c.GetGroupID(),
                    settingGroupController=c,
                    structureProfileController=self.structureProfileController,
                    groupInfo=groupInfo)

        else:
            x = Generic(parent=self.sectionCont, height=30)
            x.Startup()
            x.Load(
                node=Bunch(label=GetByLabel('UI/StructureSettingWnd/NoGroups'),
                           sublevel=1))
Example #17
0
    def ShowAgents(self):
        if self.selectedGroupButtonID != AGENTSPANEL:
            return
        try:
            agentsSvc = sm.GetService('agents')
            journalSvc = sm.GetService('journal')
            agentMissions = journalSvc.GetMyAgentJournalDetails()[:1][0]
            agentsInStation = self.controller.GetAgents()
            relevantAgents = []
            missionStateDict = {}
            for each in agentMissions:
                missionState, importantMission, missionType, missionName, agentID, expirationTime, bookmarks, remoteOfferable, remoteCompletable, contentID = each
                agent = agentsSvc.GetAgentByID(agentID)
                missionStateDict[agentID] = missionState
                onGoingMission = (const.agentMissionStateAllocated,
                                  const.agentMissionStateOffered)
                specialAgents = (const.agentTypeGenericStorylineMissionAgent,
                                 const.agentTypeStorylineMissionAgent,
                                 const.agentTypeEventMissionAgent,
                                 const.agentTypeCareerAgent,
                                 const.agentTypeEpicArcAgent)
                if missionState not in onGoingMission or agent.agentTypeID in specialAgents:
                    relevantAgents.append(agentID)

            localRelevantAgents = []
            for agent in agentsInStation:
                if agent.agentID in relevantAgents:
                    localRelevantAgents.append(agent.agentID)

            if self.destroyed:
                return
            scrolllist = []
            sortlist = []
            for agentID in relevantAgents:
                if not eve.rookieState or agentID in const.rookieAgentList:
                    if agentID not in localRelevantAgents:
                        entryWithSortValue = self.GetAgentEntryWithSortValue(
                            agentID, missionStateDict)
                        sortlist.append(entryWithSortValue)

            if sortlist:
                agentLabel = GetByLabel('UI/Station/Lobby/AgentsOfInterest')
                scrolllist.append(GetListEntry('Header',
                                               {'label': agentLabel}))
                scrolllist += SortListOfTuples(sortlist)
            agentList, unavailableAgents = self._FindAvailableAndUnavailableAgents(
                agentsInStation, localRelevantAgents, relevantAgents)
            agentInfo = [('UI/Station/Lobby/AvailableToYou', agentList),
                         ('UI/Station/Lobby/NotAvailableToYou',
                          unavailableAgents)]
            for labelPath, agentList in agentInfo:
                if agentList:
                    text = GetByLabel(labelPath)
                    scrolllist.append(GetListEntry('Header', {'label': text}))
                    sortlist = []
                    for agentID in agentList:
                        entryWithSortValue = self.GetAgentEntryWithSortValue(
                            agentID, missionStateDict)
                        sortlist.append(entryWithSortValue)

                    scrolllist += SortListOfTuples(sortlist)

            if self.destroyed:
                return
            self.agentScroll.Load(fixedEntryHeight=40, contentList=scrolllist)
        except:
            log.LogException()
            sys.exc_clear()
    def LoadPanel(self, *args):
        mygodma = self.GetMyGodmaItem(session.charid)
        if not mygodma:
            return
        implants = mygodma.implants
        boosters = mygodma.boosters
        godma = sm.GetService('godma')
        implants = SortListOfTuples([(getattr(godma.GetType(implant.typeID),
                                              'implantness', None), implant)
                                     for implant in implants])
        boosters = SortListOfTuples([
            (getattr(godma.GetType(booster.boosterTypeID), 'boosterness',
                     None), booster) for booster in boosters
        ])
        scrolllist = []
        if implants:
            scrolllist.append(
                entries.Get(
                    'Header', {
                        'label':
                        GetByLabel(
                            'UI/CharacterSheet/CharacterSheetWindow/Augmentations/Implants',
                            implantCount=len(implants))
                    }))
            for booster in implants:
                scrolllist.append(
                    entries.Get(
                        'ImplantEntry', {
                            'implant_booster': booster,
                            'label': evetypes.GetName(booster.typeID)
                        }))

            if boosters:
                scrolllist.append(entries.Get('Divider'))
        dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation()
        staticMgr = dogmaLocation.dogmaStaticMgr
        if boosters:
            scrolllist.append(
                entries.Get(
                    'Header', {
                        'label':
                        GetByLabel(
                            'UI/CharacterSheet/CharacterSheetWindow/Augmentations/Boosters',
                            boosterCount=len(boosters))
                    }))
            for booster in boosters:
                scrolllist.append(
                    entries.Get(
                        'ImplantEntry', {
                            'implant_booster': booster,
                            'label': evetypes.GetName(booster.boosterTypeID)
                        }))
                boosterEffects = staticMgr.GetPassiveFilteredEffectsByType(
                    booster.boosterTypeID)
                for effectID in boosterEffects:
                    eff = cfg.dgmeffects.Get(effectID)
                    chanceAttributeID = staticMgr.effects[
                        effectID].fittingUsageChanceAttributeID
                    if chanceAttributeID and effectID in booster.sideEffectIDs:
                        scrolllist.append(
                            entries.Get(
                                'IconEntry', {
                                    'line': 1,
                                    'hint': eff.displayName,
                                    'text': None,
                                    'label': eff.displayName,
                                    'icon': IconFile(eff.iconID),
                                    'selectable': 0,
                                    'iconoffset': 32,
                                    'iconsize': 22,
                                    'linecolor': (1.0, 1.0, 1.0, 0.125)
                                }))

                scrolllist.append(entries.Get('Divider'))

        self.scroll.sr.id = 'charsheet_implantandboosters'
        self.scroll.Load(
            fixedEntryHeight=32,
            contentList=scrolllist,
            noContentHint=GetByLabel(
                'UI/CharacterSheet/CharacterSheetWindow/Augmentations/NoImplantOrBoosterInEffect'
            ))