From cd880651486638e1a0b3759e959edd95bdd5adfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Ganne?= Date: Sun, 20 Jul 2025 15:56:58 +0200 Subject: [PATCH] Fix python path, deps and modules - use discovered python bin instead of absolute - add missing freetype deps for font handling - fix python2 -> 3 compat issue in bitmap conversion --- bin/rebble | 2 +- requirements.txt | 1 + sdk.patch | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/rebble b/bin/rebble index bf2fa143..62418770 100755 --- a/bin/rebble +++ b/bin/rebble @@ -41,4 +41,4 @@ fi export PHONESIM_PATH="$PYTHONHOME/bin/pypkjs" source "$PEBBLE_PATH/.env/bin/activate" -python "$PEBBLE_PATH/pebble.py" "$@" +"$PYTHON_BIN" "$PEBBLE_PATH/pebble.py" "$@" diff --git a/requirements.txt b/requirements.txt index 36c5e206..32135b9d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,6 +27,7 @@ virtualenv==20.29.1 websocket-client==1.8.0 wheel==0.45.1 sh==2.2.1 +freetype-py==2.5.1 # custom-modified versions of libpebble2 and pypkjs for Rebble # https://github.com/richinfante/pypkjs diff --git a/sdk.patch b/sdk.patch index 55add84c..17a93c8c 100644 --- a/sdk.patch +++ b/sdk.patch @@ -505,9 +505,12 @@ index 56b0d51..3469599 100644 x = x_offset + column if (x < x_max): pixel = pixels[x] -@@ -178,9 +178,9 @@ class PebbleBitmap(object): +@@ -176,17 +176,17 @@ class PebbleBitmap(object): + + src_pixels = self._im_pixels out_pixels = [] - row_size_words = self.row_size_bytes() / 4 +- row_size_words = self.row_size_bytes() / 4 ++ row_size_words = int(self.row_size_bytes() / 4) - for row in xrange(self.y, self.y + self.h): + for row in range(self.y, self.y + self.h): @@ -517,6 +520,13 @@ index 56b0d51..3469599 100644 x_offset = self.x + column_word * 32 out_pixels.append(pack_pixels_to_bitblt_word(src_pixels[row], x_offset, + x_max)) + +- return ''.join(out_pixels) ++ return b''.join(out_pixels) + + def image_bits_color(self): + """ @@ -200,10 +200,10 @@ class PebbleBitmap(object): assert self.bitdepth is not None