Пример #1
0
 def AppOnOpenContextMenu(self, nodeType, linkUrl, imageUrl, pageUrl,
                          frameUrl, editFlags):
     menuData = []
     eventHandlerCanTab = hasattr(self.browserEventHandler, 'AddTab')
     if nodeType & browserConst.selectedPage and not self.isViewSourceMode:
         if len(menuData) > 0:
             menuData.append(None)
         pageUrl = str(pageUrl)
         menuData.append((localization.GetByLabel('UI/Browser/Back'),
                          self.HistoryBack, []))
         menuData.append((localization.GetByLabel('UI/Browser/Forward'),
                          self.HistoryForward, []))
         menuData.append((localization.GetByLabel('UI/Browser/ReloadPage'),
                          self.ReloadPage, []))
         menuData.append((localization.GetByLabel('UI/Browser/Stop'),
                          self.StopLoading, []))
         menuData.append(None)
         menuData.append(
             (localization.GetByLabel('UI/Browser/ViewPageSource'),
              self.ViewSourceOfUrl, [pageUrl]))
     if nodeType & browserConst.selectedFrame and not self.isViewSourceMode:
         if len(menuData) > 0:
             menuData.append(None)
         menuData.append((localization.GetByLabel('UI/Browser/Back'),
                          self.HistoryBack, []))
         menuData.append((localization.GetByLabel('UI/Browser/Forward'),
                          self.HistoryForward, []))
         menuData.append((localization.GetByLabel('UI/Browser/Stop'),
                          self.StopLoading, []))
         menuData.append(None)
         frameUrl = str(frameUrl)
         if eventHandlerCanTab:
             menuData.append(
                 (localization.GetByLabel('UI/Browser/OpenFrameInNewTab'),
                  self.LaunchNewTab, [frameUrl]))
         menuData.append(
             (localization.GetByLabel('UI/Browser/ViewFrameSource'),
              self.ViewSourceOfUrl, [frameUrl]))
         menuData.append(None)
         menuData.append(
             (localization.GetByLabel('UI/Browser/ViewPageSource'),
              self.ViewSourceOfUrl, [pageUrl]))
     if nodeType & browserConst.selectedLink:
         if len(menuData) > 0:
             menuData.append(None)
         linkUrl = str(linkUrl)
         if not self.isViewSourceMode:
             menuData.append(
                 (localization.GetByLabel('UI/Browser/OpenLink'),
                  self.BrowseTo, [linkUrl]))
             if eventHandlerCanTab:
                 menuData.append((
                     localization.GetByLabel('UI/Browser/OpenLinkInNewTab'),
                     self.LaunchNewTab, [linkUrl]))
         menuData.append(
             (localization.GetByLabel('UI/Browser/CopyLinkLocation'),
              self.CopyText, [linkUrl]))
     if nodeType & browserConst.selectedImage and not self.isViewSourceMode:
         if len(menuData) > 0:
             menuData.append(None)
         imageUrl = str(imageUrl)
         menuData.append((localization.GetByLabel('UI/Browser/ViewImage'),
                          self.BrowseTo, [imageUrl]))
         menuData.append(
             (localization.GetByLabel('UI/Browser/CopyImageLocation'),
              self.CopyText, [imageUrl]))
     tempMenu = []
     if editFlags & browserConst.flagCanCut:
         tempMenu.append((uiutil.MenuLabel('UI/Common/Cut'),
                          self.PerformCommand, [browserConst.commandCut]))
     if editFlags & browserConst.flagCanCopy:
         tempMenu.append((uiutil.MenuLabel('UI/Common/Copy'),
                          self.PerformCommand, [browserConst.commandCopy]))
     if editFlags & browserConst.flagCanPaste:
         tempMenu.append((uiutil.MenuLabel('UI/Common/Paste'),
                          self.PerformCommand, [browserConst.commandPaste]))
     if editFlags & browserConst.flagCanDelete:
         tempMenu.append(
             (uiutil.MenuLabel('UI/Common/Delete'), self.PerformCommand,
              [browserConst.commandDelete]))
     if len(tempMenu) > 0:
         if len(menuData) > 0:
             menuData.append(None)
         menuData.extend(tempMenu)
         tempMenu = []
     if editFlags & browserConst.flagCanSelectAll:
         tempMenu.append(
             (uiutil.MenuLabel('UI/Common/SelectAll'), self.PerformCommand,
              [browserConst.commandSelectAll]))
     if len(tempMenu) > 0:
         if len(menuData) > 0:
             menuData.append(None)
         menuData.extend(tempMenu)
         tempMenu = []
     if len(menuData) > 0:
         mv = menu.CreateMenuView(menu.CreateMenuFromList(menuData), None,
                                  None)
         x, y = uicore.uilib.x + 10, uicore.uilib.y
         x, y = min(uicore.desktop.width - mv.width,
                    x), min(uicore.desktop.height - mv.height, y)
         mv.left, mv.top = x, y
         uicore.layer.menu.children.insert(0, mv)
Пример #2
0
 def GetSettingsMenu(self, *args):
     m = [(uiutil.MenuLabel('UI/Control/Entries/CopyKillInfo'), self.GetCombatText, ()), (uiutil.MenuLabel('UI/Control/Entries/CopyExternalKillLink'), self.GetCrestUrl, ())]
     return m
Пример #3
0
 def GetMenu(self):
     return [(uiutil.MenuLabel('UI/Commands/ShowInfo'), self.ShowInfo,
              (self.sr.node, ))]
Пример #4
0
 def GetMenuForCorpOffice(self, entry):
     station = entry.sr.node.station
     ret = sm.GetService('menu').CelestialMenu(station.stationID, typeID=station.typeID)
     if session.corprole & const.corpRoleDirector == const.corpRoleDirector:
         ret.append([uiutil.MenuLabel('UI/Station/Hangar/UnrentOffice'), self.UnrentOffice, [station.stationID]])
     return ret
