From 229219da9cd3227cf617fe3928221785124a6e21 Mon Sep 17 00:00:00 2001 From: f321x Date: Tue, 10 Jun 2025 16:03:30 +0200 Subject: [PATCH 1/2] qt: provide clearer warning for plot feature this warning is more detailed and explains the user why the plotting feature is not available to prevent confusion. --- electrum/gui/qt/history_list.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py index 27b12e031..1c42ae5a7 100644 --- a/electrum/gui/qt/history_list.py +++ b/electrum/gui/qt/history_list.py @@ -671,13 +671,15 @@ class HistoryList(MyTreeView, AcceptFileDragDrop): def plot_history_dialog(self): try: from electrum.plot import plot_history, NothingToPlotException - except Exception as e: + except ImportError as e: _logger.error(f"could not import electrum.plot. This feature needs matplotlib to be installed. exc={e!r}") - self.main_window.show_message( - _("Can't plot history.") + '\n' + - _("Perhaps some dependencies are missing...") + " (matplotlib?)" + '\n' + - f"Error: {e!r}" - ) + self.main_window.show_message("\n\n".join([ + _("This feature requires the 'matplotlib' Python library which is not " + "included in Electrum by default."), + _("If you run Electrum from source you can install matplotlib to use this feature."), + _("It is not possible to install matplotlib inside the binary executables " + "(e.g. AppImage or Windows installation).") + ])) return try: plt = plot_history(list(self.hm.transactions.values())) From dc3406d5618aebd95707c59e6452931d531c8439 Mon Sep 17 00:00:00 2001 From: f321x Date: Tue, 10 Jun 2025 16:14:04 +0200 Subject: [PATCH 2/2] change matplotlib backend from qt5agg to QtAgg according to the matplotlib docs (https://matplotlib.org/stable/api/backend_qt_api.html) specifing the exact qt version is depreceated and from now on only QtAgg should be specified for the qt backend. --- electrum/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/plot.py b/electrum/plot.py index 3e3604d29..a9a4cb922 100644 --- a/electrum/plot.py +++ b/electrum/plot.py @@ -5,7 +5,7 @@ from decimal import Decimal from collections import defaultdict import matplotlib -matplotlib.use('Qt5Agg') +matplotlib.use('QtAgg') import matplotlib.pyplot as plt import matplotlib.dates as md