示例#1
0
def SetName(invOrSlimItem, invCacheSvc):
    invCacheSvc.TryLockItem(invOrSlimItem.itemID, 'lockItemRenaming',
                            {'itemType': invOrSlimItem.typeID}, 1)
    try:
        cfg.evelocations.Prime([invOrSlimItem.itemID])
        try:
            setval = cfg.evelocations.Get(invOrSlimItem.itemID).name
        except:
            setval = ''
            sys.exc_clear()

        maxLength = 100
        categoryID = cfg.invtypes.Get(
            invOrSlimItem.typeID).Group().Category().id
        if categoryID == const.categoryShip:
            maxLength = 20
        elif categoryID == const.categoryStructure:
            maxLength = 32
        nameRet = uiutil.NamePopup(
            localization.GetByLabel('UI/Menusvc/SetName'),
            localization.GetByLabel('UI/Menusvc/TypeInNewName'),
            setvalue=setval,
            maxLength=maxLength)
        if nameRet:
            invCacheSvc.GetInventoryMgr().SetLabel(invOrSlimItem.itemID,
                                                   nameRet.replace('\n', ' '))
            sm.ScatterEvent('OnItemNameChange')
    finally:
        invCacheSvc.UnlockItem(invOrSlimItem.itemID)
示例#2
0
def SetName(invOrSlimItem, invCacheSvc):
    invCacheSvc.TryLockItem(invOrSlimItem.itemID, 'lockItemRenaming',
                            {'itemType': invOrSlimItem.typeID}, 1)
    try:
        cfg.evelocations.Prime([invOrSlimItem.itemID])
        categoryID = evetypes.GetCategoryID(invOrSlimItem.typeID)
        if categoryID == const.categoryStructure:
            return _SetStructureName(
                invOrSlimItem.itemID, invOrSlimItem.locationID
                or session.solarsystemid2)
        try:
            setval = cfg.evelocations.Get(invOrSlimItem.itemID).name
        except StandardError:
            setval = ''
            sys.exc_clear()

        maxLength = 100
        if categoryID == const.categoryShip:
            maxLength = 20
        elif categoryID == const.categoryStarbase:
            maxLength = 32
        nameRet = uiutil.NamePopup(
            localization.GetByLabel('UI/Menusvc/SetName'),
            localization.GetByLabel('UI/Menusvc/TypeInNewName'),
            setvalue=setval,
            maxLength=maxLength)
        if nameRet:
            invCacheSvc.GetInventoryMgr().SetLabel(invOrSlimItem.itemID,
                                                   nameRet.replace('\n', ' '))
            sm.ScatterEvent('OnItemNameChange')
    finally:
        invCacheSvc.UnlockItem(invOrSlimItem.itemID)
示例#3
0
 def SavePreset(self, *args):
     activeOverviewName = self.GetActiveOverviewPresetName()
     if self.IsTempName(activeOverviewName):
         baseName = activeOverviewName[1]
     else:
         baseName = activeOverviewName
     displayName = self.GetPresetDisplayName(baseName)
     ret = uiutil.NamePopup(
         localization.GetByLabel('UI/Tactical/TypeInLabelForPreset'),
         localization.GetByLabel('UI/Overview/TypeInLabel'),
         setvalue=displayName,
         maxLength=80)
     if ret:
         presetName = ret
         if presetName == DEFAULT_PRESET_NAME:
             presetName = 'default2'
         if presetName in self.allPresets:
             if eve.Message('AlreadyHaveLabel', {},
                            uiconst.YESNO) != uiconst.ID_YES:
                 return self.SavePreset()
         newPreset = {
             'groups':
             self.GetGroups(presetName=activeOverviewName)[:],
             'filteredStates':
             self.GetFilteredStates(presetName=activeOverviewName)[:],
             'alwaysShownStates':
             self.GetAlwaysShownStates(presetName=activeOverviewName)[:]
         }
         self.allPresets[presetName] = newPreset
         self.StorePresetsInSettings()
         self.LoadPreset(presetName)
         sm.ScatterEvent('OnOverviewPresetSaved')
