Browse Source

qt receive_tab: fix "show_address_on_hw" functionality

follow-up b07fe970bf

I don't like this being hidden in the toolbar menu.
The other items in the toolbar menu are ~settings or generic actions
independent of the current request. This one is dependent on the
current request, and even the active "tab"... does not make sense
to show this when the lightning tab is active.
It is more difficult to discover it in the first place than previously,
and it being less visible goes against encouraging hw device users of
using it, which is what we should be doing.

Anyway, this commit just makes it functional as-is.
master
SomberNight 3 years ago
parent
commit
4a626a113d
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 4
      electrum/gui/qt/receive_tab.py
  2. 6
      electrum/plugins/hw_wallet/qt.py

4
electrum/gui/qt/receive_tab.py

@ -252,6 +252,8 @@ class ReceiveTab(QWidget, MessageBoxMixin, Logger):
req = self.wallet.get_request(key) if key else None
if req is None:
self.receive_e.setText('')
self.addr = self.URI = self.lnaddr = ''
self.address_help = self.URI_help = self.ln_help = ''
return
help_texts = self.wallet.get_help_texts_for_receive_request(req)
self.addr = (req.get_address() or '') if not help_texts.address_is_error else ''
@ -357,6 +359,8 @@ class ReceiveTab(QWidget, MessageBoxMixin, Logger):
def do_clear(self):
self.receive_e.setText('')
self.addr = self.URI = self.lnaddr = ''
self.address_help = self.URI_help = self.ln_help = ''
self.receive_widget.setVisible(False)
self.toggle_qr_button.setEnabled(False)
self.toggle_view_button.setEnabled(False)

6
electrum/plugins/hw_wallet/qt.py

@ -284,13 +284,13 @@ class QtPluginBase(object):
keystore: 'Hardware_KeyStore',
main_window: ElectrumWindow):
plugin = keystore.plugin
receive_address_e = main_window.receive_tab.receive_address_e
receive_tab = main_window.receive_tab
def show_address():
addr = str(receive_address_e.text())
addr = str(receive_tab.addr)
keystore.thread.add(partial(plugin.show_address, wallet, addr, keystore))
dev_name = f"{plugin.device} ({keystore.label})"
main_window.receive_tab.toolbar_menu.addAction(read_QIcon("eye1.png"), _("Show address on {}").format(dev_name), show_address)
receive_tab.toolbar_menu.addAction(read_QIcon("eye1.png"), _("Show address on {}").format(dev_name), show_address)
def create_handler(self, window: Union[ElectrumWindow, InstallWizard]) -> 'QtHandlerBase':
raise NotImplementedError()

Loading…
Cancel
Save