summaryrefslogtreecommitdiff
path: root/display/pclient.py
diff options
context:
space:
mode:
authorDiego Roversi <diegor@tiscali.it>2020-05-03 11:57:32 +0200
committerDiego Roversi <diegor@tiscali.it>2020-05-03 11:57:32 +0200
commit9c32edfdd54e0ad22fed09c33262f5963accfaf6 (patch)
treed06e27743c4f6e0a0add3196d045dd4361913fd3 /display/pclient.py
parent4a2a48ee144ab2389e3006e9789b50402919e53e (diff)
display: more conversion from string to bytearray
Diffstat (limited to 'display/pclient.py')
-rw-r--r--display/pclient.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/display/pclient.py b/display/pclient.py
index 9c8f9f4..25820b1 100644
--- a/display/pclient.py
+++ b/display/pclient.py
@@ -52,6 +52,8 @@ class Icon:
def clear(self):
if 'pixmap' in self.__dict__:
del self.pixmap
+ def __str__(self):
+ return f"Icon( bmpcode={self.bmpcode}, alpha={self.alpha} )"
class DataChunk(caching.Data):
SOURCEDIR = os.path.abspath(os.path.join(os.path.dirname(caching.__file__),
@@ -348,6 +350,7 @@ class Playfield:
if data.pending:
raise KeyError
data = data.read()
+ print(f"getpixmap(bmpcode = {bmpcode}) data={data[:64]} colorkey={colorkey}",file=sys.stderr)
pixmap = loadpixmap(self.dpy, data, colorkey)
self.pixmaps[bmpcode] = pixmap
return pixmap
@@ -358,7 +361,7 @@ class Playfield:
currentsounds = {}
base = 0
- while udpdata[base+4:base+6] == '\xFF\xFF':
+ while udpdata[base+4:base+6] == b'\xFF\xFF':
key, lvol, rvol = struct.unpack("!hBB", udpdata[base:base+4])
try:
snd = self.sounds[key]
@@ -476,6 +479,7 @@ class Playfield:
self.dpy.taskbar(rect)
for x, y, ico, id in icons:
try:
+ print(f"x={x} y={y} ico={ico} id={id}",file=sys.stderr)
self.dpy.putppm(x, y, ico.pixmap, ico.rect)
except KeyError:
pass
@@ -546,7 +550,7 @@ class Playfield:
setattr(self, name, None)
def udp_over_udp_decoder(self, udpdata):
- if len(udpdata) > 3 and '\x80' <= udpdata[0] < '\x90':
+ if len(udpdata) > 3 and b'\x80' <= udpdata[0] < b'\x90':
data = self.dynamic_decompress(udpdata)
if data:
self.pending_udp_data = data