electrum

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

commit 33d14e4238d08f69934c8fcb6f77926a8f39f6d1
parent 9d7cf12244a0a519e7b65398e4783ab9ea64ba05
Author: SomberNight <somber.night@protonmail.com>
Date:   Tue, 25 Sep 2018 18:15:28 +0200

some import clean-up in qt

Diffstat:
Melectrum/gui/__init__.py | 2+-
Melectrum/gui/qt/__init__.py | 4----
Melectrum/gui/qt/completion_text_edit.py | 2++
Melectrum/gui/qt/console.py | 9+++++++--
Melectrum/gui/qt/contact_list.py | 10++++++----
Melectrum/gui/qt/fee_slider.py | 6++++--
Melectrum/gui/qt/history_list.py | 3++-
Melectrum/gui/qt/main_window.py | 12+++++++-----
Melectrum/gui/qt/password_dialog.py | 9++++++---
Melectrum/gui/qt/paytoedit.py | 4+++-
Melectrum/gui/qt/qrcodewidget.py | 5++---
Melectrum/gui/qt/qrtextedit.py | 6+++---
Melectrum/gui/qt/qrwindow.py | 1+
Melectrum/gui/qt/request_list.py | 8+++++---
Melectrum/gui/qt/transaction_dialog.py | 1-
Melectrum/gui/qt/utxo_list.py | 4+++-
Melectrum/gui/stdio.py | 9++++++---
Melectrum/gui/text.py | 8+++++---
18 files changed, 63 insertions(+), 40 deletions(-)

