Skip to content
Snippets Groups Projects
Commit b439f7fd authored by Emantor's avatar Emantor
Browse files

client: convert to python3


Conversion done by 2to3 and manual fixup afterwards.

Signed-off-by: default avatarRouven Czerwinski <rouven@czerwinskis.de>
parent 6aca2c01
No related branches found
No related tags found
1 merge request!1client: convert to python3
......@@ -9,18 +9,18 @@ SPLIT_I = 0
SPLIT = os.environ.get("SPLIT")
if SPLIT:
SPLIT = map(int, SPLIT.split('/'))
SPLIT = list(map(int, SPLIT.split('/')))
SPLIT_N = SPLIT[1]
SPLIT_I = SPLIT[0]-1
NUM_SEG_X = 96
NUM_SEG_Y = 10
PWIDTH = 5
WIDTH = PWIDTH*NUM_SEG_X/SPLIT_N
WOFFSET = WIDTH*SPLIT_I
WIDTH = int(PWIDTH*NUM_SEG_X/SPLIT_N)
WOFFSET = (WIDTH*SPLIT_I)
PHEIGHT = 7
PPAD = 5
HEIGHT = PHEIGHT*NUM_SEG_Y
HEIGHT = int(PHEIGHT*NUM_SEG_Y)
import sys
......@@ -58,7 +58,7 @@ def set_pixels(pixels):
def blit(x, y, w, h, pixels, rec=True):
x += WOFFSET
assert w*h == len(pixels)
msg = struct.pack('<Biiii', 1, x, y, w, h)+b''.join(map(chr, pixels))
msg = struct.pack('<Biiii', 1, x, y, w, h)+bytes(pixels)
socket.send_multipart([msg, b''])
if rec:
rx = socket.recv()
......@@ -100,11 +100,11 @@ def screenbuf_render():
def char_to_pixel_segment(c):
pixels = [0] * PWIDTH * PHEIGHT
if(c not in bitmapfont.FONT.keys()):
c = u"";
if(c not in list(bitmapfont.FONT.keys())):
c = "";
for x in xrange(0, PWIDTH):
for y in xrange(0, PHEIGHT):
for x in range(0, PWIDTH):
for y in range(0, PHEIGHT):
pix = (bitmapfont.FONT[c][x] & (1<<y)) >> y
pixels[y * PWIDTH + x] = pix * 255
return pixels
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment