electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 026448837fb23de74fc40067c82b7caa8211cccf
parent 8072ad1ad98485777a81e4eee31e7ff81ae0019e
Author: SomberNight <somber.night@protonmail.com>
Date:   Mon, 11 Feb 2019 20:21:24 +0100

no more "import *"

fixes #5101
fixes #5105

Diffstat:
Melectrum/gui/qt/__init__.py | 11++++++-----
Melectrum/gui/qt/address_dialog.py | 6++----
Melectrum/gui/qt/address_list.py | 6+++++-
Melectrum/gui/qt/amountedit.py | 4++--
Melectrum/gui/qt/completion_text_edit.py | 6+++---
Melectrum/gui/qt/console.py | 9+--------
Melectrum/gui/qt/contact_list.py | 4++--
Melectrum/gui/qt/exception_window.py | 4++--
Melectrum/gui/qt/fee_slider.py | 4++--
Melectrum/gui/qt/history_list.py | 12+++++++++++-
Melectrum/gui/qt/installwizard.py | 11+++++++----
Melectrum/gui/qt/invoice_list.py | 7++++++-
Melectrum/gui/qt/main_window.py | 19++++++++++++++-----
Melectrum/gui/qt/network_dialog.py | 11++++++-----
Melectrum/gui/qt/password_dialog.py | 6+++---
Melectrum/gui/qt/paytoedit.py | 2+-
Melectrum/gui/qt/qrcodewidget.py | 3+--
Melectrum/gui/qt/qrtextedit.py | 2--
Melectrum/gui/qt/seed_dialog.py | 8+++++++-
Melectrum/gui/qt/transaction_dialog.py | 13++++++++-----
Melectrum/gui/qt/util.py | 13++++++++++---
Melectrum/gui/qt/utxo_list.py | 6+++++-
Melectrum/plugins/audio_modem/qt.py | 6++----
Melectrum/plugins/coldcard/qt.py | 6+++++-
Melectrum/plugins/cosigner_pool/qt.py | 3+--
Melectrum/plugins/email_requests/qt.py | 3+--
Melectrum/plugins/hw_wallet/qt.py | 7+++++--
Melectrum/plugins/keepkey/qt.py | 14+++++++++-----
Melectrum/plugins/labels/qt.py | 7++-----
Melectrum/plugins/ledger/auth2fa.py | 9++++-----
Melectrum/plugins/ledger/qt.py | 7++++++-
Melectrum/plugins/revealer/qt.py | 16++++++++++++----
Melectrum/plugins/safe_t/qt.py | 14+++++++++-----
Melectrum/plugins/trezor/qt.py | 13++++++++-----
Melectrum/plugins/trustedcoin/qt.py | 16+++++++++-------
Melectrum/plugins/virtualkeyboard/qt.py | 5+++--
Melectrum/rsakey.py | 2--
Melectrum/wallet.py | 1-
38 files changed, 180 insertions(+), 116 deletions(-)

diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py @@ -23,6 +23,7 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import os import signal import sys import traceback @@ -34,14 +35,14 @@ try: except Exception: sys.exit("Error: Could not import PyQt5 on Linux systems, you may try 'sudo apt-get install python3-pyqt5'") -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * -from PyQt5.QtCore import * +from PyQt5.QtGui import QGuiApplication +from PyQt5.QtWidgets import (QApplication, QSystemTrayIcon, QWidget, QMenu, + QMessageBox) +from PyQt5.QtCore import QObject, pyqtSignal, QTimer import PyQt5.QtCore as QtCore from electrum.i18n import _, set_language from electrum.plugin import run_hook -from electrum.storage import WalletStorage from electrum.base_wizard import GoBack from electrum.util import (UserCancelled, PrintError, profiler, WalletFileException, BitcoinException, get_new_wallet_name) @@ -49,7 +50,7 @@ from electrum.util import (UserCancelled, PrintError, profiler, from .installwizard import InstallWizard -from .util import * # * needed for plugins +from .util import get_default_language, read_QIcon, ColorScheme from .main_window import ElectrumWindow from .network_dialog import NetworkDialog diff --git a/electrum/gui/qt/address_dialog.py b/electrum/gui/qt/address_dialog.py @@ -25,11 +25,9 @@ from electrum.i18n import _ -from PyQt5.QtCore import * -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * +from PyQt5.QtWidgets import QVBoxLayout, QLabel -from .util import * +from .util import WindowModalDialog, ButtonsLineEdit, ColorScheme, Buttons, CloseButton from .history_list import HistoryList, HistoryModel from .qrtextedit import ShowQRTextEdit diff --git a/electrum/gui/qt/address_list.py b/electrum/gui/qt/address_list.py @@ -26,13 +26,17 @@ import webbrowser from enum import IntEnum +from PyQt5.QtCore import Qt, QPersistentModelIndex, QModelIndex +from PyQt5.QtGui import QStandardItemModel, QStandardItem, QFont +from PyQt5.QtWidgets import QAbstractItemView, QComboBox, QLabel, QMenu + from electrum.i18n import _ from electrum.util import block_explorer_URL from electrum.plugin import run_hook from electrum.bitcoin import is_address from electrum.wallet import InternalAddressCorruption -from .util import * +from .util import MyTreeView, MONOSPACE_FONT, ColorScheme class AddressList(MyTreeView): diff --git a/electrum/gui/qt/amountedit.py b/electrum/gui/qt/amountedit.py @@ -2,8 +2,8 @@ from decimal import Decimal -from PyQt5.QtCore import * -from PyQt5.QtGui import * +from PyQt5.QtCore import pyqtSignal, Qt +from PyQt5.QtGui import QPalette, QPainter from PyQt5.QtWidgets import (QLineEdit, QStyle, QStyleOptionFrame) from electrum.util import (format_satoshis_plain, decimal_point_to_base_unit_name, diff --git a/electrum/gui/qt/completion_text_edit.py b/electrum/gui/qt/completion_text_edit.py @@ -23,9 +23,9 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from PyQt5.QtGui import * -from PyQt5.QtCore import * -from PyQt5.QtWidgets import * +from PyQt5.QtGui import QTextCursor +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QCompleter, QPlainTextEdit, QApplication from .util import ButtonsTextEdit diff --git a/electrum/gui/qt/console.py b/electrum/gui/qt/console.py @@ -5,7 +5,6 @@ import sys import os import re import traceback -import platform from PyQt5 import QtCore from PyQt5 import QtGui @@ -14,13 +13,7 @@ from PyQt5 import QtWidgets from electrum import util from electrum.i18n import _ - -if platform.system() == 'Windows': - MONOSPACE_FONT = 'Lucida Console' -elif platform.system() == 'Darwin': - MONOSPACE_FONT = 'Monaco' -else: - MONOSPACE_FONT = 'monospace' +from .util import MONOSPACE_FONT class OverlayLabel(QtWidgets.QLabel): diff --git a/electrum/gui/qt/contact_list.py b/electrum/gui/qt/contact_list.py @@ -26,8 +26,8 @@ import webbrowser from enum import IntEnum -from PyQt5.QtGui import * -from PyQt5.QtCore import * +from PyQt5.QtGui import QStandardItemModel, QStandardItem +from PyQt5.QtCore import Qt, QPersistentModelIndex, QModelIndex from PyQt5.QtWidgets import (QAbstractItemView, QMenu) from electrum.i18n import _ diff --git a/electrum/gui/qt/exception_window.py b/electrum/gui/qt/exception_window.py @@ -27,8 +27,8 @@ import traceback from PyQt5.QtCore import QObject import PyQt5.QtCore as QtCore -from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import * +from PyQt5.QtWidgets import (QWidget, QLabel, QPushButton, QTextEdit, + QMessageBox, QHBoxLayout, QVBoxLayout) from electrum.i18n import _ from electrum.base_crash_reporter import BaseCrashReporter diff --git a/electrum/gui/qt/fee_slider.py b/electrum/gui/qt/fee_slider.py @@ -1,7 +1,7 @@ import threading -from PyQt5.QtGui import * -from PyQt5.QtCore import * +from PyQt5.QtGui import QCursor +from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QSlider, QToolTip from electrum.i18n import _ diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py @@ -23,6 +23,7 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import os import webbrowser import datetime from datetime import date @@ -31,12 +32,21 @@ import threading from enum import IntEnum from decimal import Decimal +from PyQt5.QtGui import QMouseEvent, QFont, QBrush, QColor +from PyQt5.QtCore import (Qt, QPersistentModelIndex, QModelIndex, QAbstractItemModel, + QSortFilterProxyModel, QVariant, QItemSelectionModel, QDate, QPoint) +from PyQt5.QtWidgets import (QMenu, QHeaderView, QLabel, QMessageBox, + QPushButton, QComboBox, QVBoxLayout, QCalendarWidget, + QGridLayout) + from electrum.address_synchronizer import TX_HEIGHT_LOCAL from electrum.i18n import _ from electrum.util import (block_explorer_URL, profiler, print_error, TxMinedInfo, OrderedDictWithIndex, PrintError, timestamp_to_datetime) -from .util import * +from .util import (read_QIcon, MONOSPACE_FONT, Buttons, CancelButton, OkButton, + filename_field, MyTreeView, AcceptFileDragDrop, WindowModalDialog, + CloseButton) if TYPE_CHECKING: from electrum.wallet import Abstract_Wallet diff --git a/electrum/gui/qt/installwizard.py b/electrum/gui/qt/installwizard.py @@ -8,9 +8,11 @@ import threading import traceback from typing import Tuple, List, Callable -from PyQt5.QtCore import * -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * +from PyQt5.QtCore import QRect, QEventLoop, Qt, pyqtSignal +from PyQt5.QtGui import QPalette, QPen, QPainter, QPixmap +from PyQt5.QtWidgets import (QWidget, QDialog, QLabel, QHBoxLayout, QMessageBox, + QVBoxLayout, QLineEdit, QFileDialog, QPushButton, + QGridLayout, QSlider, QScrollArea) from electrum.wallet import Wallet from electrum.storage import WalletStorage @@ -20,7 +22,8 @@ from electrum.i18n import _ from .seed_dialog import SeedLayout, KeysLayout from .network_dialog import NetworkChoiceLayout -from .util import * +from .util import (MessageBoxMixin, Buttons, icon_path, ChoicesLayout, WWLabel, + InfoButton) from .password_dialog import PasswordLayout, PasswordLayoutForHW, PW_NEW diff --git a/electrum/gui/qt/invoice_list.py b/electrum/gui/qt/invoice_list.py @@ -25,10 +25,15 @@ from enum import IntEnum +from PyQt5.QtCore import Qt, QItemSelectionModel +from PyQt5.QtGui import QStandardItemModel, QStandardItem, QFont +from PyQt5.QtWidgets import QHeaderView, QMenu + from electrum.i18n import _ from electrum.util import format_time -from .util import * +from .util import (MyTreeView, read_QIcon, MONOSPACE_FONT, PR_UNPAID, + pr_tooltips, import_meta_gui, export_meta_gui, pr_icons) class InvoiceList(MyTreeView): diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py @@ -38,10 +38,14 @@ from functools import partial import queue import asyncio -from PyQt5.QtGui import * -from PyQt5.QtCore import * -import PyQt5.QtCore as QtCore -from PyQt5.QtWidgets import * +from PyQt5.QtGui import QPixmap, QKeySequence, QIcon, QCursor +from PyQt5.QtCore import Qt, QRect, QStringListModel, QSize, pyqtSignal +from PyQt5.QtWidgets import (QMessageBox, QComboBox, QSystemTrayIcon, QTabWidget, + QSpinBox, QMenuBar, QFileDialog, QCheckBox, QLabel, + QVBoxLayout, QGridLayout, QLineEdit, QTreeWidgetItem, + QHBoxLayout, QPushButton, QScrollArea, QTextEdit, + QShortcut, QMainWindow, QCompleter, QInputDialog, + QWidget, QMenu, QSizePolicy, QStatusBar) import electrum from electrum import (keystore, simple_config, ecc, constants, util, bitcoin, commands, @@ -72,7 +76,12 @@ from .qrcodewidget import QRCodeWidget, QRDialog from .qrtextedit import ShowQRTextEdit, ScanQRTextEdit from .transaction_dialog import show_transaction from .fee_slider import FeeSlider -from .util import * +from .util import (read_QIcon, ColorScheme, text_dialog, icon_path, WaitingDialog, + WindowModalDialog, ChoicesLayout, HelpLabel, FromList, Buttons, + OkButton, InfoButton, WWLabel, TaskThread, CancelButton, + CloseButton, HelpButton, MessageBoxMixin, EnterButton, expiration_values, + ButtonsLineEdit, CopyCloseButton, import_meta_gui, export_meta_gui, + filename_field, address_field) from .installwizard import WIF_HELP_TEXT from .history_list import HistoryList, HistoryModel from .update_checker import UpdateCheck, UpdateCheckThread diff --git a/electrum/gui/qt/network_dialog.py b/electrum/gui/qt/network_dialog.py @@ -24,12 +24,13 @@ # SOFTWARE. import socket +import time from enum import IntEnum -from PyQt5.QtGui import * -from PyQt5.QtCore import * -from PyQt5.QtWidgets import * -import PyQt5.QtCore as QtCore +from PyQt5.QtCore import Qt, pyqtSignal, QThread +from PyQt5.QtWidgets import (QTreeWidget, QTreeWidgetItem, QMenu, QGridLayout, QComboBox, + QLineEdit, QDialog, QVBoxLayout, QHeaderView, QCheckBox, + QTabWidget, QWidget, QLabel) from electrum.i18n import _ from electrum import constants, blockchain @@ -37,7 +38,7 @@ from electrum.util import print_error from electrum.interface import serialize_server, deserialize_server from electrum.network import Network -from .util import * +from .util import Buttons, CloseButton, HelpButton, read_QIcon protocol_names = ['TCP', 'SSL'] protocol_letters = 'ts' diff --git a/electrum/gui/qt/password_dialog.py b/electrum/gui/qt/password_dialog.py @@ -27,13 +27,13 @@ import re import math from PyQt5.QtCore import Qt -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * +from PyQt5.QtGui import QPixmap +from PyQt5.QtWidgets import QLineEdit, QLabel, QGridLayout, QVBoxLayout, QCheckBox from electrum.i18n import _ from electrum.plugin import run_hook -from .util import * +from .util import icon_path, WindowModalDialog, OkButton, CancelButton, Buttons def check_password_strength(password): diff --git a/electrum/gui/qt/paytoedit.py b/electrum/gui/qt/paytoedit.py @@ -26,7 +26,7 @@ import re from decimal import Decimal -from PyQt5.QtGui import * +from PyQt5.QtGui import QFontMetrics from electrum import bitcoin from electrum.util import bfh, PrintError diff --git a/electrum/gui/qt/qrcodewidget.py b/electrum/gui/qt/qrcodewidget.py @@ -1,8 +1,7 @@ import os import qrcode -from PyQt5.QtCore import * -from PyQt5.QtGui import * +from PyQt5.QtGui import QColor import PyQt5.QtGui as QtGui from PyQt5.QtWidgets import ( QApplication, QVBoxLayout, QTextEdit, QHBoxLayout, QPushButton, QWidget) diff --git a/electrum/gui/qt/qrtextedit.py b/electrum/gui/qt/qrtextedit.py @@ -1,5 +1,3 @@ -from PyQt5.QtGui import * -from PyQt5.QtCore import * from PyQt5.QtWidgets import QFileDialog from electrum.i18n import _ diff --git a/electrum/gui/qt/seed_dialog.py b/electrum/gui/qt/seed_dialog.py @@ -23,11 +23,17 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from PyQt5.QtCore import Qt +from PyQt5.QtGui import QPixmap +from PyQt5.QtWidgets import (QVBoxLayout, QCheckBox, QHBoxLayout, QLineEdit, + QLabel, QCompleter, QDialog) + from electrum.i18n import _ from electrum.mnemonic import Mnemonic import electrum.old_mnemonic -from .util import * +from .util import (Buttons, OkButton, WWLabel, ButtonsTextEdit, icon_path, + EnterButton, CloseButton, WindowModalDialog) from .qrtextedit import ShowQRTextEdit, ScanQRTextEdit from .completion_text_edit import CompletionTextEdit diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py @@ -22,15 +22,17 @@ # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + +import sys import copy import datetime import json import traceback -from PyQt5.QtCore import * -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * - +from PyQt5.QtCore import QSize +from PyQt5.QtGui import QTextCharFormat, QBrush, QFont +from PyQt5.QtWidgets import (QDialog, QLabel, QPushButton, QHBoxLayout, QVBoxLayout, + QTextEdit) import qrcode from qrcode import exceptions @@ -41,7 +43,8 @@ from electrum import simple_config from electrum.util import bfh from electrum.transaction import SerializationError, Transaction -from .util import * +from .util import (MessageBoxMixin, read_QIcon, Buttons, CopyButton, + MONOSPACE_FONT, ColorScheme, ButtonsLineEdit) SAVE_BUTTON_ENABLED_TOOLTIP = _("Save transaction offline") diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py @@ -9,9 +9,16 @@ import traceback from functools import partial, lru_cache from typing import NamedTuple, Callable, Optional, TYPE_CHECKING, Union, List, Dict -from PyQt5.QtGui import * -from PyQt5.QtCore import * -from PyQt5.QtWidgets import * +from PyQt5.QtGui import (QFont, QColor, QCursor, QPixmap, QStandardItem, + QPalette, QIcon) +from PyQt5.QtCore import (Qt, QPersistentModelIndex, QModelIndex, pyqtSignal, + QCoreApplication, QItemSelectionModel, QThread, + QSortFilterProxyModel, QSize, QLocale) +from PyQt5.QtWidgets import (QPushButton, QLabel, QMessageBox, QHBoxLayout, + QAbstractItemView, QVBoxLayout, QLineEdit, + QStyle, QDialog, QGroupBox, QButtonGroup, QRadioButton, + QFileDialog, QWidget, QToolButton, QTreeView, QPlainTextEdit, + QHeaderView, QApplication, QToolTip, QTreeWidget, QStyledItemDelegate) from electrum.i18n import _, languages from electrum.util import (FileImportFailed, FileExportFailed, diff --git a/electrum/gui/qt/utxo_list.py b/electrum/gui/qt/utxo_list.py @@ -26,9 +26,13 @@ from typing import Optional, List from enum import IntEnum +from PyQt5.QtCore import Qt +from PyQt5.QtGui import QStandardItemModel, QStandardItem, QFont +from PyQt5.QtWidgets import QAbstractItemView, QMenu + from electrum.i18n import _ -from .util import * +from .util import MyTreeView, ColorScheme, MONOSPACE_FONT class UTXOList(MyTreeView): diff --git a/electrum/plugins/audio_modem/qt.py b/electrum/plugins/audio_modem/qt.py @@ -5,15 +5,13 @@ from io import BytesIO import sys import platform +from PyQt5.QtWidgets import (QComboBox, QGridLayout, QLabel, QPushButton) + from electrum.plugin import BasePlugin, hook from electrum.gui.qt.util import WaitingDialog, EnterButton, WindowModalDialog, read_QIcon from electrum.util import print_msg, print_error from electrum.i18n import _ -from PyQt5.QtGui import * -from PyQt5.QtCore import * -from PyQt5.QtWidgets import (QComboBox, QGridLayout, QLabel, QPushButton) - try: import amodem.audio import amodem.main diff --git a/electrum/plugins/coldcard/qt.py b/electrum/plugins/coldcard/qt.py @@ -1,9 +1,13 @@ import time +from functools import partial + +from PyQt5.QtCore import Qt, pyqtSignal +from PyQt5.QtWidgets import QPushButton, QLabel, QVBoxLayout, QWidget, QGridLayout from electrum.i18n import _ from electrum.plugin import hook from electrum.wallet import Standard_Wallet -from electrum.gui.qt.util import * +from electrum.gui.qt.util import WindowModalDialog, CloseButton, get_parent_main_window from .coldcard import ColdcardPlugin from ..hw_wallet.qt import QtHandlerBase, QtPluginBase diff --git a/electrum/plugins/cosigner_pool/qt.py b/electrum/plugins/cosigner_pool/qt.py @@ -26,8 +26,7 @@ import time from xmlrpc.client import ServerProxy -from PyQt5.QtGui import * -from PyQt5.QtCore import * +from PyQt5.QtCore import QObject, pyqtSignal from PyQt5.QtWidgets import QPushButton from electrum import util, keystore, ecc, bip32, crypto diff --git a/electrum/plugins/email_requests/qt.py b/electrum/plugins/email_requests/qt.py @@ -37,8 +37,7 @@ from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email.encoders import encode_base64 -from PyQt5.QtGui import * -from PyQt5.QtCore import * +from PyQt5.QtCore import QObject, pyqtSignal, QThread from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QLineEdit, QInputDialog) diff --git a/electrum/plugins/hw_wallet/qt.py b/electrum/plugins/hw_wallet/qt.py @@ -25,11 +25,14 @@ # SOFTWARE. import threading +from functools import partial -from PyQt5.QtWidgets import QVBoxLayout, QLabel +from PyQt5.QtCore import QObject, pyqtSignal +from PyQt5.QtWidgets import QVBoxLayout, QLineEdit, QHBoxLayout, QLabel from electrum.gui.qt.password_dialog import PasswordLayout, PW_PASSPHRASE -from electrum.gui.qt.util import * +from electrum.gui.qt.util import (read_QIcon, WWLabel, OkButton, WindowModalDialog, + Buttons, CancelButton, TaskThread) from electrum.i18n import _ from electrum.util import PrintError diff --git a/electrum/plugins/keepkey/qt.py b/electrum/plugins/keepkey/qt.py @@ -1,11 +1,15 @@ from functools import partial import threading -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QGridLayout, QInputDialog, QPushButton -from PyQt5.QtWidgets import QVBoxLayout, QLabel - -from electrum.gui.qt.util import * +from PyQt5.QtCore import Qt, QEventLoop, pyqtSignal, QRegExp +from PyQt5.QtGui import QRegExpValidator +from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QPushButton, + QHBoxLayout, QButtonGroup, QGroupBox, QDialog, + QTextEdit, QLineEdit, QRadioButton, QCheckBox, QWidget, + QMessageBox, QFileDialog, QSlider, QTabWidget) + +from electrum.gui.qt.util import (WindowModalDialog, WWLabel, Buttons, CancelButton, + OkButton, CloseButton) from electrum.i18n import _ from electrum.plugin import hook from electrum.util import bh2u diff --git a/electrum/plugins/labels/qt.py b/electrum/plugins/labels/qt.py @@ -2,15 +2,12 @@ from functools import partial import traceback import sys -from PyQt5.QtGui import * -from PyQt5.QtCore import * +from PyQt5.QtCore import QObject, pyqtSignal from PyQt5.QtWidgets import (QHBoxLayout, QLabel, QVBoxLayout) from electrum.plugin import hook from electrum.i18n import _ -from electrum.gui.qt import EnterButton -from electrum.gui.qt.util import ThreadedButton, Buttons -from electrum.gui.qt.util import WindowModalDialog, OkButton +from electrum.gui.qt.util import ThreadedButton, Buttons, EnterButton, WindowModalDialog, OkButton from .labels import LabelsPlugin diff --git a/electrum/plugins/ledger/auth2fa.py b/electrum/plugins/ledger/auth2fa.py @@ -7,17 +7,16 @@ from binascii import hexlify, unhexlify import websocket -from PyQt5.QtWidgets import QDialog, QLineEdit, QTextEdit, QVBoxLayout, QLabel -import PyQt5.QtCore as QtCore -from PyQt5.QtWidgets import * +from PyQt5.QtWidgets import (QDialog, QLineEdit, QTextEdit, QVBoxLayout, QLabel, + QWidget, QHBoxLayout, QComboBox, QPushButton) +from PyQt5.QtCore import QThread, pyqtSignal -from btchip.btchip import * +from btchip.btchip import BTChipException from electrum.i18n import _ from electrum.util import print_msg from electrum import constants, bitcoin from electrum.gui.qt.qrcodewidget import QRCodeWidget -from electrum.gui.qt.util import * DEBUG = False diff --git a/electrum/plugins/ledger/qt.py b/electrum/plugins/ledger/qt.py @@ -1,9 +1,14 @@ +from functools import partial + #from btchip.btchipPersoWizard import StartBTChipPersoDialog +from PyQt5.QtCore import pyqtSignal +from PyQt5.QtWidgets import QInputDialog, QLabel, QVBoxLayout, QLineEdit + from electrum.i18n import _ from electrum.plugin import hook from electrum.wallet import Standard_Wallet -from electrum.gui.qt.util import * +from electrum.gui.qt.util import WindowModalDialog from .ledger import LedgerPlugin from ..hw_wallet.qt import QtHandlerBase, QtPluginBase diff --git a/electrum/plugins/revealer/qt.py b/electrum/plugins/revealer/qt.py @@ -11,20 +11,28 @@ Tiago Romagnani Silveira, 2017 import os import random -import qrcode import traceback from decimal import Decimal +from functools import partial +import sys +import qrcode from PyQt5.QtPrintSupport import QPrinter +from PyQt5.QtCore import Qt, QRectF, QRect, QSizeF, QUrl, QPoint, QSize +from PyQt5.QtGui import (QPixmap, QImage, QBitmap, QPainter, QFontDatabase, QPen, QFont, + QColor, QDesktopServices, qRgba, QPainterPath) +from PyQt5.QtWidgets import (QGridLayout, QVBoxLayout, QHBoxLayout, QLabel, + QPushButton, QLineEdit) from electrum.plugin import hook from electrum.i18n import _ -from electrum.util import make_dir, InvalidPassword, UserCancelled, bh2u, bfh -from electrum.gui.qt.util import * +from electrum.util import make_dir, InvalidPassword, UserCancelled +from electrum.gui.qt.util import (read_QIcon, EnterButton, WWLabel, icon_path, + WindowModalDialog, Buttons, CloseButton, OkButton) from electrum.gui.qt.qrtextedit import ScanQRTextEdit from electrum.gui.qt.main_window import StatusBarButton -from .revealer import RevealerPlugin, VersionedSeed +from .revealer import RevealerPlugin class Plugin(RevealerPlugin): diff --git a/electrum/plugins/safe_t/qt.py b/electrum/plugins/safe_t/qt.py @@ -1,11 +1,15 @@ from functools import partial import threading -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QGridLayout, QInputDialog, QPushButton -from PyQt5.QtWidgets import QVBoxLayout, QLabel - -from electrum.gui.qt.util import * +from PyQt5.QtCore import Qt, pyqtSignal, QRegExp +from PyQt5.QtGui import QRegExpValidator +from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QPushButton, + QHBoxLayout, QButtonGroup, QGroupBox, + QTextEdit, QLineEdit, QRadioButton, QCheckBox, QWidget, + QMessageBox, QFileDialog, QSlider, QTabWidget) + +from electrum.gui.qt.util import (WindowModalDialog, WWLabel, Buttons, CancelButton, + OkButton, CloseButton) from electrum.i18n import _ from electrum.plugin import hook from electrum.util import bh2u diff --git a/electrum/plugins/trezor/qt.py b/electrum/plugins/trezor/qt.py @@ -1,11 +1,14 @@ from functools import partial import threading -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QGridLayout, QInputDialog, QPushButton -from PyQt5.QtWidgets import QVBoxLayout, QLabel - -from electrum.gui.qt.util import * +from PyQt5.QtCore import Qt, QEventLoop, pyqtSignal +from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QPushButton, + QHBoxLayout, QButtonGroup, QGroupBox, QDialog, + QLineEdit, QRadioButton, QCheckBox, QWidget, + QMessageBox, QFileDialog, QSlider, QTabWidget) + +from electrum.gui.qt.util import (WindowModalDialog, WWLabel, Buttons, CancelButton, + OkButton, CloseButton) from electrum.i18n import _ from electrum.plugin import hook from electrum.util import bh2u diff --git a/electrum/plugins/trustedcoin/qt.py b/electrum/plugins/trustedcoin/qt.py @@ -25,14 +25,16 @@ from functools import partial import threading -from threading import Thread -import re -from decimal import Decimal +import sys +import os -from PyQt5.QtGui import * -from PyQt5.QtCore import * +from PyQt5.QtGui import QPixmap +from PyQt5.QtCore import QObject, pyqtSignal +from PyQt5.QtWidgets import (QTextEdit, QVBoxLayout, QLabel, QGridLayout, QHBoxLayout, + QRadioButton, QCheckBox, QLineEdit) -from electrum.gui.qt.util import * +from electrum.gui.qt.util import (read_QIcon, WindowModalDialog, WaitingDialog, OkButton, + CancelButton, Buttons, icon_path, WWLabel, CloseButton) from electrum.gui.qt.qrcodewidget import QRCodeWidget from electrum.gui.qt.amountedit import AmountEdit from electrum.gui.qt.main_window import StatusBarButton @@ -254,7 +256,7 @@ class Plugin(TrustedCoinPlugin): tos_e.tos_signal.connect(on_result) tos_e.error_signal.connect(on_error) - t = Thread(target=request_TOS) + t = threading.Thread(target=request_TOS) t.setDaemon(True) t.start() email_e.textChanged.connect(set_enabled) diff --git a/electrum/plugins/virtualkeyboard/qt.py b/electrum/plugins/virtualkeyboard/qt.py @@ -1,8 +1,9 @@ -from PyQt5.QtGui import * +import random + from PyQt5.QtWidgets import (QVBoxLayout, QGridLayout, QPushButton) + from electrum.plugin import BasePlugin, hook from electrum.i18n import _ -import random class Plugin(BasePlugin): diff --git a/electrum/rsakey.py b/electrum/rsakey.py @@ -37,8 +37,6 @@ import os import math import hashlib -from .pem import * - def SHA1(x): return hashlib.sha1(x).digest() diff --git a/electrum/wallet.py b/electrum/wallet.py @@ -48,7 +48,6 @@ from .util import (NotEnoughFunds, PrintError, UserCancelled, profiler, Fiat, bfh, bh2u, TxMinedInfo) from .bitcoin import (COIN, TYPE_ADDRESS, is_address, address_to_script, is_minikey, relayfee, dust_threshold) -from .version import * from .crypto import sha256d from .keystore import load_keystore, Hardware_KeyStore from .storage import multisig_type, STO_EV_PLAINTEXT, STO_EV_USER_PW, STO_EV_XPUB_PW, WalletStorage