Пример #5
0
 def GetMenu(self):
     m = []
     c = self.sr.node.contract
     node = self.sr.node
     m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/ViewContract'),
               self.ViewContract, (node, )))
     if c.startSolarSystemID and c.startSolarSystemID != eve.session.solarsystemid2:
         m.append((uiutil.MenuLabel('UI/Generic/ShowRoute'), self.ShowRoute,
                   (node, )))
     if c.startStationID:
         typeID = self.GetStationType(c.startStationID)
         m += [
             (uiutil.MenuLabel('UI/Contracts/ContractEntry/PickupStation'),
              ('isDynamic', sm.GetService('menu').CelestialMenu,
               (c.startStationID, None, None, 0, typeID)))
         ]
     if c.endStationID and c.endStationID != c.startStationID:
         typeID = self.GetStationType(c.endStationID)
         m += [
             (uiutil.MenuLabel('UI/Contracts/ContractEntry/DropOffStation'),
              ('isDynamic', sm.GetService('menu').CelestialMenu,
               (c.endStationID, None, None, 0, typeID)))
         ]
     if c.type == const.conTypeAuction and c.issuerID != eve.session.charid and c.status == const.conStatusOutstanding and c.dateExpired > blue.os.GetWallclockTime(
     ):
         m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/PlaceBid'),
                   self.PlaceBid, (node, )))
     if self.sr.node.Get('canDismiss', False):
         m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/Dismiss'),
                   self.Dismiss, (node, )))
     if self.sr.node.Get('canGetItems', False):
         m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/GetItems'),
                   self.GetItems, (node, )))
     if self.sr.node.Get('canGetMoney', False):
         m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/GetMoney'),
                   self.GetMoney, (node, )))
     if self.sr.node.Get('canIgnore',
                         True) and c.issuerID != eve.session.charid:
         m.append((uiutil.MenuLabel(
             'UI/Contracts/ContractEntry/IgnoreFromThisIssuer'),
                   self.AddIgnore, (node, )))
     typeID = self.sr.node.Get('typeID', None)
     if typeID and self.sr.node.contract.type != const.conTypeCourier:
         m.append(None)
         m.append((uiutil.MenuLabel('UI/Commands/ShowInfo'),
                   sm.GetService('info').ShowInfo, (typeID, )))
         if evetypes.GetMarketGroupID(typeID) is not None:
             m.append((uiutil.MenuLabel(
                 'UI/Inventory/ItemActions/ViewTypesMarketDetails'),
                       sm.GetService('marketutils').ShowMarketDetails,
                       (typeID, None)))
     m.append(None)
     if c.issuerID == eve.session.charid:
         m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/Delete'),
                   self.Delete, (node, )))
     if session.role & service.ROLE_GML > 0:
         m.append(('GM - contractID: %s' % node.contract.contractID,
                   blue.pyos.SetClipboardData,
                   (str(node.contract.contractID), )))
         m.append(
             ('GM - issuerID: %s' % node.contract.issuerID,
              blue.pyos.SetClipboardData, (str(node.contract.issuerID), )))
         m.append(('GM - Expire now', self._ExpireContract,
                   (node.contract.contractID, )))
     return m