示例#4
0
    def CreateSubGroup(self, droneID, droneGroupID, nodes = None):
        ret = uiutil.NamePopup(localization.GetByLabel('UI/Generic/TypeGroupName'), localization.GetByLabel('UI/Generic/TypeNameForGroup'))
        if not ret:
            return
        droneIDs = set()
        for node in nodes:
            for group in self.GetDroneGroup(node.itemID, getall=1):
                group['droneIDs'].remove(node.itemID)

            droneIDs.add(node.itemID)

        origname = groupname = ret
        i = 2
        while groupname in self.groups:
            groupname = '%s_%i' % (origname, i)
            i += 1

        group = {}
        group['label'] = groupname
        group['droneIDs'] = droneIDs
        group['id'] = (groupname, str(blue.os.GetWallclockTime()))
        group['droneGroupID'] = droneGroupID
        self.groups[groupname] = group
        self.CheckDrones(1)
        self.UpdateGroupSettings()
示例#5
0
def _SetStructureName(structureID, solarsystemID):
    if not util.IsSolarSystem(solarsystemID):
        log.LogError("Can't rename a structure that's not in space.  What is",
                     structureID, 'doing inside', solarsystemID, 'anyways?')
        return
    currentName = cfg.evelocations.Get(structureID).locationName
    namePrefix = '%s - ' % localization.CleanImportantMarkup(
        cfg.evelocations.Get(solarsystemID).locationName)
    if not currentName.startswith(namePrefix):
        currentName = namePrefix + currentName

    def _CheckLen(name, *args):
        if len(name) - len(namePrefix) < structures.MIN_STRUCTURE_NAME_LEN:
            raise UserError('CharNameTooShort')

    newName = uiutil.NamePopup(
        localization.GetByLabel('UI/Menusvc/SetName'),
        localization.GetByLabel('UI/Menusvc/TypeInNewName'),
        setvalue=currentName,
        maxLength=32 + len(namePrefix),
        fixedPrefix=namePrefix,
        validator=_CheckLen)
    if newName:
        sm.RemoteSvc('structureDeployment').RenameStructure(
            structureID, newName)
示例#6
0
 def RenameNote(self, noteID):
     if noteID in self.folders:
         noteID = self.folders[noteID].type + ':' + str(
             self.folders[noteID].data)
     if noteID not in self.notes:
         return
     ret = uiutil.NamePopup(
         localization.GetByLabel('UI/Notepad/NoteName'),
         localization.GetByLabel('UI/Notepad/TypeNewNoteLabel'),
         self.notes[noteID].label,
         maxLength=80)
     if ret is not None:
         if self.AlreadyExists('N', ret):
             eve.Message(
                 'CustomInfo', {
                     'info':
                     localization.GetByLabel('UI/Notepad/NoteAlreadyExists')
                 })
             return
         self.notes[noteID].label = ret
         sm.RemoteSvc('charMgr').EditOwnerNote(self.notes[noteID].noteID,
                                               'N:' + ret)
         self.LoadNotes()
         if getattr(self, 'activeNode', None) == noteID:
             self.sr.titletext.text = ret
示例#7
0
 def Profile_SaveCurrent(self, *args):
     ret = uiutil.NamePopup('Save skill sheet as...',
                            'Enter profile name',
                            setvalue=self.currentProfileName
                            or 'New Profile',
                            maxLength=32)
     if ret:
         self.currentProfileName = ret
         self.Profile_Save(self.currentProfileName)
         self.Profile_Refresh()
示例#8
0
文件: notepad.py 项目: R4M80MrX/eve-1
 def RenameFolder(self, folderID = 0, entry = None, name = None, *args):
     if name is None:
         ret = uiutil.NamePopup(localization.GetByLabel('UI/Notepad/FolderName'), localization.GetByLabel('UI/Notepad/TypeNewFolderName'), maxLength=20)
         if ret is None:
             return self.folders[folderID].data
         name = ret
     if self.AlreadyExists('F', name):
         eve.Message('CustomInfo', {'info': localization.GetByLabel('UI/Notepad/FolderAlreadyExists')})
         return
     self.folders[folderID].data = name
     return name
 def EnterTowerPassword(self, towerID):
     password = uiutil.NamePopup(
         caption=localization.GetByLabel(
             'UI/Inflight/POS/TowerShieldHarmonic'),
         label=localization.GetByLabel(
             'UI/Inflight/POS/EnterTheSharedSecret'),
         setvalue='',
         maxLength=50,
         passwordChar='*')
     if password is None:
         return
     posMgr = moniker.GetPOSMgr()
     posMgr.SetTowerPassword(towerID, password)
