tb2097 / wacom-gui

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

Error when restoring default config when tablet doesn't have Touch support #14

Closed jcpearson closed 5 years ago

jcpearson commented 6 years ago

wacom-gui prints the following when 'Restore Default Configuration" is selected using a PTK-640 tablet:

Traceback (most recent call last):
  File "./wacom-gui.py", line 105, in restoreDefaults
    self.touch.resetDefaults()
  File "/usr/local/wacom-gui/touch.py", line 57, in resetDefaults
    if self.tabletName:
AttributeError: 'touch' object has no attribute 'tabletName'

The following patch fixes this:

--- ./wacom-gui/touch.py.orig   2018-07-24 15:42:08.000000000 +0100
+++ ./wacom-gui/touch.py        2018-07-26 16:34:49.058371533 +0100
@@ -7,6 +7,7 @@ class touch(QtGui.QWidget):
     def __init__(self, tabletName, parent=None):
         QtGui.QWidget.__init__(self, parent)
         if tabletName is None:
+            self.tabletName = tabletName
             return None
         self.tabletName = tabletName
         self.enable = None
tb2097 commented 6 years ago

I'm a bit busy this week but I'll try to address this either closer to the end of the week or next week; same with the other issues mentioned.

tb2097 commented 6 years ago

I was away from vacation for the last week; I'll be starting to look into these patches once I catch up later this week.

tb2097 commented 6 years ago

Working on other issues, but this is a better fix. It'll come out with other patches.

     def resetDefaults(self):
-        if self.tabletName:
-            self.enable = "xsetwacom --set \"" + self.tabletName + " touch\" Touch on"
-            os.popen(self.enable)
-            self.buttons.setChecked(True)
+        try:
+            if self.tabletName:
+                self.enable = "xsetwacom --set \"" + self.tabletName + " touch\" Touch on"
+                os.popen(self.enable)
+                self.buttons.setChecked(True)
+        except Exception:
+            pass
tb2097 commented 5 years ago

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