commit ef88bb1c286db6c7ca29754a750c499cb90dbb82
parent d9e7807fff34ec4f32480a70b8cd5f69766845d6
Author: Janus <ysangkok@gmail.com>
Date: Thu, 17 Jan 2019 15:29:21 +0100
request_list: select new items
Diffstat:
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
@@ -1070,6 +1070,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
self.address_list.update()
self.clear_receive_tab()
self.request_list.update()
+ self.request_list.select_key(key)
def create_bitcoin_request(self, amount, message, expiration):
addr = self.wallet.get_unused_address()
@@ -1094,6 +1095,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
else:
self.sign_payment_request(addr)
#self.save_request_button.setEnabled(False)
+ return addr
def view_and_paste(self, title, msg, data):
dialog = WindowModalDialog(self, title)
diff --git a/electrum/gui/qt/request_list.py b/electrum/gui/qt/request_list.py
@@ -27,7 +27,7 @@ from enum import IntEnum
from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtWidgets import QMenu, QHeaderView
-from PyQt5.QtCore import Qt
+from PyQt5.QtCore import Qt, QItemSelectionModel
from electrum.i18n import _
from electrum.util import format_time, age
@@ -76,6 +76,16 @@ class RequestList(MyTreeView):
self.selectionModel().currentRowChanged.connect(self.item_changed)
self.setColumnWidth(self.Columns.ADDRESS, 250)
+ def select_key(self, key):
+ for i in range(self.model().rowCount()):
+ item = self.model().index(i, 0)
+ row_key = item.data(ROLE_RHASH_OR_ADDR)
+ if item.data(ROLE_REQUEST_TYPE) == REQUEST_TYPE_LN:
+ row_key = self.wallet.lnworker.invoices[row_key][1]
+ if key == row_key:
+ self.selectionModel().setCurrentIndex(item, QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows)
+ break
+
def item_changed(self, idx):
# TODO use siblingAtColumn when min Qt version is >=5.11
addr = self.model().itemFromIndex(idx.sibling(idx.row(), self.Columns.ADDRESS)).text()