Пример #6
0
    def GetMenu(self, *args):
        if eve.rookieState and eve.rookieState < 32:
            return []
        m = []
        if self.sr.Get('groupByType', 0):
            typedict = {}
            if self.sr.typeID and self.sr.itemID:
                m += [(uiutil.MenuLabel('UI/Commands/ShowInfo'),
                       sm.GetService('menu').ShowInfo, (self.sr.typeID,
                                                        self.sr.itemID))]
            menuItems = {
                const.groupAsteroidBelt:
                uiutil.MenuLabel('UI/Common/LocationTypes/AsteroidBelts'),
                const.groupPlanet:
                uiutil.MenuLabel('UI/Common/LocationTypes/Planets'),
                const.groupStargate:
                uiutil.MenuLabel('UI/Common/LocationTypes/Stargates'),
                const.groupStation:
                uiutil.MenuLabel('UI/Common/LocationTypes/Stations')
            }
            for item in self.sr.mapitems:
                if item.groupID in (const.groupMoon, const.groupSun,
                                    const.groupSecondarySun):
                    continue
                if item.groupID not in typedict:
                    typedict[item.groupID] = []
                typedict[item.groupID].append(item)

            listToSort = []
            for groupID, itemList in typedict.iteritems():
                menuLabel = menuItems[groupID]
                path = menuLabel[0]
                listToSort.append(
                    (localization.GetByLabel(path), (menuLabel, itemList)))

            sortedList = uiutil.SortListOfTuples(listToSort)
            for entry in sortedList:
                menuLabel, itemList = entry
                m.append((menuLabel, ('isDynamic', self.ExpandTypeMenu,
                                      (itemList, ))))

            bookmarks = {}
            folders = {}
            b, f = sm.GetService('bookmarkSvc').GetBookmarksAndFolders()
            bookmarks.update(b)
            folders.update(f)
            bookmarkMenu = bookmarkUtil.GetBookmarkMenuForSystem(
                bookmarks, folders)
            if bookmarkMenu:
                m += bookmarkMenu
            agentMenu = sm.GetService('journal').GetMyAgentJournalBookmarks()
            if agentMenu:
                agentMenu2 = []
                for missionNameID, bms, agentID in agentMenu:
                    if isinstance(missionNameID, (int, long)):
                        missionName = localization.GetByMessageID(
                            missionNameID)
                    else:
                        missionName = missionNameID
                    agentMenuText = uiutil.MenuLabel(
                        'UI/Neocom/MissionNameSubmenu', {
                            'missionName': missionName,
                            'agent': agentID
                        })
                    tmp = [agentMenuText, []]
                    for bm in bms:
                        if bm.solarsystemID == session.solarsystemid2:
                            txt = bm.hint
                            systemName = cfg.evelocations.Get(
                                bm.solarsystemID).name
                            if bm.locationType == 'dungeon':
                                txt = txt.replace(' - %s' % systemName, '')
                            if '- Moon ' in txt:
                                txt = txt.replace(' - Moon ', ' - M')
                            if txt.endswith('- '):
                                txt = txt[:-2]
                            tmp[1].append(
                                (txt, ('isDynamic', self.CelestialMenu,
                                       (bm.itemID, None, None, 0, None, None,
                                        bm))))

                    if tmp[1]:
                        agentMenu2.append(tmp)

                if agentMenu2:
                    agentMenuText = uiutil.MenuLabel(
                        'UI/Neocom/AgentMissionsSubmenu')
                    m += [None, (agentMenuText, lambda: None)] + agentMenu2
            contractsMenu = sm.GetService(
                'contracts').GetContractsBookmarkMenu()
            if contractsMenu:
                m += contractsMenu
        else:
            if not self.itemssorted:
                self.sr.mapitems = uiutil.SortListOfTuples([
                    (item.itemName.lower(), item) for item in self.sr.mapitems
                ])
                self.itemssorted = 1
            maxmenu = 25
            if len(self.sr.mapitems) > maxmenu:
                groups = []
                approxgroupcount = len(self.sr.mapitems) / float(maxmenu)
                counter = 0
                while counter < len(self.sr.mapitems):
                    groups.append(self.sr.mapitems[counter:counter + maxmenu])
                    counter = counter + maxmenu

                for group in groups:
                    groupmenu = []
                    for item in group:
                        groupmenu.append(
                            (item.itemName or 'no name!',
                             self.CelestialMenu(item.itemID, item)))

                    if len(groupmenu):
                        fromLetter = '???'
                        if group[0].itemName:
                            fromLetter = uiutil.StripTags(group[0].itemName)[0]
                        toLetter = '???'
                        if group[-1].itemName:
                            toLetter = uiutil.StripTags(group[-1].itemName)[0]
                        m.append((fromLetter + '...' + toLetter, groupmenu))

                return m
            for item in self.sr.mapitems[:30]:
                m.append((item.itemName
                          or 'no name!', self.CelestialMenu(item.itemID,
                                                            item)))

        m.append(None)
        starmapSvc = sm.GetService('starmap')
        showRoute = settings.user.ui.Get('neocomRouteVisible', 1)
        infoSettings = sm.GetService('infoPanel').GetLocationInfoSettings()
        if len(starmapSvc.GetWaypoints()) > 0:
            m.append((uiutil.MenuLabel('UI/Neocom/ClearAllAutopilotWaypoints'),
                      starmapSvc.ClearWaypoints, (None, )))
        m.append(None)
        m.append((uiutil.MenuLabel('UI/Neocom/ConfigureSubmenu'),
                  self.ConfigureLocationInfo))
        return m
Пример #7
0
 def GetAgentMenu(self, agent, station):
     m = sm.StartService('menu').CharacterMenu(agent.agentID)
     if station.solarSystemID == session.solarsystemid:
         m += [None]
         m += [(uiutil.MenuLabel('UI/Tutorial/WarpToAgentStation'), self.DockAtStation, (station[0],))]
     return m
 def OpenMenu(self, *args):
     m = []
     m.append((uiutil.MenuLabel('UI/InfrastructureHub/HubSettings'), self.OpenSettings))
     return m
Пример #9
0
 def GetMenu(self):
     m = ContractEntry.GetMenu(self)
     m += [(uiutil.MenuLabel('UI/Contracts/ContractEntry/FindRelated'), ('isDynamic', sm.GetService('contracts').GetRelatedMenu, (self.sr.node.contract, self.sr.node.Get('typeID', None), False)))]
     return m
def GetMenu_Member(charID):
    m = [(uiutil.MenuLabel('UI/Fleet/Ranks/FleetMember'),
          sm.GetService('menu').FleetMenu(charID, unparsed=False))]
    return m
Пример #11
0
 def GetMenu(self):
     m = []
     if self.sr.node.quantity > 1:
         m.append((uiutil.MenuLabel('UI/Generic/SplitStack'), self.SplitStack))
     m.extend(sm.GetService('menu').GetMenuFormItemIDTypeID(self.sr.node.itemID, self.sr.node.typeID))
     return m
 def GetMenu(self):
     ret = [(uiutil.MenuLabel('UI/Commands/ShowInfo'),
             sm.GetService('info').ShowInfo, [self.typeID])]
     if session.role & ROLE_GML == ROLE_GML:
         ret.append(('GM / WM Extras', self.GetGMMenu()))
     return ret
