This commit is contained in:
ThomasV 2017-08-12 10:22:19 +02:00
parent 5fb51a91a2
commit 8d82e66eee
1 changed files with 11 additions and 10 deletions

View File

@ -52,6 +52,10 @@ from electrum import Transaction, mnemonic
from electrum import util, bitcoin, commands, coinchooser
from electrum import SimpleConfig, paymentrequest
from electrum.wallet import Wallet, Multisig_Wallet
try:
from electrum.plot import plot_history
except:
plot_history = None
from amountedit import AmountEdit, BTCAmountEdit, MyLineEdit, BTCkBEdit
from qrcodewidget import QRCodeWidget, QRDialog
@ -465,7 +469,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
invoices_menu = wallet_menu.addMenu(_("Invoices"))
invoices_menu.addAction(_("Import"), lambda: self.invoice_list.import_invoices())
hist_menu = wallet_menu.addMenu(_("&History"))
hist_menu.addAction("Plot", self.plot_history_dialog)
hist_menu.addAction("Plot", self.plot_history_dialog).setEnabled(plot_history is not None)
hist_menu.addAction("Export", self.export_history_dialog)
wallet_menu.addSeparator()
@ -2229,16 +2233,13 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.show_message(_("Your wallet history has been successfully exported."))
def plot_history_dialog(self):
try:
from electrum.plot import plot_history
wallet = self.wallet
history = wallet.get_history()
if len(history) > 0:
plt = plot_history(self.wallet, history)
plt.show()
except BaseException as e:
self.show_error(str(e))
if plot_history is None:
return
wallet = self.wallet
history = wallet.get_history()
if len(history) > 0:
plt = plot_history(self.wallet, history)
plt.show()
def do_export_history(self, wallet, fileName, is_csv):
history = wallet.get_history()