Exemplo n.º 1
0
 def nameIsValid(self, name):
     self.notify.debug('nameIsValid')
     if name in self.usedNames:
         return TTLocalizer.ToonAlreadyExists % name
     problem = NameCheck.checkName(name, [self._checkNpcNames], font=self.nameEntry.getFont())
     if problem:
         return problem
     return None
Exemplo n.º 2
0
 def nameIsValid(self, name):
     self.notify.debug('nameIsValid')
     if name in self.usedNames:
         return TTLocalizer.ToonAlreadyExists % name
     problem = NameCheck.checkName(name, [self._checkNpcNames], font=self.nameEntry.getFont())
     if problem:
         return problem
     return None
 def _typedAName(self, *args):
     self.nameEntry['focus'] = 0
     name = self.nameEntry.get()
     name = TextEncoder().decodeText(name)
     name = name.strip()
     name = TextEncoder().encodeWtext(name)
     self.nameEntry.enterText(name)
     self.notify.debug('Chosen name: %s' % self.nameEntry.get())
     problem = NameCheck.checkName(name, [self._checkNpcNames],
                                   font=self.nameEntry.getFont())
     if problem:
         print problem
         self.nameEntry.enterText('')
     else:
         self.fsm.request('Approved')
 def _typedAName(self, *args):
     self.nameEntry['focus'] = 0
     name = self.nameEntry.get()
     name = TextEncoder().decodeText(name)
     name = name.strip()
     name = TextEncoder().encodeWtext(name)
     self.nameEntry.enterText(name)
     self.notify.debug('Chosen name: %s' % self.nameEntry.get())
     problem = NameCheck.checkName(name, [
         self._checkNpcNames], font = self.nameEntry.getFont())
     if problem:
         print problem
         self.nameEntry.enterText('')
     else:
         self.fsm.request('Approved')
Exemplo n.º 5
0
    def nameIsValid(self, name):
        """nameIsValid(self, string name)
        Checks the name for legitimacy according to our various
        Toontown rules.  If it violates any of those rules, returns a
        string explaining the objection; otherwise, returns None
        indicating the name is acceptable.
        """
        self.notify.debug('nameIsValid')
        if (name in self.usedNames):
            return OTPLocalizer.ToonAlreadyExists % (name)

        problem = NameCheck.checkName(name, font=self.nameEntry.getFont())
        if problem:
            return problem

        # name has passed local checks
        return None
Exemplo n.º 6
0
    def nameIsValid(self, name):
        self.notify.debug('nameIsValid')
        inventory = base.localAvatar.getInventory()
        if not inventory:
            return
        usedNames = []
        shipList = inventory.getShipDoIdList()
        for shipId in shipList:
            shipOwnview = base.cr.getOwnerView(shipId)
            usedNames.append(shipOwnview.name)

        if name in usedNames:
            return PLocalizer.ShipNameAlreadyExists % name
        problem = NameCheck.checkName(name, font=self.nameEntry.getFont())
        if problem:
            return problem
        return
 def complete(self):
     self.nameEntry['focus'] = 0
     name = self.nameEntry.get()
     name = TextEncoder().decodeText(name)
     name = name.strip()
     name = TextEncoder().encodeWtext(name)
     self.nameEntry.enterText(name)
     self.notify.debug('Chosen name: %s' % name)
     if self.customName:
         problem = NameCheck.checkName(name, [self._checkNpcNames],
                                       font=self.nameEntry.getFont())
         if problem:
             print problem
             self.nameEntry.enterText('')
         else:
             self.fsm.request('Done')
     else:
         self.fsm.request('Done')
 def complete(self):
     self.nameEntry['focus'] = 0
     name = self.nameEntry.get()
     name = TextEncoder().decodeText(name)
     name = name.strip()
     name = TextEncoder().encodeWtext(name)
     self.nameEntry.enterText(name)
     self.notify.debug('Chosen name: %s' % name)
     if self.customName:
         problem = NameCheck.checkName(name, [
             self._checkNpcNames], font = self.nameEntry.getFont())
         if problem:
             print problem
             self.nameEntry.enterText('')
         else:
             self.fsm.request('Done')
     else:
         self.fsm.request('Done')
 def nameIsValid(self, name):
     self.notify.debug('nameIsValid')
     inventory = base.localAvatar.getInventory()
     if not inventory:
         return None
     
     usedNames = []
     shipList = inventory.getShipDoIdList()
     for shipId in shipList:
         shipOwnview = base.cr.getOwnerView(shipId)
         usedNames.append(shipOwnview.name)
     
     if name in usedNames:
         return PLocalizer.ShipNameAlreadyExists % name
     
     problem = NameCheck.checkName(name, font = self.nameEntry.getFont())
     if problem:
         return problem
 def getTypeANameProblem(self, callback):
     if not self.customName:
         callback(None)
     else:
         problem = None
         name = self.nameEntry.get()
         name = TextEncoder().decodeText(name)
         name = name.strip()
         name = TextEncoder().encodeWtext(name)
         self.nameEntry.enterText(name)
         problem = NameCheck.checkName(self.nameEntry.get(), [
             self._checkNpcNames], font = self.nameEntry.getFont())
         if problem:
             callback(problem)
         elif self.cr:
             self.ignore(self.cr.getWishNameResultMsg())
             self.acceptOnce(self.cr.getWishNameResultMsg(), self._handleSetWishnameResult)
             self._nameCheckCallback = callback
             self._sendSetWishname(justCheck = True)
             return None
Exemplo n.º 11
0
 def getTypeANameProblem(self, callback):
     if not self.customName:
         callback(None)
     else:
         problem = None
         name = self.nameEntry.get()
         name = TextEncoder().decodeText(name)
         name = name.strip()
         name = TextEncoder().encodeWtext(name)
         self.nameEntry.enterText(name)
         problem = NameCheck.checkName(self.nameEntry.get(),
                                       [self._checkNpcNames],
                                       font=self.nameEntry.getFont())
         if problem:
             callback(problem)
         elif self.cr:
             self.ignore(self.cr.getWishNameResultMsg())
             self.acceptOnce(self.cr.getWishNameResultMsg(),
                             self._handleSetWishnameResult)
             self._nameCheckCallback = callback
             self._sendSetWishname(justCheck=True)
             return None