Пример #13
0
def GetContainerMenu(containerWindow):
    m = []
    if eve.rookieState:
        return m
    m += [(uiutil.MenuLabel('UI/Common/SelectAll'), containerWindow.SelectAll), (uiutil.MenuLabel('UI/Inventory/InvertSelection'), containerWindow.InvertSelection)]
    if eve.session.role & (service.ROLE_GML | service.ROLE_WORLDMOD):
        m += [(uiutil.MenuLabel('UI/Commands/Refresh'), containerWindow.Refresh)]
    if containerWindow.viewMode == 'icons':
        m += [(uiutil.MenuLabel('UI/Common/SortBy'), [(uiutil.MenuLabel('UI/Common/Name'), containerWindow.SortIconsBy, ('name', 0)),
           (uiutil.MenuLabel('UI/Inventory/NameReversed'), containerWindow.SortIconsBy, ('name', 1)),
           None,
           (uiutil.MenuLabel('UI/Inventory/ItemQuantity'), containerWindow.SortIconsBy, ('qty', 0)),
           (uiutil.MenuLabel('UI/Inventory/QuantityReversed'), containerWindow.SortIconsBy, ('qty', 1)),
           None,
           (uiutil.MenuLabel('UI/Common/Type'), containerWindow.SortIconsBy, ('type', 0)),
           (uiutil.MenuLabel('UI/Inventory/TypeReversed'), containerWindow.SortIconsBy, ('type', 1))])]
    if containerWindow.invController.viewOnly:
        return m
    containerItem = containerWindow.invController.GetInventoryItem()
    containerOwnerID = containerItem.ownerID
    myOwnerIDs = (session.charid, session.corpid, session.allianceid)
    containerSlim = sm.GetService('michelle').GetItem(containerItem.itemID)
    stackAll = containerItem.groupID in (const.groupStation, const.groupPlanetaryCustomsOffices) or containerOwnerID in myOwnerIDs or session.corpid == getattr(containerSlim, 'corpID', None) or session.allianceid and session.allianceid == getattr(containerSlim, 'allianceID', None)
    if stackAll:
        m += [(uiutil.MenuLabel('UI/Inventory/StackAll'), containerWindow.StackAll)]
    return m
Пример #14
0
 def LabelGroupMenu(self, node, *args):
     m = []
     m.append((uiutil.MenuLabel('UI/PeopleAndPlaces/ManageLabels'),
               self.ManageLabels))
     return m
Пример #15
0
 def GetAddMenuForSkillEntries(self, skillTypeID, skillInfo):
     m = []
     if skillInfo is None:
         return m
     skillLevel = skillInfo.skillLevel
     if skillLevel is not None:
         sqWnd = form.SkillQueue.GetIfOpen()
         if skillLevel < 5:
             queue = self.GetQueue()
             nextLevel = self.FindNextLevel(skillTypeID,
                                            skillInfo.skillLevel, queue)
             if not self.SkillInTraining(skillTypeID):
                 trainingTime, totalTime, _ = self.GetTrainingLengthOfSkill(
                     skillTypeID, skillInfo.skillLevel + 1, 0)
                 if trainingTime <= 0:
                     takesText = localization.GetByLabel(
                         'UI/SkillQueue/Skills/CompletionImminent')
                 else:
                     takesText = localization.GetByLabel(
                         'UI/SkillQueue/Skills/SkillTimeLeft',
                         timeLeft=long(trainingTime))
                 if sqWnd:
                     if nextLevel < 6 and self.FindInQueue(
                             skillTypeID, skillInfo.skillLevel + 1) is None:
                         trainText = uiutil.MenuLabel(
                             'UI/SkillQueue/AddSkillMenu/AddToFrontOfQueueTime',
                             {'takes': takesText})
                         m.append(
                             (trainText, sqWnd.AddSkillsThroughOtherEntry,
                              (skillTypeID, 0, queue, nextLevel, 1)))
                 else:
                     trainText = uiutil.MenuLabel(
                         'UI/SkillQueue/AddSkillMenu/TrainNowWithTime', {
                             'skillLevel': skillInfo.skillLevel + 1,
                             'takes': takesText
                         })
                     m.append((trainText, self.TrainSkillNow,
                               (skillTypeID, skillInfo.skillLevel + 1)))
             if nextLevel < 6:
                 if sqWnd:
                     label = uiutil.MenuLabel(
                         'UI/SkillQueue/AddSkillMenu/AddToEndOfQueue',
                         {'nextLevel': nextLevel})
                     m.append((label, sqWnd.AddSkillsThroughOtherEntry,
                               (skillInfo.typeID, -1, queue, nextLevel, 1)))
                 else:
                     label = uiutil.MenuLabel(
                         'UI/SkillQueue/AddSkillMenu/TrainAfterQueue',
                         {'nextLevel': nextLevel})
                     m.append((label, self.AddSkillToEnd,
                               (skillInfo.typeID, skillInfo.skillLevel,
                                nextLevel)))
             if sm.GetService('skills').GetFreeSkillPoints() > 0:
                 diff = sm.GetService('skills').SkillpointsNextLevel(
                     skillTypeID) + 0.5 - skillInfo.skillPoints
                 m.append(
                     (uiutil.MenuLabel(
                         'UI/SkillQueue/AddSkillMenu/ApplySkillPoints'),
                      self.UseFreeSkillPoints, (skillInfo.typeID, diff)))
         if self.SkillInTraining(skillTypeID):
             m.append((uiutil.MenuLabel(
                 'UI/SkillQueue/AddSkillMenu/AbortTraining'),
                       sm.StartService('skills').AbortTrain))
     if m:
         m.append(None)
     return m
Пример #16
0
 def GetMenu(self, *args):
     if self.fleetSvc.IsCommanderOrBoss():
         return [(uiutil.MenuLabel('UI/Fleet/FleetWindow/LoadFleetSetup'),
                  self.fleetSvc.LoadSetup, (self.settingConfigName, ))]
     return []
Пример #17
0
 def GetMenu(self, *args):
     m = uicontrols.Window.GetMenu(self)
     m += [None, (uiutil.MenuLabel('UI/Accessories/Log/CaptureLog'), sm.GetService('logger').DumpToLog), (uiutil.MenuLabel('UI/Accessories/Log/CopyLog'), sm.GetService('logger').CopyLog)]
     return m
Пример #18
0
 def GetGroupMenu(self, *args):
     masterID = self.shell.IsInWeaponBank(self.module.locationID, self.id)
     if masterID:
         return [(uiutil.MenuLabel('UI/Fitting/ClearGroup'),
                  self.UnlinkModule, (masterID, ))]
     return []
