当前位置: 首页>>代码示例>>Python>>正文


Python PandaModules.TextEncoder类代码示例

本文整理汇总了Python中pandac.PandaModules.TextEncoder的典型用法代码示例。如果您正苦于以下问题:Python TextEncoder类的具体用法?Python TextEncoder怎么用?Python TextEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TextEncoder类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: checkJapanese

    def checkJapanese(name):
        asciiSpace = range(32, 33)
        asciiDigits = range(48, 64)
        hiragana = range(12353, 12448)
        katakana = range(12449, 12544)
        halfwidthKatakana = range(65381, 65440)
        halfwidthCharacter = set(asciiSpace + halfwidthKatakana)
        allowedUtf8 = set(asciiSpace + hiragana + katakana + halfwidthKatakana)

        te = TextEncoder()
        dc = 0.0

        for char in (ord(char) for char in te.decodeText(name)):
            if char not in allowedUtf8:
                if char in asciiDigits:
                    notify.info('name contains not allowed ascii digits')
                    return OTPLocalizer.NCNoDigits
                else:
                    notify.info('name contains not allowed utf8 char: 0x%04x' % char)
                    return OTPLocalizer.NCBadCharacter % te.encodeWtext(unichr(char))
            elif char in halfwidthCharacter:
                dc += 0.5
            else:
                dc += 1

        if dc < 2:
            notify.info('name is too short: %0.1f' % dc)
            return OTPLocalizer.NCTooShort
        elif dc > 8:
            notify.info('name has been occupied more than eight display cells: %0.1f' % dc)
            return OTPLocalizer.NCGeneric
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:31,代码来源:NameCheck.py

示例2: __typedAName

 def __typedAName(self, *args):
     self.notify.debug('__typedAName')
     self.nameEntry['focus'] = 0
     name = self.nameEntry.get()
     name = TextEncoder().decodeText(name)
     name = name.strip()
     name = TextEncoder().encodeWtext(name)
     self.nameEntry.enterText(name)
     problem = self.nameIsValid(self.nameEntry.get())
     if problem:
         self.rejectName(problem)
         return
     self.checkNameTyped(justCheck=True)
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:13,代码来源:NameShop.py

示例3: _typedAName

 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')
开发者ID:XamarinDeveloper,项目名称:Pirates-Online-Source,代码行数:15,代码来源:NameGUI.py

示例4: makeSign

 def makeSign(topStr, signStr, textId):
     top = self.geom.find('**/' + topStr)
     sign = top.find('**/' + signStr)
     locator = top.find('**/sign_origin')
     signText = DirectGui.OnscreenText(text=TextEncoder.upper(TTLocalizer.GlobalStreetNames[textId][-1]), font=ToontownGlobals.getSuitFont(), scale=TTLocalizer.BCHQLsignText, fg=(0, 0, 0, 1), parent=sign)
     signText.setPosHpr(locator, 0, -0.1, -0.25, 0, 0, 0)
     signText.setDepthWrite(0)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:7,代码来源:BossbotCogHQLoader.py

示例5: perWord

 def perWord(word):
     word = word
     letters = justLetters(word)
     if len(letters) > 2:
         letters = TextEncoder().decodeText(TextEncoder.lower(TextEncoder().encodeWtext(letters)))
         filtered = filterString(letters, letters[0])
         if filtered == letters:
             notify.info('word "%s" uses only one letter' % TextEncoder().encodeWtext(word))
             return OTPLocalizer.NCGeneric
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:9,代码来源:NameCheck.py

示例6: complete

 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')
开发者ID:XamarinDeveloper,项目名称:Pirates-Online-Source,代码行数:18,代码来源:NameGUI.py

示例7: allCaps

    def allCaps(name):
        letters = justLetters(name)
        if len(letters) > 2:
            upperLetters = TextEncoder().decodeText(TextEncoder.upper(TextEncoder().encodeWtext(letters)))
            for i in xrange(len(upperLetters)):
                if not upperLetters[0].isupper():
                    return

            if upperLetters == letters:
                notify.info('name is all caps')
                return OTPLocalizer.NCAllCaps
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:11,代码来源:NameCheck.py

示例8: getTypeANameProblem

 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
开发者ID:XamarinDeveloper,项目名称:Pirates-Online-Source,代码行数:20,代码来源:NameGUI.py

示例9: _getName

 def _getName(self):
     newName = ''
     if self.mode == self._NameGUI__MODE_TYPEANAME:
         newName = self.nameEntry.get()
         newName = TextEncoder().decodeText(newName)
         newName = newName.strip()
         newName = TextEncoder().encodeWtext(newName)
     else:
         newName += self.names[0]
         if len(newName) > 0 and len(self.names[1]) > 0:
             newName += ' '
         
         newName += self.names[1]
         if len(newName) > 0 and len(self.names[2]) > 0:
             newName += ' '
         
         newName += self.names[2]
         if self.names[2] in PL.PirateNames_LastNamePrefixesCapped:
             newName += self.names[3].capitalize()
         else:
             newName += self.names[3]
     return newName
开发者ID:XamarinDeveloper,项目名称:Pirates-Online-Source,代码行数:22,代码来源:NameGUI.py

示例10: match

 def match(npcName, name = name):
     name = TextEncoder().encodeWtext(name)
     name = name.strip()
     return TextEncoder.upper(npcName) == TextEncoder.upper(name)
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:4,代码来源:NameShop.py


注:本文中的pandac.PandaModules.TextEncoder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。