mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
chore(python): deprecate language setting in apply_settings / reset / recover
This commit is contained in:
parent
055662ea27
commit
519e591d91
@ -137,7 +137,6 @@ def load(
|
|||||||
pin=pin,
|
pin=pin,
|
||||||
passphrase_protection=passphrase_protection,
|
passphrase_protection=passphrase_protection,
|
||||||
label=label,
|
label=label,
|
||||||
language="en-US",
|
|
||||||
skip_checksum=ignore_checksum,
|
skip_checksum=ignore_checksum,
|
||||||
needs_backup=needs_backup,
|
needs_backup=needs_backup,
|
||||||
no_backup=no_backup,
|
no_backup=no_backup,
|
||||||
@ -188,7 +187,6 @@ def recover(
|
|||||||
pin_protection=pin_protection,
|
pin_protection=pin_protection,
|
||||||
label=label,
|
label=label,
|
||||||
u2f_counter=u2f_counter,
|
u2f_counter=u2f_counter,
|
||||||
language="en-US",
|
|
||||||
input_callback=input_callback,
|
input_callback=input_callback,
|
||||||
type=rec_type,
|
type=rec_type,
|
||||||
dry_run=dry_run,
|
dry_run=dry_run,
|
||||||
@ -241,7 +239,6 @@ def setup(
|
|||||||
passphrase_protection=passphrase_protection,
|
passphrase_protection=passphrase_protection,
|
||||||
pin_protection=pin_protection,
|
pin_protection=pin_protection,
|
||||||
label=label,
|
label=label,
|
||||||
language="en-US",
|
|
||||||
u2f_counter=u2f_counter,
|
u2f_counter=u2f_counter,
|
||||||
skip_backup=skip_backup,
|
skip_backup=skip_backup,
|
||||||
no_backup=no_backup,
|
no_backup=no_backup,
|
||||||
|
@ -1241,7 +1241,6 @@ def load_device(
|
|||||||
pin: Optional[str],
|
pin: Optional[str],
|
||||||
passphrase_protection: bool,
|
passphrase_protection: bool,
|
||||||
label: Optional[str],
|
label: Optional[str],
|
||||||
language: str = "en-US",
|
|
||||||
skip_checksum: bool = False,
|
skip_checksum: bool = False,
|
||||||
needs_backup: bool = False,
|
needs_backup: bool = False,
|
||||||
no_backup: bool = False,
|
no_backup: bool = False,
|
||||||
@ -1261,7 +1260,6 @@ def load_device(
|
|||||||
mnemonics=mnemonics,
|
mnemonics=mnemonics,
|
||||||
pin=pin,
|
pin=pin,
|
||||||
passphrase_protection=passphrase_protection,
|
passphrase_protection=passphrase_protection,
|
||||||
language=language,
|
|
||||||
label=label,
|
label=label,
|
||||||
skip_checksum=skip_checksum,
|
skip_checksum=skip_checksum,
|
||||||
needs_backup=needs_backup,
|
needs_backup=needs_backup,
|
||||||
|
@ -18,6 +18,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import warnings
|
||||||
from typing import TYPE_CHECKING, Callable, Optional
|
from typing import TYPE_CHECKING, Callable, Optional
|
||||||
|
|
||||||
from . import messages
|
from . import messages
|
||||||
@ -47,9 +48,13 @@ def apply_settings(
|
|||||||
experimental_features: Optional[bool] = None,
|
experimental_features: Optional[bool] = None,
|
||||||
hide_passphrase_from_host: Optional[bool] = None,
|
hide_passphrase_from_host: Optional[bool] = None,
|
||||||
) -> "MessageType":
|
) -> "MessageType":
|
||||||
|
if language is not None:
|
||||||
|
warnings.warn(
|
||||||
|
"language ignored. Use change_language() to set device language.",
|
||||||
|
DeprecationWarning,
|
||||||
|
)
|
||||||
settings = messages.ApplySettings(
|
settings = messages.ApplySettings(
|
||||||
label=label,
|
label=label,
|
||||||
language=language,
|
|
||||||
use_passphrase=use_passphrase,
|
use_passphrase=use_passphrase,
|
||||||
homescreen=homescreen,
|
homescreen=homescreen,
|
||||||
passphrase_always_on_device=passphrase_always_on_device,
|
passphrase_always_on_device=passphrase_always_on_device,
|
||||||
@ -150,12 +155,18 @@ def recover(
|
|||||||
passphrase_protection: bool = False,
|
passphrase_protection: bool = False,
|
||||||
pin_protection: bool = True,
|
pin_protection: bool = True,
|
||||||
label: Optional[str] = None,
|
label: Optional[str] = None,
|
||||||
language: str = "en-US",
|
language: Optional[str] = None,
|
||||||
input_callback: Optional[Callable] = None,
|
input_callback: Optional[Callable] = None,
|
||||||
type: messages.RecoveryDeviceType = messages.RecoveryDeviceType.ScrambledWords,
|
type: messages.RecoveryDeviceType = messages.RecoveryDeviceType.ScrambledWords,
|
||||||
dry_run: bool = False,
|
dry_run: bool = False,
|
||||||
u2f_counter: Optional[int] = None,
|
u2f_counter: Optional[int] = None,
|
||||||
) -> "MessageType":
|
) -> "MessageType":
|
||||||
|
if language is not None:
|
||||||
|
warnings.warn(
|
||||||
|
"language ignored. Use change_language() to set device language.",
|
||||||
|
DeprecationWarning,
|
||||||
|
)
|
||||||
|
|
||||||
if client.features.model == "1" and input_callback is None:
|
if client.features.model == "1" and input_callback is None:
|
||||||
raise RuntimeError("Input callback required for Trezor One")
|
raise RuntimeError("Input callback required for Trezor One")
|
||||||
|
|
||||||
@ -179,7 +190,6 @@ def recover(
|
|||||||
msg.passphrase_protection = passphrase_protection
|
msg.passphrase_protection = passphrase_protection
|
||||||
msg.pin_protection = pin_protection
|
msg.pin_protection = pin_protection
|
||||||
msg.label = label
|
msg.label = label
|
||||||
msg.language = language
|
|
||||||
msg.u2f_counter = u2f_counter
|
msg.u2f_counter = u2f_counter
|
||||||
|
|
||||||
res = client.call(msg)
|
res = client.call(msg)
|
||||||
@ -205,12 +215,18 @@ def reset(
|
|||||||
passphrase_protection: bool = False,
|
passphrase_protection: bool = False,
|
||||||
pin_protection: bool = True,
|
pin_protection: bool = True,
|
||||||
label: Optional[str] = None,
|
label: Optional[str] = None,
|
||||||
language: str = "en-US",
|
language: Optional[str] = None,
|
||||||
u2f_counter: int = 0,
|
u2f_counter: int = 0,
|
||||||
skip_backup: bool = False,
|
skip_backup: bool = False,
|
||||||
no_backup: bool = False,
|
no_backup: bool = False,
|
||||||
backup_type: messages.BackupType = messages.BackupType.Bip39,
|
backup_type: messages.BackupType = messages.BackupType.Bip39,
|
||||||
) -> "MessageType":
|
) -> "MessageType":
|
||||||
|
if language is not None:
|
||||||
|
warnings.warn(
|
||||||
|
"language ignored. Use change_language() to set device language.",
|
||||||
|
DeprecationWarning,
|
||||||
|
)
|
||||||
|
|
||||||
if client.features.initialized:
|
if client.features.initialized:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Device is initialized already. Call wipe_device() and try again."
|
"Device is initialized already. Call wipe_device() and try again."
|
||||||
@ -228,7 +244,6 @@ def reset(
|
|||||||
strength=strength,
|
strength=strength,
|
||||||
passphrase_protection=bool(passphrase_protection),
|
passphrase_protection=bool(passphrase_protection),
|
||||||
pin_protection=bool(pin_protection),
|
pin_protection=bool(pin_protection),
|
||||||
language=language,
|
|
||||||
label=label,
|
label=label,
|
||||||
u2f_counter=u2f_counter,
|
u2f_counter=u2f_counter,
|
||||||
skip_backup=bool(skip_backup),
|
skip_backup=bool(skip_backup),
|
||||||
|
Loading…
Reference in New Issue
Block a user