Пример #19
0
 def GetFleetMenuTop(self):
     fleetSvc = sm.GetService('fleet')
     if session.fleetid is None:
         ret = [
             (uiutil.MenuLabel('UI/Fleet/FleetWindow/FormFleet'),
              lambda: sm.GetService('menu').InviteToFleet(session.charid)),
             None
         ]
     else:
         ret = [(uiutil.MenuLabel('UI/Fleet/LeaveMyFleet'),
                 fleetSvc.LeaveFleet), None]
         takesFleetWarp = fleetSvc.TakesFleetWarp()
         if takesFleetWarp:
             ret.append(
                 (uiutil.MenuLabel('UI/Fleet/FleetWindow/ExemptFleetWarp'),
                  fleetSvc.SetIgnoreFleetWarp))
         else:
             ret.append(
                 (uiutil.MenuLabel('UI/Fleet/FleetWindow/AcceptFleetWarp'),
                  fleetSvc.SetTakeFleetWarp))
         if session.fleetrole in [
                 fleetConst.fleetRoleLeader, fleetConst.fleetRoleWingCmdr,
                 fleetConst.fleetRoleSquadCmdr
         ]:
             ret.append((uiutil.MenuLabel('UI/Fleet/FleetWindow/Regroup'),
                         lambda: fleetSvc.Regroup()))
         if fleetSvc.HasActiveBeacon(session.charid):
             ret.append((uiutil.MenuLabel('UI/Fleet/BroadcastJumpBeacon'),
                         lambda: fleetSvc.SendBroadcast_JumpBeacon()))
         if fleetSvc.IsBoss():
             options = fleetSvc.GetOptions()
             ret.append(([
                 uiutil.MenuLabel('UI/Fleet/FleetWindow/SetFreeMove'),
                 localization.GetByLabel(
                     'UI/Fleet/FleetWindow/UnsetFreeMove')
             ][options.isFreeMove], lambda: fleetSvc.SetOptions(
                 isFreeMove=not options.isFreeMove)))
             ret.append(([
                 uiutil.MenuLabel('UI/Fleet/FleetWindow/SetVoiceEnabled'),
                 localization.GetByLabel(
                     'UI/Fleet/FleetWindow/UnsetVoiceEnabled')
             ][options.isVoiceEnabled], lambda: fleetSvc.SetOptions(
                 isVoiceEnabled=not options.isVoiceEnabled)))
         ret.append(None)
         ret.extend([
             None,
             [
                 uiutil.MenuLabel('UI/Fleet/FleetWindow/Broadcasts'),
                 self.broadcastMenuItems
             ]
         ])
         ret.append(
             (uiutil.MenuLabel('UI/Fleet/FleetBroadcast/BroadcastSettings'),
              lambda: BroadcastSettings.Open()))
         if self.isFlat:
             hierarchyText = uiutil.MenuLabel(
                 'UI/Fleet/FleetWindow/ViewAsHierarchy')
         else:
             hierarchyText = uiutil.MenuLabel(
                 'UI/Fleet/FleetWindow/ViewAsFlatList')
         ret.append((hierarchyText, self.ToggleFlat))
         ret.extend([
             None,
             [
                 uiutil.MenuLabel('UI/Fleet/FleetWindow/ExportLootHistory'),
                 self.ExportLootHistory
             ]
         ])
         ret.append(
             (uiutil.MenuLabel('UI/Fleet/FleetWindow/StoreFleetSetup'),
              fleetSvc.StoreSetup))
         if fleetSvc.IsCommanderOrBoss():
             ret.append(None)
             if fleetSvc.GetSetups():
                 ret.append(
                     (uiutil.MenuLabel('UI/Fleet/FleetWindow/FleetSetups'),
                      ('isDynamic', self.GetFleetSetups, ())))
             ret.append((uiutil.MenuLabel(
                 'UI/Fleet/FleetWindow/ShowFleetComposition'),
                         fleetSvc.OpenFleetCompositionWindow))
         if fleetSvc.IsBoss():
             ret.append(
                 (uiutil.MenuLabel('UI/Fleet/FleetWindow/OpenJoinRequest'),
                  fleetSvc.OpenJoinRequestWindow))
             if fleetSvc.options.isRegistered:
                 ret.append(
                     (uiutil.MenuLabel('UI/Fleet/FleetWindow/EditAdvert'),
                      sm.GetService('fleet').OpenRegisterFleetWindow))
                 ret.append(
                     (uiutil.MenuLabel('UI/Fleet/FleetWindow/RemoveAdvert'),
                      sm.GetService('fleet').UnregisterFleet))
             else:
                 ret.append(
                     (uiutil.MenuLabel('UI/Fleet/FleetWindow/CreateAdvert'),
                      sm.GetService('fleet').OpenRegisterFleetWindow))
             ret.append(
                 (uiutil.MenuLabel('UI/Fleet/FleetWindow/GetFleetID'),
                  self.GetFleetID))
     return ret
Пример #20
0
 def GetAlignToMenu(self, position):
     return [(uiutil.MenuLabel('UI/Inflight/AlignTo'), self.AlignToPosition, (position,))]
