diff options
author | Diego Roversi <diegor@tiscali.it> | 2020-05-23 10:05:51 +0200 |
---|---|---|
committer | Diego Roversi <diegor@tiscali.it> | 2020-05-23 10:05:51 +0200 |
commit | 2c41e377ab7257f879840abca9305fd25c274100 (patch) | |
tree | e0760281aff75f297aae75474fda0224edff206c /display | |
parent | 81c86067960952f0ec87a035ce060da584e05df3 (diff) |
more string to bytearray conversion
Diffstat (limited to 'display')
-rw-r--r-- | display/modes.py | 24 | ||||
-rw-r--r-- | display/pclient.py | 10 |
2 files changed, 18 insertions, 16 deletions
diff --git a/display/modes.py b/display/modes.py index c43638d..caadfcb 100644 --- a/display/modes.py +++ b/display/modes.py @@ -13,8 +13,8 @@ class BaseDisplay: def taskbar(self, s): (x, y, w, h) = s if self.__taskbkgnd is None: - pixel = "\x00\x00\x80" - hole = "\x01\x01\x01" + pixel = b"\x00\x00\x80" + hole = b"\x01\x01\x01" self.__taskbkgnd = self.pixmap(32, 32, ((pixel+hole)*16 + (hole+pixel)*16) * 16, 0x010101) for j in range(y, y+h, 32): @@ -105,12 +105,12 @@ class SoundMode(Mode): def graphicmodeslist(): return [ - GraphicMode('X', 'XWindow (Linux/Unix)', - ['--shm=yes use the Shared Memory extension (default)', - '--shm=no disable it (for remote connections or old X servers)', - ], - {'shm': 'yes'}), - GraphicMode('windows', 'MS Windows', []), +# GraphicMode('X', 'XWindow (Linux/Unix)', +# ['--shm=yes use the Shared Memory extension (default)', +# '--shm=no disable it (for remote connections or old X servers)', +# ], +# {'shm': 'yes'}), +# GraphicMode('windows', 'MS Windows', []), GraphicMode('pygame', 'PyGame library (all platforms)', ['--fullscreen=yes go full screen (Esc key to exit)', '--transparency=yes slightly transparent bubbles (default)', @@ -121,10 +121,10 @@ def graphicmodeslist(): {'transparency': 'yes', 'fullscreen': 'no', 'zoom': '100', 'smooth': 'yes', 'smoothfast': 'no'}, url='http://www.pygame.org'), - GraphicMode('gtk', 'PyGTK (Gnome)', - ['--zoom=xxx% scale image by xxx %'], - {'zoom': '100'}, - url='http://www.pygtk.org/'), +# GraphicMode('gtk', 'PyGTK (Gnome)', +# ['--zoom=xxx% scale image by xxx %'], +# {'zoom': '100'}, +# url='http://www.pygtk.org/'), ] def soundmodeslist(): diff --git a/display/pclient.py b/display/pclient.py index 25820b1..b8650f6 100644 --- a/display/pclient.py +++ b/display/pclient.py @@ -226,7 +226,7 @@ class Playfield: raise break self.udpbytecounter += len(udpdata) - if len(udpdata) > 3 and '\x80' <= udpdata[0] < '\x90': + if len(udpdata) > 3 and 0x80 <= udpdata[0] < 0x90: udpdata = self.dynamic_decompress(udpdata) if udpdata is not None: udpdata1 = udpdata @@ -248,7 +248,7 @@ class Playfield: self.update_sprites(udpdata) if self.pending_udp_data: self.update_sprites(self.pending_udp_data) - self.pending_udp_data = '' + self.pending_udp_data = b'' erasetb = self.taskbarmode and self.draw_taskbar() d = self.dpy.flip() if d: @@ -345,12 +345,14 @@ class Playfield: except KeyError: data, colorkey = self.bitmaps[bmpcode] if type(data) is type(''): + raise Exception('data should be bytes, not str') + if type(data) is type(b''): data = zlib.decompress(data) else: if data.pending: raise KeyError data = data.read() - print(f"getpixmap(bmpcode = {bmpcode}) data={data[:64]} colorkey={colorkey}",file=sys.stderr) + ## DEBUG 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 @@ -713,7 +715,7 @@ class Playfield: ico.alpha = alpha def msg_def_bitmap(self, bmpcode, data, colorkey=None, *rest): - if type(data) is not type(''): + if type(data) is not type(b''): data = self.fileids[data] self.bitmaps[bmpcode] = data, colorkey |