{"action":"created","comment":{"url":"https://api.github.com/repos/metabrainz/picard/pulls/comments/60576450","id":60576450,"diff_hunk":"@@ -88,17 +102,77 @@ def _display_artwork_tab(self):\n             if image.width and image.height:\n                 infos.append(u\"%d x %d\" % (image.width, image.height))\n             infos.append(image.mimetype)\n-            item.setText(u\"\\n\".join(infos))\n-            self.ui.artwork_list.addItem(item)\n+\n+            img_wgt = self.artwork_table.get_coverart_widget(pixmap, \"\\n\".join(infos))\n+            self.artwork_table.setCellWidget(row, col, img_wgt)\n+            self.artwork_table.setItem(row, col, item)\n+            row += 1\n+\n+    def _display_artwork_type(self):\n+        \"\"\"Display image type in Type column.\n+        If both existing covers and new covers are to be displayed, take union of both cover types list.\n+        \"\"\"\n+        types = [image.types_as_string() for image in self.obj.metadata.images]\n+        if self.display_existing_artwork:\n+            existing_types = [image.types_as_string() for image in self.obj.orig_metadata.images]\n+            #Merge both types and existing types list in sorted order.\n+            #If a type is common in both types and existing_types list, append it only once.\n+            #Otherwise append type in final list according to order.\n+            temp = []\n+            i = 0\n+            j = 0\n+            while i != len(types) and j != len(existing_types):\n+                if types[i] > existing_types[j]:\n+                    temp.append(existing_types[j])\n+                    j += 1\n+                elif types[i] < existing_types[j]:\n+                    temp.append(types[i])\n+                    i += 1\n+                else:\n+                    temp.append(types[i])\n+                    i += 1\n+                    j += 1\n+            if i == len(types):\n+                temp.extend(existing_types[j:])\n+            else:\n+                temp.extend(types[i:])\n+            types = temp","path":"picard/ui/infodialog.py","position":120,"original_position":120,"commit_id":"c2a4666dc07dfb529c6a0f7b40a6ffcaa789f373","original_commit_id":"c2a4666dc07dfb529c6a0f7b40a6ffcaa789f373","user":{"login":"rahul-raturi","id":7776696,"avatar_url":"https://avatars.githubusercontent.com/u/7776696?v=3","gravatar_id":"","url":"https://api.github.com/users/rahul-raturi","html_url":"https://github.com/rahul-raturi","followers_url":"https://api.github.com/users/rahul-raturi/followers","following_url":"https://api.github.com/users/rahul-raturi/following{/other_user}","gists_url":"https://api.github.com/users/rahul-raturi/gists{/gist_id}","starred_url":"https://api.github.com/users/rahul-raturi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahul-raturi/subscriptions","organizations_url":"https://api.github.com/users/rahul-raturi/orgs","repos_url":"https://api.github.com/users/rahul-raturi/repos","events_url":"https://api.github.com/users/rahul-raturi/events{/privacy}","received_events_url":"https://api.github.com/users/rahul-raturi/received_events","type":"User","site_admin":false},"body":"This code block is supposed to take union of already sorted lists. As cover art types are already sorted before using them here, it works fine. But the lists you threw at it are unsorted, that's why.\r\n\r\n> I did few tests, and i'm not sure this code is doing what you expect in all cases, in fact i'm not even sure what it is expected here.\r\n\r\nSay, `types = [ u\"front\", u\"front\", u\"front,back\", u\"back,spine\"]` and `existing_types =  [ u\"front\", u\"front,back\", u\"back,spine\" ]`. What is expected is to take a union of these two lists. Final list should look like `union = [\"front\", \"front\", \"front,back\", \"back,spine\"]`. This list has all types present in both initial lists, so no cover image will be skipped.\r\n\r\n> Can you please take out this code to its own function, and write test cases for it ?\r\n\r\nWill do. :+1: ","created_at":"2016-04-21T13:12:48Z","updated_at":"2016-04-21T13:12:48Z","html_url":"https://github.com/metabrainz/picard/pull/467#discussion_r60576450","pull_request_url":"https://api.github.com/repos/metabrainz/picard/pulls/467","_links":{"self":{"href":"https://api.github.com/repos/metabrainz/picard/pulls/comments/60576450"},"html":{"href":"https://github.com/metabrainz/picard/pull/467#discussion_r60576450"},"pull_request":{"href":"https://api.github.com/repos/metabrainz/picard/pulls/467"}}},"pull_request":{"url":"https://api.github.com/repos/metabrainz/picard/pulls/467","id":64230666,"html_url":"https://github.com/metabrainz/picard/pull/467","diff_url":"https://github.com/metabrainz/picard/pull/467.diff","patch_url":"https://github.com/metabrainz/picard/pull/467.patch","issue_url":"https://api.github.com/repos/metabrainz/picard/issues/467","number":467,"state":"open","locked":false,"title":"PICARD-808: Display existing covers in File Info dialog","user":{"login":"rahul-raturi","id":7776696,"avatar_url":"https://avatars.githubusercontent.com/u/7776696?v=3","gravatar_id":"","url":"https://api.github.com/users/rahul-raturi","html_url":"https://github.com/rahul-raturi","followers_url":"https://api.github.com/users/rahul-raturi/followers","following_url":"https://api.github.com/users/rahul-raturi/following{/other_user}","gists_url":"https://api.github.com/users/rahul-raturi/gists{/gist_id}","starred_url":"https://api.github.com/users/rahul-raturi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahul-raturi/subscriptions","organizations_url":"https://api.github.com/users/rahul-raturi/orgs","repos_url":"https://api.github.com/users/rahul-raturi/repos","events_url":"https://api.github.com/users/rahul-raturi/events{/privacy}","received_events_url":"https://api.github.com/users/rahul-raturi/received_events","type":"User","site_admin":false},"body":"This is somewhat related to [Picard-258](http://tickets.musicbrainz.org/browse/PICARD-258), but requires user to open up the 'More Info' dialog. IMO, it would be better to display to display covers as such, than in before-after pane.   ","created_at":"2016-03-26T06:29:46Z","updated_at":"2016-04-21T13:12:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2e1644a21bd6451b7533ea594ea75e667ddaf664","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/metabrainz/picard/pulls/467/commits","review_comments_url":"https://api.github.com/repos/metabrainz/picard/pulls/467/comments","review_comment_url":"https://api.github.com/repos/metabrainz/picard/pulls/comments{/number}","comments_url":"https://api.github.com/repos/metabrainz/picard/issues/467/comments","statuses_url":"https://api.github.com/repos/metabrainz/picard/statuses/c2a4666dc07dfb529c6a0f7b40a6ffcaa789f373","head":{"label":"rahul-raturi:display_old_cover","ref":"display_old_cover","sha":"c2a4666dc07dfb529c6a0f7b40a6ffcaa789f373","user":{"login":"rahul-raturi","id":7776696,"avatar_url":"https://avatars.githubusercontent.com/u/7776696?v=3","gravatar_id":"","url":"https://api.github.com/users/rahul-raturi","html_url":"https://github.com/rahul-raturi","followers_url":"https://api.github.com/users/rahul-raturi/followers","following_url":"https://api.github.com/users/rahul-raturi/following{/other_user}","gists_url":"https://api.github.com/users/rahul-raturi/gists{/gist_id}","starred_url":"https://api.github.com/users/rahul-raturi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahul-raturi/subscriptions","organizations_url":"https://api.github.com/users/rahul-raturi/orgs","repos_url":"https://api.github.com/users/rahul-raturi/repos","events_url":"https://api.github.com/users/rahul-raturi/events{/privacy}","received_events_url":"https://api.github.com/users/rahul-raturi/received_events","type":"User","site_admin":false},"repo":{"id":48329625,"name":"picard","full_name":"rahul-raturi/picard","owner":{"login":"rahul-raturi","id":7776696,"avatar_url":"https://avatars.githubusercontent.com/u/7776696?v=3","gravatar_id":"","url":"https://api.github.com/users/rahul-raturi","html_url":"https://github.com/rahul-raturi","followers_url":"https://api.github.com/users/rahul-raturi/followers","following_url":"https://api.github.com/users/rahul-raturi/following{/other_user}","gists_url":"https://api.github.com/users/rahul-raturi/gists{/gist_id}","starred_url":"https://api.github.com/users/rahul-raturi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahul-raturi/subscriptions","organizations_url":"https://api.github.com/users/rahul-raturi/orgs","repos_url":"https://api.github.com/users/rahul-raturi/repos","events_url":"https://api.github.com/users/rahul-raturi/events{/privacy}","received_events_url":"https://api.github.com/users/rahul-raturi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rahul-raturi/picard","description":"MusicBrainz Picard","fork":true,"url":"https://api.github.com/repos/rahul-raturi/picard","forks_url":"https://api.github.com/repos/rahul-raturi/picard/forks","keys_url":"https://api.github.com/repos/rahul-raturi/picard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rahul-raturi/picard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rahul-raturi/picard/teams","hooks_url":"https://api.github.com/repos/rahul-raturi/picard/hooks","issue_events_url":"https://api.github.com/repos/rahul-raturi/picard/issues/events{/number}","events_url":"https://api.github.com/repos/rahul-raturi/picard/events","assignees_url":"https://api.github.com/repos/rahul-raturi/picard/assignees{/user}","branches_url":"https://api.github.com/repos/rahul-raturi/picard/branches{/branch}","tags_url":"https://api.github.com/repos/rahul-raturi/picard/tags","blobs_url":"https://api.github.com/repos/rahul-raturi/picard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rahul-raturi/picard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rahul-raturi/picard/git/refs{/sha}","trees_url":"https://api.github.com/repos/rahul-raturi/picard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rahul-raturi/picard/statuses/{sha}","languages_url":"https://api.github.com/repos/rahul-raturi/picard/languages","stargazers_url":"https://api.github.com/repos/rahul-raturi/picard/stargazers","contributors_url":"https://api.github.com/repos/rahul-raturi/picard/contributors","subscribers_url":"https://api.github.com/repos/rahul-raturi/picard/subscribers","subscription_url":"https://api.github.com/repos/rahul-raturi/picard/subscription","commits_url":"https://api.github.com/repos/rahul-raturi/picard/commits{/sha}","git_commits_url":"https://api.github.com/repos/rahul-raturi/picard/git/commits{/sha}","comments_url":"https://api.github.com/repos/rahul-raturi/picard/comments{/number}","issue_comment_url":"https://api.github.com/repos/rahul-raturi/picard/issues/comments{/number}","contents_url":"https://api.github.com/repos/rahul-raturi/picard/contents/{+path}","compare_url":"https://api.github.com/repos/rahul-raturi/picard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rahul-raturi/picard/merges","archive_url":"https://api.github.com/repos/rahul-raturi/picard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rahul-raturi/picard/downloads","issues_url":"https://api.github.com/repos/rahul-raturi/picard/issues{/number}","pulls_url":"https://api.github.com/repos/rahul-raturi/picard/pulls{/number}","milestones_url":"https://api.github.com/repos/rahul-raturi/picard/milestones{/number}","notifications_url":"https://api.github.com/repos/rahul-raturi/picard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rahul-raturi/picard/labels{/name}","releases_url":"https://api.github.com/repos/rahul-raturi/picard/releases{/id}","deployments_url":"https://api.github.com/repos/rahul-raturi/picard/deployments","created_at":"2015-12-20T16:57:20Z","updated_at":"2016-01-14T17:18:40Z","pushed_at":"2016-04-17T09:29:03Z","git_url":"git://github.com/rahul-raturi/picard.git","ssh_url":"git@github.com:rahul-raturi/picard.git","clone_url":"https://github.com/rahul-raturi/picard.git","svn_url":"https://github.com/rahul-raturi/picard","homepage":"http://musicbrainz.org/doc/MusicBrainz_Picard","size":21336,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"metabrainz:master","ref":"master","sha":"0a5b500d7817583db2eeda165a30f45fb537653d","user":{"login":"metabrainz","id":293421,"avatar_url":"https://avatars.githubusercontent.com/u/293421?v=3","gravatar_id":"","url":"https://api.github.com/users/metabrainz","html_url":"https://github.com/metabrainz","followers_url":"https://api.github.com/users/metabrainz/followers","following_url":"https://api.github.com/users/metabrainz/following{/other_user}","gists_url":"https://api.github.com/users/metabrainz/gists{/gist_id}","starred_url":"https://api.github.com/users/metabrainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metabrainz/subscriptions","organizations_url":"https://api.github.com/users/metabrainz/orgs","repos_url":"https://api.github.com/users/metabrainz/repos","events_url":"https://api.github.com/users/metabrainz/events{/privacy}","received_events_url":"https://api.github.com/users/metabrainz/received_events","type":"Organization","site_admin":false},"repo":{"id":2218679,"name":"picard","full_name":"metabrainz/picard","owner":{"login":"metabrainz","id":293421,"avatar_url":"https://avatars.githubusercontent.com/u/293421?v=3","gravatar_id":"","url":"https://api.github.com/users/metabrainz","html_url":"https://github.com/metabrainz","followers_url":"https://api.github.com/users/metabrainz/followers","following_url":"https://api.github.com/users/metabrainz/following{/other_user}","gists_url":"https://api.github.com/users/metabrainz/gists{/gist_id}","starred_url":"https://api.github.com/users/metabrainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metabrainz/subscriptions","organizations_url":"https://api.github.com/users/metabrainz/orgs","repos_url":"https://api.github.com/users/metabrainz/repos","events_url":"https://api.github.com/users/metabrainz/events{/privacy}","received_events_url":"https://api.github.com/users/metabrainz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/metabrainz/picard","description":"MusicBrainz Picard","fork":false,"url":"https://api.github.com/repos/metabrainz/picard","forks_url":"https://api.github.com/repos/metabrainz/picard/forks","keys_url":"https://api.github.com/repos/metabrainz/picard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/metabrainz/picard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/metabrainz/picard/teams","hooks_url":"https://api.github.com/repos/metabrainz/picard/hooks","issue_events_url":"https://api.github.com/repos/metabrainz/picard/issues/events{/number}","events_url":"https://api.github.com/repos/metabrainz/picard/events","assignees_url":"https://api.github.com/repos/metabrainz/picard/assignees{/user}","branches_url":"https://api.github.com/repos/metabrainz/picard/branches{/branch}","tags_url":"https://api.github.com/repos/metabrainz/picard/tags","blobs_url":"https://api.github.com/repos/metabrainz/picard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/metabrainz/picard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/metabrainz/picard/git/refs{/sha}","trees_url":"https://api.github.com/repos/metabrainz/picard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/metabrainz/picard/statuses/{sha}","languages_url":"https://api.github.com/repos/metabrainz/picard/languages","stargazers_url":"https://api.github.com/repos/metabrainz/picard/stargazers","contributors_url":"https://api.github.com/repos/metabrainz/picard/contributors","subscribers_url":"https://api.github.com/repos/metabrainz/picard/subscribers","subscription_url":"https://api.github.com/repos/metabrainz/picard/subscription","commits_url":"https://api.github.com/repos/metabrainz/picard/commits{/sha}","git_commits_url":"https://api.github.com/repos/metabrainz/picard/git/commits{/sha}","comments_url":"https://api.github.com/repos/metabrainz/picard/comments{/number}","issue_comment_url":"https://api.github.com/repos/metabrainz/picard/issues/comments{/number}","contents_url":"https://api.github.com/repos/metabrainz/picard/contents/{+path}","compare_url":"https://api.github.com/repos/metabrainz/picard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/metabrainz/picard/merges","archive_url":"https://api.github.com/repos/metabrainz/picard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/metabrainz/picard/downloads","issues_url":"https://api.github.com/repos/metabrainz/picard/issues{/number}","pulls_url":"https://api.github.com/repos/metabrainz/picard/pulls{/number}","milestones_url":"https://api.github.com/repos/metabrainz/picard/milestones{/number}","notifications_url":"https://api.github.com/repos/metabrainz/picard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/metabrainz/picard/labels{/name}","releases_url":"https://api.github.com/repos/metabrainz/picard/releases{/id}","deployments_url":"https://api.github.com/repos/metabrainz/picard/deployments","created_at":"2011-08-16T22:30:23Z","updated_at":"2016-04-20T17:07:56Z","pushed_at":"2016-04-17T09:29:03Z","git_url":"git://github.com/metabrainz/picard.git","ssh_url":"git@github.com:metabrainz/picard.git","clone_url":"https://github.com/metabrainz/picard.git","svn_url":"https://github.com/metabrainz/picard","homepage":"http://musicbrainz.org/doc/MusicBrainz_Picard","size":41978,"stargazers_count":707,"watchers_count":707,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":149,"mirror_url":null,"open_issues_count":22,"forks":149,"open_issues":22,"watchers":707,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/metabrainz/picard/pulls/467"},"html":{"href":"https://github.com/metabrainz/picard/pull/467"},"issue":{"href":"https://api.github.com/repos/metabrainz/picard/issues/467"},"comments":{"href":"https://api.github.com/repos/metabrainz/picard/issues/467/comments"},"review_comments":{"href":"https://api.github.com/repos/metabrainz/picard/pulls/467/comments"},"review_comment":{"href":"https://api.github.com/repos/metabrainz/picard/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/metabrainz/picard/pulls/467/commits"},"statuses":{"href":"https://api.github.com/repos/metabrainz/picard/statuses/c2a4666dc07dfb529c6a0f7b40a6ffcaa789f373"}}}}