Skip to content

Commit

Permalink
no more "import *"
Browse files Browse the repository at this point in the history
fixes #5101
fixes #5105
  • Loading branch information
SomberNight committed Feb 11, 2019
1 parent 8072ad1 commit 0264488
Show file tree
Hide file tree
Showing 38 changed files with 180 additions and 116 deletions.
11 changes: 6 additions & 5 deletions electrum/gui/qt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,22 +35,22 @@
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)

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

Expand Down
6 changes: 2 additions & 4 deletions electrum/gui/qt/address_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion electrum/gui/qt/address_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions electrum/gui/qt/amountedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions electrum/gui/qt/completion_text_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 1 addition & 8 deletions electrum/gui/qt/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os
import re
import traceback
import platform

from PyQt5 import QtCore
from PyQt5 import QtGui
Expand All @@ -14,13 +13,7 @@
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):
Expand Down
4 changes: 2 additions & 2 deletions electrum/gui/qt/contact_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 _
Expand Down
4 changes: 2 additions & 2 deletions electrum/gui/qt/exception_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

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
Expand Down
4 changes: 2 additions & 2 deletions electrum/gui/qt/fee_slider.py
Original file line number Diff line number Diff line change
@@ -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 _
Expand Down
12 changes: 11 additions & 1 deletion electrum/gui/qt/history_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,12 +32,21 @@
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
Expand Down
11 changes: 7 additions & 4 deletions electrum/gui/qt/installwizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
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
Expand All @@ -20,7 +22,8 @@

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


Expand Down
7 changes: 6 additions & 1 deletion electrum/gui/qt/invoice_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
19 changes: 14 additions & 5 deletions electrum/gui/qt/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@
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,
Expand Down Expand Up @@ -72,7 +76,12 @@
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
Expand Down
11 changes: 6 additions & 5 deletions electrum/gui/qt/network_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@
# 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
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'
Expand Down
6 changes: 3 additions & 3 deletions electrum/gui/qt/password_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
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):
Expand Down
2 changes: 1 addition & 1 deletion electrum/gui/qt/paytoedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions electrum/gui/qt/qrcodewidget.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 0 additions & 2 deletions electrum/gui/qt/qrtextedit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QFileDialog

from electrum.i18n import _
Expand Down
8 changes: 7 additions & 1 deletion electrum/gui/qt/seed_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 8 additions & 5 deletions electrum/gui/qt/transaction_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -41,7 +43,8 @@
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")
Expand Down
13 changes: 10 additions & 3 deletions electrum/gui/qt/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
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,
Expand Down
Loading

0 comments on commit 0264488

Please sign in to comment.