1
0

Merge pull request #2911 from SomberNight/pyqt5

migration to PyQt5
This commit is contained in:
ThomasV
2017-09-24 09:42:32 +02:00
committed by GitHub
34 changed files with 232 additions and 168 deletions

View File

@@ -10,8 +10,9 @@ from electrum_gui.qt.util import WaitingDialog, EnterButton, WindowModalDialog
from electrum.util import print_msg, print_error
from electrum.i18n import _
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import (QComboBox, QGridLayout, QLabel, QPushButton)
try:
import amodem.audio

View File

@@ -28,8 +28,9 @@ import threading
import time
from xmlrpc.client import ServerProxy
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QPushButton
from electrum import bitcoin, util
from electrum import transaction
@@ -82,19 +83,23 @@ class Listener(util.DaemonThread):
if message:
self.received.add(keyhash)
self.print_error("received message for", keyhash)
self.parent.obj.emit(SIGNAL("cosigner:receive"), keyhash,
message)
self.parent.obj.cosigner_receive_signal.emit(
keyhash, message)
# poll every 30 seconds
time.sleep(30)
class QReceiveSignalObject(QObject):
cosigner_receive_signal = pyqtSignal(object, object)
class Plugin(BasePlugin):
def __init__(self, parent, config, name):
BasePlugin.__init__(self, parent, config, name)
self.listener = None
self.obj = QObject()
self.obj.connect(self.obj, SIGNAL('cosigner:receive'), self.on_receive)
self.obj = QReceiveSignalObject()
self.obj.cosigner_receive_signal.connect(self.on_receive)
self.keys = []
self.cosigner_list = []

View File

@@ -1,4 +1,4 @@
from PyQt4.Qt import (QInputDialog, QLineEdit)
from PyQt5.QtWidgets import (QInputDialog, QLineEdit)
from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
from .digitalbitbox import DigitalBitboxPlugin

View File

@@ -35,10 +35,11 @@ from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.encoders import encode_base64
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import PyQt4.QtCore as QtCore
import PyQt4.QtGui as QtGui
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import PyQt5.QtCore as QtCore
import PyQt5.QtGui as QtGui
from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QLineEdit)
from electrum.plugins import BasePlugin, hook
from electrum.paymentrequest import PaymentRequest
@@ -102,6 +103,10 @@ class Processor(threading.Thread):
s.quit()
class QEmailSignalObject(QObject):
email_new_invoice_signal = pyqtSignal()
class Plugin(BasePlugin):
def fullname(self):
@@ -121,13 +126,13 @@ class Plugin(BasePlugin):
if self.imap_server and self.username and self.password:
self.processor = Processor(self.imap_server, self.username, self.password, self.on_receive)
self.processor.start()
self.obj = QObject()
self.obj.connect(self.obj, SIGNAL('email:new_invoice'), self.new_invoice)
self.obj = QEmailSignalObject()
self.obj.email_new_invoice_signal.connect(self.new_invoice)
def on_receive(self, pr_str):
self.print_error('received payment request')
self.pr = PaymentRequest(pr_str)
self.obj.emit(SIGNAL('email:new_invoice'))
self.obj.email_new_invoice_signal.emit()
def new_invoice(self):
self.parent.invoices.add(self.pr)

View File

@@ -28,7 +28,7 @@ import urllib
import sys
import requests
from PyQt4.QtGui import QApplication, QPushButton
from PyQt5.QtWidgets import QApplication, QPushButton
from electrum.plugins import BasePlugin, hook
from electrum.i18n import _

View File

@@ -26,7 +26,7 @@
import threading
from PyQt4.Qt import QVBoxLayout, QLabel, SIGNAL
from PyQt5.Qt import QVBoxLayout, QLabel
from electrum_gui.qt.password_dialog import PasswordDialog, PW_PASSPHRASE
from electrum_gui.qt.util import *

View File

