{"action":"created","comment":{"url":"https://api.github.com/repos/mathics/Mathics/pulls/comments/74514895","id":74514895,"diff_hunk":"@@ -243,6 +244,16 @@ def init(self, graphics, item=None, style=None):\n \n \n class _Color(_GraphicsElement):\n+    formats = {\n+        # we are adding ImageSizeMultipliers in the rule below, because we do _not_ want color boxes to\n+        # diminish in size when they appear in lists or rows. we only want the display of colors this\n+        # way in the notebook, so we restrict the rule to StandardForm.\n+\n+        (('StandardForm', ), '%(name)s[x__]'):","path":"mathics/builtin/graphics.py","position":21,"original_position":21,"commit_id":"ddcbde24269a9ac8f2cce704a07b71f80be6832f","original_commit_id":"ddcbde24269a9ac8f2cce704a07b71f80be6832f","user":{"login":"bnjones","id":4872429,"avatar_url":"https://avatars.githubusercontent.com/u/4872429?v=3","gravatar_id":"","url":"https://api.github.com/users/bnjones","html_url":"https://github.com/bnjones","followers_url":"https://api.github.com/users/bnjones/followers","following_url":"https://api.github.com/users/bnjones/following{/other_user}","gists_url":"https://api.github.com/users/bnjones/gists{/gist_id}","starred_url":"https://api.github.com/users/bnjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnjones/subscriptions","organizations_url":"https://api.github.com/users/bnjones/orgs","repos_url":"https://api.github.com/users/bnjones/repos","events_url":"https://api.github.com/users/bnjones/events{/privacy}","received_events_url":"https://api.github.com/users/bnjones/received_events","type":"User","site_admin":false},"body":"Maybe this pattern should be more specific - something like `x__?NumericQ`? Otherwise entering a colour with symbolic components raises a box error and we don't get any output.\r\n\r\nTo make this pattern easier to write I'd suggest a separate rule mapping `RGBColor[{r,g,b}]` to `RGBColor[r,g,b]`, so you don't have to handle the list case in this pattern. If this works, the code in `_Color.init` to handle the list case could be removed.","created_at":"2016-08-11T22:23:31Z","updated_at":"2016-08-11T22:23:31Z","html_url":"https://github.com/mathics/Mathics/pull/386#discussion_r74514895","pull_request_url":"https://api.github.com/repos/mathics/Mathics/pulls/386","_links":{"self":{"href":"https://api.github.com/repos/mathics/Mathics/pulls/comments/74514895"},"html":{"href":"https://github.com/mathics/Mathics/pull/386#discussion_r74514895"},"pull_request":{"href":"https://api.github.com/repos/mathics/Mathics/pulls/386"}}},"pull_request":{"url":"https://api.github.com/repos/mathics/Mathics/pulls/386","id":70798442,"html_url":"https://github.com/mathics/Mathics/pull/386","diff_url":"https://github.com/mathics/Mathics/pull/386.diff","patch_url":"https://github.com/mathics/Mathics/pull/386.patch","issue_url":"https://api.github.com/repos/mathics/Mathics/issues/386","number":386,"state":"open","locked":false,"title":"Graphics boxes for colors","user":{"login":"poke1024","id":11859538,"avatar_url":"https://avatars.githubusercontent.com/u/11859538?v=3","gravatar_id":"","url":"https://api.github.com/users/poke1024","html_url":"https://github.com/poke1024","followers_url":"https://api.github.com/users/poke1024/followers","following_url":"https://api.github.com/users/poke1024/following{/other_user}","gists_url":"https://api.github.com/users/poke1024/gists{/gist_id}","starred_url":"https://api.github.com/users/poke1024/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poke1024/subscriptions","organizations_url":"https://api.github.com/users/poke1024/orgs","repos_url":"https://api.github.com/users/poke1024/repos","events_url":"https://api.github.com/users/poke1024/events{/privacy}","received_events_url":"https://api.github.com/users/poke1024/received_events","type":"User","site_admin":false},"body":"Adds little color boxes to colors (i.e. classes derived from `_Color`) like `RGBColor[0, 1, 1]` in `StandardForm`.\r\n\r\nThis should have been a fairly simple format change, but I ran into obstacles with my new unit test, that should be testing that `RGBColor[0, 1, 0] // StandardForm` is now `-Graphics-`.\r\n\r\nThe test case didn't work, it just ignored my `//StandardForm` direction. And this was due to some special case handling in `mathics/core/expression.py` involving `OutputForm` and `StandardForm` (that I don't understand). Disabling it (as below) fixes my new test case, but breaks two old test cases, namely: `ToBoxes[a + a]` and `StandardForm[a + b * c]`. Both of these test `StandardForm` expressions (`ToBoxes` defaults to `StandardForm` if no second parameter is given), and they failed, because their test cases expected the `Times` unicode dot symbol. I checked with MMA and I don't think `StandardForm` should have a `Times` dot symbol anywhere. So I changed these test cases to map `Times` to space in `StandardForm` which seems to be the right thing to me. On the other hand, I don't understand what's going on here with this special case I disabled.\r\n\r\nI extended `ImageSize` for `Graphics` to allow a width or a {width, height} specification, which was not possible before. The whole `xmax, xmin` handling in `mathics/builtin/graphics.py` seems quite sloppy in regard to `None` values (looks to me like they subtract None values and then return it as int), so I added an `if` there.\r\n\r\nThe change in `mathics/builtin/base.py` is just about allowing `%(name)s` in format patterns.\r\n\r\n\r\n","created_at":"2016-05-20T03:58:14Z","updated_at":"2016-08-11T22:23:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ec1f6673f2757f90e25726ffb40836546af8d8b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mathics/Mathics/pulls/386/commits","review_comments_url":"https://api.github.com/repos/mathics/Mathics/pulls/386/comments","review_comment_url":"https://api.github.com/repos/mathics/Mathics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mathics/Mathics/issues/386/comments","statuses_url":"https://api.github.com/repos/mathics/Mathics/statuses/ddcbde24269a9ac8f2cce704a07b71f80be6832f","head":{"label":"poke1024:colorgfx2","ref":"colorgfx2","sha":"ddcbde24269a9ac8f2cce704a07b71f80be6832f","user":{"login":"poke1024","id":11859538,"avatar_url":"https://avatars.githubusercontent.com/u/11859538?v=3","gravatar_id":"","url":"https://api.github.com/users/poke1024","html_url":"https://github.com/poke1024","followers_url":"https://api.github.com/users/poke1024/followers","following_url":"https://api.github.com/users/poke1024/following{/other_user}","gists_url":"https://api.github.com/users/poke1024/gists{/gist_id}","starred_url":"https://api.github.com/users/poke1024/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poke1024/subscriptions","organizations_url":"https://api.github.com/users/poke1024/orgs","repos_url":"https://api.github.com/users/poke1024/repos","events_url":"https://api.github.com/users/poke1024/events{/privacy}","received_events_url":"https://api.github.com/users/poke1024/received_events","type":"User","site_admin":false},"repo":{"id":57144589,"name":"Mathics","full_name":"poke1024/Mathics","owner":{"login":"poke1024","id":11859538,"avatar_url":"https://avatars.githubusercontent.com/u/11859538?v=3","gravatar_id":"","url":"https://api.github.com/users/poke1024","html_url":"https://github.com/poke1024","followers_url":"https://api.github.com/users/poke1024/followers","following_url":"https://api.github.com/users/poke1024/following{/other_user}","gists_url":"https://api.github.com/users/poke1024/gists{/gist_id}","starred_url":"https://api.github.com/users/poke1024/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poke1024/subscriptions","organizations_url":"https://api.github.com/users/poke1024/orgs","repos_url":"https://api.github.com/users/poke1024/repos","events_url":"https://api.github.com/users/poke1024/events{/privacy}","received_events_url":"https://api.github.com/users/poke1024/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/poke1024/Mathics","description":"a general-purpose computer algebra system","fork":true,"url":"https://api.github.com/repos/poke1024/Mathics","forks_url":"https://api.github.com/repos/poke1024/Mathics/forks","keys_url":"https://api.github.com/repos/poke1024/Mathics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/poke1024/Mathics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/poke1024/Mathics/teams","hooks_url":"https://api.github.com/repos/poke1024/Mathics/hooks","issue_events_url":"https://api.github.com/repos/poke1024/Mathics/issues/events{/number}","events_url":"https://api.github.com/repos/poke1024/Mathics/events","assignees_url":"https://api.github.com/repos/poke1024/Mathics/assignees{/user}","branches_url":"https://api.github.com/repos/poke1024/Mathics/branches{/branch}","tags_url":"https://api.github.com/repos/poke1024/Mathics/tags","blobs_url":"https://api.github.com/repos/poke1024/Mathics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/poke1024/Mathics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/poke1024/Mathics/git/refs{/sha}","trees_url":"https://api.github.com/repos/poke1024/Mathics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/poke1024/Mathics/statuses/{sha}","languages_url":"https://api.github.com/repos/poke1024/Mathics/languages","stargazers_url":"https://api.github.com/repos/poke1024/Mathics/stargazers","contributors_url":"https://api.github.com/repos/poke1024/Mathics/contributors","subscribers_url":"https://api.github.com/repos/poke1024/Mathics/subscribers","subscription_url":"https://api.github.com/repos/poke1024/Mathics/subscription","commits_url":"https://api.github.com/repos/poke1024/Mathics/commits{/sha}","git_commits_url":"https://api.github.com/repos/poke1024/Mathics/git/commits{/sha}","comments_url":"https://api.github.com/repos/poke1024/Mathics/comments{/number}","issue_comment_url":"https://api.github.com/repos/poke1024/Mathics/issues/comments{/number}","contents_url":"https://api.github.com/repos/poke1024/Mathics/contents/{+path}","compare_url":"https://api.github.com/repos/poke1024/Mathics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/poke1024/Mathics/merges","archive_url":"https://api.github.com/repos/poke1024/Mathics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/poke1024/Mathics/downloads","issues_url":"https://api.github.com/repos/poke1024/Mathics/issues{/number}","pulls_url":"https://api.github.com/repos/poke1024/Mathics/pulls{/number}","milestones_url":"https://api.github.com/repos/poke1024/Mathics/milestones{/number}","notifications_url":"https://api.github.com/repos/poke1024/Mathics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/poke1024/Mathics/labels{/name}","releases_url":"https://api.github.com/repos/poke1024/Mathics/releases{/id}","deployments_url":"https://api.github.com/repos/poke1024/Mathics/deployments","created_at":"2016-04-26T16:32:19Z","updated_at":"2016-07-27T13:49:47Z","pushed_at":"2016-08-11T03:34:16Z","git_url":"git://github.com/poke1024/Mathics.git","ssh_url":"git@github.com:poke1024/Mathics.git","clone_url":"https://github.com/poke1024/Mathics.git","svn_url":"https://github.com/poke1024/Mathics","homepage":"https://mathics.github.io","size":11076,"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":"master"}},"base":{"label":"mathics:master","ref":"master","sha":"77bc81297fb7e0957edb3377c435f15fb3c0586d","user":{"login":"mathics","id":655749,"avatar_url":"https://avatars.githubusercontent.com/u/655749?v=3","gravatar_id":"","url":"https://api.github.com/users/mathics","html_url":"https://github.com/mathics","followers_url":"https://api.github.com/users/mathics/followers","following_url":"https://api.github.com/users/mathics/following{/other_user}","gists_url":"https://api.github.com/users/mathics/gists{/gist_id}","starred_url":"https://api.github.com/users/mathics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathics/subscriptions","organizations_url":"https://api.github.com/users/mathics/orgs","repos_url":"https://api.github.com/users/mathics/repos","events_url":"https://api.github.com/users/mathics/events{/privacy}","received_events_url":"https://api.github.com/users/mathics/received_events","type":"Organization","site_admin":false},"repo":{"id":1341741,"name":"Mathics","full_name":"mathics/Mathics","owner":{"login":"mathics","id":655749,"avatar_url":"https://avatars.githubusercontent.com/u/655749?v=3","gravatar_id":"","url":"https://api.github.com/users/mathics","html_url":"https://github.com/mathics","followers_url":"https://api.github.com/users/mathics/followers","following_url":"https://api.github.com/users/mathics/following{/other_user}","gists_url":"https://api.github.com/users/mathics/gists{/gist_id}","starred_url":"https://api.github.com/users/mathics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathics/subscriptions","organizations_url":"https://api.github.com/users/mathics/orgs","repos_url":"https://api.github.com/users/mathics/repos","events_url":"https://api.github.com/users/mathics/events{/privacy}","received_events_url":"https://api.github.com/users/mathics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mathics/Mathics","description":"a general-purpose computer algebra system","fork":false,"url":"https://api.github.com/repos/mathics/Mathics","forks_url":"https://api.github.com/repos/mathics/Mathics/forks","keys_url":"https://api.github.com/repos/mathics/Mathics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mathics/Mathics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mathics/Mathics/teams","hooks_url":"https://api.github.com/repos/mathics/Mathics/hooks","issue_events_url":"https://api.github.com/repos/mathics/Mathics/issues/events{/number}","events_url":"https://api.github.com/repos/mathics/Mathics/events","assignees_url":"https://api.github.com/repos/mathics/Mathics/assignees{/user}","branches_url":"https://api.github.com/repos/mathics/Mathics/branches{/branch}","tags_url":"https://api.github.com/repos/mathics/Mathics/tags","blobs_url":"https://api.github.com/repos/mathics/Mathics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mathics/Mathics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mathics/Mathics/git/refs{/sha}","trees_url":"https://api.github.com/repos/mathics/Mathics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mathics/Mathics/statuses/{sha}","languages_url":"https://api.github.com/repos/mathics/Mathics/languages","stargazers_url":"https://api.github.com/repos/mathics/Mathics/stargazers","contributors_url":"https://api.github.com/repos/mathics/Mathics/contributors","subscribers_url":"https://api.github.com/repos/mathics/Mathics/subscribers","subscription_url":"https://api.github.com/repos/mathics/Mathics/subscription","commits_url":"https://api.github.com/repos/mathics/Mathics/commits{/sha}","git_commits_url":"https://api.github.com/repos/mathics/Mathics/git/commits{/sha}","comments_url":"https://api.github.com/repos/mathics/Mathics/comments{/number}","issue_comment_url":"https://api.github.com/repos/mathics/Mathics/issues/comments{/number}","contents_url":"https://api.github.com/repos/mathics/Mathics/contents/{+path}","compare_url":"https://api.github.com/repos/mathics/Mathics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mathics/Mathics/merges","archive_url":"https://api.github.com/repos/mathics/Mathics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mathics/Mathics/downloads","issues_url":"https://api.github.com/repos/mathics/Mathics/issues{/number}","pulls_url":"https://api.github.com/repos/mathics/Mathics/pulls{/number}","milestones_url":"https://api.github.com/repos/mathics/Mathics/milestones{/number}","notifications_url":"https://api.github.com/repos/mathics/Mathics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mathics/Mathics/labels{/name}","releases_url":"https://api.github.com/repos/mathics/Mathics/releases{/id}","deployments_url":"https://api.github.com/repos/mathics/Mathics/deployments","created_at":"2011-02-08T11:53:13Z","updated_at":"2016-08-08T16:20:16Z","pushed_at":"2016-08-11T21:36:39Z","git_url":"git://github.com/mathics/Mathics.git","ssh_url":"git@github.com:mathics/Mathics.git","clone_url":"https://github.com/mathics/Mathics.git","svn_url":"https://github.com/mathics/Mathics","homepage":"https://mathics.github.io","size":12523,"stargazers_count":1052,"watchers_count":1052,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":132,"mirror_url":null,"open_issues_count":65,"forks":132,"open_issues":65,"watchers":1052,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mathics/Mathics/pulls/386"},"html":{"href":"https://github.com/mathics/Mathics/pull/386"},"issue":{"href":"https://api.github.com/repos/mathics/Mathics/issues/386"},"comments":{"href":"https://api.github.com/repos/mathics/Mathics/issues/386/comments"},"review_comments":{"href":"https://api.github.com/repos/mathics/Mathics/pulls/386/comments"},"review_comment":{"href":"https://api.github.com/repos/mathics/Mathics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mathics/Mathics/pulls/386/commits"},"statuses":{"href":"https://api.github.com/repos/mathics/Mathics/statuses/ddcbde24269a9ac8f2cce704a07b71f80be6832f"}}}}
{"actor":{"display_login":"bnjones"}}