mirror of https://github.com/kivy/kivy.git
- fixes issue #649, simpler alternative to pull request # 651
This commit is contained in:
parent
c3a0f48828
commit
dc70c6d359
|
@ -396,19 +396,16 @@ class LabelBase(object):
|
||||||
sz[1] + self.options['padding_y'] * 2
|
sz[1] + self.options['padding_y'] * 2
|
||||||
|
|
||||||
def _get_text(self):
|
def _get_text(self):
|
||||||
return self._text
|
try:
|
||||||
|
return self._text.decode('utf8')
|
||||||
|
except AttributeError:
|
||||||
|
# python 3 support
|
||||||
|
return str(self._text)
|
||||||
|
|
||||||
def _set_text(self, text):
|
def _set_text(self, text):
|
||||||
if text == self._text:
|
if text != self._text:
|
||||||
return
|
self._text = text
|
||||||
# try to automaticly decode unicode
|
|
||||||
try:
|
|
||||||
self._text = text.decode('utf8')
|
|
||||||
except:
|
|
||||||
try:
|
|
||||||
self._text = str(text)
|
|
||||||
except:
|
|
||||||
self._text = text
|
|
||||||
text = property(_get_text, _set_text, doc='Get/Set the text')
|
text = property(_get_text, _set_text, doc='Get/Set the text')
|
||||||
label = property(_get_text, _set_text, doc='Get/Set the text')
|
label = property(_get_text, _set_text, doc='Get/Set the text')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue