From b07d3466c01e6ca83490b1573cb936ca2a36b663 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sat, 27 Aug 2016 11:30:53 +0200 Subject: [PATCH] new icons to show hardware wallet pairing in status bar --- icons.qrc | 2 ++ icons/keepkey.png | Bin 2213 -> 1267 bytes icons/keepkey_unpaired.png | Bin 0 -> 1267 bytes icons/trezor_unpaired.png | Bin 0 -> 2251 bytes lib/plugins.py | 3 +++ plugins/keepkey/qt.py | 3 ++- plugins/trezor/plugin.py | 4 ---- plugins/trezor/qt.py | 3 ++- plugins/trezor/qt_generic.py | 22 ++++++++++++++++++---- 9 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 icons/keepkey_unpaired.png create mode 100644 icons/trezor_unpaired.png diff --git a/icons.qrc b/icons.qrc index 7caa8836f..2f2f62d11 100644 --- a/icons.qrc +++ b/icons.qrc @@ -15,6 +15,7 @@ icons/file.png icons/hot_seed.png icons/keepkey.png + icons/keepkey_unpaired.png icons/key.png icons/lock.png icons/microphone.png @@ -28,6 +29,7 @@ icons/status_lagging.png icons/seal.png icons/speaker.png + icons/trezor_unpaired.png icons/trezor.png icons/trustedcoin.png icons/unconfirmed.png diff --git a/icons/keepkey.png b/icons/keepkey.png index 9867bddc9c49af76c6c278a580e76f9a02700383..76877bbd95f724b129450c02ab3779e275524905 100644 GIT binary patch delta 100 zcmZ1~_?dHp^5z=mUPfESByV>Yh7ML)4+aJX&H|6fVg?3oVGw3ym^DWND9B#o>Fdh= zfJ2&7R8w3pzl(u^>8GcQV@Sl|x0~m(eq<75{Lyf$+2h^CnLx!1p00i_>zopr0R5>P AbpQYW delta 1051 zcmc&zJ#W)M7n?QoV>B0k&sv=vh&b|NBhR3(wfg2ctXCRS>nu`k5Q;tGBM z`~((OB*fSO#D@3>6+Z!l5DO9moL#%5LuPKe_w+o^`@A3b^XltsFAFhui?&B}K#u4F z1(<8vWQ;-AMHAe|$X-7Agc}@pWzQLo=*WDaTErDlf)OIu=aSPnh@xC8#c=6S6cxR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ue(x@N7``A6|Ipq}WxH^0*y!N6&UTibKrX6kn@ii2t+VAh61F z=E=BUCdU}A1MYf=r;GA~KDB!y#=TBQfLh|s(`0W9EJ3gG`w@0AQy0dOT z72HHpj)%4=yXUWfL+Fxk6yOuz4kKqCQ0qEnke&8x;YR;f6$H;}@`MQBme9!ZI&-cd-uT3Xb!)v~{{=V_r dxdG%^e*yS_+Ji{$(U|}M002ovPDHLkV1h+yOSJ$1 literal 0 HcmV?d00001 diff --git a/icons/trezor_unpaired.png b/icons/trezor_unpaired.png new file mode 100644 index 0000000000000000000000000000000000000000..8d29638e99a63b3890bf83f478f06e53b179c715 GIT binary patch literal 2251 zcmV;+2sHPJP)T}TX9<}|$Bg||g)Ij1lF_D2t-x9dBn zrG@iNo+$_y~X^*oQ33qPDgchYlUWfddC%GMP|NPyhg!ot?$} z{5%#G7BD?MjYp3jf#>;9<#++K1Gu`IYTj_L8lzMysk*wF#>U1dR*j8~QFV1SDV54l zwQ+d2!22RtfE5)L)YsQX+f`p*A5~OTgo5}*y2JZCSo_x6+Dc-pwY4==JNbFK!uvEZ z7^BfhcDtPtCA-~DMx!wp#81-=UTt6y85tQgF)=}j*2KgFWn^RogIJp`@K^u~{?2PO z8X6iJqGV}kXoxf#O(4Jp!8cK*NC3cJ0r;W+A8y>Zfx5c7s4}mvuHxCVXRz69c<|r> z1_uZ6^5si791dhCiiK{!hNLvNGzL)6~>NMMXs+ z2g*f7Mby;P6t%s|%E~|+T&lzC4s7@O`}-pX+R@Pws__q+j7B4MbaX_t+uz?GtUc^b zWq{-U&eqh_L=3X6t&QYzdCc=)xm-?dZEX?l*VNPm=1tiZobv!Y{?1NKO@$4vv$J#C z3kjW_ongzEnwkpC;}LvKIeqN!sM%~LhrInLgD}YHL-%0iwID;`3u7^C@n1w`9-_kF8b38XS1}l6b!=z^)*$b1K{+Z zd4yAQbF=6*u(`Q8Y?%Qw6Q|&F%GAK`1K4`Ra(Q^Ov$M0JKfy>g1AJlxpHl{)Ar@N> z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?!<6Mb(55NZC=hC`3a16fN$NwE+ShOVcp!IvHrp41<{y~66@Llcx48FS!EUD(~ Z{{V$Y_PVRMjaL8w002ovPDHLkV1lFhGAjT8 literal 0 HcmV?d00001 diff --git a/lib/plugins.py b/lib/plugins.py index f6fbe18f8..b7fc62a7e 100644 --- a/lib/plugins.py +++ b/lib/plugins.py @@ -385,6 +385,7 @@ class DeviceMgr(ThreadJob, PrintError): def client_for_keystore(self, plugin, handler, keystore, force_pair): with self.lock: + plugin.update_status(handler, False) devices = self.scan_devices() xpub = keystore.xpub derivation = keystore.get_derivation() @@ -392,6 +393,8 @@ class DeviceMgr(ThreadJob, PrintError): if client is None and force_pair: info = self.select_device(plugin, handler, keystore, devices) client = self.force_pair_xpub(plugin, handler, info, xpub, derivation, devices) + if client: + plugin.update_status(handler, True) return client def client_by_xpub(self, plugin, xpub, handler, devices): diff --git a/plugins/keepkey/qt.py b/plugins/keepkey/qt.py index 69e2fbcfd..9bdc4695c 100644 --- a/plugins/keepkey/qt.py +++ b/plugins/keepkey/qt.py @@ -3,7 +3,8 @@ from keepkey import KeepKeyPlugin class Plugin(qt_plugin_class(KeepKeyPlugin)): - icon_file = ":icons/keepkey.png" + icon_paired = ":icons/keepkey.png" + icon_unpaired = ":icons/keepkey_unpaired.png" @classmethod def pin_matrix_widget_class(self): diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py index 6aad39663..a4696667e 100644 --- a/plugins/trezor/plugin.py +++ b/plugins/trezor/plugin.py @@ -353,7 +353,3 @@ class TrezorCompatiblePlugin(HW_PluginBase): def get_tx(self, tx_hash): tx = self.prev_tx[tx_hash] return self.electrum_tx_to_txtype(tx) - - @staticmethod - def is_valid_seed(seed): - return True diff --git a/plugins/trezor/qt.py b/plugins/trezor/qt.py index 1f418f6ea..473a25715 100644 --- a/plugins/trezor/qt.py +++ b/plugins/trezor/qt.py @@ -3,7 +3,8 @@ from trezor import TrezorPlugin class Plugin(qt_plugin_class(TrezorPlugin)): - icon_file = ":icons/trezor.png" + icon_unpaired = ":icons/trezor_unpaired.png" + icon_paired = ":icons/trezor.png" @classmethod def pin_matrix_widget_class(self): diff --git a/plugins/trezor/qt_generic.py b/plugins/trezor/qt_generic.py index 873b8969d..5efc07c14 100644 --- a/plugins/trezor/qt_generic.py +++ b/plugins/trezor/qt_generic.py @@ -193,15 +193,26 @@ def qt_plugin_class(base_plugin_class): for keystore in wallet.get_keystores(): if type(keystore) != self.keystore_class: continue - tooltip = self.device + ' ' + keystore.label - button = StatusBarButton(QIcon(self.icon_file), tooltip, + tooltip = self.device + ' ' + (keystore.label or '') + button = StatusBarButton(QIcon(self.icon_unpaired), tooltip, partial(self.settings_dialog, window, keystore)) window.statusBar().addPermanentWidget(button) - keystore.handler = self.create_handler(window) + handler = self.create_handler(window) + handler.button = button + keystore.handler = handler keystore.thread = TaskThread(window, window.on_error) # Trigger a pairing keystore.thread.add(partial(self.get_client, keystore)) + window.connect(window, SIGNAL('keystore_status'), self._update_status) + + def update_status(self, handler, paired): + handler.win.emit(SIGNAL('keystore_status'), handler, paired) + + def _update_status(self, handler, paired): + icon = self.icon_paired if paired else self.icon_unpaired + handler.button.setIcon(QIcon(icon)) + @hook def receive_menu(self, menu, addrs, wallet): if type(wallet) is not Standard_Wallet: @@ -222,7 +233,10 @@ def qt_plugin_class(base_plugin_class): forgotten their PIN or it is in bootloader mode.''' device_id = self.device_manager().xpub_id(keystore.xpub) if not device_id: - info = self.device_manager().select_device(keystore.handler, self, keystore) + try: + info = self.device_manager().select_device(self, keystore.handler, keystore) + except UserCancelled: + return device_id = info.device.id_ return device_id