|
|
|
|
@ -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,8 +676,10 @@ 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 |
|
|
|
|
try: |
|
|
|
|
@ -684,11 +687,14 @@ def import_meta_gui(electrum_window, title, importer, on_success):
|
|
|
|
|
except FileImportFailed as e: |
|
|
|
|
electrum_window.show_critical(str(e)) |
|
|
|
|
else: |
|
|
|
|
electrum_window.show_message(_("Your {} were successfully imported" ).format(title)) |
|
|
|
|
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") |
|
|
|
|
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: |
|
|
|
|
@ -696,7 +702,9 @@ def export_meta_gui(electrum_window, title, exporter):
|
|
|
|
|
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([]) |
|
|
|
|
|