|
@@ -216,11 +216,11 @@ class DirectEntry(DirectFrame):
|
|
|
self._autoCapitalize()
|
|
self._autoCapitalize()
|
|
|
|
|
|
|
|
def _autoCapitalize(self):
|
|
def _autoCapitalize(self):
|
|
|
- name = self.get().decode('utf-8')
|
|
|
|
|
|
|
+ name = self.guiItem.getWtext()
|
|
|
# capitalize each word, allowing for things like McMutton
|
|
# capitalize each word, allowing for things like McMutton
|
|
|
- capName = ''
|
|
|
|
|
|
|
+ capName = u''
|
|
|
# track each individual word to detect prefixes like Mc
|
|
# track each individual word to detect prefixes like Mc
|
|
|
- wordSoFar = ''
|
|
|
|
|
|
|
+ wordSoFar = u''
|
|
|
# track whether the previous character was part of a word or not
|
|
# track whether the previous character was part of a word or not
|
|
|
wasNonWordChar = True
|
|
wasNonWordChar = True
|
|
|
for i, character in enumerate(name):
|
|
for i, character in enumerate(name):
|
|
@@ -229,9 +229,9 @@ class DirectEntry(DirectFrame):
|
|
|
# This assumes that string.lower and string.upper will return different
|
|
# This assumes that string.lower and string.upper will return different
|
|
|
# values for all unicode letters.
|
|
# values for all unicode letters.
|
|
|
# - Don't count apostrophes as a break between words
|
|
# - Don't count apostrophes as a break between words
|
|
|
- if character.lower() == character.upper() and character != "'":
|
|
|
|
|
|
|
+ if character.lower() == character.upper() and character != u"'":
|
|
|
# we are between words
|
|
# we are between words
|
|
|
- wordSoFar = ''
|
|
|
|
|
|
|
+ wordSoFar = u''
|
|
|
wasNonWordChar = True
|
|
wasNonWordChar = True
|
|
|
else:
|
|
else:
|
|
|
capitalize = False
|
|
capitalize = False
|
|
@@ -255,7 +255,8 @@ class DirectEntry(DirectFrame):
|
|
|
wordSoFar += character
|
|
wordSoFar += character
|
|
|
wasNonWordChar = False
|
|
wasNonWordChar = False
|
|
|
capName += character
|
|
capName += character
|
|
|
- self.enterText(capName.encode('utf-8'))
|
|
|
|
|
|
|
+ self.guiItem.setWtext(capName)
|
|
|
|
|
+ self.guiItem.setCursorPosition(self.guiItem.getNumCharacters())
|
|
|
|
|
|
|
|
def focusOutCommandFunc(self):
|
|
def focusOutCommandFunc(self):
|
|
|
if self['focusOutCommand']:
|
|
if self['focusOutCommand']:
|