{"action":"created","issue":{"url":"https://api.github.com/repos/hyperspy/hyperspy/issues/423","labels_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/423/labels{/name}","comments_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/423/comments","events_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/423/events","html_url":"https://github.com/hyperspy/hyperspy/pull/423","id":54341154,"number":423,"title":"General events implementation","user":{"login":"francisco-dlp","id":989719,"avatar_url":"https://avatars.githubusercontent.com/u/989719?v=3","gravatar_id":"","url":"https://api.github.com/users/francisco-dlp","html_url":"https://github.com/francisco-dlp","followers_url":"https://api.github.com/users/francisco-dlp/followers","following_url":"https://api.github.com/users/francisco-dlp/following{/other_user}","gists_url":"https://api.github.com/users/francisco-dlp/gists{/gist_id}","starred_url":"https://api.github.com/users/francisco-dlp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francisco-dlp/subscriptions","organizations_url":"https://api.github.com/users/francisco-dlp/orgs","repos_url":"https://api.github.com/users/francisco-dlp/repos","events_url":"https://api.github.com/users/francisco-dlp/events{/privacy}","received_events_url":"https://api.github.com/users/francisco-dlp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hyperspy/hyperspy/labels/New","name":"New","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/hyperspy/hyperspy/milestones/8","html_url":"https://github.com/hyperspy/hyperspy/milestones/0.9","labels_url":"https://api.github.com/repos/hyperspy/hyperspy/milestones/8/labels","id":856137,"number":8,"title":"0.9","description":"","creator":{"login":"francisco-dlp","id":989719,"avatar_url":"https://avatars.githubusercontent.com/u/989719?v=3","gravatar_id":"","url":"https://api.github.com/users/francisco-dlp","html_url":"https://github.com/francisco-dlp","followers_url":"https://api.github.com/users/francisco-dlp/followers","following_url":"https://api.github.com/users/francisco-dlp/following{/other_user}","gists_url":"https://api.github.com/users/francisco-dlp/gists{/gist_id}","starred_url":"https://api.github.com/users/francisco-dlp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francisco-dlp/subscriptions","organizations_url":"https://api.github.com/users/francisco-dlp/orgs","repos_url":"https://api.github.com/users/francisco-dlp/repos","events_url":"https://api.github.com/users/francisco-dlp/events{/privacy}","received_events_url":"https://api.github.com/users/francisco-dlp/received_events","type":"User","site_admin":false},"open_issues":52,"closed_issues":26,"state":"open","created_at":"2014-11-06T15:54:23Z","updated_at":"2015-12-10T10:49:04Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2015-01-14T16:17:29Z","updated_at":"2015-12-10T14:20:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/423","html_url":"https://github.com/hyperspy/hyperspy/pull/423","diff_url":"https://github.com/hyperspy/hyperspy/pull/423.diff","patch_url":"https://github.com/hyperspy/hyperspy/pull/423.patch"},"body":"At present some HyperSpy objects have a very primitive events implementation that is inconsistent and limiting. Given the increasing interest in implementing interactive features in HyperSpy, the time has come to get a more general event system for it.\r\n\r\nI have considered using a third party solution such as pydispatcher. However, because HyperSpy's main interface is IPython, I think that it'll better to implement our own IPython friendly events. Any opinions on this?\r\n\r\nUsage\r\n--------\r\n\r\n```python\r\n\r\n>>> from hyperspy.events import Event, Events\r\n>>> events = Events()\r\n>>> events.speak = Event()\r\n>>> def say_hi(n):\r\n...         print(\" Hi.\" * n)\r\n...     \r\n>>> def say_bye(n):\r\n...         print(\" Bye.\" * n)\r\n...     \r\n>>> events.speak.connect(say_hi)\r\n>>> events.speak.connect(say_bye)\r\n>>> events.speak.connected\r\nset([<function say_hi at 0x7f062c065758>, <function say_bye at 0x7f062c0656e0>])\r\n>>> events.speak.trigger(3)\r\n Hi. Hi. Hi.\r\n Bye. Bye. Bye.\r\n>>> events.speak.disconnect(say_hi)\r\n>>> events.speak.trigger(1)\r\n Bye.\r\n\r\n```\r\n\r\n\r\n\r\nTODO\r\n--------\r\n- [ ] unittests\r\n- [ ] docstrings\r\n- [ ] User guide\r\n- [ ] Reimplement old events using the new infraestructure. \r\n"},"comment":{"url":"https://api.github.com/repos/hyperspy/hyperspy/issues/comments/163632972","html_url":"https://github.com/hyperspy/hyperspy/pull/423#issuecomment-163632972","issue_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/423","id":163632972,"user":{"login":"vidartf","id":510760,"avatar_url":"https://avatars.githubusercontent.com/u/510760?v=3","gravatar_id":"","url":"https://api.github.com/users/vidartf","html_url":"https://github.com/vidartf","followers_url":"https://api.github.com/users/vidartf/followers","following_url":"https://api.github.com/users/vidartf/following{/other_user}","gists_url":"https://api.github.com/users/vidartf/gists{/gist_id}","starred_url":"https://api.github.com/users/vidartf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vidartf/subscriptions","organizations_url":"https://api.github.com/users/vidartf/orgs","repos_url":"https://api.github.com/users/vidartf/repos","events_url":"https://api.github.com/users/vidartf/events{/privacy}","received_events_url":"https://api.github.com/users/vidartf/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T14:20:09Z","updated_at":"2015-12-10T14:20:09Z","body":"The diff for this PR is huge. I think the state might be a bit off. Can you fix it without a rebase? If you need to rebase and force push, that's OK, but please let me know so I can rebase off this again after."}}