{"url":"https://api.github.com/repos/open-cogsci/OpenSesame/issues/617","repository_url":"https://api.github.com/repos/open-cogsci/OpenSesame","labels_url":"https://api.github.com/repos/open-cogsci/OpenSesame/issues/617/labels{/name}","comments_url":"https://api.github.com/repos/open-cogsci/OpenSesame/issues/617/comments","events_url":"https://api.github.com/repos/open-cogsci/OpenSesame/issues/617/events","html_url":"https://github.com/open-cogsci/OpenSesame/issues/617","id":308374793,"node_id":"MDU6SXNzdWUzMDgzNzQ3OTM=","number":617,"title":"Form(focus_widget=[...]) broken with WidgetFactory","user":{"login":"wolfgangwalther","id":9132420,"node_id":"MDQ6VXNlcjkxMzI0MjA=","avatar_url":"https://avatars.githubusercontent.com/u/9132420?v=4","gravatar_id":"","url":"https://api.github.com/users/wolfgangwalther","html_url":"https://github.com/wolfgangwalther","followers_url":"https://api.github.com/users/wolfgangwalther/followers","following_url":"https://api.github.com/users/wolfgangwalther/following{/other_user}","gists_url":"https://api.github.com/users/wolfgangwalther/gists{/gist_id}","starred_url":"https://api.github.com/users/wolfgangwalther/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolfgangwalther/subscriptions","organizations_url":"https://api.github.com/users/wolfgangwalther/orgs","repos_url":"https://api.github.com/users/wolfgangwalther/repos","events_url":"https://api.github.com/users/wolfgangwalther/events{/privacy}","received_events_url":"https://api.github.com/users/wolfgangwalther/received_events","type":"User","user_view_type":"public","site_admin":false},"labels":[{"id":425538403,"node_id":"MDU6TGFiZWw0MjU1Mzg0MDM=","url":"https://api.github.com/repos/open-cogsci/OpenSesame/labels/Bug","name":"Bug","color":"FF9800","default":false,"description":null}],"state":"closed","locked":false,"assignees":[{"login":"smathot","id":594936,"node_id":"MDQ6VXNlcjU5NDkzNg==","avatar_url":"https://avatars.githubusercontent.com/u/594936?v=4","gravatar_id":"","url":"https://api.github.com/users/smathot","html_url":"https://github.com/smathot","followers_url":"https://api.github.com/users/smathot/followers","following_url":"https://api.github.com/users/smathot/following{/other_user}","gists_url":"https://api.github.com/users/smathot/gists{/gist_id}","starred_url":"https://api.github.com/users/smathot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smathot/subscriptions","organizations_url":"https://api.github.com/users/smathot/orgs","repos_url":"https://api.github.com/users/smathot/repos","events_url":"https://api.github.com/users/smathot/events{/privacy}","received_events_url":"https://api.github.com/users/smathot/received_events","type":"User","user_view_type":"public","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-03-25T18:52:30Z","updated_at":"2018-03-30T12:23:16Z","closed_at":"2018-03-30T12:23:16Z","assignee":{"login":"smathot","id":594936,"node_id":"MDQ6VXNlcjU5NDkzNg==","avatar_url":"https://avatars.githubusercontent.com/u/594936?v=4","gravatar_id":"","url":"https://api.github.com/users/smathot","html_url":"https://github.com/smathot","followers_url":"https://api.github.com/users/smathot/followers","following_url":"https://api.github.com/users/smathot/following{/other_user}","gists_url":"https://api.github.com/users/smathot/gists{/gist_id}","starred_url":"https://api.github.com/users/smathot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smathot/subscriptions","organizations_url":"https://api.github.com/users/smathot/orgs","repos_url":"https://api.github.com/users/smathot/repos","events_url":"https://api.github.com/users/smathot/events{/privacy}","received_events_url":"https://api.github.com/users/smathot/received_events","type":"User","user_view_type":"public","site_admin":false},"author_association":"CONTRIBUTOR","issue_field_values":[],"type":null,"active_lock_reason":null,"sub_issues_summary":{"total":0,"completed":0,"percent_completed":0},"issue_dependencies_summary":{"blocked_by":0,"total_blocked_by":0,"blocking":0,"total_blocking":0},"body":"Using `focus_widget` with a previously created widget on `Form._exec()` leads to:\r\n```\r\nFile \"C:\\Program Files (x86)\\OpenSesame\\lib\\site-packages\\libopensesame\\widgets\\_form.py\", line 228, in _exec\r\n    resp = coroutines[focus_widget].send(msg)\r\n KeyError: <libopensesame.widgets.widget_factory.TextInput object at 0x0EB628B0>\r\n```\r\n\r\nTest-case:\r\n```python\r\ntest = TextInput()\r\nf = Form(rows=[1], cols=[1])\r\nf.set_widget(test, (0, 0))\r\nf._exec(focus_widget=test)\r\n```\r\nPressing a key on the form crashes. (Error was only shown with the inprocess runner for me. MultiProcess runner crashed silently.)\r\n\r\nThis is because `test` is now actually a `WidgetFactory`, but the keys for the `coroutines` dict is the created `Widget` itself.\r\n\r\nA quick hack could be to return the created widget from `Form.set_widget()`, so we could use it in the inline_script to pass it to `f._exec()`.\r\n\r\nA better way to solve this could be to change the interface of `Form` to named objects similiar to `Canvas` and pass the name of the widget to `f._exec()`.","closed_by":{"login":"smathot","id":594936,"node_id":"MDQ6VXNlcjU5NDkzNg==","avatar_url":"https://avatars.githubusercontent.com/u/594936?v=4","gravatar_id":"","url":"https://api.github.com/users/smathot","html_url":"https://github.com/smathot","followers_url":"https://api.github.com/users/smathot/followers","following_url":"https://api.github.com/users/smathot/following{/other_user}","gists_url":"https://api.github.com/users/smathot/gists{/gist_id}","starred_url":"https://api.github.com/users/smathot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smathot/subscriptions","organizations_url":"https://api.github.com/users/smathot/orgs","repos_url":"https://api.github.com/users/smathot/repos","events_url":"https://api.github.com/users/smathot/events{/privacy}","received_events_url":"https://api.github.com/users/smathot/received_events","type":"User","user_view_type":"public","site_admin":false},"reactions":{"url":"https://api.github.com/repos/open-cogsci/OpenSesame/issues/617/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"timeline_url":"https://api.github.com/repos/open-cogsci/OpenSesame/issues/617/timeline","performed_via_github_app":null,"state_reason":"completed","pinned_comment":null}