Browse Source

coldcard qt: change receive_menu to be similar to other hw plugins

you should not interact with the hw device in the GUI thread if possible...
right-click was lagging
dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
SomberNight 6 years ago
parent
commit
9c83bc1008
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 25
      electrum/plugins/coldcard/qt.py

25
electrum/plugins/coldcard/qt.py

@ -34,23 +34,14 @@ class Plugin(ColdcardPlugin, QtPluginBase):
@hook @hook
def receive_menu(self, menu, addrs, wallet): def receive_menu(self, menu, addrs, wallet):
# Context menu on each address in the Addresses Tab, right click... # Context menu on each address in the Addresses Tab, right click...
if len(addrs) != 1:
if type(wallet) is Standard_Wallet: return
keystore = wallet.get_keystore() for keystore in wallet.get_keystores():
else: if type(keystore) == self.keystore_class:
# find if any devices are connected and ready to go, use first of those. def show_address(keystore=keystore):
for ks in wallet.get_keystores(): keystore.thread.add(partial(self.show_address, wallet, addrs[0], keystore=keystore))
if ks.has_usable_connection_with_device(): device_name = "{} ({})".format(self.device, keystore.label)
keystore = ks menu.addAction(_("Show on {}").format(device_name), show_address)
break
else:
# don't hook into menu
return
if type(keystore) == self.keystore_class and len(addrs) == 1:
def show_address():
keystore.thread.add(partial(self.show_address, wallet, addrs[0], keystore=keystore))
menu.addAction(_("Show on Coldcard ({})").format(keystore.label), show_address)
@only_hook_if_libraries_available @only_hook_if_libraries_available
@hook @hook

Loading…
Cancel
Save