本文整理汇总了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
示例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)
示例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')
示例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)
示例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
示例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')
示例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
示例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
示例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
示例10: match
def match(npcName, name = name):
name = TextEncoder().encodeWtext(name)
name = name.strip()
return TextEncoder.upper(npcName) == TextEncoder.upper(name)