From f7293694cc45e8950e4824b89196c35b74beaac8 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sat, 28 May 2016 15:51:00 +0200 Subject: [PATCH] qt: minor fixes --- gui/qt/address_list.py | 11 +++++++++++ gui/qt/history_list.py | 7 ++++--- gui/qt/main_window.py | 10 ---------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/gui/qt/address_list.py b/gui/qt/address_list.py index f3450f63e..03a8ec9be 100644 --- a/gui/qt/address_list.py +++ b/gui/qt/address_list.py @@ -109,6 +109,8 @@ class AddressList(MyTreeWidget): selected = self.selectedItems() multi_select = len(selected) > 1 addrs = [unicode(item.text(0)) for item in selected] + if not addrs: + return if not multi_select: item = self.itemAt(position) col = self.currentColumn() @@ -155,3 +157,12 @@ class AddressList(MyTreeWidget): run_hook('receive_menu', menu, addrs, self.wallet) menu.exec_(self.viewport().mapToGlobal(position)) + + def create_account_menu(self, position, k, item): + menu = QMenu() + exp = item.isExpanded() + menu.addAction(_("Minimize") if exp else _("Maximize"), lambda: self.parent.account_set_expanded(item, k, not exp)) + menu.addAction(_("Rename"), lambda: self.parent.edit_account_label(k)) + if self.wallet.seed_version > 4: + menu.addAction(_("View details"), lambda: self.parent.show_account_details(k)) + menu.exec_(self.viewport().mapToGlobal(position)) diff --git a/gui/qt/history_list.py b/gui/qt/history_list.py index 32ef61e47..a9f266ed5 100644 --- a/gui/qt/history_list.py +++ b/gui/qt/history_list.py @@ -73,16 +73,17 @@ class HistoryList(MyTreeWidget): current_tx = item.data(0, Qt.UserRole).toString() if item else None self.clear() run_hook('history_tab_update_begin') - for tx in h: - tx_hash, conf, value, timestamp, balance = tx + for h_item in h: + tx_hash, conf, value, timestamp, balance = h_item if conf is None and timestamp is None: continue # skip history in offline mode + icon, time_str = self.get_icon(conf, timestamp) v_str = self.parent.format_amount(value, True, whitespaces=True) balance_str = self.parent.format_amount(balance, whitespaces=True) label = self.wallet.get_label(tx_hash) entry = ['', tx_hash, time_str, label, v_str, balance_str] - run_hook('history_tab_update', tx, entry) + run_hook('history_tab_update', h_item, entry) item = QTreeWidgetItem(entry) item.setIcon(0, icon) for i in range(len(entry)): diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index e187fe1bf..830f7f45f 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -1450,16 +1450,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): item.setExpanded(b) self.accounts_expanded[k] = b - def create_account_menu(self, position, k, item): - menu = QMenu() - exp = item.isExpanded() - menu.addAction(_("Minimize") if exp else _("Maximize"), lambda: self.account_set_expanded(item, k, not exp)) - menu.addAction(_("Rename"), lambda: self.edit_account_label(k)) - if self.wallet.seed_version > 4: - menu.addAction(_("View details"), lambda: self.show_account_details(k)) - menu.exec_(self.address_list.viewport().mapToGlobal(position)) - - def get_coins(self): if self.pay_from: return self.pay_from