Merge pull request #9934 from f321x/matplotlib_warning
qt: provide more detailed warning for plot feature, change matplotlib backend
This commit is contained in:
@@ -671,13 +671,15 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||||||
def plot_history_dialog(self):
|
def plot_history_dialog(self):
|
||||||
try:
|
try:
|
||||||
from electrum.plot import plot_history, NothingToPlotException
|
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}")
|
_logger.error(f"could not import electrum.plot. This feature needs matplotlib to be installed. exc={e!r}")
|
||||||
self.main_window.show_message(
|
self.main_window.show_message("\n\n".join([
|
||||||
_("Can't plot history.") + '\n' +
|
_("This feature requires the 'matplotlib' Python library which is not "
|
||||||
_("Perhaps some dependencies are missing...") + " (matplotlib?)" + '\n' +
|
"included in Electrum by default."),
|
||||||
f"Error: {e!r}"
|
_("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
|
return
|
||||||
try:
|
try:
|
||||||
plt = plot_history(list(self.hm.transactions.values()))
|
plt = plot_history(list(self.hm.transactions.values()))
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from decimal import Decimal
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import matplotlib
|
import matplotlib
|
||||||
matplotlib.use('Qt5Agg')
|
matplotlib.use('QtAgg')
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import matplotlib.dates as md
|
import matplotlib.dates as md
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user