commit c3996930492747d6980a6d6317bfced5213d0a23
parent 9bbea9bf2f257ac9feccd2b4acd170b10276437c
Author: SomberNight <somber.night@protonmail.com>
Date: Thu, 31 Jan 2019 12:13:31 +0100
qt contact list: context menu fixups
fixes #5048
fixes #5049
follow-up 9cff42328d5b6c92c87a2b41bb1f4e463c39aab7
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/electrum/gui/qt/contact_list.py b/electrum/gui/qt/contact_list.py
@@ -62,18 +62,18 @@ class ContactList(MyTreeView):
menu = QMenu()
idx = self.indexAt(position)
column = idx.column() or 0
- selected = self.selected_in_column(column)
selected_keys = []
- for s_idx in selected:
+ for s_idx in self.selected_in_column(0):
sel_key = self.model().itemFromIndex(s_idx).data(Qt.UserRole)
selected_keys.append(sel_key)
- if not selected or not idx.isValid():
+ if not selected_keys or not idx.isValid():
menu.addAction(_("New contact"), lambda: self.parent.new_contact_dialog())
menu.addAction(_("Import file"), lambda: self.import_contacts())
menu.addAction(_("Export file"), lambda: self.export_contacts())
else:
column_title = self.model().horizontalHeaderItem(column).text()
- column_data = '\n'.join(self.model().itemFromIndex(s_idx).text() for s_idx in selected)
+ column_data = '\n'.join(self.model().itemFromIndex(s_idx).text()
+ for s_idx in self.selected_in_column(column))
menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(column_data))
if column in self.editable_columns:
item = self.model().itemFromIndex(idx)
@@ -85,7 +85,7 @@ class ContactList(MyTreeView):
menu.addAction(_("Delete"), lambda: self.parent.delete_contacts(selected_keys))
URLs = [block_explorer_URL(self.config, 'addr', key) for key in filter(is_address, selected_keys)]
if URLs:
- menu.addAction(_("View on block explorer"), lambda: map(webbrowser.open, URLs))
+ menu.addAction(_("View on block explorer"), lambda: [webbrowser.open(u) for u in URLs])
run_hook('create_contact_menu', menu, selected_keys)
menu.exec_(self.viewport().mapToGlobal(position))