electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit df9935e6af3a8c65b2d5b5f55f77e985d5c4c384
parent 2345d5f47321e5e1e4fe959e63f7ae63289f8640
Author: ThomasV <thomasv@electrum.org>
Date:   Wed, 28 Feb 2018 11:07:39 +0100

unify date format in history tab

Diffstat:
Mgui/qt/history_list.py | 17++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/gui/qt/history_list.py b/gui/qt/history_list.py @@ -63,6 +63,9 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop): self.end_timestamp = None self.years = [] + def format_date(self, d): + return str(datetime.date(d.year, d.month, d.day)) if d else _('None') + def refresh_headers(self): headers = ['', '', _('Date'), _('Description'), _('Amount'), _('Balance')] fx = self.parent.fx @@ -98,8 +101,8 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop): end_date = datetime.datetime(year+1, 1, 1) self.start_timestamp = time.mktime(start_date.timetuple()) self.end_timestamp = time.mktime(end_date.timetuple()) - self.start_button.setText(_('From') + ' ' + str(start_date)) - self.end_button.setText(_('To') + ' ' + str(end_date)) + self.start_button.setText(_('From') + ' ' + self.format_date(start_date)) + self.end_button.setText(_('To') + ' ' + self.format_date(end_date)) self.update() def create_toolbar_buttons(self): @@ -143,23 +146,23 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop): if d.exec_(): if d.date is None: return None - button.setText(d.date.toString()) - return time.mktime(d.date.toPyDate().timetuple()) + date = d.date.toPyDate() + button.setText(self.format_date(date)) + return time.mktime(date.timetuple()) def show_summary(self): h = self.summary start_date = h.get('start_date') end_date = h.get('end_date') format_amount = lambda x: self.parent.format_amount(x.value) + ' ' + self.parent.base_unit() - format_date = lambda x: x.isoformat(' ')[:-3] if x else _("None") d = WindowModalDialog(self, _("Summary")) d.setMinimumSize(600, 150) vbox = QVBoxLayout() grid = QGridLayout() grid.addWidget(QLabel(_("Start")), 0, 0) - grid.addWidget(QLabel(format_date(start_date)), 0, 1) + grid.addWidget(QLabel(self.format_date(start_date)), 0, 1) grid.addWidget(QLabel(_("End")), 1, 0) - grid.addWidget(QLabel(format_date(end_date)), 1, 1) + grid.addWidget(QLabel(self.format_date(end_date)), 1, 1) grid.addWidget(QLabel(_("Initial balance")), 2, 0) grid.addWidget(QLabel(format_amount(h['start_balance'])), 2, 1) grid.addWidget(QLabel(str(h.get('start_fiat_balance'))), 2, 2)