tkivy: simplify bind - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 3d42193223f89fa2ac4a26a0e4c7bf04a06e4152 DIR parent 45a0c3b53b58dd54b1118e7379521bc6acc72052 HTML Author: ThomasV <thomasv@electrum.org> Date: Thu, 4 Feb 2016 20:14:11 +0100 kivy: simplify bind Diffstat: M gui/kivy/i18n.py | 7 +------ M gui/kivy/main.kv | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) --- DIR diff --git a/gui/kivy/i18n.py b/gui/kivy/i18n.py t@@ -18,16 +18,11 @@ class _(str): return _.lang(s).format(args, kwargs) @staticmethod - def bind(label, arg): - if not isinstance(label.text, _): - return - if label.bound: - return + def bind(label): try: _.observers.add(label) except: pass - label.bound = True # garbage collection new = set() for label in _.observers: DIR diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv t@@ -13,7 +13,7 @@ font_name: 'Roboto' font_size: '16sp' bound: False - on_text: _.bind(self, args[1]) + on_text: if isinstance(self.text, _) and not self.bound: self.bound=True; _.bind(self) <TextInput> on_focus: app._focused_widget = root