diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/README.md b/README.md index 5f83b7f..e5dfe19 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ These instructions will help you get a copy of the project up and running on yor ### Prerequisites You will require a few packages to get this working on your system: -- PyQt4 +- PyQt5 ### Installing - Running from source diff --git a/rpmbuild/wacom-gui b/rpmbuild/wacom-gui index 5f0e8be..aeb1d73 100644 --- a/rpmbuild/wacom-gui +++ b/rpmbuild/wacom-gui @@ -2,4 +2,4 @@ script="/usr/local/wacom-gui/wacom-gui.py" -exec /usr/bin/python "$script" "$@" +exec /usr/bin/python3 "$script" "$@" diff --git a/rpmbuild/wacom-gui.spec b/rpmbuild/wacom-gui.spec index 8d66c5c..660fea4 100644 --- a/rpmbuild/wacom-gui.spec +++ b/rpmbuild/wacom-gui.spec @@ -1,48 +1,45 @@ -%global libwacom_ver 1.11 +%global libwacom_ver 2.2.0 Name: wacom-gui -Version: 0.3.1 +Version: 0.4.0 Release: rc1 -Summary: Wacom PyQt4 GUI +Summary: Wacom PyQt5 GUI License: GPLv3 BuildArch: noarch URL: https://github.com/tb2097/wacom-gui -Requires: PyQt4 -Requires: PyQt4-webkit -Requires: qtwebkit +Requires: PyQt5 +Requires: libwacom Requires: xorg-x11-server-utils Requires: xorg-x11-drv-wacom Requires: xorg-x11-xkb-utils Requires: xorg-x11-utils Requires: dconf Requires: usbutils -Requires: python +Requires: python3 Requires: systemd -BuildRequires: python -Source0: %{name}-%{version}-%{release}.tar.xz +BuildRequires: python3 +Source0: %{name}-%{version}-%{release}.tar.gz # latest libwacom source can be downloaded from https://github.com/linuxwacom/libwacom/releases/latest # this is just to get the .tablet and svg data -Source1: libwacom-%{libwacom_ver}.tar.bz2 +Source1: libwacom-%{libwacom_ver}.tar.xz Source2: wacom.desktop %description -Wacom PyQt4 GUI +Wacom PyQt5 GUI %prep -%setup -q -n %{name}-%{version}-%{release} -%setup -q -T -D -a 1 -n %{name}-%{version}-%{release} +%setup -q -n wacom-gui-master +%setup -q -T -D -a 1 -n wacom-gui-master %build cd wacom-gui rm -f *.pyc rm -f *.ui -python -m compileall . +python3 -m compileall . mv ../LICENSE . mv ../README.md . -mkdir data -cp ../libwacom-%{libwacom_ver}/data/*tablet data -cp ../libwacom-%{libwacom_ver}/data/*stylus data -mv ../libwacom-%{libwacom_ver}/data/layouts data +mv ../libwacom-%{libwacom_ver}/data . +rm -f data/Makefile.* rm -f data/layouts/Makefile.* %install @@ -67,15 +64,12 @@ install -D -m 0644 wacom-gui.service %{buildroot}/etc/systemd/system/wacom-gui.s /etc/systemd/system/wacom-gui.service #/usr/share/applications/wacom.desktop + %clean rm -rf %{buildroot} %changelog -* Tue Jul 27 2021 Ping Cheng - 0.3.1-rc1 -- Supported new devices -- Updated data and layouts files from libwacom-1.11 -- Included data and layouts files to wacom-gui.rpm * Fri Dec 07 2018 Travis Best - 0.3.0-rc13 - Fixed: minor typo in pad.py (line 83) * Tue Dec 04 2018 Travis Best - 0.3.0-rc12 diff --git a/wacom-gui/hotkeys.py b/wacom-gui/hotkeys.py index 1413fbf..9248717 100644 --- a/wacom-gui/hotkeys.py +++ b/wacom-gui/hotkeys.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # -*- coding: utf-8 -*- from PyQt5.QtCore import * @@ -204,7 +204,7 @@ def get_keystroke(self, runcmd): json.dump(self.keymap_custom, fout, sort_keys=True, indent=4, separators=(',', ": ")) def xsetcmd_gen(self, cmdstring): - strokes = filter(None, re.split('{|}| ', str(cmdstring))) + strokes = [i for i in re.split('{|}| ', str(cmdstring)) if i] self.cmd = ' '.join(strokes) xsetcmd = '' button = False diff --git a/wacom-gui/options.py b/wacom-gui/options.py index a0c5941..dc5ac2e 100644 --- a/wacom-gui/options.py +++ b/wacom-gui/options.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 from PyQt5 import QtCore, QtGui import sys @@ -146,7 +146,7 @@ def getTabletArea(self): cmd = "xdpyinfo | grep dimensions | awk '{print $2}' | awk -Fx '{print $1, $2}'" totalResolution = os.popen(cmd).read() totalResolution = totalResolution.split() - display = [[0 for x in xrange(3)] for x in xrange(3)] + display = [[0 for x in range(3)] for x in range(3)] display[2][2] = 1.0 display[0][0] = float(screen.width()) / float(totalResolution[0]) # percent of screen height diff --git a/wacom-gui/pad.py b/wacom-gui/pad.py index 9a4417e..fde727d 100644 --- a/wacom-gui/pad.py +++ b/wacom-gui/pad.py @@ -1,7 +1,7 @@ # TODO: mapping to specific -#!/usr/bin/python +#!/usr/bin/python3 # -*- coding: utf-8 -*- from PyQt5.QtCore import * diff --git a/wacom-gui/pressure.py b/wacom-gui/pressure.py index a89676a..76aea18 100644 --- a/wacom-gui/pressure.py +++ b/wacom-gui/pressure.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 #from PyQt5.QtGui import QWidget, QPolygonF, QPainter, QPen, QBrush, QColor, \ # QApplication, QIcon, QVBoxLayout, QHBoxLayout, QPushButton, QPainterPath,\ diff --git a/wacom-gui/stylus.py b/wacom-gui/stylus.py index 31f250f..d9801ed 100644 --- a/wacom-gui/stylus.py +++ b/wacom-gui/stylus.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # -*- coding: utf-8 -*- from PyQt5.QtCore import * @@ -582,7 +582,7 @@ def update_forced(self): os.popen(cmd) cmd = "xsetwacom --get %s area" % (self.sid) p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE) - output = p.communicate()[0].rstrip() + output = str(p.communicate()[0].rstrip()) self.settings['area'] = output if self.forced.isChecked(): self.settings['forcedproportion'] = 'True' diff --git a/wacom-gui/touch.py b/wacom-gui/touch.py index 6d705c7..eb2a6e8 100644 --- a/wacom-gui/touch.py +++ b/wacom-gui/touch.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 from PyQt5 import QtCore, QtGui import sys, os, re diff --git a/wacom-gui/wacom-gui.py b/wacom-gui/wacom-gui.py index fee2b60..4cfe1de 100644 --- a/wacom-gui/wacom-gui.py +++ b/wacom-gui/wacom-gui.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # -*- coding: utf-8 -*- from PyQt5.QtCore import * @@ -376,7 +376,7 @@ def updateConfigs(self): write = False if not self.toolButtons.buttons[(0, 0)].isHidden(): pad = self.pad.get_config() - if pad != self.configs[self.dev][self.config]['pad']['buttons']: + if pad != self.configs[self.dev][self.config]['pad'].get('buttons'): write = True self.configs[self.dev][self.config]['pad']['buttons'] = pad if not self.toolButtons.buttons[(1, 0)].isHidden(): @@ -507,7 +507,7 @@ def initUI(self): def addButton(self, label, wid=0, dev=0, dev_id=0, icon=None, isize=48, hide=False): select = False - idx = self.buttons.__len__() / 4 + idx = int(self.buttons.__len__() / 4) self.buttons[(idx, 0)] = QToolButton() self.btn_grp.addButton(self.buttons[(idx, 0)], idx) self.buttons[(idx, 1)] = dev