Browse Source

kivy i18n: test if label is already bound

283
ThomasV 9 years ago
parent
commit
a388b59bc2
  1. 3
      gui/kivy/i18n.py
  2. 3
      gui/kivy/main.kv

3
gui/kivy/i18n.py

@ -19,8 +19,7 @@ class _(str):
@staticmethod
def bind(label):
if isinstance(label.text, _):
_.observers.add(label)
_.observers.add(label)
@staticmethod
def switch_lang(lang):

3
gui/kivy/main.kv

@ -12,7 +12,8 @@
markup: True
font_name: 'Roboto'
font_size: '16sp'
on_text: _.bind(self)
bound: False
on_text: if isinstance(self.text, _) and not self.bound: self.bound = True; _.bind(self)
<TextInput>
on_focus: app._focused_widget = root

Loading…
Cancel
Save