mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-10 15:30:55 +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
|
||||
|
||||
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 (
|
||||
QPushButton,
|
||||
QLineEdit,
|
||||
@ -46,6 +32,20 @@ except ImportError:
|
||||
from PyQt5.QtGui import QRegExpValidator
|
||||
from PyQt5.QtCore import QRegExp, Qt
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user