Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builder adds handlers ('on_touch_down', 'on_touch_up', etc) to widgets, disregarding if the method is called on the widget #1

Open
fscz opened this issue Feb 25, 2015 · 0 comments

Comments

@fscz
Copy link

fscz commented Feb 25, 2015

I think in kivy/kivy/lang.py

if rule.handlers:                                                                                                                                                                    
    rctx['hdl'].append((widget.proxy_ref, rule.handlers)) 

shoule be replaced by

    for handler in rule.handlers:
        idmap = copy(global_idmap)
        idmap.update(rctx['ids'])
        idmap['self'] = widget.proxy_ref
        if hasattr(widget.proxy_ref, handler.name):
    method = getattr(widget.proxy_ref, handler.name)
            def new_method(*args):
                method(*args)
                exec handler.value in idmap
            setattr(widget.proxy_ref, handler.name, new_method)
        else:
            def new_method(*args):
                exec handler.value in idmap
            setattr(widget.proxy_ref, handler.name, new_method)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant