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

qt: switch to PySide6 #691

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions contrib/generate-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pushd hwilib/ui
for file in *.ui
do
gen_file=ui_`echo $file| cut -d. -f1`.py
pyside2-uic $file -o $gen_file
sed -i'' -e 's/raise()/raise_()/g' $gen_file
pyside6-uic $file -o $gen_file
done
popd
16 changes: 8 additions & 8 deletions hwilib/_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
print('Could not import UI files, did you run contrib/generate-ui.sh')
exit(-1)

from PySide2.QtGui import QRegExpValidator
from PySide2.QtWidgets import QApplication, QDialog, QDialogButtonBox, QFileDialog, QLineEdit, QMessageBox, QMainWindow, QMenu
from PySide2.QtCore import QCoreApplication, QRegExp, Signal, Slot
from PySide6.QtGui import QRegularExpressionValidator
from PySide6.QtWidgets import QApplication, QDialog, QDialogButtonBox, QFileDialog, QLineEdit, QMessageBox, QMainWindow, QMenu
from PySide6.QtCore import QCoreApplication, QRegularExpression, Signal, Slot

def do_command(f, *args, **kwargs):
result = {}
Expand Down Expand Up @@ -59,7 +59,7 @@ def __init__(self, client, prompt_pin=True):
self.setWindowTitle('Send Pin')
self.client = client
self.ui.pin_lineedit.setFocus()
self.ui.pin_lineedit.setValidator(QRegExpValidator(QRegExp("[1-9]+"), None))
self.ui.pin_lineedit.setValidator(QRegularExpressionValidator(QRegularExpression("[1-9]+"), None))
self.ui.pin_lineedit.setEchoMode(QLineEdit.Password)

self.ui.p1_button.clicked.connect(self.button_clicked(1))
Expand Down Expand Up @@ -100,7 +100,7 @@ def __init__(self, client):
self.setWindowTitle('Get xpub')
self.client = client

self.ui.path_lineedit.setValidator(QRegExpValidator(QRegExp("m(/[0-9]+['Hh]?)+"), None))
self.ui.path_lineedit.setValidator(QRegularExpressionValidator(QRegularExpression("m(/[0-9]+['Hh]?)+"), None))
self.ui.path_lineedit.setFocus()
self.ui.buttonBox.button(QDialogButtonBox.Close).setAutoDefault(False)

Expand Down Expand Up @@ -186,7 +186,7 @@ def __init__(self, client):
self.setWindowTitle('Sign Message')
self.client = client

self.ui.path_lineedit.setValidator(QRegExpValidator(QRegExp("m(/[0-9]+['Hh]?)+"), None))
self.ui.path_lineedit.setValidator(QRegularExpressionValidator(QRegularExpression("m(/[0-9]+['Hh]?)+"), None))
self.ui.msg_textedit.setFocus()

self.ui.signmsg_button.clicked.connect(self.signmsg_button_clicked)
Expand All @@ -207,7 +207,7 @@ def __init__(self, client):
self.setWindowTitle('Display Address')
self.client = client

self.ui.path_lineedit.setValidator(QRegExpValidator(QRegExp("m(/[0-9]+['Hh]?)+"), None))
self.ui.path_lineedit.setValidator(QRegularExpressionValidator(QRegularExpression("m(/[0-9]+['Hh]?)+"), None))
self.ui.path_lineedit.setFocus()

self.ui.go_button.clicked.connect(self.go_button_clicked)
Expand Down Expand Up @@ -239,7 +239,7 @@ def __init__(self, opts):
self.ui.internal_checkbox.setChecked(opts['internal'])
self.ui.keypool_checkbox.setChecked(opts['keypool'])
self.ui.account_spinbox.setValue(opts['account'])
self.ui.path_lineedit.setValidator(QRegExpValidator(QRegExp(r"m(/[0-9]+['Hh]?)+/\*"), None))
self.ui.path_lineedit.setValidator(QRegularExpressionValidator(QRegExp(r"m(/[0-9]+['Hh]?)+/\*"), None))
if opts['account_used']:
self.ui.account_radio.setChecked(True)
self.ui.path_radio.setChecked(False)
Expand Down
83 changes: 61 additions & 22 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pyaes = "^1.6"
mnemonic = "~0"
typing-extensions = "^4.4"
libusb1 = ">=1.7,<4"
pyside2 = { version = "^5.14.0", optional = true, python = "<3.10" }
pyside6 = { version = ">=6.0,<7.0", optional = true }
cbor = "^1.0.0"
pyserial = "^3.5"
dataclasses = {version = "^0.8", python = ">=3.6,<3.7"}
Expand All @@ -32,7 +32,7 @@ noiseprotocol = "^0.3.1"
protobuf = "^4.23.3"

[tool.poetry.extras]
qt = ["pyside2"]
qt = ["pyside6"]

[tool.poetry.dev-dependencies]
pyinstaller = "^5.3"
Expand Down