Bit of cleanup, and some fixes in the docs

This commit is contained in:
Jan Klopper 2017-06-16 14:21:58 +02:00
parent d15f225b66
commit 2fcfc6773c
2 changed files with 13 additions and 13 deletions

View file

@ -52,7 +52,7 @@ Pixels/message: 140
| byte 6 | bit 7-0 | B color value. |
| byte 7 | bit 7-0 | Alpha color value. |
## Protocol: 1 (0x01)
## Protocol: 1 (0x01) Only supported on the C server
Protocol 1 compresses the coordinates so more pixels may be send in one message. Full 24 bit colors can be used with optinal alpha.
###Header
@ -94,7 +94,7 @@ Pixels/message: 160
| byte 5 | bit 7-0 | B color value. |
| byte 6 | bit 7-0 | Alpha color value. |
## Protocol: 2 (0x02)
## Protocol: 2 (0x02) Only supported on the C server
Protocol 2 compresses the coordinates and colors so more pixels may be send in one message. Only 8 bit colors can be used with optinal alpha.
###Header
@ -136,7 +136,7 @@ Pixels/message: 280
| byte 3 | bit 3-2 | 2 bit B color value. |
| byte 3 | bit 1-0 | 2 bit alpha color value. |
## Protocol: 3 (0x03)
## Protocol: 3 (0x03) Only supported on the C server
Protocol 3 compresses the coordinates and colors so more pixels may be send in one message. Only 8 bit colors can be used with optinal alpha.
###Header
@ -160,7 +160,7 @@ Pixels/message: 373
| byte 1 | bit 7-4 | Lowest 4 bits of the Y coordinate of the pixel. |
| byte 2 | bit 7-0 | Highest 8 bits of the Y coordinate of the pixel. |
# The Autodetection system
# The Autodetection system, Only supported on the Python servers
A pixelvloed server should broadcast a package advertising its settings with the following string content

View file

@ -132,19 +132,19 @@ class Canvas(object):
pixelcount = min(((len(data)-1) / pixellength),
self.limit)
if self.debug:
print '%d pixels received, protocol V %d' % (pixelcount, protocol)
print('%d pixels received, protocol V %d' % (pixelcount, protocol))
for i in xrange(0, pixelcount):
pixel = struct.unpack_from(
packetformat,
data,
self.pixeloffset + (i*pixellength))
if self.debug:
print pixel
print(pixel)
self.Pixel(*pixel)
except Exception as error:
if self.debug:
# All exceptions will be printed, but won't result in a crash.
print error
print(error)
# indicate that we have been drawing stuff
return True
@ -158,10 +158,10 @@ class Canvas(object):
self.width/self.factor, self.height/self.factor),
('<broadcast>', DISCOVER_PORT))
if self.debug:
print 'sending discovery packet'
print('sending discovery packet')
except Exception as error:
if self.debug:
print error
print(error)
def __del__(self):
"""Clean up any sockets we created"""
@ -196,7 +196,7 @@ class PixelVloedClient(object):
self.height = servers[0]['height']
if self.debug:
print ('displaying on %(ip)s:%(port)d, %(width)d*%(height)dpx' %
print('displaying on %(ip)s:%(port)d, %(width)d*%(height)dpx' %
servers[0])
else:
self.ipaddress = ip
@ -204,7 +204,7 @@ class PixelVloedClient(object):
self.width = width
self.height = height
if self.debug:
print ('displaying on %(ipaddress)s:%(port)d, %(width)d*%(height)dpx' %
print('displaying on %(ipaddress)s:%(port)d, %(width)d*%(height)dpx' %
{'ipaddress': self.ipaddress,
'port': self.port,
'width': self.width,
@ -251,7 +251,7 @@ class PixelVloedClient(object):
'width': width,
'height': height}
foundhash[data] = True
print 'New pixelvloed screen found: %r' % newserver
print('New pixelvloed screen found: %r' % newserver)
servers.append(newserver)
if returnfirst:
return servers
@ -342,4 +342,4 @@ if __name__ == '__main__':
try:
RunServer(options)
except KeyboardInterrupt:
print 'Closing server'
print('Closing server')