Пример #21
0
    def _GetMultiMenu(self, selected):
        """ 
            Populate right-click menu in the case where multiple entries are selected 
        """
        m = []
        charIDs = []
        multiCharIDs = []
        multiEveCharIDs = []
        listGroupIDs = {}
        listGroupID_charIDs = []
        onlyCharacters = True
        for entry in selected:
            listGroupID = entry.listGroupID
            if listGroupID:
                listGroupIDs[listGroupID] = 0
                listGroupID_charIDs.append((listGroupID, entry.charID))
            if entry.charID:
                charIDs.append((entry.charID, None))
                multiCharIDs.append(entry.charID)
                if not util.IsCharacter(entry.charID):
                    onlyCharacters = False
                elif util.IsDustCharacter(entry.charID):
                    multiEveCharIDs.append(entry.charID)

        if self.isContactList is None:
            if onlyCharacters:
                m += sm.GetService('menu').CharacterMenu(charIDs)
            if listGroupIDs:
                listname = ''
                delCharIDs = []
                rem = []
                for listGroupID, charID in listGroupID_charIDs:
                    if listGroupID in [('buddygroups', 'all'),
                                       ('buddygroups', 'allcorps')]:
                        if onlyCharacters:
                            return m
                        group = uicore.registry.GetListGroup(listGroupID)
                        listname = [
                            localization.GetByLabel('UI/Generic/BuddyList')
                        ][listGroupID == ('buddygroups', 'all')]
                        delCharIDs.append(charID)
                        rem.append((listGroupID, charID))

                for each in rem:
                    listGroupID_charIDs.remove(each)

                foldername = 'folders'
                if len(listGroupIDs) == 1:
                    group = uicore.registry.GetListGroup(
                        listGroupIDs.keys()[0])
                    if group:
                        foldername = group['label']
                label = ''
                if delCharIDs and listname:
                    label = localization.GetByLabel(
                        'UI/PeopleAndPlaces/RemoveMultipleFromAddressbook',
                        removecount=len(delCharIDs))
                    if listGroupID_charIDs:
                        label += [', ']
                if listGroupID_charIDs:
                    label += localization.GetByLabel(
                        'UI/PeopleAndPlaces/RemoveFromFolder',
                        foldername=foldername,
                        removecount=len(listGroupID_charIDs))
                m.append((label, self.RemoveFromListGroup,
                          (listGroupID_charIDs, delCharIDs, listname)))
        else:
            addressBookSvc = sm.GetService('addressbook')
            counter = len(selected)
            blocked = 0
            if self.isContactList == 'contact':
                editLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/EditContacts', contactcount=counter)
                m.append((editLabel, addressBookSvc.EditContacts,
                          [multiCharIDs, 'contact']))
                deleteLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveContacts', contactcount=counter)
                m.append((deleteLabel, addressBookSvc.DeleteEntryMulti,
                          [multiCharIDs, 'contact']))
                for charid in multiCharIDs:
                    if sm.GetService('addressbook').IsBlocked(charid):
                        blocked += 1

                if blocked == counter:
                    unblockLabel = localization.GetByLabel(
                        'UI/PeopleAndPlaces/UnblockContacts',
                        contactcount=blocked)
                    m.append((unblockLabel, addressBookSvc.UnblockOwner,
                              [multiCharIDs]))
            elif self.isContactList == 'corpcontact':
                editLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/EditCorpContacts',
                    contactcount=counter)
                m.append((editLabel, addressBookSvc.EditContacts,
                          [multiCharIDs, 'corpcontact']))
                deleteLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveCorpContacts',
                    contactcount=counter)
                m.append((deleteLabel, addressBookSvc.DeleteEntryMulti,
                          [multiCharIDs, 'corpcontact']))
            elif self.isContactList == 'alliancecontact':
                editLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/EditAllianceContacts',
                    contactcount=counter)
                m.append((editLabel, addressBookSvc.EditContacts,
                          [multiCharIDs, 'alliancecontact']))
                deleteLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveAllianceContacts',
                    contactcount=counter)
                m.append((deleteLabel, addressBookSvc.DeleteEntryMulti,
                          [multiCharIDs, 'alliancecontact']))
            m.append(None)
            assignLabelMenu = sm.StartService(
                'addressbook').GetAssignLabelMenu(selected, multiCharIDs,
                                                  self.isContactList)
            if len(assignLabelMenu) > 0:
                m.append(
                    (uiutil.MenuLabel('UI/PeopleAndPlaces/AddContactLabel'),
                     assignLabelMenu))
            removeLabelMenu = sm.StartService(
                'addressbook').GetRemoveLabelMenu(selected, multiCharIDs,
                                                  self.isContactList)
            if len(removeLabelMenu) > 0:
                m.append(
                    (uiutil.MenuLabel('UI/PeopleAndPlaces/RemoveContactLabel'),
                     removeLabelMenu))
            m.append(None)
            m.append(
                (uiutil.MenuLabel('UI/Commands/CapturePortrait'),
                 sm.StartService('photo').SavePortraits, [multiEveCharIDs]))
        if self.sr.node.Get('MenuFunction', None):
            cm = [None]
            cm += self.sr.node.MenuFunction(selected)
            m += cm
        return m
