tb2097 / wacom-gui

Python/PyQt Wacom GUI for KDE
GNU General Public License v3.0
134 stars 36 forks source link

Error at startup when using a Wacom Cintiq Pro 16 (DTH-1620) #15

Closed jcpearson closed 6 years ago

jcpearson commented 6 years ago

wacom-gui fails to start when using Wacom Cintiq Pro 16 (DTH-1620) - error is:

  File "./wacom-gui.py", line 318, in <module>
    main()    
  File "./wacom-gui.py", line 233, in main
    window = WacomGui()
  File "./wacom-gui.py", line 25, in __init__
    self.initUI()
  File "./wacom-gui.py", line 29, in initUI
    self.pad           = Pad()
  File "/usr/local/wacom-gui/pad.py", line 22, in __init__
    self.initUI()
  File "/usr/local/wacom-gui/pad.py", line 62, in initUI
    self.Tablet.pop(idx - count)
IndexError: pop index out of range

I'm not really sure of the logic where this happens:

    # make sure we have at least 1 tablet detected...
    if gen_idx.__len__() < self.Tablet.__len__():
        gen_idx = sorted(gen_idx)
        count = 0 
        for idx in gen_idx:
            self.Tablet.pop(idx - count)

count is set to zero - but doesn't change - so (idx - count) is just (idx) ?

I can work around the error with the following patch:

--- ./wacom-gui/pad.py.dist     2018-06-18 16:26:00.000000000 +0100
+++ ./wacom-gui/pad.py  2018-07-30 12:11:35.666138338 +0100
@@ -56,7 +56,7 @@ class Pad(QtGui.QWidget):
                         gen_idx.append(idx)
                 # make sure we have at least 1 tablet detected...
                 if gen_idx.__len__() < self.Tablet.__len__():
-                    gen_idx = sorted(gen_idx)
+                    gen_idx = sorted(gen_idx, reverse=True)
                     count = 0
                     for idx in gen_idx:
                         self.Tablet.pop(idx - count)

But that might just be papering over the real issue?

IMHO the logic for selecting the 'first' tablet to use if there are more than one seems over complicated?

In this case, there is only one tablet connected, but it reports 4 separate USB ids - and only one is a 'known' tablet device

tb2097 commented 6 years ago

Closing this issue as it is related to the 0.2.x releases and I have no plans to further maintain it.