Browse Source

don't offer recovery type choice for trezor T

3.2.x
SomberNight 7 years ago
parent
commit
5fafd34de7
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 4
      plugins/trezor/clientbase.py
  2. 8
      plugins/trezor/qt.py
  3. 5
      plugins/trezor/trezor.py

4
plugins/trezor/clientbase.py

@ -233,6 +233,10 @@ class TrezorClientBase(GuiMixin, PrintError):
def atleast_version(self, major, minor=0, patch=0):
return self.firmware_version() >= (major, minor, patch)
def get_trezor_model(self):
"""Returns '1' for Trezor One, 'T' for Trezor T."""
return self.features.model
@staticmethod
def wrapper(func):
'''Wrap methods to clear any message box they opened.'''

8
plugins/trezor/qt.py

@ -181,7 +181,7 @@ class QtPlugin(QtPluginBase):
if device_id:
SettingsDialog(window, self, keystore, device_id).exec_()
def request_trezor_init_settings(self, wizard, method, device):
def request_trezor_init_settings(self, wizard, method, model):
vbox = QVBoxLayout()
next_enabled = True
label = QLabel(_("Enter a label to name your device:"))
@ -251,7 +251,7 @@ class QtPlugin(QtPluginBase):
vbox.addWidget(cb_phrase)
# ask for recovery type (random word order OR matrix)
if method == TIM_RECOVER:
if method == TIM_RECOVER and not model == 'T':
gb_rectype = QGroupBox()
hbox_rectype = QHBoxLayout()
gb_rectype.setLayout(hbox_rectype)
@ -271,13 +271,15 @@ class QtPlugin(QtPluginBase):
bg_rectype.addButton(rb2)
bg_rectype.setId(rb2, RECOVERY_TYPE_MATRIX)
hbox_rectype.addWidget(rb2)
else:
bg_rectype = None
wizard.exec_layout(vbox, next_enabled=next_enabled)
if method in [TIM_NEW, TIM_RECOVER]:
item = bg_numwords.checkedId()
pin = cb_pin.isChecked()
recovery_type = bg_rectype.checkedId()
recovery_type = bg_rectype.checkedId() if bg_rectype else None
else:
item = ' '.join(str(clean_text(text)).split())
pin = str(pin.text())

5
plugins/trezor/trezor.py

@ -196,9 +196,12 @@ class TrezorPlugin(HW_PluginBase):
(TIM_MNEMONIC, _("Upload a BIP39 mnemonic to generate the seed")),
(TIM_PRIVKEY, _("Upload a master private key"))
]
devmgr = self.device_manager()
client = devmgr.client_by_id(device_id)
model = client.get_trezor_model()
def f(method):
import threading
settings = self.request_trezor_init_settings(wizard, method, self.device)
settings = self.request_trezor_init_settings(wizard, method, model)
t = threading.Thread(target=self._initialize_device_safe, args=(settings, method, device_id, wizard, handler))
t.setDaemon(True)
t.start()

Loading…
Cancel
Save