mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-01 12:22:34 +00:00
Fix Qt5/4 import strategy.
- Try Qt5 before Qt4. - Handle all exceptions (a ValueError is thrown if the wrong Qt was imported earlier)
This commit is contained in:
parent
3424f01ae7
commit
b4c5b996a1
@ -18,20 +18,6 @@ import math
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PyQt4.QtGui import (
|
|
||||||
QPushButton,
|
|
||||||
QLineEdit,
|
|
||||||
QSizePolicy,
|
|
||||||
QRegExpValidator,
|
|
||||||
QLabel,
|
|
||||||
QApplication,
|
|
||||||
QWidget,
|
|
||||||
QGridLayout,
|
|
||||||
QVBoxLayout,
|
|
||||||
QHBoxLayout,
|
|
||||||
)
|
|
||||||
from PyQt4.QtCore import QObject, SIGNAL, QRegExp, Qt, QT_VERSION_STR
|
|
||||||
except ImportError:
|
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QPushButton,
|
QPushButton,
|
||||||
QLineEdit,
|
QLineEdit,
|
||||||
@ -46,6 +32,20 @@ except ImportError:
|
|||||||
from PyQt5.QtGui import QRegExpValidator
|
from PyQt5.QtGui import QRegExpValidator
|
||||||
from PyQt5.QtCore import QRegExp, Qt
|
from PyQt5.QtCore import QRegExp, Qt
|
||||||
from PyQt5.Qt import QT_VERSION_STR
|
from PyQt5.Qt import QT_VERSION_STR
|
||||||
|
except Exception:
|
||||||
|
from PyQt4.QtGui import (
|
||||||
|
QPushButton,
|
||||||
|
QLineEdit,
|
||||||
|
QSizePolicy,
|
||||||
|
QRegExpValidator,
|
||||||
|
QLabel,
|
||||||
|
QApplication,
|
||||||
|
QWidget,
|
||||||
|
QGridLayout,
|
||||||
|
QVBoxLayout,
|
||||||
|
QHBoxLayout,
|
||||||
|
)
|
||||||
|
from PyQt4.QtCore import QObject, SIGNAL, QRegExp, Qt, QT_VERSION_STR
|
||||||
|
|
||||||
|
|
||||||
class PinButton(QPushButton):
|
class PinButton(QPushButton):
|
||||||
|
Loading…
Reference in New Issue
Block a user