Пример #22
0
    def GetMenu(self):
        if self.drag:
            self.drag = False
            return
        mapSvc = sm.GetService('map')
        starmapSvc = sm.GetService('starmap')
        solarsystemID = starmapSvc.PickSolarSystemID()
        if solarsystemID is not None:
            return starmapSvc.GetItemMenu(solarsystemID)
        regionID = self.PickRegionID()
        if regionID:
            return starmapSvc.GetItemMenu(regionID)
        if blue.os.GetWallclockTimeNow(
        ) - self.lastTimeLeftMouseWasPressed < 30000L:
            return
        loctations = [
            (uiutil.MenuLabel('UI/Map/Navigation/menuSolarSystem'),
             starmapSvc.SetInterest, (eve.session.solarsystemid2, 1)),
            (uiutil.MenuLabel('UI/Map/Navigation/menuConstellation'),
             starmapSvc.SetInterest, (eve.session.constellationid, 1)),
            (uiutil.MenuLabel('UI/Map/Navigation/menuRegion'),
             starmapSvc.SetInterest, (eve.session.regionid, 1))
        ]
        panel = [
            (uiutil.MenuLabel('UI/Map/Navigation/menuSearch'), self.ShowPanel,
             (localization.GetByLabel('UI/Map/Navigation/menuSearch'), )),
            (uiutil.MenuLabel('UI/Map/Navigation/menuDisplayMapSettings'),
             self.ShowPanel,
             (localization.GetByLabel('UI/Map/Navigation/lblStarMap'), ))
        ]
        m = [(uiutil.MenuLabel('UI/Map/Navigation/menuSelectCurrent'),
              loctations)]
        waypoints = starmapSvc.GetWaypoints()
        if len(waypoints):
            waypointList = []
            wpCount = 1
            for waypointID in waypoints:
                waypointItem = mapSvc.GetItem(waypointID)
                caption = uiutil.MenuLabel(
                    'UI/Map/Navigation/menuWaypointEntry', {
                        'itemName': waypointItem.itemName,
                        'wpCount': wpCount
                    })
                waypointList += [(caption, starmapSvc.SetInterest, (waypointID,
                                                                    1))]
                wpCount += 1

            m.append((uiutil.MenuLabel('UI/Map/Navigation/menuSelectWaypoint'),
                      waypointList))
        m += [
            None,
            (uiutil.MenuLabel('UI/Map/Navigation/menuWorldControlPanel'),
             panel)
        ]
        if len(starmapSvc.GetWaypoints()) > 0:
            m.append(None)
            m.append((uiutil.MenuLabel('UI/Map/Navigation/menuClearWaypoints'),
                      starmapSvc.ClearWaypoints, (None, )))
            if starmapSvc.genericRoute:
                m.append((uiutil.MenuLabel('UI/Map/Navigation/menuClearRoute'),
                          starmapSvc.RemoveGenericPath))
        if eve.session.role & (service.ROLE_GML | service.ROLE_WORLDMOD):
            landmarkScales = [
                (uiutil.MenuLabel('UI/Map/Navigation/menuAllImportance'),
                 starmapSvc.LM_DownloadLandmarks, ()),
                (uiutil.MenuLabel('UI/Map/Navigation/menuImportance',
                                  {'level': 0}),
                 starmapSvc.LM_DownloadLandmarks, (0, )),
                (uiutil.MenuLabel('UI/Map/Navigation/menuImportance',
                                  {'level': 1}),
                 starmapSvc.LM_DownloadLandmarks, (1, )),
                (uiutil.MenuLabel('UI/Map/Navigation/menuImportance',
                                  {'level': 2}),
                 starmapSvc.LM_DownloadLandmarks, (2, )),
                (uiutil.MenuLabel('UI/Map/Navigation/menuImportance',
                                  {'level': 3}),
                 starmapSvc.LM_DownloadLandmarks, (3, )),
                (uiutil.MenuLabel('UI/Map/Navigation/menuImportance',
                                  {'level': 4}),
                 starmapSvc.LM_DownloadLandmarks, (4, )),
                (uiutil.MenuLabel('UI/Map/Navigation/menuImportance',
                                  {'level': 5}),
                 starmapSvc.LM_DownloadLandmarks, (5, ))
            ]
            m.append(None)
            m.append((uiutil.MenuLabel('UI/Map/Navigation/menuGetLandmarks'),
                      landmarkScales))
            if eve.session.role & service.ROLE_WORLDMOD:
                m.append(
                    (uiutil.MenuLabel('UI/Map/Navigation/menuUpdateLandmarks'),
                     starmapSvc.LM_UploadLandmarks, ()))
            m.append((uiutil.MenuLabel('UI/Map/Navigation/menuHideLandmarks'),
                      starmapSvc.LM_ClearLandmarks, ()))
        return m
Пример #23
0
 def GroupMenu(self, node):
     m = []
     if node.sublevel < 5:
         m.append((uiutil.MenuLabel('UI/Notepad/NewFolder'), self.NewFolder, (node.id[1], node)))
     m.append((uiutil.MenuLabel('UI/Notepad/NewNote'), self.NewNote, (node.id[1], node)))
     return m
Пример #24
0
 def GetMenu(self):
     return [(uiutil.MenuLabel('UI/Agents/Commands/ReadDetails'),
              self.OpenDetails),
             (uiutil.MenuLabel('UI/Agents/Commands/StartConversationWith',
                               {'agentID': self.sr.node.agentID}),
              self.Convo)]
Пример #25
0
 def GetMenu(self, *args):
     menu = uicls.WindowCore.GetMenu(self)
     helpMenu = self.Help()
     if helpMenu:
         menu.append((uiutil.MenuLabel('UI/Control/EveWindow/Help'), helpMenu))
     return menu
