mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
qt history_list: (UX) handle extremes of "Summary" and "Plot" buttons
This commit is contained in:
parent
c1d2aabd54
commit
5e7c1330d4
1 changed files with 11 additions and 5 deletions
|
@ -158,15 +158,16 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
|
||||||
|
|
||||||
def show_summary(self):
|
def show_summary(self):
|
||||||
h = self.summary
|
h = self.summary
|
||||||
|
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()
|
format_amount = lambda x: self.parent.format_amount(x) + ' ' + self.parent.base_unit()
|
||||||
d = WindowModalDialog(self, _("Summary"))
|
d = WindowModalDialog(self, _("Summary"))
|
||||||
d.setMinimumSize(600, 150)
|
d.setMinimumSize(600, 150)
|
||||||
vbox = QVBoxLayout()
|
vbox = QVBoxLayout()
|
||||||
grid = QGridLayout()
|
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")), 0, 0)
|
||||||
grid.addWidget(QLabel(start_date.isoformat(' ')), 0, 1)
|
grid.addWidget(QLabel(start_date.isoformat(' ')), 0, 1)
|
||||||
grid.addWidget(QLabel(_("End")), 1, 0)
|
grid.addWidget(QLabel(_("End")), 1, 0)
|
||||||
|
@ -190,10 +191,15 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
|
||||||
|
|
||||||
def plot_history_dialog(self):
|
def plot_history_dialog(self):
|
||||||
if plot_history is None:
|
if plot_history is None:
|
||||||
|
self.parent.show_message(
|
||||||
|
_("Can't plot history.") + '\n' +
|
||||||
|
_("Perhaps some dependencies are missing...") + " (matplotlib?)")
|
||||||
return
|
return
|
||||||
if len(self.transactions) > 0:
|
if len(self.transactions) > 0:
|
||||||
plt = plot_history(self.transactions)
|
plt = plot_history(self.transactions)
|
||||||
plt.show()
|
plt.show()
|
||||||
|
else:
|
||||||
|
self.parent.show_message(_("Nothing to plot."))
|
||||||
|
|
||||||
@profiler
|
@profiler
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue