Merge branch 'v0.6' into qt5-wip #2237

Open
kashikoibumi wants to merge 38 commits from kashikoibumi/qt5-wip into v0.6
28 changed files with 62 additions and 113 deletions
Showing only changes of commit 4cd0df7299 - Show all commits

View File

@ -216,8 +216,7 @@ autodoc_mock_imports = [
'pkg_resources',
'pycanberra',
'pyopencl',
'PyQt4',
'PyQt5',
'qtpy',
'qrcode',
'stem',
'xdg',

View File

@ -16,7 +16,7 @@ import time
from datetime import datetime, timedelta
from sqlite3 import register_adapter
from PyQt5 import QtCore, QtGui, QtWidgets, QtNetwork
from qtpy import QtCore, QtGui, QtWidgets, QtNetwork
import dialogs
import helper_addressbook
@ -1442,7 +1442,7 @@ class MyForm(settingsmixin.SMainWindow):
self._theme_player = get_plugin('notification.sound', 'theme')
try:
from PyQt5 import QtMultimedia
from qtpy import QtMultimedia
self._player = QtMultimedia.QSound.play
except ImportError:
_plugin = get_plugin(

View File

@ -6,7 +6,7 @@ Dialogs that work with BM address.
import hashlib
from PyQt5 import QtGui, QtWidgets
from qtpy import QtGui, QtWidgets
import queues
import widgets

View File

@ -6,7 +6,7 @@ used in `.dialogs.NewChanDialog`.
from Queue import Empty
from PyQt5 import QtGui
from qtpy import QtGui
from addresses import decodeAddress, addBMIfNotPresent
from bmconfigparser import config

View File

@ -7,7 +7,7 @@
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
from qtpy import QtCore
qt_resource_data = "\
\x00\x00\x03\x66\

View File

@ -1,7 +1,7 @@
# pylint: skip-file
# flake8: noqa
from PyQt5 import QtCore, QtGui, QtWidgets
from qtpy import QtCore, QtGui, QtWidgets
from tr import _translate
from bmconfigparser import config
from foldertree import AddressBookCompleter

View File

@ -1,4 +1,4 @@
from PyQt5 import QtCore, QtGui, QtWidgets
from qtpy import QtCore, QtGui, QtWidgets
import widgets
from addresses import addBMIfNotPresent

View File

@ -3,7 +3,7 @@ All dialogs are available in this module.
"""
# pylint: disable=too-few-public-methods
from PyQt5 import QtWidgets
from qtpy import QtWidgets
import paths
import widgets

View File

@ -6,7 +6,7 @@ Folder tree and messagelist widgets definitions.
from cgi import escape
from PyQt5 import QtCore, QtGui, QtWidgets
from qtpy import QtCore, QtGui, QtWidgets
from bmconfigparser import config
from helper_sql import sqlExecute, sqlQuery

View File

@ -3,7 +3,7 @@
import glob
import os
from PyQt5 import QtCore, QtWidgets
from qtpy import QtCore, QtWidgets
import paths
from bmconfigparser import config

View File

@ -1,6 +1,6 @@
"""The MessageCompose class definition"""
from PyQt5 import QtCore, QtWidgets
from qtpy import QtCore, QtWidgets
from tr import _translate

View File

@ -4,7 +4,7 @@ text rendering, HTML sanitization, lazy rendering (as you scroll down),
zoom and URL click warning popup.
"""
from PyQt5 import QtCore, QtGui, QtWidgets
from qtpy import QtCore, QtGui, QtWidgets
from safehtmlparser import SafeHTMLParser
from tr import _translate

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python2.7
from PyQt5 import QtCore, QtWidgets
from qtpy import QtCore, QtWidgets
class MigrationWizardIntroPage(QtWidgets.QWizardPage):
def __init__(self):

View File

@ -4,7 +4,7 @@ Network status tab widget definition.
import time
from PyQt5 import QtCore, QtGui, QtWidgets
from qtpy import QtCore, QtGui, QtWidgets
import l10n
import network.stats

View File

@ -2,7 +2,7 @@
NewChanDialog class definition
"""
from PyQt5 import QtCore, QtWidgets
from qtpy import QtCore, QtWidgets
import widgets
from addresses import addBMIfNotPresent

View File

@ -1,4 +1,4 @@
from PyQt5 import QtWidgets
from qtpy import QtWidgets
import widgets

View File

@ -7,7 +7,7 @@ import os
import sys
import tempfile
from PyQt5 import QtCore, QtGui, QtWidgets
from qtpy import QtCore, QtGui, QtWidgets
import six
import debug

View File

@ -4,7 +4,7 @@ src/settingsmixin.py
"""
from PyQt5 import QtCore, QtWidgets
from qtpy import QtCore, QtWidgets
class SettingsMixin(object):

View File

@ -2,7 +2,7 @@
from time import time
from PyQt5 import QtWidgets
from qtpy import QtWidgets
class BMStatusBar(QtWidgets.QStatusBar):

View File

@ -4,7 +4,7 @@ import Queue
import sys
import unittest
from PyQt5 import QtCore, QtWidgets
from qtpy import QtCore, QtWidgets
from six import string_types
import bitmessageqt

View File

@ -1,6 +1,6 @@
import sys
from PyQt5 import QtCore
from qtpy import QtCore
import queues
from network.node import Peer

View File

@ -1,7 +1,7 @@
import hashlib
import os
from PyQt5 import QtGui
from qtpy import QtGui
import state
from addresses import addBMIfNotPresent

View File

@ -1,4 +1,4 @@
from PyQt5 import uic
from qtpy import uic
import os.path
import paths

View File

@ -69,8 +69,8 @@ PACKAGES = {
"description":
"You only need qtpy if you want to use the GUI."
" When only running as a daemon, this can be skipped.\n"
"Also maybe you need to install PyQt5 if your package manager"
" not installs it as qtpy dependency"
"Also maybe you need to install PyQt5 or PyQt4"
" if your package manager not installs it as qtpy dependency"
},
"msgpack": {
"OpenBSD": "py-msgpack",
@ -381,34 +381,47 @@ def check_curses():
def check_pyqt():
"""Do pyqt dependency check.
Here we are checking for PyQt4 with its version, as for it require
Here we are checking for qtpy with its version, as for it require
PyQt 4.8 or later.
"""
# pylint: disable=no-member
try:
from fallback import PyQt5
import qtpy
except ImportError:
logger.error(
'PyBitmessage requires PyQt5 or qtpy, PyQt 4.8 or later'
' and Qt 4.7 or later.')
PyQt5 = None
if not PyQt5:
'PyBitmessage requires qtpy, and PyQt5 or PyQt4, '
' PyQt 4.8 or later and Qt 4.7 or later.')
return False
logger.info('PyQt Version: %s', PyQt5.PYQT_VERSION)
logger.info('Qt Version: %s', PyQt5.QT_VERSION)
from qtpy import QtCore
try:
logger.info('PyQt Version: %s', QtCore.PYQT_VERSION_STR)
except AttributeError:
logger.info('Can be PySide..')
try:
logger.info('Qt Version: %s', QtCore.__version__)
except AttributeError:
# Can be PySide..
pass
passed = True
if version.LooseVersion(PyQt5.PYQT_VERSION) < '4.8':
try:
if version.LooseVersion(QtCore.PYQT_VERSION_STR) < '4.8':
logger.error(
'This version of PyQt is too old. PyBitmessage requries'
' PyQt 4.8 or later.')
passed = False
if version.LooseVersion(PyQt5.QT_VERSION) < '4.7':
except AttributeError:
# Can be PySide..
pass
try:
if version.LooseVersion(QtCore.__version__) < '4.7':
logger.error(
'This version of Qt is too old. PyBitmessage requries'
' Qt 4.7 or later.')
passed = False
except AttributeError:
# Can be PySide..
pass
return passed

View File

@ -30,46 +30,3 @@ else:
if data:
hasher.update(data)
return hasher
try:
import PyQt5
except ImportError:
try:
import qtpy as PyQt5
except ImportError:
pass
else:
from PyQt5 import QtCore
QtCore.Signal = QtCore.pyqtSignal
PyQt5.PYQT_VERSION = QtCore.PYQT_VERSION_STR
PyQt5.QT_VERSION = QtCore.QT_VERSION_STR
# try:
# from qtpy import QtCore, QtGui, QtWidgets, QtNetwork, uic
# except ImportError:
# PyQt5 = 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
# PyQt5 = types.ModuleType(
# 'PyQt5', 'qtpy based dynamic fallback for PyQt5')
# PyQt5.__dict__.update(context)
# sys.modules['PyQt5'] = PyQt5

View File

@ -42,10 +42,7 @@ Returns an instance of :class:`QPixmap` which have generated identicon image.
from six.moves import range
try:
from PyQt5 import QtCore, QtGui
except (ImportError, RuntimeError):
from PyQt4 import QtCore, QtGui
from qtpy import QtCore, QtGui
class IdenticonRendererBase(object):

View File

@ -4,7 +4,7 @@ import atexit
import unittest
try:
from PyQt5 import QtGui, QtWidgets
from qtpy import QtGui, QtWidgets
from xvfbwrapper import Xvfb
from pybitmessage import qidenticon
except ImportError:

View File

@ -15,26 +15,10 @@ def _tr_dummy(context, text, disambiguation=None, n=None):
if state.enableGUI and not state.curses:
try:
from fallback import PyQt5 # noqa:F401
from PyQt5 import QtWidgets, QtCore
from qtpy import QtWidgets, QtCore
except ImportError:
_translate = _tr_dummy
else:
try:
from PyQt5 import API
except ImportError:
API = 'pyqt5'
if API == 'pyqt5':
_translate = QtWidgets.QApplication.translate
else:
def _translate(context, text, disambiguation=None, n=None):
return (
QtWidgets.QApplication.translate(
context, text, disambiguation)
if n is None else
QtWidgets.QApplication.translate(
context, text, disambiguation,
QtCore.QCoreApplication.CodecForTr, n)
)
else:
_translate = _tr_dummy