don't offer recovery type choice for trezor T
This commit is contained in:
@@ -233,6 +233,10 @@ class TrezorClientBase(GuiMixin, PrintError):
|
|||||||
def atleast_version(self, major, minor=0, patch=0):
|
def atleast_version(self, major, minor=0, patch=0):
|
||||||
return self.firmware_version() >= (major, minor, patch)
|
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
|
@staticmethod
|
||||||
def wrapper(func):
|
def wrapper(func):
|
||||||
'''Wrap methods to clear any message box they opened.'''
|
'''Wrap methods to clear any message box they opened.'''
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class QtPlugin(QtPluginBase):
|
|||||||
if device_id:
|
if device_id:
|
||||||
SettingsDialog(window, self, keystore, device_id).exec_()
|
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()
|
vbox = QVBoxLayout()
|
||||||
next_enabled = True
|
next_enabled = True
|
||||||
label = QLabel(_("Enter a label to name your device:"))
|
label = QLabel(_("Enter a label to name your device:"))
|
||||||
@@ -251,7 +251,7 @@ class QtPlugin(QtPluginBase):
|
|||||||
vbox.addWidget(cb_phrase)
|
vbox.addWidget(cb_phrase)
|
||||||
|
|
||||||
# ask for recovery type (random word order OR matrix)
|
# ask for recovery type (random word order OR matrix)
|
||||||
if method == TIM_RECOVER:
|
if method == TIM_RECOVER and not model == 'T':
|
||||||
gb_rectype = QGroupBox()
|
gb_rectype = QGroupBox()
|
||||||
hbox_rectype = QHBoxLayout()
|
hbox_rectype = QHBoxLayout()
|
||||||
gb_rectype.setLayout(hbox_rectype)
|
gb_rectype.setLayout(hbox_rectype)
|
||||||
@@ -271,13 +271,15 @@ class QtPlugin(QtPluginBase):
|
|||||||
bg_rectype.addButton(rb2)
|
bg_rectype.addButton(rb2)
|
||||||
bg_rectype.setId(rb2, RECOVERY_TYPE_MATRIX)
|
bg_rectype.setId(rb2, RECOVERY_TYPE_MATRIX)
|
||||||
hbox_rectype.addWidget(rb2)
|
hbox_rectype.addWidget(rb2)
|
||||||
|
else:
|
||||||
|
bg_rectype = None
|
||||||
|
|
||||||
wizard.exec_layout(vbox, next_enabled=next_enabled)
|
wizard.exec_layout(vbox, next_enabled=next_enabled)
|
||||||
|
|
||||||
if method in [TIM_NEW, TIM_RECOVER]:
|
if method in [TIM_NEW, TIM_RECOVER]:
|
||||||
item = bg_numwords.checkedId()
|
item = bg_numwords.checkedId()
|
||||||
pin = cb_pin.isChecked()
|
pin = cb_pin.isChecked()
|
||||||
recovery_type = bg_rectype.checkedId()
|
recovery_type = bg_rectype.checkedId() if bg_rectype else None
|
||||||
else:
|
else:
|
||||||
item = ' '.join(str(clean_text(text)).split())
|
item = ' '.join(str(clean_text(text)).split())
|
||||||
pin = str(pin.text())
|
pin = str(pin.text())
|
||||||
|
|||||||
@@ -196,9 +196,12 @@ class TrezorPlugin(HW_PluginBase):
|
|||||||
(TIM_MNEMONIC, _("Upload a BIP39 mnemonic to generate the seed")),
|
(TIM_MNEMONIC, _("Upload a BIP39 mnemonic to generate the seed")),
|
||||||
(TIM_PRIVKEY, _("Upload a master private key"))
|
(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):
|
def f(method):
|
||||||
import threading
|
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 = threading.Thread(target=self._initialize_device_safe, args=(settings, method, device_id, wizard, handler))
|
||||||
t.setDaemon(True)
|
t.setDaemon(True)
|
||||||
t.start()
|
t.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user