{"action":"created","issue":{"url":"https://api.github.com/repos/biolab/orange3/issues/2312","repository_url":"https://api.github.com/repos/biolab/orange3","labels_url":"https://api.github.com/repos/biolab/orange3/issues/2312/labels{/name}","comments_url":"https://api.github.com/repos/biolab/orange3/issues/2312/comments","events_url":"https://api.github.com/repos/biolab/orange3/issues/2312/events","html_url":"https://github.com/biolab/orange3/pull/2312","id":228267856,"number":2312,"title":"Move creation of widget description to widgets; Reimplement signal definition lists","user":{"login":"janezd","id":2387315,"avatar_url":"https://avatars3.githubusercontent.com/u/2387315?v=3","gravatar_id":"","url":"https://api.github.com/users/janezd","html_url":"https://github.com/janezd","followers_url":"https://api.github.com/users/janezd/followers","following_url":"https://api.github.com/users/janezd/following{/other_user}","gists_url":"https://api.github.com/users/janezd/gists{/gist_id}","starred_url":"https://api.github.com/users/janezd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janezd/subscriptions","organizations_url":"https://api.github.com/users/janezd/orgs","repos_url":"https://api.github.com/users/janezd/repos","events_url":"https://api.github.com/users/janezd/events{/privacy}","received_events_url":"https://api.github.com/users/janezd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-05-12T11:46:13Z","updated_at":"2017-05-16T08:05:44Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/biolab/orange3/pulls/2312","html_url":"https://github.com/biolab/orange3/pull/2312","diff_url":"https://github.com/biolab/orange3/pull/2312.diff","patch_url":"https://github.com/biolab/orange3/pull/2312.patch"},"body":"A different take on #2292 and #2290.\r\n\r\n## Widget discovery\r\n\r\nWidget discovery code used to search for classes with metatype `WidgetMetaClass`, and then it extracted information contained in class attributes into `WidgetDescription`. The canvas thus had to import `WidgetMetaClass` and dug into the widget's attributes.\r\n\r\nIn this PR, the widget must describe itself. Discovery searches for any class that implements `get_widget_description`, which returns a `WidgetDescription`. Signals are described with `InputSignal` and `OutputSignal`; the widget can represent them internally in any way it wants.\r\n\r\nThe idea here is that canvas knows less about widget implementation. The entire API would be (more or less) that canvas exposes descriptive classes (`WidgetDescription`, `InputSignal`, `OutputSignal`) and requires that objects driven by the canvas implement a single method (`get_widget_description`). Ideally, canvas would no longer import any widget modules or assume anything else about widgets. This would be a step towards entirely separating the canvas from widgets.\r\n\r\n## New-style Signals\r\n\r\nSignals are changed as already proposed in #2292 but without touching canvas. Signals can be declared as follows.\r\n\r\n```\r\nclass OWTestLearners:\r\n    ...\r\n    class Inputs:\r\n        train_data = Input(\"Data\", Table, default=True)\r\n        test_data = Input(\"Test Data\", Table)\r\n        learner = Input(\"Learner\", Learner, multiple=True)\r\n        preprocessor = Input(\"Preprocessor\", Preprocess)\r\n\r\n    class Outputs:\r\n        predictions = Output(\"Predictions\", Table)\r\n        evaluations_results = Output(\"Evaluation Results\", Results)\r\n```\r\n\r\nInput handlers are than marked with\r\n\r\n    @Inputs.train_data\r\n    def set_train_data(self, data):\r\n\r\nand outputs are sent by\r\n\r\n    Outputs.predictions.send(predictions)\r\n\r\nThis is convenient since we don't have to write handlers' names (as string literals); any errors doing this were however already catched in the widget's metaclass. Disadvantage: inputs are not longer listed out in the beginning. Advantage: the sole reason for looking at those lists was to find handler names (and then searching for the corresponding method). Now you can just search for \"InputSignal\".\r\n\r\nThe code is compatible with the existing code.\r\n\r\n##### Includes\r\n- [X] Code changes\r\n- [X] Tests\r\n- [x] Documentation"},"comment":{"url":"https://api.github.com/repos/biolab/orange3/issues/comments/301707185","html_url":"https://github.com/biolab/orange3/pull/2312#issuecomment-301707185","issue_url":"https://api.github.com/repos/biolab/orange3/issues/2312","id":301707185,"user":{"login":"astaric","id":588601,"avatar_url":"https://avatars3.githubusercontent.com/u/588601?v=3","gravatar_id":"","url":"https://api.github.com/users/astaric","html_url":"https://github.com/astaric","followers_url":"https://api.github.com/users/astaric/followers","following_url":"https://api.github.com/users/astaric/following{/other_user}","gists_url":"https://api.github.com/users/astaric/gists{/gist_id}","starred_url":"https://api.github.com/users/astaric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astaric/subscriptions","organizations_url":"https://api.github.com/users/astaric/orgs","repos_url":"https://api.github.com/users/astaric/repos","events_url":"https://api.github.com/users/astaric/events{/privacy}","received_events_url":"https://api.github.com/users/astaric/received_events","type":"User","site_admin":false},"created_at":"2017-05-16T08:05:44Z","updated_at":"2017-05-16T08:05:44Z","body":"@ales-erjavec, can you check if your comments have been addressed and update your review accordingly?"}}
{"actor":{"display_login":"astaric"}}