{"action":"created","comment":{"url":"https://api.github.com/repos/biolab/orange3/pulls/comments/46035405","id":46035405,"diff_hunk":"@@ -539,6 +539,48 @@ def progressBarFinished(self, processEvents=QEventLoop.AllEvents):\n         if processEvents is not None and processEvents is not False:\n             qApp.processEvents(processEvents)\n \n+    def progressBar(self, show_bar=True):\n+        \"\"\"\n+        Decorator and context manager for progress bar.\n+\n+        Using this decorator ensures that the progress bar is removed at the\n+        end of the with-block or at exit from function even in case of\n+        exceptions, therefore removing the need to remove the bar in\n+        `finally` blocks.\n+\n+        Usage as context handler:\n+\n+            with self.progressBar:","path":"Orange/widgets/widget.py","position":21,"original_position":21,"commit_id":"399cca99733886cf78b932ba47563163daea24d9","original_commit_id":"399cca99733886cf78b932ba47563163daea24d9","user":{"login":"kernc","id":684364,"avatar_url":"https://avatars.githubusercontent.com/u/684364?v=3","gravatar_id":"","url":"https://api.github.com/users/kernc","html_url":"https://github.com/kernc","followers_url":"https://api.github.com/users/kernc/followers","following_url":"https://api.github.com/users/kernc/following{/other_user}","gists_url":"https://api.github.com/users/kernc/gists{/gist_id}","starred_url":"https://api.github.com/users/kernc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kernc/subscriptions","organizations_url":"https://api.github.com/users/kernc/orgs","repos_url":"https://api.github.com/users/kernc/repos","events_url":"https://api.github.com/users/kernc/events{/privacy}","received_events_url":"https://api.github.com/users/kernc/received_events","type":"User","site_admin":false},"body":"The examples above make a _call_ to `self.progressBar()`.","created_at":"2015-11-27T10:40:29Z","updated_at":"2015-11-27T10:40:29Z","html_url":"https://github.com/biolab/orange3/pull/872#discussion_r46035405","pull_request_url":"https://api.github.com/repos/biolab/orange3/pulls/872","_links":{"self":{"href":"https://api.github.com/repos/biolab/orange3/pulls/comments/46035405"},"html":{"href":"https://github.com/biolab/orange3/pull/872#discussion_r46035405"},"pull_request":{"href":"https://api.github.com/repos/biolab/orange3/pulls/872"}}},"pull_request":{"url":"https://api.github.com/repos/biolab/orange3/pulls/872","id":51410670,"html_url":"https://github.com/biolab/orange3/pull/872","diff_url":"https://github.com/biolab/orange3/pull/872.diff","patch_url":"https://github.com/biolab/orange3/pull/872.patch","issue_url":"https://api.github.com/repos/biolab/orange3/issues/872","number":872,"state":"open","locked":false,"title":"Progress bar context handler and decorator","user":{"login":"janezd","id":2387315,"avatar_url":"https://avatars.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},"body":"Packs `progressBarInit` and `progressBarFinished` within a method decorator (to wrap an entire function) or context manager (to wrap individual blocks).\r\n\r\nBesides convenience, this removes the need to call `progressBarFinished` when handling exceptions and/or the opportunity to forget to call it.\r\n\r\nIf PR is accepted, this should become the preferred way of handling progress bars.","created_at":"2015-11-20T21:29:39Z","updated_at":"2015-11-27T10:40:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bef2717a55a0688f5a792b95f872d578243a5f03","assignee":{"login":"kernc","id":684364,"avatar_url":"https://avatars.githubusercontent.com/u/684364?v=3","gravatar_id":"","url":"https://api.github.com/users/kernc","html_url":"https://github.com/kernc","followers_url":"https://api.github.com/users/kernc/followers","following_url":"https://api.github.com/users/kernc/following{/other_user}","gists_url":"https://api.github.com/users/kernc/gists{/gist_id}","starred_url":"https://api.github.com/users/kernc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kernc/subscriptions","organizations_url":"https://api.github.com/users/kernc/orgs","repos_url":"https://api.github.com/users/kernc/repos","events_url":"https://api.github.com/users/kernc/events{/privacy}","received_events_url":"https://api.github.com/users/kernc/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/biolab/orange3/pulls/872/commits","review_comments_url":"https://api.github.com/repos/biolab/orange3/pulls/872/comments","review_comment_url":"https://api.github.com/repos/biolab/orange3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/biolab/orange3/issues/872/comments","statuses_url":"https://api.github.com/repos/biolab/orange3/statuses/399cca99733886cf78b932ba47563163daea24d9","head":{"label":"janezd:progress-bar-context","ref":"progress-bar-context","sha":"399cca99733886cf78b932ba47563163daea24d9","user":{"login":"janezd","id":2387315,"avatar_url":"https://avatars.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},"repo":{"id":22688172,"name":"orange3","full_name":"janezd/orange3","owner":{"login":"janezd","id":2387315,"avatar_url":"https://avatars.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},"private":false,"html_url":"https://github.com/janezd/orange3","description":"","fork":true,"url":"https://api.github.com/repos/janezd/orange3","forks_url":"https://api.github.com/repos/janezd/orange3/forks","keys_url":"https://api.github.com/repos/janezd/orange3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/janezd/orange3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/janezd/orange3/teams","hooks_url":"https://api.github.com/repos/janezd/orange3/hooks","issue_events_url":"https://api.github.com/repos/janezd/orange3/issues/events{/number}","events_url":"https://api.github.com/repos/janezd/orange3/events","assignees_url":"https://api.github.com/repos/janezd/orange3/assignees{/user}","branches_url":"https://api.github.com/repos/janezd/orange3/branches{/branch}","tags_url":"https://api.github.com/repos/janezd/orange3/tags","blobs_url":"https://api.github.com/repos/janezd/orange3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/janezd/orange3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/janezd/orange3/git/refs{/sha}","trees_url":"https://api.github.com/repos/janezd/orange3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/janezd/orange3/statuses/{sha}","languages_url":"https://api.github.com/repos/janezd/orange3/languages","stargazers_url":"https://api.github.com/repos/janezd/orange3/stargazers","contributors_url":"https://api.github.com/repos/janezd/orange3/contributors","subscribers_url":"https://api.github.com/repos/janezd/orange3/subscribers","subscription_url":"https://api.github.com/repos/janezd/orange3/subscription","commits_url":"https://api.github.com/repos/janezd/orange3/commits{/sha}","git_commits_url":"https://api.github.com/repos/janezd/orange3/git/commits{/sha}","comments_url":"https://api.github.com/repos/janezd/orange3/comments{/number}","issue_comment_url":"https://api.github.com/repos/janezd/orange3/issues/comments{/number}","contents_url":"https://api.github.com/repos/janezd/orange3/contents/{+path}","compare_url":"https://api.github.com/repos/janezd/orange3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/janezd/orange3/merges","archive_url":"https://api.github.com/repos/janezd/orange3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/janezd/orange3/downloads","issues_url":"https://api.github.com/repos/janezd/orange3/issues{/number}","pulls_url":"https://api.github.com/repos/janezd/orange3/pulls{/number}","milestones_url":"https://api.github.com/repos/janezd/orange3/milestones{/number}","notifications_url":"https://api.github.com/repos/janezd/orange3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/janezd/orange3/labels{/name}","releases_url":"https://api.github.com/repos/janezd/orange3/releases{/id}","created_at":"2014-08-06T15:40:07Z","updated_at":"2014-09-05T08:19:49Z","pushed_at":"2015-11-20T21:31:36Z","git_url":"git://github.com/janezd/orange3.git","ssh_url":"git@github.com:janezd/orange3.git","clone_url":"https://github.com/janezd/orange3.git","svn_url":"https://github.com/janezd/orange3","homepage":null,"size":34596,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"loading-your-data"}},"base":{"label":"biolab:master","ref":"master","sha":"b6af1a8aba535b6595c662b3a5d5cf83d1256658","user":{"login":"biolab","id":555189,"avatar_url":"https://avatars.githubusercontent.com/u/555189?v=3","gravatar_id":"","url":"https://api.github.com/users/biolab","html_url":"https://github.com/biolab","followers_url":"https://api.github.com/users/biolab/followers","following_url":"https://api.github.com/users/biolab/following{/other_user}","gists_url":"https://api.github.com/users/biolab/gists{/gist_id}","starred_url":"https://api.github.com/users/biolab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biolab/subscriptions","organizations_url":"https://api.github.com/users/biolab/orgs","repos_url":"https://api.github.com/users/biolab/repos","events_url":"https://api.github.com/users/biolab/events{/privacy}","received_events_url":"https://api.github.com/users/biolab/received_events","type":"Organization","site_admin":false},"repo":{"id":8357227,"name":"orange3","full_name":"biolab/orange3","owner":{"login":"biolab","id":555189,"avatar_url":"https://avatars.githubusercontent.com/u/555189?v=3","gravatar_id":"","url":"https://api.github.com/users/biolab","html_url":"https://github.com/biolab","followers_url":"https://api.github.com/users/biolab/followers","following_url":"https://api.github.com/users/biolab/following{/other_user}","gists_url":"https://api.github.com/users/biolab/gists{/gist_id}","starred_url":"https://api.github.com/users/biolab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biolab/subscriptions","organizations_url":"https://api.github.com/users/biolab/orgs","repos_url":"https://api.github.com/users/biolab/repos","events_url":"https://api.github.com/users/biolab/events{/privacy}","received_events_url":"https://api.github.com/users/biolab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/biolab/orange3","description":"Orange 3 data mining suite: http://orange.biolab.si ","fork":false,"url":"https://api.github.com/repos/biolab/orange3","forks_url":"https://api.github.com/repos/biolab/orange3/forks","keys_url":"https://api.github.com/repos/biolab/orange3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/biolab/orange3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/biolab/orange3/teams","hooks_url":"https://api.github.com/repos/biolab/orange3/hooks","issue_events_url":"https://api.github.com/repos/biolab/orange3/issues/events{/number}","events_url":"https://api.github.com/repos/biolab/orange3/events","assignees_url":"https://api.github.com/repos/biolab/orange3/assignees{/user}","branches_url":"https://api.github.com/repos/biolab/orange3/branches{/branch}","tags_url":"https://api.github.com/repos/biolab/orange3/tags","blobs_url":"https://api.github.com/repos/biolab/orange3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/biolab/orange3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/biolab/orange3/git/refs{/sha}","trees_url":"https://api.github.com/repos/biolab/orange3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/biolab/orange3/statuses/{sha}","languages_url":"https://api.github.com/repos/biolab/orange3/languages","stargazers_url":"https://api.github.com/repos/biolab/orange3/stargazers","contributors_url":"https://api.github.com/repos/biolab/orange3/contributors","subscribers_url":"https://api.github.com/repos/biolab/orange3/subscribers","subscription_url":"https://api.github.com/repos/biolab/orange3/subscription","commits_url":"https://api.github.com/repos/biolab/orange3/commits{/sha}","git_commits_url":"https://api.github.com/repos/biolab/orange3/git/commits{/sha}","comments_url":"https://api.github.com/repos/biolab/orange3/comments{/number}","issue_comment_url":"https://api.github.com/repos/biolab/orange3/issues/comments{/number}","contents_url":"https://api.github.com/repos/biolab/orange3/contents/{+path}","compare_url":"https://api.github.com/repos/biolab/orange3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/biolab/orange3/merges","archive_url":"https://api.github.com/repos/biolab/orange3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/biolab/orange3/downloads","issues_url":"https://api.github.com/repos/biolab/orange3/issues{/number}","pulls_url":"https://api.github.com/repos/biolab/orange3/pulls{/number}","milestones_url":"https://api.github.com/repos/biolab/orange3/milestones{/number}","notifications_url":"https://api.github.com/repos/biolab/orange3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/biolab/orange3/labels{/name}","releases_url":"https://api.github.com/repos/biolab/orange3/releases{/id}","created_at":"2013-02-22T12:52:56Z","updated_at":"2015-11-24T09:54:11Z","pushed_at":"2015-11-27T10:37:51Z","git_url":"git://github.com/biolab/orange3.git","ssh_url":"git@github.com:biolab/orange3.git","clone_url":"https://github.com/biolab/orange3.git","svn_url":"https://github.com/biolab/orange3","homepage":"","size":70994,"stargazers_count":149,"watchers_count":149,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":69,"mirror_url":null,"open_issues_count":36,"forks":69,"open_issues":36,"watchers":149,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/biolab/orange3/pulls/872"},"html":{"href":"https://github.com/biolab/orange3/pull/872"},"issue":{"href":"https://api.github.com/repos/biolab/orange3/issues/872"},"comments":{"href":"https://api.github.com/repos/biolab/orange3/issues/872/comments"},"review_comments":{"href":"https://api.github.com/repos/biolab/orange3/pulls/872/comments"},"review_comment":{"href":"https://api.github.com/repos/biolab/orange3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/biolab/orange3/pulls/872/commits"},"statuses":{"href":"https://api.github.com/repos/biolab/orange3/statuses/399cca99733886cf78b932ba47563163daea24d9"}}}}