commit 8d82e66eee412a04d73e246528eccc47155fdccc
parent 5fb51a91a2c7d4c62297d92d9084a9ebe83716ee
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 12 Aug 2017 10:22:19 +0200
fix #2690
Diffstat:
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -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()