tb2097 / wacom-gui

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

wacom-gui 'silent' when run via a .desktop file with no tablet attached #3

Closed jcpearson closed 6 years ago

jcpearson commented 6 years ago

If wacom-gui is launched from a .desktop file as a menu item when there is no tablet attached, the "No tablet detected" error to stdout isn't seen

A simple 'fix' is to report this via something like zenity - e.g.

--- ./wacom-gui/pad.py.dist     2018-02-02 18:10:47.000000000 +0000
+++ ./wacom-gui/pad.py  2018-04-03 13:58:12.000000000 +0100
@@ -28,8 +28,9 @@ class Pad(QtGui.QWidget):
         label = ''
         if len(tablets) == 0:
             label = "No tablet detected"
+            os.system("zenity --error --title=wacom-gui --text \"%s\"" % label)
             print label
-            sys.exit()
+            sys.exit(1)
         #if len(tablets) > 1:
             # no longer checking for multiple tablets; only the first is configured
         #    label = "Multiple tablets detected. Please connect only one at a time"

(also as it's an error, the app should have a non-zero exit status)

tb2097 commented 6 years ago

Used QMessage window to keep consistent with using QT; resolving.