Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt5 migration #40

Open
wants to merge 3 commits into
base: Python3/Qt5-build
Choose a base branch
from

Conversation

battlesnake
Copy link
Contributor

This runs with Python3 and PyQt5 now.

I'm not a Python dev and I'm not familiar with Qt, so it's probably not "correct", but it works for me™

@tb2097
Copy link
Owner

tb2097 commented Jan 13, 2020

Thanks for taking the time to look into this. From a quick overview it looks like for the most part I just need to change a few lines for imports, along with a few syntax changes that should be cross compatible with Python 2.7.
I'll try to take a look into this further to determine exactly what is needed to limit differences between a 2.7 release and a 3.x release while still allowing me to maintain both code bases.

@ssledz
Copy link

ssledz commented Aug 12, 2020

It doesn't work for me :(

virtualenv  .env
. .env/bin/activate
pip install PyQt5
python ./wacom-gui/wacom-gui.py
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 0,0,0,100'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 90,90,90,90'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 0,0,0,100'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 90,90,90,90'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 0,0,0,100'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 90,90,90,90'
could not convert string to float: '42,10.5'
./wacom-gui/wacom-gui.py:504: DeprecationWarning: an integer is required (got type float).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  self.btn_grp.addButton(self.buttons[(idx, 0)], idx)
./wacom-gui/wacom-gui.py:519: DeprecationWarning: an integer is required (got type float).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  self.buttonMapper.setMapping(self.buttons[(idx, 0)], idx)
could not convert string to float: '42,10.5'
Traceback (most recent call last):
  File "./wacom-gui/wacom-gui.py", line 745, in <module>
    main()
  File "./wacom-gui/wacom-gui.py", line 737, in main
    form = WacomGui()
  File "./wacom-gui/wacom-gui.py", line 74, in __init__
    self.refreshTablets()
  File "./wacom-gui/wacom-gui.py", line 112, in refreshTablets
    self.tabletSelect(0)
  File "./wacom-gui/wacom-gui.py", line 303, in tabletSelect
    self.setToolsAvail(idx)
  File "./wacom-gui/wacom-gui.py", line 138, in setToolsAvail
    self.tablet_data.tablets[self.dev][self.dev_id]['eraser']['id']]
KeyError: 'eraser'

@oxpa
Copy link

oxpa commented Feb 7, 2021

In stylus.py:584 the command "xsetwacom --get %s area" should be called with 'text=True' attribute. In python3 popen will return you bytes instead of a string and that will break a bunch of things (like saving to json, or calling 'split' with a charater instead of a byte sequence (https://docs.python.org/3/library/subprocess.html#subprocess.CompletedProcess.stdout).
p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
Same goes for a couple of popens inside 'toggleDisplay' function (wacom-gui.py:666 and 676)

In wacom-gui.py:505 there is a division by 4. It will return float by default. So it's better to convert to int straight away:
idx = int(self.buttons.__len__() / 4)

In hotkeys.py:209 there is a filter statement. It produces a generator which is consumed by next line and therefore the cycle below does nothing. So the filter() may be replaced with
strokes = [i for i in re.split('{|}| ', str(cmdstring)) if i]
and then everything seems to work for me.

@tb2097 tb2097 changed the base branch from master to Python3/Qt5-build July 28, 2021 16:47
@helge000 helge000 mentioned this pull request Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants