commit a388b59bc2c765b5cfe82476bd5d2f79d77b40d5 parent 802261c8699e01f0d58967ca5655163112485b13 Author: ThomasV <thomasv@electrum.org> Date: Thu, 4 Feb 2016 13:48:40 +0100 kivy i18n: test if label is already bound Diffstat:
M | gui/kivy/i18n.py | | | 3 | +-- |
M | gui/kivy/main.kv | | | 3 | ++- |
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gui/kivy/i18n.py b/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): diff --git a/gui/kivy/main.kv b/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