Browse Source

request_list: select new items

regtest_lnd
Janus 6 years ago
committed by SomberNight
parent
commit
3bfd284fb0
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/gui/qt/main_window.py
  2. 12
      electrum/gui/qt/request_list.py

2
electrum/gui/qt/main_window.py

@ -1072,6 +1072,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
self.address_list.update() self.address_list.update()
self.clear_receive_tab() self.clear_receive_tab()
self.request_list.update() self.request_list.update()
self.request_list.select_key(key)
def create_bitcoin_request(self, amount, message, expiration): def create_bitcoin_request(self, amount, message, expiration):
addr = self.wallet.get_unused_address() addr = self.wallet.get_unused_address()
@ -1096,6 +1097,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
else: else:
self.sign_payment_request(addr) self.sign_payment_request(addr)
#self.save_request_button.setEnabled(False) #self.save_request_button.setEnabled(False)
return addr
def view_and_paste(self, title, msg, data): def view_and_paste(self, title, msg, data):
dialog = WindowModalDialog(self, title) dialog = WindowModalDialog(self, title)

12
electrum/gui/qt/request_list.py

@ -27,7 +27,7 @@ from enum import IntEnum
from PyQt5.QtGui import QStandardItemModel, QStandardItem from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtWidgets import QMenu, QHeaderView from PyQt5.QtWidgets import QMenu, QHeaderView
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt, QItemSelectionModel
from electrum.i18n import _ from electrum.i18n import _
from electrum.util import format_time, age from electrum.util import format_time, age
@ -76,6 +76,16 @@ class RequestList(MyTreeView):
self.selectionModel().currentRowChanged.connect(self.item_changed) self.selectionModel().currentRowChanged.connect(self.item_changed)
self.setColumnWidth(self.Columns.ADDRESS, 250) 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): def item_changed(self, idx):
# TODO use siblingAtColumn when min Qt version is >=5.11 # TODO use siblingAtColumn when min Qt version is >=5.11
addr = self.model().itemFromIndex(idx.sibling(idx.row(), self.Columns.ADDRESS)).text() addr = self.model().itemFromIndex(idx.sibling(idx.row(), self.Columns.ADDRESS)).text()

Loading…
Cancel
Save