Package: streamdeck-ui
Version: 2.0.15-1
Severity: important
Tags: patch upstream

Dear Maintainer,

after the upgrade to Debian Trixie on a machine which has a Streamdeck
attached, I noticed that the streamdeck application is not currently
working. I seems that there are multiple issues:

* When trying to start the application, I get the following error:

    Traceback (most recent call last):
      File "/usr/bin/streamdeck", line 5, in <module>
        from streamdeck_ui.gui import start
      File "/usr/lib/python3/dist-packages/streamdeck_ui/gui.py", line 12, in 
<module>
        from PySide6 import QtWidgets
    ModuleNotFoundError: No module named 'PySide6'

  So it seems like some Python module is missing, which appears to
  imply that the dependency list of the package is not complete. The
  attached patch in Update-py3dist-overrides-for-pyside6.patch should
  fix that issue.

* After manually installing the missing dependencies, the application
  starts, however, when clicking on a Streamdeck button in the UI, I get
  the following error:

    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/streamdeck_ui/gui.py", line 523, in 
<lambda>
        button.clicked.connect(lambda button=button, buttons=buttons: 
button_clicked(ui, button, buttons))
                                                                      
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/streamdeck_ui/gui.py", line 407, in 
button_clicked
        button_id = selected_button.index  # type: ignore # Index property added
                    ^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'bool' object has no attribute 'index'

  It seems like there's a library incompatibility here and that there is
  a new first, boolean parameter now. This should be fixed by the patch
  in fix-resolve-inability-to-select-buttons-in-the-ui.patch. Please
  note that this patch looks a bit different than the one from [1]
  since there have been other changes in the meantime. Also note that
  this is a different repo/project than the current upstream which
  appears to be a fork of the project/repo the current Debian package is
  built from and which was also mentioned in Debian Bug #1065001 [2],
  however, by now, it unfortunately seems a bit dormant as well [3].

* With the above patch, it is possible to select buttons. However, when
  entering a label, I get the following error:

    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/streamdeck_ui/gui.py", line 262, in 
update_button_text
        api.set_button_text(deck_id, _page(ui), selected_button.index, text)  # 
type: ignore # Index property added
        ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/streamdeck_ui/api.py", line 281, in 
set_button_text
        self.update_button_filters(deck_id, page, button)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/streamdeck_ui/api.py", line 514, in 
update_button_filters
        display_handler.replace(page, button, filters)
        ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
      File 
"/usr/lib/python3/dist-packages/streamdeck_ui/display/display_grid.py", line 
79, in replace
        filter.initialize(self.size)
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^
      File 
"/usr/lib/python3/dist-packages/streamdeck_ui/display/text_filter.py", line 43, 
in initialize
        label_w, _ = backdrop_draw.textsize(self.text, font=self.true_font)
                     ^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'ImageDraw' object has no attribute 'textsize'

  When selecting an image instead of adding a label, I get the following
  error when pressing the button on the Streamdeck afterwards:

    Exception in thread Thread-3 (_run):
    Traceback (most recent call last):
      File "/usr/lib/python3.13/threading.py", line 1043, in _bootstrap_inner
        self.run()
        ~~~~~~~~^^
      File "/usr/lib/python3.13/threading.py", line 994, in run
        self._target(*self._args, **self._kwargs)
        ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File 
"/usr/lib/python3/dist-packages/streamdeck_ui/display/display_grid.py", line 
135, in _run
        image, hashcode = pipeline.execute(current_time)
                          ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/streamdeck_ui/display/pipeline.py", 
line 35, in execute
        (image, hashcode) = current_filter.transform(
                            ~~~~~~~~~~~~~~~~~~~~~~~~^
            lambda input_image=image: input_image.copy(),  # type: ignore [misc]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        ...<2 lines>...
            time,
            ^^^^^
        )
        ^
      File 
"/usr/lib/python3/dist-packages/streamdeck_ui/display/keypress_filter.py", line 
38, in transform
        input.thumbnail((self.size[0] - 10, self.size[1] - 10), Image.ANTIALIAS)
                                                            ^^^^^^^^^^^^^^^
    AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

  Both of these issue should be fixed by the patch based on [4] in
  fix-Fix-for-Pillow-10.0.0-breaking-changes.-13.patch.

With these changes, the streamdeck application seems to work on my
machine on Debian Trixie and to support the features I'm currently
using, without throwing any errors.


Cheers,
Manfred


