Skip to content

Commit

Permalink
Py3/Qt5 for EL8
Browse files Browse the repository at this point in the history
  • Loading branch information
helge000 committed Apr 22, 2022
1 parent c56ddc8 commit 2d8671f
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rpmbuild/wacom-gui
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

script="/usr/local/wacom-gui/wacom-gui.py"

exec /usr/bin/python "$script" "$@"
exec /usr/bin/python3 "$script" "$@"
38 changes: 16 additions & 22 deletions rpmbuild/wacom-gui.spec
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 <ping.cheng@wacom.com> - 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 <tb2097> - 0.3.0-rc13
- Fixed: minor typo in pad.py (line 83)
* Tue Dec 04 2018 Travis Best <tb2097> - 0.3.0-rc12
Expand Down
4 changes: 2 additions & 2 deletions wacom-gui/hotkeys.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
# -*- coding: utf-8 -*-

from PyQt5.QtCore import *
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions wacom-gui/options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

from PyQt5 import QtCore, QtGui
import sys
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion wacom-gui/pad.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TODO: mapping to specific


#!/usr/bin/python
#!/usr/bin/python3
# -*- coding: utf-8 -*-

from PyQt5.QtCore import *
Expand Down
2 changes: 1 addition & 1 deletion wacom-gui/pressure.py
Original file line number Diff line number Diff line change
@@ -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,\
Expand Down
4 changes: 2 additions & 2 deletions wacom-gui/stylus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
# -*- coding: utf-8 -*-

from PyQt5.QtCore import *
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion wacom-gui/touch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

from PyQt5 import QtCore, QtGui
import sys, os, re
Expand Down
6 changes: 3 additions & 3 deletions wacom-gui/wacom-gui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
# -*- coding: utf-8 -*-

from PyQt5.QtCore import *
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2d8671f

Please sign in to comment.