Пример #26
0
 def GetMenu(self):
     m = []
     mm = []
     mmm = []
     if self.locationID:
         if self.regionID is None:
             label = ''
             if self.scope == SovereigntyTab.SolarSystem:
                 label = None
                 mm += sm.GetService('menu').CelestialMenu(self.locationID)
                 m.append(
                     (uiutil.MenuLabel('UI/Common/LocationTypes/System'),
                      mm))
             if self.scope == SovereigntyTab.World:
                 label = uiutil.MenuLabel('UI/Common/LocationTypes/Region')
                 mm += sm.GetService('menu').CelestialMenu(self.locationID)
                 m.append((label, mm))
             elif self.scope == SovereigntyTab.Region:
                 label = uiutil.MenuLabel(
                     'UI/Common/LocationTypes/Constellation')
                 mm += sm.GetService('menu').CelestialMenu(self.locationID)
                 m.append((label, mm))
             elif self.scope == SovereigntyTab.Constellation:
                 label = uiutil.MenuLabel('UI/Common/LocationTypes/System')
                 mm += sm.GetService('menu').CelestialMenu(self.locationID)
                 m.append((label, mm))
             m.append(None)
             if label is not None:
                 if label == uiutil.MenuLabel(
                         'UI/Common/LocationTypes/System'):
                     viewLabel = uiutil.MenuLabel(
                         'UI/Common/LocationTypes/ViewSystem')
                 elif label == uiutil.MenuLabel(
                         'UI/Common/LocationTypes/Constellation'):
                     viewLabel = uiutil.MenuLabel(
                         'UI/Common/LocationTypes/ViewConstellation')
                 else:
                     viewLabel = uiutil.MenuLabel(
                         'UI/Common/LocationTypes/ViewRegion')
                 m.append([viewLabel, self.DrillToLocation])
         else:
             mm += sm.GetService('menu').CelestialMenu(self.locationID)
             m.append(
                 (uiutil.MenuLabel('UI/Common/LocationTypes/System'), mm))
             mmm += sm.GetService('menu').CelestialMenu(self.regionID)
             m.append(
                 (uiutil.MenuLabel('UI/Common/LocationTypes/Region'), mmm))
             m.append(None)
         if self.allianceID is not None:
             if util.IsFaction(self.allianceID):
                 m.append([
                     uiutil.MenuLabel('UI/Sovereignty/ShowInfoOnFaction'),
                     self.ShowInfoOnSovHolder,
                     (const.typeFaction, self.allianceID)
                 ])
             else:
                 m.append([
                     uiutil.MenuLabel('UI/Sovereignty/ShowInfoOnAlliance'),
                     self.ShowInfoOnSovHolder,
                     (const.typeAlliance, self.allianceID)
                 ])
         elif self.corpID is not None:
             m.append([
                 uiutil.MenuLabel('UI/Sovereignty/ShowInfoOnCorporation'),
                 self.ShowInfoOnSovHolder,
                 (const.typeCorporation, self.corpID)
             ])
         return m
     else:
         return
Пример #27
0
 def GetMenuDelegate(self, widget, node, m):
     if self.debug:
         self.LogInfo('    GetMenuDelegate widget:', widget, 'node:', node, 'm:', m)
         self.LogInfo('    PRIMARY LANG:', self.primaryLanguage, 'SECONDARY:', self.subLanguage)
     if self.primaryLanguage == LANG_CHINESE and self.subLanguage == SUBLANG_CHINESE_SIMPLIFIED:
         if self.GetOpenStatus():
             m.append((uiutil.MenuLabel('/Carbon/UI/Commands/CloseIme'), self.SetOpenStatus, (0,)))
         else:
             m.append((uiutil.MenuLabel('/Carbon/UI/Commands/OpenIME'), self.SetOpenStatus, (1,)))
         m.append((uiutil.MenuLabel('/Carbon/UI/Commands/CmdShape'), self.SimulateHotKey, (IME_CHOTKEY_SHAPE_TOGGLE,)))
         m.append((uiutil.MenuLabel('/Carbon/UI/Commands/CmdSymbol'), self.SimulateHotKey, (IME_CHOTKEY_SYMBOL_TOGGLE,)))
     elif self.primaryLanguage == LANG_CHINESE and self.subLanguage == SUBLANG_CHINESE_TRADITIONAL:
         if self.GetOpenStatus():
             m.append((uiutil.MenuLabel('/Carbon/UI/Commands/CloseIme'), self.SetOpenStatus, (0,)))
         else:
             m.append((uiutil.MenuLabel('/Carbon/UI/Commands/OpenIME'), self.SetOpenStatus, (1,)))
         m.append((uiutil.MenuLabel('/Carbon/UI/Commands/CmdShape'), self.SimulateHotKey, (IME_THOTKEY_SHAPE_TOGGLE,)))
         m.append((uiutil.MenuLabel('/Carbon/UI/Commands/CmdSymbol'), self.SimulateHotKey, (IME_THOTKEY_SYMBOL_TOGGLE,)))
     elif self.primaryLanguage == LANG_JAPANESE:
         if self.GetOpenStatus():
             m.append((uiutil.MenuLabel('/Carbon/UI/Commands/CloseIme'), self.SetOpenStatus, (0,)))
         else:
             m.append((uiutil.MenuLabel('/Carbon/UI/Commands/OpenIME'), self.SetOpenStatus, (1,)))
     elif self.primaryLanguage == LANG_KOREAN:
         m.append((uiutil.MenuLabel('/Carbon/UI/Commands/CloseIme'), self.SimulateHotKey, (IME_KHOTKEY_ENGLISH,)))
         m.append((uiutil.MenuLabel('/Carbon/UI/Commands/OpenIME'), self.SimulateHotKey, (IME_KHOTKEY_ENGLISH,)))
         m.append((uiutil.MenuLabel('/Carbon/UI/Commands/CmdShape'), self.SimulateHotKey, (IME_KHOTKEY_SHAPE_TOGGLE,)))
         m.append((uiutil.MenuLabel('/Carbon/UI/Commands/CmdHanja'), self.SimulateHotKey, (IME_KHOTKEY_HANJACONVERT,)))
def DefaultWarpToLabel():
    defaultWarpDist = sm.GetService('menu').GetDefaultActionDistance('WarpTo')
    label = uiutil.MenuLabel('UI/Inflight/WarpToWithinDistance', {'distance': util.FmtDist(float(defaultWarpDist))})
    return label
Пример #29
0
 def GetGroupMenu(self, *args):
     masterID = self.controller.IsInWeaponBank()
     if masterID:
         return [(uiutil.MenuLabel('UI/Fitting/ClearGroup'),
                  self.UnlinkModule, ())]
     return []