Browse Source

Qt: update current request when update_tabs is called

patch-4
ThomasV 3 years ago
parent
commit
e43983e854
  1. 14
      electrum/gui/qt/main_window.py
  2. 6
      electrum/gui/qt/request_list.py

14
electrum/gui/qt/main_window.py

@ -203,6 +203,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
self.showing_cert_mismatch_error = False
self.tl_windows = []
self.pending_invoice = None
self.current_request = None # request shown in the receive tab
Logger.__init__(self)
self._coroutines_scheduled = set() # type: Set[concurrent.futures.Future]
@ -1039,6 +1040,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
return
self.history_model.refresh('update_tabs')
self.request_list.update()
self.update_current_request()
self.invoice_list.update()
self.address_list.update()
self.utxo_list.update()
@ -1293,7 +1295,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
return w
def show_receive_request(self, req):
def set_current_request(self, req):
self.current_request = req
self.update_current_request()
def update_current_request(self):
req = self.current_request
if req is None:
self.receive_URI_e.setText('')
self.receive_lightning_e.setText('')
self.receive_address_e.setText('')
return
addr = req.get_address() or ''
amount_sat = req.get_amount_sat() or 0
address_help = '' if addr else _('Amount too small to be received onchain')

6
electrum/gui/qt/request_list.py

@ -85,9 +85,7 @@ class RequestList(MyTreeView):
def item_changed(self, idx: Optional[QModelIndex]):
if idx is None:
self.parent.receive_URI_e.setText('')
self.parent.receive_lightning_e.setText('')
self.parent.receive_address_e.setText('')
self.parent.set_current_request(None)
return
if not idx.isValid():
return
@ -98,7 +96,7 @@ class RequestList(MyTreeView):
if req is None:
self.update()
return
self.parent.show_receive_request(req)
self.parent.set_current_request(req)
def clearSelection(self):
super().clearSelection()

Loading…
Cancel
Save