示例#10
0
文件: notepad.py 项目: R4M80MrX/eve-1
 def NewFolder(self, folderID = 0, node = None, *args):
     ret = uiutil.NamePopup(localization.GetByLabel('UI/Notepad/FolderName'), localization.GetByLabel('UI/Notepad/TypeNewFolderName'), maxLength=20)
     if ret is not None:
         name = ret
         if self.AlreadyExists('F', name):
             eve.Message('CustomInfo', {'info': localization.GetByLabel('UI/Notepad/FolderAlreadyExists')})
             return
         self.AddNote(folderID, 'F', name)
         data = {'label': name,
          'folderid': self.lastid,
          'parent': folderID}
         self.LoadNotes()
         return data
示例#11
0
 def Store(self, *args):
     insiderDir = sm.GetService('insider').GetInsiderDir()
     import poser
     s = poser.Starbase()
     s.ImportFromEnvironment()
     filename = uiutil.NamePopup(caption='Store Starbase', label='Enter filename:', setvalue='', maxLength=32)
     if not filename:
         return
     filename = os.path.join(insiderDir, filename)
     if not filename:
         return
     if filename[:4].lower() != '.pos':
         filename += '.pos'
     s.ExportAsFile(filename)
示例#12
0
 def GiveMedalToCharacters(self, medalID, recipientID, reason=''):
     roles = const.corpRoleDirector | const.corpRolePersonnelManager
     if session.corprole & roles == 0:
         raise UserError(
             'CrpAccessDenied', {
                 'reason':
                 localization.GetByLabel(
                     'UI/Corporations/CreateDecorationWindow/NeedRolesError'
                 )
             })
     if reason == '':
         ret = uiutil.NamePopup(
             localization.GetByLabel(
                 'UI/Corporations/CorporationWindow/Members/AwardReasonTitle'
             ),
             localization.GetByLabel(
                 'UI/Corporations/CorporationWindow/Members/PromptForReason'
             ),
             reason,
             maxLength=200)
         if ret:
             reason = ret
         else:
             return
     if type(recipientID) == types.IntType:
         recipientID = [recipientID]
     try:
         sm.RemoteSvc('corporationSvc').GiveMedalToCharacters(
             medalID, recipientID, reason)
     except UserError as e:
         if e.args[0].startswith('ConfirmGivingMedal'):
             d = dict(amount=len(recipientID),
                      members=localization.GetByLabel(
                          'UI/Corporations/MedalsToUsers',
                          numMembers=len(recipientID)),
                      cost=util.FmtISK(e.dict.get('cost', 0)))
             ret = eve.Message(e.msg,
                               d,
                               uiconst.YESNO,
                               suppress=uiconst.ID_YES)
             if ret == uiconst.ID_YES:
                 sm.RemoteSvc('corporationSvc').GiveMedalToCharacters(
                     medalID, recipientID, reason, True)
         elif e.args[0] == 'NotEnoughMoney':
             eve.Message(e.msg, e.dict)
         else:
             raise
示例#13
0
 def Profile_ToCharacter(self, charID=None):
     if not charID:
         ret = uiutil.NamePopup('Give Skills',
                                'Name of character to give skills to',
                                setvalue='',
                                maxLength=37)
         if ret:
             sm.GetService('loading').Cycle(
                 '   Searching...', 'for owner with %s in its name' % ret)
             charID = uix.Search(ret.lower(),
                                 const.groupCharacter,
                                 const.categoryOwner,
                                 hideNPC=1)
             sm.GetService('loading').StopCycle()
     if not charID:
         return
     self.ApplyProfile(self.currentProfile, charID)
