{"action":"created","comment":{"url":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/comments/62833171","id":62833171,"diff_hunk":"@@ -0,0 +1,64 @@\n+# -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; -*-\n+#\n+# This program is free software; you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation version 2.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see <http://gnu.org/licenses/gpl-2.0.txt>\n+\n+import socket\n+\n+class Flaschen(object):\n+  '''A Framebuffer display interface that sends a frame via UDP.'''\n+\n+  def __init__(self, host, port, width, height, layer=0):\n+    self.host = host\n+    self.port = port\n+    self.width = width\n+    self.height = height\n+    self.layer = layer\n+    self.pixels = []\n+    for x in xrange(width):\n+      self.pixels.append([(0, 0, 0) for y in xrange(height)])\n+    self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n+\n+  def _header(self):\n+    return ''.join([\"P6\\n\",\n+                    \"45 35\\n\",\n+                    \"255\\n\"])\n+\n+  def _footer(self):\n+    return ''.join([\"0\\n\",\n+                    \"0\\n\",\n+                    \"%d\\n\" % self.layer])\n+\n+  def set(self, x, y, color, transparent=False):\n+    '''Set the pixel at the given coordinates to the specified color.\n+\n+    Args:\n+      x: x offset of the pixel to set\n+      y: y offset of the piyel to set\n+      color: A 3 tuple of (r, g, b) color values, 0-255\n+      transparent: If true, black(0, 0, 0) will be transparent and show the layer below.\n+    '''\n+    if x >= self.width or y >= self.height:\n+      return\n+    if color == (0, 0, 0) and transparent:","path":"client/flaschen.py","position":52,"original_position":52,"commit_id":"b172178ffb5adcdac75930a1901f707a67fb4b87","original_commit_id":"b172178ffb5adcdac75930a1901f707a67fb4b87","user":{"login":"hzeller","id":140937,"avatar_url":"https://avatars.githubusercontent.com/u/140937?v=3","gravatar_id":"","url":"https://api.github.com/users/hzeller","html_url":"https://github.com/hzeller","followers_url":"https://api.github.com/users/hzeller/followers","following_url":"https://api.github.com/users/hzeller/following{/other_user}","gists_url":"https://api.github.com/users/hzeller/gists{/gist_id}","starred_url":"https://api.github.com/users/hzeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzeller/subscriptions","organizations_url":"https://api.github.com/users/hzeller/orgs","repos_url":"https://api.github.com/users/hzeller/repos","events_url":"https://api.github.com/users/hzeller/events{/privacy}","received_events_url":"https://api.github.com/users/hzeller/received_events","type":"User","site_admin":false},"body":"This logic is messed up - you probably meant _not_ transparent here.","created_at":"2016-05-11T11:48:38Z","updated_at":"2016-05-11T11:48:38Z","html_url":"https://github.com/hzeller/flaschen-taschen/pull/15#discussion_r62833171","pull_request_url":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/comments/62833171"},"html":{"href":"https://github.com/hzeller/flaschen-taschen/pull/15#discussion_r62833171"},"pull_request":{"href":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/15","id":69613354,"html_url":"https://github.com/hzeller/flaschen-taschen/pull/15","diff_url":"https://github.com/hzeller/flaschen-taschen/pull/15.diff","patch_url":"https://github.com/hzeller/flaschen-taschen/pull/15.patch","issue_url":"https://api.github.com/repos/hzeller/flaschen-taschen/issues/15","number":15,"state":"open","locked":false,"title":"Add python library.","user":{"login":"scottyallen","id":73208,"avatar_url":"https://avatars.githubusercontent.com/u/73208?v=3","gravatar_id":"","url":"https://api.github.com/users/scottyallen","html_url":"https://github.com/scottyallen","followers_url":"https://api.github.com/users/scottyallen/followers","following_url":"https://api.github.com/users/scottyallen/following{/other_user}","gists_url":"https://api.github.com/users/scottyallen/gists{/gist_id}","starred_url":"https://api.github.com/users/scottyallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottyallen/subscriptions","organizations_url":"https://api.github.com/users/scottyallen/orgs","repos_url":"https://api.github.com/users/scottyallen/repos","events_url":"https://api.github.com/users/scottyallen/events{/privacy}","received_events_url":"https://api.github.com/users/scottyallen/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-11T04:23:21Z","updated_at":"2016-05-11T11:48:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1f767cadd573b6825e43e8ba3c313c7546d7bff5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/15/commits","review_comments_url":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/15/comments","review_comment_url":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hzeller/flaschen-taschen/issues/15/comments","statuses_url":"https://api.github.com/repos/hzeller/flaschen-taschen/statuses/b172178ffb5adcdac75930a1901f707a67fb4b87","head":{"label":"scottyallen:pythonlib","ref":"pythonlib","sha":"b172178ffb5adcdac75930a1901f707a67fb4b87","user":{"login":"scottyallen","id":73208,"avatar_url":"https://avatars.githubusercontent.com/u/73208?v=3","gravatar_id":"","url":"https://api.github.com/users/scottyallen","html_url":"https://github.com/scottyallen","followers_url":"https://api.github.com/users/scottyallen/followers","following_url":"https://api.github.com/users/scottyallen/following{/other_user}","gists_url":"https://api.github.com/users/scottyallen/gists{/gist_id}","starred_url":"https://api.github.com/users/scottyallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottyallen/subscriptions","organizations_url":"https://api.github.com/users/scottyallen/orgs","repos_url":"https://api.github.com/users/scottyallen/repos","events_url":"https://api.github.com/users/scottyallen/events{/privacy}","received_events_url":"https://api.github.com/users/scottyallen/received_events","type":"User","site_admin":false},"repo":{"id":58512269,"name":"flaschen-taschen","full_name":"scottyallen/flaschen-taschen","owner":{"login":"scottyallen","id":73208,"avatar_url":"https://avatars.githubusercontent.com/u/73208?v=3","gravatar_id":"","url":"https://api.github.com/users/scottyallen","html_url":"https://github.com/scottyallen","followers_url":"https://api.github.com/users/scottyallen/followers","following_url":"https://api.github.com/users/scottyallen/following{/other_user}","gists_url":"https://api.github.com/users/scottyallen/gists{/gist_id}","starred_url":"https://api.github.com/users/scottyallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottyallen/subscriptions","organizations_url":"https://api.github.com/users/scottyallen/orgs","repos_url":"https://api.github.com/users/scottyallen/repos","events_url":"https://api.github.com/users/scottyallen/events{/privacy}","received_events_url":"https://api.github.com/users/scottyallen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/scottyallen/flaschen-taschen","description":"Noisebridge Flaschen Taschen display","fork":true,"url":"https://api.github.com/repos/scottyallen/flaschen-taschen","forks_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/forks","keys_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/teams","hooks_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/hooks","issue_events_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/issues/events{/number}","events_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/events","assignees_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/assignees{/user}","branches_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/branches{/branch}","tags_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/tags","blobs_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/git/refs{/sha}","trees_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/statuses/{sha}","languages_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/languages","stargazers_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/stargazers","contributors_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/contributors","subscribers_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/subscribers","subscription_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/subscription","commits_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/commits{/sha}","git_commits_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/git/commits{/sha}","comments_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/comments{/number}","issue_comment_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/issues/comments{/number}","contents_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/contents/{+path}","compare_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/merges","archive_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/downloads","issues_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/issues{/number}","pulls_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/pulls{/number}","milestones_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/milestones{/number}","notifications_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/labels{/name}","releases_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/releases{/id}","deployments_url":"https://api.github.com/repos/scottyallen/flaschen-taschen/deployments","created_at":"2016-05-11T03:43:39Z","updated_at":"2016-05-11T03:43:44Z","pushed_at":"2016-05-11T04:23:07Z","git_url":"git://github.com/scottyallen/flaschen-taschen.git","ssh_url":"git@github.com:scottyallen/flaschen-taschen.git","clone_url":"https://github.com/scottyallen/flaschen-taschen.git","svn_url":"https://github.com/scottyallen/flaschen-taschen","homepage":null,"size":8041,"stargazers_count":0,"watchers_count":0,"language":"KiCad","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":"hzeller:master","ref":"master","sha":"9cd03255154ceac7cd8fd93a0079ab3e3348f5a1","user":{"login":"hzeller","id":140937,"avatar_url":"https://avatars.githubusercontent.com/u/140937?v=3","gravatar_id":"","url":"https://api.github.com/users/hzeller","html_url":"https://github.com/hzeller","followers_url":"https://api.github.com/users/hzeller/followers","following_url":"https://api.github.com/users/hzeller/following{/other_user}","gists_url":"https://api.github.com/users/hzeller/gists{/gist_id}","starred_url":"https://api.github.com/users/hzeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzeller/subscriptions","organizations_url":"https://api.github.com/users/hzeller/orgs","repos_url":"https://api.github.com/users/hzeller/repos","events_url":"https://api.github.com/users/hzeller/events{/privacy}","received_events_url":"https://api.github.com/users/hzeller/received_events","type":"User","site_admin":false},"repo":{"id":51235799,"name":"flaschen-taschen","full_name":"hzeller/flaschen-taschen","owner":{"login":"hzeller","id":140937,"avatar_url":"https://avatars.githubusercontent.com/u/140937?v=3","gravatar_id":"","url":"https://api.github.com/users/hzeller","html_url":"https://github.com/hzeller","followers_url":"https://api.github.com/users/hzeller/followers","following_url":"https://api.github.com/users/hzeller/following{/other_user}","gists_url":"https://api.github.com/users/hzeller/gists{/gist_id}","starred_url":"https://api.github.com/users/hzeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzeller/subscriptions","organizations_url":"https://api.github.com/users/hzeller/orgs","repos_url":"https://api.github.com/users/hzeller/repos","events_url":"https://api.github.com/users/hzeller/events{/privacy}","received_events_url":"https://api.github.com/users/hzeller/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hzeller/flaschen-taschen","description":"Noisebridge Flaschen Taschen display","fork":false,"url":"https://api.github.com/repos/hzeller/flaschen-taschen","forks_url":"https://api.github.com/repos/hzeller/flaschen-taschen/forks","keys_url":"https://api.github.com/repos/hzeller/flaschen-taschen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hzeller/flaschen-taschen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hzeller/flaschen-taschen/teams","hooks_url":"https://api.github.com/repos/hzeller/flaschen-taschen/hooks","issue_events_url":"https://api.github.com/repos/hzeller/flaschen-taschen/issues/events{/number}","events_url":"https://api.github.com/repos/hzeller/flaschen-taschen/events","assignees_url":"https://api.github.com/repos/hzeller/flaschen-taschen/assignees{/user}","branches_url":"https://api.github.com/repos/hzeller/flaschen-taschen/branches{/branch}","tags_url":"https://api.github.com/repos/hzeller/flaschen-taschen/tags","blobs_url":"https://api.github.com/repos/hzeller/flaschen-taschen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hzeller/flaschen-taschen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hzeller/flaschen-taschen/git/refs{/sha}","trees_url":"https://api.github.com/repos/hzeller/flaschen-taschen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hzeller/flaschen-taschen/statuses/{sha}","languages_url":"https://api.github.com/repos/hzeller/flaschen-taschen/languages","stargazers_url":"https://api.github.com/repos/hzeller/flaschen-taschen/stargazers","contributors_url":"https://api.github.com/repos/hzeller/flaschen-taschen/contributors","subscribers_url":"https://api.github.com/repos/hzeller/flaschen-taschen/subscribers","subscription_url":"https://api.github.com/repos/hzeller/flaschen-taschen/subscription","commits_url":"https://api.github.com/repos/hzeller/flaschen-taschen/commits{/sha}","git_commits_url":"https://api.github.com/repos/hzeller/flaschen-taschen/git/commits{/sha}","comments_url":"https://api.github.com/repos/hzeller/flaschen-taschen/comments{/number}","issue_comment_url":"https://api.github.com/repos/hzeller/flaschen-taschen/issues/comments{/number}","contents_url":"https://api.github.com/repos/hzeller/flaschen-taschen/contents/{+path}","compare_url":"https://api.github.com/repos/hzeller/flaschen-taschen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hzeller/flaschen-taschen/merges","archive_url":"https://api.github.com/repos/hzeller/flaschen-taschen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hzeller/flaschen-taschen/downloads","issues_url":"https://api.github.com/repos/hzeller/flaschen-taschen/issues{/number}","pulls_url":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls{/number}","milestones_url":"https://api.github.com/repos/hzeller/flaschen-taschen/milestones{/number}","notifications_url":"https://api.github.com/repos/hzeller/flaschen-taschen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hzeller/flaschen-taschen/labels{/name}","releases_url":"https://api.github.com/repos/hzeller/flaschen-taschen/releases{/id}","deployments_url":"https://api.github.com/repos/hzeller/flaschen-taschen/deployments","created_at":"2016-02-07T04:48:38Z","updated_at":"2016-04-29T02:42:19Z","pushed_at":"2016-05-11T04:23:22Z","git_url":"git://github.com/hzeller/flaschen-taschen.git","ssh_url":"git@github.com:hzeller/flaschen-taschen.git","clone_url":"https://github.com/hzeller/flaschen-taschen.git","svn_url":"https://github.com/hzeller/flaschen-taschen","homepage":null,"size":8092,"stargazers_count":10,"watchers_count":10,"language":"KiCad","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":1,"forks":9,"open_issues":1,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/15"},"html":{"href":"https://github.com/hzeller/flaschen-taschen/pull/15"},"issue":{"href":"https://api.github.com/repos/hzeller/flaschen-taschen/issues/15"},"comments":{"href":"https://api.github.com/repos/hzeller/flaschen-taschen/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hzeller/flaschen-taschen/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/hzeller/flaschen-taschen/statuses/b172178ffb5adcdac75930a1901f707a67fb4b87"}}}}