2018-06-02 09:40:29 -07:00
|
|
|
from functools import partial
|
|
|
|
|
2016-12-28 13:49:09 -08:00
|
|
|
from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
|
2017-02-16 01:54:24 -08:00
|
|
|
from .digitalbitbox import DigitalBitboxPlugin
|
2016-12-28 13:49:09 -08:00
|
|
|
|
2019-02-28 13:26:15 -08:00
|
|
|
from electrum_zclassic.i18n import _
|
|
|
|
from electrum_zclassic.plugins import hook
|
|
|
|
from electrum_zclassic.wallet import Standard_Wallet
|
2017-11-12 20:54:04 -08:00
|
|
|
|
2016-12-28 13:49:09 -08:00
|
|
|
|
|
|
|
class Plugin(DigitalBitboxPlugin, QtPluginBase):
|
|
|
|
icon_unpaired = ":icons/digitalbitbox_unpaired.png"
|
|
|
|
icon_paired = ":icons/digitalbitbox.png"
|
|
|
|
|
|
|
|
def create_handler(self, window):
|
|
|
|
return DigitalBitbox_Handler(window)
|
|
|
|
|
2017-09-24 15:18:03 -07:00
|
|
|
@hook
|
|
|
|
def receive_menu(self, menu, addrs, wallet):
|
|
|
|
if type(wallet) is not Standard_Wallet:
|
|
|
|
return
|
|
|
|
|
|
|
|
keystore = wallet.get_keystore()
|
|
|
|
if type(keystore) is not self.keystore_class:
|
|
|
|
return
|
|
|
|
|
|
|
|
if not self.is_mobile_paired():
|
|
|
|
return
|
|
|
|
|
2017-11-22 03:58:19 -08:00
|
|
|
if not keystore.is_p2pkh():
|
|
|
|
return
|
|
|
|
|
2017-09-24 15:18:03 -07:00
|
|
|
if len(addrs) == 1:
|
|
|
|
def show_address():
|
2018-06-02 09:40:29 -07:00
|
|
|
keystore.thread.add(partial(self.show_address, wallet, keystore, addrs[0]))
|
|
|
|
|
|
|
|
menu.addAction(_("Show on {}").format(self.device), show_address)
|
2017-09-24 15:18:03 -07:00
|
|
|
|
2016-12-28 13:49:09 -08:00
|
|
|
|
|
|
|
class DigitalBitbox_Handler(QtHandlerBase):
|
|
|
|
|
|
|
|
def __init__(self, win):
|
|
|
|
super(DigitalBitbox_Handler, self).__init__(win, 'Digital Bitbox')
|