Porting bitmessageqt to Qt5 #1389

Open
g1itch wants to merge 34 commits from g1itch/qt5-wip into v0.6
3 changed files with 41 additions and 4 deletions
Showing only changes of commit 6864b4465a - Show all commits

View File

@ -145,7 +145,7 @@ def createSupportMessage(myapp):
opensslversion = "%s (Python internal), %s (external for PyElliptic)" % (
ssl.OPENSSL_VERSION, OpenSSL._version)
qtapi = os.environ['QT_API']
qtapi = os.environ.get('QT_API', 'fallback')
frozen = "N/A"
if paths.frozen:

View File

@ -383,9 +383,13 @@ def check_pyqt():
PyQt 4.8 or later.
"""
PeterSurda commented 2018-11-11 18:25:52 +01:00 (Migrated from github.com)
Review

These tests are wrong as they compare strings and it thinks '4.11.4' < '4.8'. You need to use

from distiutils.version import LooseVersion

and then wrap these comparisons in LooseVersion like qtpy does it.

These tests are wrong as they compare strings and it thinks '4.11.4' < '4.8'. You need to use `from distiutils.version import LooseVersion` and then wrap these comparisons in `LooseVersion` like qtpy does it.
PeterSurda commented 2018-11-11 18:26:10 +01:00 (Migrated from github.com)
Review

same problem here, should use LooseVersion

same problem here, should use `LooseVersion`
# pylint: disable=no-member
qtpy = try_import(
'qtpy',
'PyBitmessage requires qtpy, PyQt 4.8 or later and Qt 4.7 or later.')
try:
from fallback import qtpy
except ImportError:
logger.error(
'PyBitmessage requires qtpy, PyQt 4.8 or later and Qt 4.7 or later.'
)
qtpy = None
if not qtpy:
return False

View File

@ -30,3 +30,36 @@ else:
if data:
hasher.update(data)
return hasher
try:
import qtpy
except ImportError:
try:
from PyQt5 import QtCore, QtGui, QtWidgets, QtNetwork, uic
except ImportError:
qtpy = None
else:
import sys
import types
QtCore.Signal = QtCore.pyqtSignal
context = {
'API': 'pyqt5', # for tr
'PYQT_VERSION': QtCore.PYQT_VERSION_STR,
'QT_VERSION': QtCore.QT_VERSION_STR,
'QtCore': QtCore,
'QtGui': QtGui,
'QtWidgets': QtWidgets,
'QtNetwork': QtNetwork,
'uic': uic
}
try:
from PyQt5 import QtTest
except ImportError:
pass
else:
context['QtTest'] = QtTest
qtpy = types.ModuleType(
'qtpy', 'PyQt5 based dynamic fallback for qtpy')
qtpy.__dict__.update(context)
sys.modules['qtpy'] = qtpy