commit 5e7c1330d4d3d0bad0745cd897c05f9ffafd70ee
parent c1d2aabd54a3ab30603a97eae865aed35e925342
Author: SomberNight <somber.night@protonmail.com>
Date: Fri, 23 Feb 2018 19:00:29 +0100
qt history_list: (UX) handle extremes of "Summary" and "Plot" buttons
Diffstat:
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/gui/qt/history_list.py b/gui/qt/history_list.py
@@ -158,15 +158,16 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
def show_summary(self):
h = self.summary
- format_amount = lambda x: self.parent.format_amount(x) + ' '+ self.parent.base_unit()
+ start_date = h.get('start_date')
+ end_date = h.get('end_date')
+ if start_date is None or end_date is None:
+ self.parent.show_message(_("Nothing to summarize."))
+ return
+ format_amount = lambda x: self.parent.format_amount(x) + ' ' + self.parent.base_unit()
d = WindowModalDialog(self, _("Summary"))
d.setMinimumSize(600, 150)
vbox = QVBoxLayout()
grid = QGridLayout()
- start_date = h.get('start_date')
- end_date = h.get('end_date')
- if start_date is None and end_date is None:
- return
grid.addWidget(QLabel(_("Start")), 0, 0)
grid.addWidget(QLabel(start_date.isoformat(' ')), 0, 1)
grid.addWidget(QLabel(_("End")), 1, 0)
@@ -190,10 +191,15 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
def plot_history_dialog(self):
if plot_history is None:
+ self.parent.show_message(
+ _("Can't plot history.") + '\n' +
+ _("Perhaps some dependencies are missing...") + " (matplotlib?)")
return
if len(self.transactions) > 0:
plt = plot_history(self.transactions)
plt.show()
+ else:
+ self.parent.show_message(_("Nothing to plot."))
@profiler
def on_update(self):