示例#14
0
文件: notepad.py 项目: R4M80MrX/eve-1
 def NewNote(self, folderID = 0, node = None, *args):
     ret = uiutil.NamePopup(localization.GetByLabel('UI/Notepad/NoteName'), localization.GetByLabel('UI/Notepad/TypeNewNoteLabel'), maxLength=80)
     if ret is not None:
         name = ret
         if self.AlreadyExists('N', name):
             eve.Message('CustomInfo', {'info': localization.GetByLabel('UI/Notepad/NoteAlreadyExists')})
             return
         noteID = sm.RemoteSvc('charMgr').AddOwnerNote('N:' + name, '<br>')
         if folderID:
             self.AddNote(folderID, 'N', noteID)
         n = util.KeyVal()
         n.noteID = noteID
         n.label = name
         n.text = '<br>'
         self.notes['N:' + str(noteID)] = n
         self.LoadNotes()
         self.ShowNote('N:' + str(noteID))
示例#15
0
 def StackAll(self, securityCode=None):
     if not self.CheckAndConfirmOneWayMove():
         return
     if self.locationFlag:
         retval = self._GetInvCacheContainer().StackAll(self.locationFlag)
         return retval
     try:
         if securityCode is None:
             retval = self._GetInvCacheContainer().StackAll()
         else:
             retval = self._GetInvCacheContainer().StackAll(
                 securityCode=securityCode)
         return retval
     except UserError as what:
         if what.args[0] == 'PermissionDenied':
             if securityCode:
                 caption = localization.GetByLabel(
                     'UI/Menusvc/IncorrectPassword')
                 label = localization.GetByLabel(
                     'UI/Menusvc/PleaseTryEnteringPasswordAgain')
             else:
                 caption = localization.GetByLabel(
                     'UI/Menusvc/PasswordRequired')
                 label = localization.GetByLabel(
                     'UI/Menusvc/PleaseEnterPassword')
             passw = uiutil.NamePopup(caption=caption,
                                      label=label,
                                      setvalue='',
                                      icon=-1,
                                      modal=1,
                                      btns=None,
                                      maxLength=50,
                                      passwordChar='*')
             if passw == '':
                 raise UserError('IgnoreToTop')
             else:
                 retval = self.StackAll(securityCode=passw['name'])
                 return retval
         else:
             raise
         sys.exc_clear()
示例#16
0
def TransferCorporationOwnership(itemID):
    michelle = sm.GetService('michelle')
    remotePark = michelle.GetRemotePark()
    localPark = michelle.GetBallpark()
    if itemID not in localPark.slimItems or remotePark is None:
        return
    oldOwnerID = localPark.slimItems[itemID].ownerID
    name = uiutil.NamePopup(
        localization.GetByLabel('UI/Corporations/Common/TransferOwnership'),
        localization.GetByLabel(
            'UI/Corporations/Common/TransferOwnershipLabel'))
    if name is None:
        return
    owner = uix.SearchOwners(searchStr=name,
                             groupIDs=[const.groupCorporation],
                             hideNPC=True,
                             notifyOneMatch=True,
                             searchWndName='AddToBlockSearch')
    if owner is None or owner == oldOwnerID:
        return
    remotePark.CmdChangeStructureOwner(itemID, oldOwnerID, owner)
示例#17
0
 def SetExpiryTime(self):
     ret = uiutil.NamePopup(caption='Set Expiry Time', label='Type in Expiry Time', setvalue=util.FmtDate(self.node.expiryTime))
     if ret is None:
         return
     newTime = util.ParseDateTime(ret)
     self.teamHandlerClient.GMSetAuctionExpiryTime(self.team.teamID, newTime)
示例#18
0
 def GetNewGroupName(self):
     return uiutil.NamePopup(localization.GetByLabel('/Carbon/UI/Controls/ScrollEntries/TypeInNewName'), localization.GetByLabel('/Carbon/UI/Controls/ScrollEntries/TypeInNewFolderName'))
def GagPopup(charID, numMinutes):
    reason = 'Gagged for Spamming'
    ret = uiutil.NamePopup('Gag User', 'Enter Reason', reason)
    if ret:
        SlashCmd('/gag %s "%s" %s' % (charID, ret, numMinutes))