clean up prev commit
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
import webbrowser
|
||||
import os
|
||||
|
||||
from electrum.i18n import _
|
||||
from electrum.bitcoin import is_address
|
||||
|
||||
@@ -23,10 +23,11 @@
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
from .util import *
|
||||
from electrum.i18n import _
|
||||
from electrum.util import format_time
|
||||
|
||||
from .util import *
|
||||
|
||||
|
||||
class InvoiceList(MyTreeWidget):
|
||||
filter_columns = [0, 1, 2, 3] # Date, Requestor, Description, Amount
|
||||
|
||||
@@ -39,15 +39,14 @@ import PyQt5.QtCore as QtCore
|
||||
from .exception_window import Exception_Hook
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
from electrum.util import bh2u, bfh
|
||||
|
||||
from electrum import keystore, simple_config
|
||||
from electrum.bitcoin import COIN, is_address, TYPE_ADDRESS, NetworkConstants
|
||||
from electrum.plugins import run_hook
|
||||
from electrum.i18n import _
|
||||
from electrum.util import (format_time, format_satoshis, PrintError,
|
||||
format_satoshis_plain, NotEnoughFunds,
|
||||
UserCancelled, NoDynamicFeeEstimates)
|
||||
UserCancelled, NoDynamicFeeEstimates, profiler,
|
||||
export_meta, import_meta, bh2u, bfh)
|
||||
from electrum import Transaction
|
||||
from electrum import util, bitcoin, commands, coinchooser
|
||||
from electrum import paymentrequest
|
||||
@@ -58,10 +57,8 @@ 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 electrum.util import profiler, export_meta, import_meta
|
||||
|
||||
class StatusBarButton(QPushButton):
|
||||
def __init__(self, icon, tooltip, func):
|
||||
@@ -2420,16 +2417,16 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
|
||||
def do_import_labels(self):
|
||||
def import_labels(path):
|
||||
#TODO: Import labels validation
|
||||
def import_labels_validate(data):
|
||||
return data
|
||||
def _validate(data):
|
||||
return data # TODO
|
||||
|
||||
def import_labels_assign(data):
|
||||
for key, value in data.items():
|
||||
self.wallet.set_label(key, value)
|
||||
import_meta(path, import_labels_validate, import_labels_assign)
|
||||
import_meta(path, _validate, import_labels_assign)
|
||||
|
||||
def on_import():
|
||||
self.address_list.update()
|
||||
self.history_list.update()
|
||||
self.need_update.set()
|
||||
import_meta_gui(self, _('labels'), import_labels, on_import)
|
||||
|
||||
def do_export_labels(self):
|
||||
|
||||
@@ -6,12 +6,15 @@ import queue
|
||||
from collections import namedtuple
|
||||
from functools import partial
|
||||
|
||||
from electrum.i18n import _
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
from electrum.i18n import _
|
||||
from electrum.util import FileImportFailed, FileExportFailed
|
||||
from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_EXPIRED
|
||||
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
MONOSPACE_FONT = 'Lucida Console'
|
||||
elif platform.system() == 'Darwin':
|
||||
@@ -22,8 +25,6 @@ else:
|
||||
|
||||
dialogs = []
|
||||
|
||||
from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_EXPIRED
|
||||
|
||||
pr_icons = {
|
||||
PR_UNPAID:":icons/unpaid.png",
|
||||
PR_PAID:":icons/confirmed.png",
|
||||
@@ -675,28 +676,35 @@ class AcceptFileDragDrop:
|
||||
def onFileAdded(self, fn):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def import_meta_gui(electrum_window, title, importer, on_success):
|
||||
filename = electrum_window.getOpenFileName(_("Open {} file").format(title) , "*.json")
|
||||
filter_ = "JSON (*.json);;All files (*)"
|
||||
filename = electrum_window.getOpenFileName(_("Open {} file").format(title), filter_)
|
||||
if not filename:
|
||||
return
|
||||
return
|
||||
try:
|
||||
importer(filename)
|
||||
importer(filename)
|
||||
except FileImportFailed as e:
|
||||
electrum_window.show_critical(str(e))
|
||||
electrum_window.show_critical(str(e))
|
||||
else:
|
||||
electrum_window.show_message(_("Your {} were successfully imported" ).format(title))
|
||||
on_success()
|
||||
electrum_window.show_message(_("Your {} were successfully imported").format(title))
|
||||
on_success()
|
||||
|
||||
|
||||
def export_meta_gui(electrum_window, title, exporter):
|
||||
filename = electrum_window.getSaveFileName(_("Select file to save your {}").format(title), 'electrum_{}.json'.format(title), "*.json")
|
||||
if not filename:
|
||||
filter_ = "JSON (*.json);;All files (*)"
|
||||
filename = electrum_window.getSaveFileName(_("Select file to save your {}").format(title),
|
||||
'electrum_{}.json'.format(title), filter_)
|
||||
if not filename:
|
||||
return
|
||||
try:
|
||||
exporter(filename)
|
||||
except FileExportFailed as e:
|
||||
electrum_window.show_critical(str(e))
|
||||
else:
|
||||
electrum_window.show_message(_("Your {0} were exported to '{1}'").format(title,str(filename)))
|
||||
electrum_window.show_message(_("Your {0} were exported to '{1}'")
|
||||
.format(title, str(filename)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication([])
|
||||
|
||||
Reference in New Issue
Block a user