diff --git a/electrum/gui/__init__.py b/electrum/gui/__init__.py @@ -1,5 +1,5 @@ # To create a new GUI, please add its code to this directory. # Three objects are passed to the ElectrumGui: config, daemon and plugins -# The Wallet object is instanciated by the GUI +# The Wallet object is instantiated by the GUI # Notifications about network events are sent to the GUI by using network.register_callback() diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py @@ -42,12 +42,8 @@ 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.synchronizer import Synchronizer -# from electrum.verifier import SPV -# from electrum.util import DebugMem from electrum.util import (UserCancelled, PrintError, WalletFileException, BitcoinException) -# from electrum.wallet import Abstract_Wallet from .installwizard import InstallWizard diff --git a/electrum/gui/qt/completion_text_edit.py b/electrum/gui/qt/completion_text_edit.py @@ -26,8 +26,10 @@ from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * + from .util import ButtonsTextEdit + class CompletionTextEdit(ButtonsTextEdit): def __init__(self, parent=None): diff --git a/electrum/gui/qt/console.py b/electrum/gui/qt/console.py @@ -1,11 +1,16 @@ # source: http://stackoverflow.com/questions/2758159/how-to-embed-a-python-interpreter-in-a-pyqt-widget -import sys, os, re -import traceback, platform +import sys +import os +import re +import traceback +import platform + from PyQt5 import QtCore from PyQt5 import QtGui from PyQt5 import QtWidgets + from electrum import util from electrum.i18n import _ diff --git a/electrum/gui/qt/contact_list.py b/electrum/gui/qt/contact_list.py @@ -24,14 +24,16 @@ # SOFTWARE. import webbrowser -from electrum.i18n import _ -from electrum.bitcoin import is_address -from electrum.util import block_explorer_URL -from electrum.plugin import run_hook from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import ( QAbstractItemView, QFileDialog, QMenu, QTreeWidgetItem) + +from electrum.i18n import _ +from electrum.bitcoin import is_address +from electrum.util import block_explorer_URL +from electrum.plugin import run_hook + from .util import MyTreeWidget, import_meta_gui, export_meta_gui diff --git a/electrum/gui/qt/fee_slider.py b/electrum/gui/qt/fee_slider.py @@ -1,9 +1,11 @@ -from electrum.i18n import _ +import threading + from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import QSlider, QToolTip -import threading +from electrum.i18n import _ + class FeeSlider(QSlider): diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py @@ -28,10 +28,11 @@ import datetime from datetime import date from electrum.address_synchronizer import TX_HEIGHT_LOCAL -from .util import * from electrum.i18n import _ from electrum.util import block_explorer_URL, profiler, print_error, TxMinedStatus +from .util import * + try: from electrum.plot import plot_history, NothingToPlotException except: diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py @@ -22,8 +22,12 @@ # 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, time, threading -import os, json, traceback +import sys +import time +import threading +import os +import traceback +import json import shutil import weakref import webbrowser @@ -36,8 +40,6 @@ import queue from PyQt5.QtGui import * from PyQt5.QtCore import * import PyQt5.QtCore as QtCore - -from .exception_window import Exception_Hook from PyQt5.QtWidgets import * from electrum import (keystore, simple_config, ecc, constants, util, bitcoin, commands, @@ -56,6 +58,7 @@ from electrum.transaction import Transaction, TxOutput from electrum.address_synchronizer import AddTransactionException from electrum.wallet import Multisig_Wallet, CannotBumpFee +from .exception_window import Exception_Hook from .amountedit import AmountEdit, BTCAmountEdit, MyLineEdit, FeerateEdit from .qrcodewidget import QRCodeWidget, QRDialog from .qrtextedit import ShowQRTextEdit, ScanQRTextEdit @@ -2504,7 +2507,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): for addr, pk in pklist.items(): transaction.writerow(["%34s"%addr,pk]) else: - import json f.write(json.dumps(pklist, indent = 4)) def do_import_labels(self): diff --git a/electrum/gui/qt/password_dialog.py b/electrum/gui/qt/password_dialog.py @@ -23,15 +23,18 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import re +import math + from PyQt5.QtCore import Qt from PyQt5.QtGui import * from PyQt5.QtWidgets import * + from electrum.i18n import _ +from electrum.plugin import run_hook + from .util import * -import re -import math -from electrum.plugin import run_hook def check_password_strength(password): diff --git a/electrum/gui/qt/paytoedit.py b/electrum/gui/qt/paytoedit.py @@ -23,10 +23,11 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from PyQt5.QtGui import * import re from decimal import Decimal +from PyQt5.QtGui import * + from electrum import bitcoin from electrum.util import bfh from electrum.transaction import TxOutput @@ -40,6 +41,7 @@ RE_ALIAS = '(.*?)\s*\<([0-9A-Za-z]{1,})\>' frozen_style = "QWidget { background-color:none; border:none;}" normal_style = "QPlainTextEdit { }" + class PayToEdit(CompletionTextEdit, ScanQRTextEdit): def __init__(self, win): diff --git a/electrum/gui/qt/qrcodewidget.py b/electrum/gui/qt/qrcodewidget.py @@ -1,3 +1,5 @@ +import os +import qrcode from PyQt5.QtCore import * from PyQt5.QtGui import * @@ -5,9 +7,6 @@ import PyQt5.QtGui as QtGui from PyQt5.QtWidgets import ( QApplication, QVBoxLayout, QTextEdit, QHBoxLayout, QPushButton, QWidget) -import os -import qrcode - import electrum from electrum.i18n import _ from .util import WindowModalDialog diff --git a/electrum/gui/qt/qrtextedit.py b/electrum/gui/qt/qrtextedit.py @@ -1,10 +1,10 @@ - -from electrum.i18n import _ -from electrum.plugin import run_hook from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import QFileDialog +from electrum.i18n import _ +from electrum.plugin import run_hook + from .util import ButtonsTextEdit, MessageBoxMixin, ColorScheme diff --git a/electrum/gui/qt/qrwindow.py b/electrum/gui/qt/qrwindow.py @@ -41,6 +41,7 @@ else: column_index = 4 + class QR_Window(QWidget): def __init__(self, win): diff --git a/electrum/gui/qt/request_list.py b/electrum/gui/qt/request_list.py @@ -23,13 +23,15 @@ # 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 QTreeWidgetItem, QMenu + from electrum.i18n import _ from electrum.util import format_time, age from electrum.plugin import run_hook from electrum.paymentrequest import PR_UNKNOWN -from PyQt5.QtGui import * -from PyQt5.QtCore import * -from PyQt5.QtWidgets import QTreeWidgetItem, QMenu + from .util import MyTreeWidget, pr_tooltips, pr_icons diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py @@ -38,7 +38,6 @@ from electrum.bitcoin import base_encode from electrum.i18n import _ from electrum.plugin import run_hook from electrum import simple_config - from electrum.util import bfh from electrum.transaction import SerializationError diff --git a/electrum/gui/qt/utxo_list.py b/electrum/gui/qt/utxo_list.py @@ -22,9 +22,11 @@ # 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. -from .util import * + from electrum.i18n import _ +from .util import * + class UTXOList(MyTreeWidget): filter_columns = [0, 2] # Address, Label diff --git a/electrum/gui/stdio.py b/electrum/gui/stdio.py @@ -1,15 +1,18 @@ from decimal import Decimal -_ = lambda x:x -#from i18n import _ +import getpass +import datetime + from electrum import WalletStorage, Wallet from electrum.util import format_satoshis, set_verbosity from electrum.bitcoin import is_address, COIN, TYPE_ADDRESS from electrum.transaction import TxOutput -import getpass, datetime + +_ = lambda x:x # i18n # minimal fdisk like gui for console usage # written by rofl0r, with some bits stolen from the text gui (ncurses) + class ElectrumGui: def __init__(self, config, daemon, plugins): diff --git a/electrum/gui/text.py b/electrum/gui/text.py @@ -1,5 +1,8 @@ -import tty, sys -import curses, datetime, locale +import tty +import sys +import curses +import datetime +import locale from decimal import Decimal import getpass @@ -15,7 +18,6 @@ from electrum.interface import deserialize_server _ = lambda x:x - class ElectrumGui: def __init__(self, config, daemon, plugins):