[1] 
https://github.com/streamdeck-linux-gui/streamdeck-linux-gui/commit/7451b9ffd686ac45faf7889715bbeec28718bcb8
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1065001
[3] https://github.com/streamdeck-linux-gui/streamdeck-linux-gui/discussions/203
[4] 
https://github.com/streamdeck-linux-gui/streamdeck-linux-gui/commit/71294789455caa5f5d51acb68f2861ba4ea34968

-- System Information:
Debian Release: 13.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.48+deb13-amd64 (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=de_CH.utf8, LC_CTYPE=de_CH.utf8 (charmap=UTF-8), LANGUAGE=de_CH:de
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages streamdeck-ui depends on:
ii  fonts-roboto-unhinted      2:0~20170802-4
ii  libhidapi-libusb0          0.14.0-1+b2
ii  python3                    3.13.5-1
ii  python3-cairosvg           2.7.1-2
ii  python3-elgato-streamdeck  0.9.1+ds-1.1
ii  python3-filetype           1.2.0-1
ii  python3-pil                11.1.0-5+b1
ii  python3-pynput             1.8.1-1
ii  python3-xlib               0.33-3

streamdeck-ui recommends no packages.

streamdeck-ui suggests no packages.

-- debconf-show failed

Attachment: Update-py3dist-overrides-for-pyside6.patch
Description: application/mbox

From: Zachary Seguin <[email protected]>
Date: Sat, 13 Apr 2024 02:06:05 -0400
Subject: fix: resolve inability to select buttons in the ui

The first argument passed to the `clicked` callback returns whether
the item is `checked` or not.
---
 streamdeck_ui/gui.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/streamdeck_ui/gui.py b/streamdeck_ui/gui.py
index b659339..a4d6dd2 100644
--- a/streamdeck_ui/gui.py
+++ b/streamdeck_ui/gui.py
@@ -520,7 +520,11 @@ def build_buttons(ui, tab) -> None:
     # Note that the button click event captures the ui variable, the current 
button
     #  and all the other buttons
     for button in buttons:
-        button.clicked.connect(lambda button=button, buttons=buttons: 
button_clicked(ui, button, buttons))
+        button.clicked.connect(
+            lambda checked=False, current_button=button, all_buttons=buttons: 
button_clicked(
+                ui, current_button, all_buttons
+            )
+        )
 
 
 def export_config(window) -> None:
From: THOMAS_THOMAS <[email protected]>
Date: Fri, 28 Jul 2023 16:35:26 +0100
Subject: fix: Fix for Pillow 10.0.0 breaking changes. (#13)

---
 streamdeck_ui/display/keypress_filter.py | 2 +-
 streamdeck_ui/display/text_filter.py     | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/streamdeck_ui/display/keypress_filter.py 
b/streamdeck_ui/display/keypress_filter.py
index 3f7f9ed..c4827ca 100644
--- a/streamdeck_ui/display/keypress_filter.py
+++ b/streamdeck_ui/display/keypress_filter.py
@@ -35,7 +35,7 @@ class KeypressFilter(Filter):
             if self.active:
                 input = get_input()
                 background = self.blank_image.copy()
-                input.thumbnail((self.size[0] - 10, self.size[1] - 10), 
Image.ANTIALIAS)
+                input.thumbnail((self.size[0] - 10, self.size[1] - 10), 
Image.LANCZOS)
                 # Reduce the image by 10px
 
                 enhancer = ImageEnhance.Brightness(input)
diff --git a/streamdeck_ui/display/text_filter.py 
b/streamdeck_ui/display/text_filter.py
index 4267438..061f358 100644
--- a/streamdeck_ui/display/text_filter.py
+++ b/streamdeck_ui/display/text_filter.py
@@ -40,14 +40,13 @@ class TextFilter(Filter):
         backdrop_draw = ImageDraw.Draw(self.image)
 
         # Calculate the height and width of the text we're drawing, using the 
font itself
-        label_w, _ = backdrop_draw.textsize(self.text, font=self.true_font)
-
+        label_w = backdrop_draw.textlength(self.text, font=self.true_font)
         # Calculate dimensions for text that include ascender (above the line)
         # and below the line  (descender) characters. This is used to adust the
         # font placement and should allow for button text to horizontally align
         # across buttons. Basically we want to figure out what is the tallest
         # text we will need to draw.
-        _, label_h = backdrop_draw.textsize("lLpgyL|", font=self.true_font)
+        _, _, _, label_h = backdrop_draw.textbbox((0, 0), "lLpgyL|", 
font=self.true_font)
 
         gap = (size[1] - 5 * label_h) // 4
 

Reply via email to