kivy i18n: test if label is already bound
This commit is contained in:
parent
802261c869
commit
a388b59bc2
|
@ -19,7 +19,6 @@ class _(str):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def bind(label):
|
def bind(label):
|
||||||
if isinstance(label.text, _):
|
|
||||||
_.observers.add(label)
|
_.observers.add(label)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
markup: True
|
markup: True
|
||||||
font_name: 'Roboto'
|
font_name: 'Roboto'
|
||||||
font_size: '16sp'
|
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>
|
<TextInput>
|
||||||
on_focus: app._focused_widget = root
|
on_focus: app._focused_widget = root
|
||||||
|
|
Loading…
Reference in New Issue