{"action":"created","issue":{"url":"https://api.github.com/repos/kivy/kivy/issues/3673","labels_url":"https://api.github.com/repos/kivy/kivy/issues/3673/labels{/name}","comments_url":"https://api.github.com/repos/kivy/kivy/issues/3673/comments","events_url":"https://api.github.com/repos/kivy/kivy/issues/3673/events","html_url":"https://github.com/kivy/kivy/pull/3673","id":110145303,"number":3673,"title":"Add a focusable check to _on_focus","user":{"login":"ngoonee","id":135656,"avatar_url":"https://avatars.githubusercontent.com/u/135656?v=3","gravatar_id":"","url":"https://api.github.com/users/ngoonee","html_url":"https://github.com/ngoonee","followers_url":"https://api.github.com/users/ngoonee/followers","following_url":"https://api.github.com/users/ngoonee/following{/other_user}","gists_url":"https://api.github.com/users/ngoonee/gists{/gist_id}","starred_url":"https://api.github.com/users/ngoonee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngoonee/subscriptions","organizations_url":"https://api.github.com/users/ngoonee/orgs","repos_url":"https://api.github.com/users/ngoonee/repos","events_url":"https://api.github.com/users/ngoonee/events{/privacy}","received_events_url":"https://api.github.com/users/ngoonee/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-07T03:18:12Z","updated_at":"2015-10-07T05:59:53Z","closed_at":"2015-10-07T05:58:53Z","pull_request":{"url":"https://api.github.com/repos/kivy/kivy/pulls/3673","html_url":"https://github.com/kivy/kivy/pull/3673","diff_url":"https://github.com/kivy/kivy/pull/3673.diff","patch_url":"https://github.com/kivy/kivy/pull/3673.patch"},"body":"Previously this would cause stack overflow or similar by trying to focus but not being allowed to. Simply adds a check. Also including below a minimal example which works with this patch but doesn't without.\r\n\r\n#!/usr/bin/env python\r\nimport kivy\r\nfrom kivy.app import App\r\nfrom kivy.clock import Clock\r\nfrom kivy.uix.button import Button\r\nfrom kivy.uix.boxlayout import BoxLayout\r\nfrom kivy.uix.textinput import TextInput\r\n\r\n\r\nclass MyTextInput(TextInput):\r\n    def __init__(self, **kwargs):\r\n        super(MyTextInput, self).__init__(**kwargs)\r\n        self.write_tab = False\r\n        self.is_focusable = False\r\n\r\nclass TestApp(App):\r\n    def build(self):\r\n        self.box = BoxLayout()\r\n        self.box.add_widget(MyTextInput(text=\"starting text\"))\r\n        Clock.schedule_once(self.test)\r\n        return self.box\r\n\r\n    def test(self, dt):\r\n        for widget in self.box.walk():\r\n            if isinstance(widget, TextInput):\r\n                widget.focus = True\r\n                return\r\n\r\nif __name__=='__main__':\r\n    TestApp().run()"},"comment":{"url":"https://api.github.com/repos/kivy/kivy/issues/comments/146084944","html_url":"https://github.com/kivy/kivy/pull/3673#issuecomment-146084944","issue_url":"https://api.github.com/repos/kivy/kivy/issues/3673","id":146084944,"user":{"login":"ngoonee","id":135656,"avatar_url":"https://avatars.githubusercontent.com/u/135656?v=3","gravatar_id":"","url":"https://api.github.com/users/ngoonee","html_url":"https://github.com/ngoonee","followers_url":"https://api.github.com/users/ngoonee/followers","following_url":"https://api.github.com/users/ngoonee/following{/other_user}","gists_url":"https://api.github.com/users/ngoonee/gists{/gist_id}","starred_url":"https://api.github.com/users/ngoonee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngoonee/subscriptions","organizations_url":"https://api.github.com/users/ngoonee/orgs","repos_url":"https://api.github.com/users/ngoonee/repos","events_url":"https://api.github.com/users/ngoonee/events{/privacy}","received_events_url":"https://api.github.com/users/ngoonee/received_events","type":"User","site_admin":false},"created_at":"2015-10-07T05:59:53Z","updated_at":"2015-10-07T05:59:53Z","body":"You're welcome"}}