@@ -1,7 +1,8 @@
from functools import partial
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import (QHBoxLayout, QLabel, QVBoxLayout)
from electrum.plugins import hook
from electrum.i18n import _
@@ -12,11 +13,15 @@ from electrum_gui.qt.util import WindowModalDialog, OkButton
from .labels import LabelsPlugin
class QLabelsSignalObject(QObject):
labels_changed_signal = pyqtSignal(object)
class Plugin(LabelsPlugin):
def __init__(self, *args):
LabelsPlugin.__init__(self, *args)
self.obj = QObject()
self.obj = QLabelsSignalObject()
def requires_settings(self):
return True
@@ -47,14 +52,14 @@ class Plugin(LabelsPlugin):
return bool(d.exec_())
def on_pulled(self, wallet):
self.obj.emit(SIGNAL('labels_changed'), wallet)
self.obj.labels_changed_signal.emit(wallet)
def done_processing(self, dialog, result):
dialog.show_message(_("Your labels have been synchronised."))
@hook
def on_new_window(self, window):
window.connect(window.app, SIGNAL('labels_changed'), window.update_tabs)
self.obj.labels_changed_signal.connect(window.update_tabs)
self.start_wallet(window.wallet)
@hook

View File

@@ -1,8 +1,9 @@
from binascii import hexlify, unhexlify
import threading
from PyQt4.Qt import (QDialog, QInputDialog, QLineEdit, QTextEdit, QVBoxLayout, QLabel, SIGNAL)
import PyQt4.QtCore as QtCore
from PyQt5.Qt import (QDialog, QInputDialog, QLineEdit, QTextEdit, QVBoxLayout, QLabel)
import PyQt5.QtCore as QtCore
from PyQt5.QtWidgets import *
from electrum.i18n import _
from electrum_gui.qt.util import *

View File

@@ -1,8 +1,8 @@
import threading
from PyQt4.Qt import (QDialog, QInputDialog, QLineEdit,
QVBoxLayout, QLabel, SIGNAL)
import PyQt4.QtCore as QtCore
from PyQt5.Qt import (QDialog, QInputDialog, QLineEdit,
QVBoxLayout, QLabel)
import PyQt5.QtCore as QtCore
from electrum.i18n import _
from .ledger import LedgerPlugin

View File

@@ -1,9 +1,9 @@
from functools import partial
import threading
from PyQt4.Qt import Qt
from PyQt4.Qt import QGridLayout, QInputDialog, QPushButton
from PyQt4.Qt import QVBoxLayout, QLabel, SIGNAL
from PyQt5.Qt import Qt
from PyQt5.Qt import QGridLayout, QInputDialog, QPushButton
from PyQt5.Qt import QVBoxLayout, QLabel
from electrum_gui.qt.util import *
from .plugin import TIM_NEW, TIM_RECOVER, TIM_MNEMONIC
from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
@@ -377,7 +377,7 @@ class SettingsDialog(WindowModalDialog):
def change_homescreen():
from PIL import Image # FIXME
dialog = QFileDialog(self, _("Choose Homescreen"))
filename = dialog.getOpenFileName()
filename, __ = dialog.getOpenFileName()
if filename:
im = Image.open(str(filename))
if im.size != (hs_cols, hs_rows):

View File

@@ -28,8 +28,8 @@ from threading import Thread
import re
from decimal import Decimal
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from electrum_gui.qt.util import *
from electrum_gui.qt.qrcodewidget import QRCodeWidget
@@ -40,8 +40,16 @@ from electrum.plugins import hook
from .trustedcoin import TrustedCoinPlugin, server
class QTOSSignalObject(QObject):
two_factor_tos_signal = pyqtSignal()
class Plugin(TrustedCoinPlugin):
def __init__(self, parent, config, name):
super().__init__(parent, config, name)
self.tos_signal_obj = QTOSSignalObject()
@hook
def on_new_window(self, window):
wallet = window.wallet
@@ -196,7 +204,7 @@ class Plugin(TrustedCoinPlugin):
def request_TOS():
tos = server.get_terms_of_service()
self.TOS = tos
window.emit(SIGNAL('twofactor:TOS'))
self.tos_signal_obj.two_factor_tos_signal.emit()
def on_result():
tos_e.setText(self.TOS)
@@ -204,7 +212,7 @@ class Plugin(TrustedCoinPlugin):
def set_enabled():
next_button.setEnabled(re.match(regexp,email_e.text()) is not None)
window.connect(window, SIGNAL('twofactor:TOS'), on_result)
self.tos_signal_obj.two_factor_tos_signal.connect(on_result)
t = Thread(target=request_TOS)
t.setDaemon(True)
t.start()

View File

@@ -1,4 +1,5 @@
from PyQt4.QtGui import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import (QVBoxLayout, QGridLayout, QPushButton)
from electrum.plugins import BasePlugin, hook
from electrum.i18n import _
import random