Merge pull request #3834 from SomberNight/string_format
use string.format instead of old style (%) formatting
This commit is contained in:
commit
42ed4bc3d6
|
@ -631,7 +631,7 @@ class ElectrumWindow(App):
|
||||||
if not self.wallet.up_to_date or server_height == 0:
|
if not self.wallet.up_to_date or server_height == 0:
|
||||||
status = _("Synchronizing...")
|
status = _("Synchronizing...")
|
||||||
elif server_lag > 1:
|
elif server_lag > 1:
|
||||||
status = _("Server lagging (%d blocks)"%server_lag)
|
status = _("Server lagging ({} blocks)").format(server_lag)
|
||||||
else:
|
else:
|
||||||
c, u, x = self.wallet.get_balance()
|
c, u, x = self.wallet.get_balance()
|
||||||
text = self.format_amount(c+x+u)
|
text = self.format_amount(c+x+u)
|
||||||
|
@ -846,7 +846,7 @@ class ElectrumWindow(App):
|
||||||
def _delete_wallet(self, b):
|
def _delete_wallet(self, b):
|
||||||
if b:
|
if b:
|
||||||
basename = os.path.basename(self.wallet.storage.path)
|
basename = os.path.basename(self.wallet.storage.path)
|
||||||
self.protected(_("Enter your PIN code to confirm deletion of %s") % basename, self.__delete_wallet, ())
|
self.protected(_("Enter your PIN code to confirm deletion of {}").format(basename), self.__delete_wallet, ())
|
||||||
|
|
||||||
def __delete_wallet(self, pw):
|
def __delete_wallet(self, pw):
|
||||||
wallet_path = self.get_wallet_path()
|
wallet_path = self.get_wallet_path()
|
||||||
|
|
|
@ -135,7 +135,7 @@ Builder.load_string('''
|
||||||
height: self.minimum_height
|
height: self.minimum_height
|
||||||
Label:
|
Label:
|
||||||
color: root.text_color
|
color: root.text_color
|
||||||
text: _('From %d cosigners')%n.value
|
text: _('From {} cosigners').format(n.value)
|
||||||
Slider:
|
Slider:
|
||||||
id: n
|
id: n
|
||||||
range: 2, 5
|
range: 2, 5
|
||||||
|
@ -143,7 +143,7 @@ Builder.load_string('''
|
||||||
value: 2
|
value: 2
|
||||||
Label:
|
Label:
|
||||||
color: root.text_color
|
color: root.text_color
|
||||||
text: _('Require %d signatures')%m.value
|
text: _('Require {} signatures').format(m.value)
|
||||||
Slider:
|
Slider:
|
||||||
id: m
|
id: m
|
||||||
range: 1, n.value
|
range: 1, n.value
|
||||||
|
|
|
@ -112,7 +112,7 @@ class TxDialog(Factory.Popup):
|
||||||
if timestamp:
|
if timestamp:
|
||||||
self.date_str = datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
self.date_str = datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
||||||
elif exp_n:
|
elif exp_n:
|
||||||
self.date_str = _('Within %d blocks') % exp_n if exp_n > 0 else _('unknown (low fee)')
|
self.date_str = _('Within {} blocks').format(exp_n) if exp_n > 0 else _('unknown (low fee)')
|
||||||
else:
|
else:
|
||||||
self.date_str = ''
|
self.date_str = ''
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ Popup:
|
||||||
height: self.minimum_height
|
height: self.minimum_height
|
||||||
padding: '10dp'
|
padding: '10dp'
|
||||||
SettingsItem:
|
SettingsItem:
|
||||||
value: _("%d connections.")% app.num_nodes if app.num_nodes else _("Not connected")
|
value: _("{} connections.").format(app.num_nodes) if app.num_nodes else _("Not connected")
|
||||||
title: _("Status") + ': ' + self.value
|
title: _("Status") + ': ' + self.value
|
||||||
description: _("Connections with Electrum servers")
|
description: _("Connections with Electrum servers")
|
||||||
action: lambda x: None
|
action: lambda x: None
|
||||||
|
@ -46,7 +46,7 @@ Popup:
|
||||||
|
|
||||||
CardSeparator
|
CardSeparator
|
||||||
SettingsItem:
|
SettingsItem:
|
||||||
title: _('Fork detected at block %d')%app.blockchain_checkpoint if app.num_chains>1 else _('No fork detected')
|
title: _('Fork detected at block {}').format(app.blockchain_checkpoint) if app.num_chains>1 else _('No fork detected')
|
||||||
fork_description: (_('You are following branch') if app.auto_connect else _("Your server is on branch")) + ' ' + app.blockchain_name
|
fork_description: (_('You are following branch') if app.auto_connect else _("Your server is on branch")) + ' ' + app.blockchain_name
|
||||||
description: self.fork_description if app.num_chains>1 else _('Connected nodes are on the same chain')
|
description: self.fork_description if app.num_chains>1 else _('Connected nodes are on the same chain')
|
||||||
action: app.choose_blockchain_dialog
|
action: app.choose_blockchain_dialog
|
||||||
|
|
|
@ -135,10 +135,10 @@ class AddressList(MyTreeWidget):
|
||||||
if not multi_select:
|
if not multi_select:
|
||||||
column_title = self.headerItem().text(col)
|
column_title = self.headerItem().text(col)
|
||||||
copy_text = item.text(col)
|
copy_text = item.text(col)
|
||||||
menu.addAction(_("Copy %s")%column_title, lambda: self.parent.app.clipboard().setText(copy_text))
|
menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(copy_text))
|
||||||
menu.addAction(_('Details'), lambda: self.parent.show_address(addr))
|
menu.addAction(_('Details'), lambda: self.parent.show_address(addr))
|
||||||
if col in self.editable_columns:
|
if col in self.editable_columns:
|
||||||
menu.addAction(_("Edit %s")%column_title, lambda: self.editItem(item, col))
|
menu.addAction(_("Edit {}").format(column_title), lambda: self.editItem(item, col))
|
||||||
menu.addAction(_("Request payment"), lambda: self.parent.receive_at(addr))
|
menu.addAction(_("Request payment"), lambda: self.parent.receive_at(addr))
|
||||||
if self.wallet.can_export():
|
if self.wallet.can_export():
|
||||||
menu.addAction(_("Private key"), lambda: self.parent.show_private_key(addr))
|
menu.addAction(_("Private key"), lambda: self.parent.show_private_key(addr))
|
||||||
|
|
|
@ -203,7 +203,8 @@ class Console(QtWidgets.QPlainTextEdit):
|
||||||
self.skip = not self.skip
|
self.skip = not self.skip
|
||||||
|
|
||||||
if type(self.namespace.get(command)) == type(lambda:None):
|
if type(self.namespace.get(command)) == type(lambda:None):
|
||||||
self.appendPlainText("'%s' is a function. Type '%s()' to use it in the Python console."%(command, command))
|
self.appendPlainText("'{}' is a function. Type '{}()' to use it in the Python console."
|
||||||
|
.format(command, command))
|
||||||
self.newPrompt()
|
self.newPrompt()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,10 @@ class ContactList(MyTreeWidget):
|
||||||
column = self.currentColumn()
|
column = self.currentColumn()
|
||||||
column_title = self.headerItem().text(column)
|
column_title = self.headerItem().text(column)
|
||||||
column_data = '\n'.join([item.text(column) for item in selected])
|
column_data = '\n'.join([item.text(column) for item in selected])
|
||||||
menu.addAction(_("Copy %s")%column_title, lambda: self.parent.app.clipboard().setText(column_data))
|
menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(column_data))
|
||||||
if column in self.editable_columns:
|
if column in self.editable_columns:
|
||||||
item = self.currentItem()
|
item = self.currentItem()
|
||||||
menu.addAction(_("Edit %s")%column_title, lambda: self.editItem(item, column))
|
menu.addAction(_("Edit {}").format(column_title), lambda: self.editItem(item, column))
|
||||||
menu.addAction(_("Pay to"), lambda: self.parent.payto_contacts(keys))
|
menu.addAction(_("Pay to"), lambda: self.parent.payto_contacts(keys))
|
||||||
menu.addAction(_("Delete"), lambda: self.parent.delete_contacts(keys))
|
menu.addAction(_("Delete"), lambda: self.parent.delete_contacts(keys))
|
||||||
URLs = [block_explorer_URL(self.config, 'addr', key) for key in filter(is_address, keys)]
|
URLs = [block_explorer_URL(self.config, 'addr', key) for key in filter(is_address, keys)]
|
||||||
|
|
|
@ -166,9 +166,9 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
|
||||||
if height == TX_HEIGHT_LOCAL:
|
if height == TX_HEIGHT_LOCAL:
|
||||||
menu.addAction(_("Remove"), lambda: self.remove_local_tx(tx_hash))
|
menu.addAction(_("Remove"), lambda: self.remove_local_tx(tx_hash))
|
||||||
|
|
||||||
menu.addAction(_("Copy %s")%column_title, lambda: self.parent.app.clipboard().setText(column_data))
|
menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(column_data))
|
||||||
if column in self.editable_columns:
|
if column in self.editable_columns:
|
||||||
menu.addAction(_("Edit %s")%column_title, lambda: self.editItem(item, column))
|
menu.addAction(_("Edit {}").format(column_title), lambda: self.editItem(item, column))
|
||||||
|
|
||||||
menu.addAction(_("Details"), lambda: self.parent.show_transaction(tx))
|
menu.addAction(_("Details"), lambda: self.parent.show_transaction(tx))
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ MSG_GENERATING_WAIT = _("Electrum is generating your addresses, please wait...")
|
||||||
MSG_ENTER_ANYTHING = _("Please enter a seed phrase, a master key, a list of "
|
MSG_ENTER_ANYTHING = _("Please enter a seed phrase, a master key, a list of "
|
||||||
"Bitcoin addresses, or a list of private keys")
|
"Bitcoin addresses, or a list of private keys")
|
||||||
MSG_ENTER_SEED_OR_MPK = _("Please enter a seed phrase or a master key (xpub or xprv):")
|
MSG_ENTER_SEED_OR_MPK = _("Please enter a seed phrase or a master key (xpub or xprv):")
|
||||||
MSG_COSIGNER = _("Please enter the master public key of cosigner #%d:")
|
MSG_COSIGNER = _("Please enter the master public key of cosigner #{}:")
|
||||||
MSG_ENTER_PASSWORD = _("Choose a password to encrypt your wallet keys.") + '\n'\
|
MSG_ENTER_PASSWORD = _("Choose a password to encrypt your wallet keys.") + '\n'\
|
||||||
+ _("Leave this field empty if you want to disable encryption.")
|
+ _("Leave this field empty if you want to disable encryption.")
|
||||||
MSG_HW_STORAGE_ENCRYPTION = _("Set wallet file encryption.") + '\n'\
|
MSG_HW_STORAGE_ENCRYPTION = _("Set wallet file encryption.") + '\n'\
|
||||||
|
@ -275,8 +275,8 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||||
path = self.storage.path
|
path = self.storage.path
|
||||||
if self.storage.requires_split():
|
if self.storage.requires_split():
|
||||||
self.hide()
|
self.hide()
|
||||||
msg = _("The wallet '%s' contains multiple accounts, which are no longer supported since Electrum 2.7.\n\n"
|
msg = _("The wallet '{}' contains multiple accounts, which are no longer supported since Electrum 2.7.\n\n"
|
||||||
"Do you want to split your wallet into multiple files?"%path)
|
"Do you want to split your wallet into multiple files?").format(path)
|
||||||
if not self.question(msg):
|
if not self.question(msg):
|
||||||
return
|
return
|
||||||
file_list = '\n'.join(self.storage.split_accounts())
|
file_list = '\n'.join(self.storage.split_accounts())
|
||||||
|
@ -294,10 +294,10 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||||
action = self.storage.get_action()
|
action = self.storage.get_action()
|
||||||
if action and action != 'new':
|
if action and action != 'new':
|
||||||
self.hide()
|
self.hide()
|
||||||
msg = _("The file '%s' contains an incompletely created wallet.\n"
|
msg = _("The file '{}' contains an incompletely created wallet.\n"
|
||||||
"Do you want to complete its creation now?") % path
|
"Do you want to complete its creation now?").format(path)
|
||||||
if not self.question(msg):
|
if not self.question(msg):
|
||||||
if self.question(_("Do you want to delete '%s'?") % path):
|
if self.question(_("Do you want to delete '{}'?").format(path)):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
self.show_warning(_('The file was removed'))
|
self.show_warning(_('The file was removed'))
|
||||||
return
|
return
|
||||||
|
|
|
@ -76,7 +76,7 @@ class InvoiceList(MyTreeWidget):
|
||||||
pr = self.parent.invoices.get(key)
|
pr = self.parent.invoices.get(key)
|
||||||
status = self.parent.invoices.get_status(key)
|
status = self.parent.invoices.get_status(key)
|
||||||
if column_data:
|
if column_data:
|
||||||
menu.addAction(_("Copy %s")%column_title, lambda: self.parent.app.clipboard().setText(column_data))
|
menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(column_data))
|
||||||
menu.addAction(_("Details"), lambda: self.parent.show_invoice(key))
|
menu.addAction(_("Details"), lambda: self.parent.show_invoice(key))
|
||||||
if status == PR_UNPAID:
|
if status == PR_UNPAID:
|
||||||
menu.addAction(_("Pay Now"), lambda: self.parent.do_pay_invoice(key))
|
menu.addAction(_("Pay Now"), lambda: self.parent.do_pay_invoice(key))
|
||||||
|
|
|
@ -115,7 +115,7 @@ class RequestList(MyTreeWidget):
|
||||||
column_title = self.headerItem().text(column)
|
column_title = self.headerItem().text(column)
|
||||||
column_data = item.text(column)
|
column_data = item.text(column)
|
||||||
menu = QMenu(self)
|
menu = QMenu(self)
|
||||||
menu.addAction(_("Copy %s")%column_title, lambda: self.parent.app.clipboard().setText(column_data))
|
menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(column_data))
|
||||||
menu.addAction(_("Copy URI"), lambda: self.parent.view_and_paste('URI', '', self.parent.get_request_URI(addr)))
|
menu.addAction(_("Copy URI"), lambda: self.parent.view_and_paste('URI', '', self.parent.get_request_URI(addr)))
|
||||||
menu.addAction(_("Save as BIP70 file"), lambda: self.parent.export_payment_request(addr))
|
menu.addAction(_("Save as BIP70 file"), lambda: self.parent.export_payment_request(addr))
|
||||||
menu.addAction(_("Delete"), lambda: self.parent.delete_payment_request(addr))
|
menu.addAction(_("Delete"), lambda: self.parent.delete_payment_request(addr))
|
||||||
|
|
|
@ -218,7 +218,7 @@ class TxDialog(QDialog, MessageBoxMixin):
|
||||||
|
|
||||||
if timestamp:
|
if timestamp:
|
||||||
time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
||||||
self.date_label.setText(_("Date: %s")%time_str)
|
self.date_label.setText(_("Date: {}").format(time_str))
|
||||||
self.date_label.show()
|
self.date_label.show()
|
||||||
elif exp_n:
|
elif exp_n:
|
||||||
text = '%d blocks'%(exp_n) if exp_n > 0 else _('unknown (low fee)')
|
text = '%d blocks'%(exp_n) if exp_n > 0 else _('unknown (low fee)')
|
||||||
|
|
|
@ -224,7 +224,7 @@ class BaseWizard(object):
|
||||||
choices = []
|
choices = []
|
||||||
for name, info in devices:
|
for name, info in devices:
|
||||||
state = _("initialized") if info.initialized else _("wiped")
|
state = _("initialized") if info.initialized else _("wiped")
|
||||||
label = info.label or _("An unnamed %s")%name
|
label = info.label or _("An unnamed {}").format(name)
|
||||||
descr = "%s [%s, %s]" % (label, name, state)
|
descr = "%s [%s, %s]" % (label, name, state)
|
||||||
choices.append(((name, info), descr))
|
choices.append(((name, info), descr))
|
||||||
msg = _('Select a device') + ':'
|
msg = _('Select a device') + ':'
|
||||||
|
|
|
@ -808,7 +808,7 @@ def subparser_call(self, parser, namespace, values, option_string=None):
|
||||||
parser = self._name_parser_map[parser_name]
|
parser = self._name_parser_map[parser_name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
tup = parser_name, ', '.join(self._name_parser_map)
|
tup = parser_name, ', '.join(self._name_parser_map)
|
||||||
msg = _('unknown parser %r (choices: %s)') % tup
|
msg = _('unknown parser {!r} (choices: {})').format(*tup)
|
||||||
raise ArgumentError(self, msg)
|
raise ArgumentError(self, msg)
|
||||||
# parse all the remaining options into the namespace
|
# parse all the remaining options into the namespace
|
||||||
# store any unrecognized options on the object, so that the top
|
# store any unrecognized options on the object, so that the top
|
||||||
|
|
|
@ -442,11 +442,11 @@ class DeviceMgr(ThreadJob, PrintError):
|
||||||
# The user input has wrong PIN or passphrase, or cancelled input,
|
# The user input has wrong PIN or passphrase, or cancelled input,
|
||||||
# or it is not pairable
|
# or it is not pairable
|
||||||
raise DeviceUnpairableError(
|
raise DeviceUnpairableError(
|
||||||
_('Electrum cannot pair with your %s.\n\n'
|
_('Electrum cannot pair with your {}.\n\n'
|
||||||
'Before you request bitcoins to be sent to addresses in this '
|
'Before you request bitcoins to be sent to addresses in this '
|
||||||
'wallet, ensure you can pair with your device, or that you have '
|
'wallet, ensure you can pair with your device, or that you have '
|
||||||
'its seed (and passphrase, if any). Otherwise all bitcoins you '
|
'its seed (and passphrase, if any). Otherwise all bitcoins you '
|
||||||
'receive will be unspendable.') % plugin.device)
|
'receive will be unspendable.').format(plugin.device))
|
||||||
|
|
||||||
def unpaired_device_infos(self, handler, plugin, devices=None):
|
def unpaired_device_infos(self, handler, plugin, devices=None):
|
||||||
'''Returns a list of DeviceInfo objects: one for each connected,
|
'''Returns a list of DeviceInfo objects: one for each connected,
|
||||||
|
@ -472,9 +472,9 @@ class DeviceMgr(ThreadJob, PrintError):
|
||||||
infos = self.unpaired_device_infos(handler, plugin, devices)
|
infos = self.unpaired_device_infos(handler, plugin, devices)
|
||||||
if infos:
|
if infos:
|
||||||
break
|
break
|
||||||
msg = _('Please insert your %s. Verify the cable is '
|
msg = _('Please insert your {}. Verify the cable is '
|
||||||
'connected and that no other application is using it.\n\n'
|
'connected and that no other application is using it.\n\n'
|
||||||
'Try to connect again?') % plugin.device
|
'Try to connect again?').format(plugin.device)
|
||||||
if not handler.yes_no_question(msg):
|
if not handler.yes_no_question(msg):
|
||||||
raise UserCancelled()
|
raise UserCancelled()
|
||||||
devices = None
|
devices = None
|
||||||
|
@ -484,7 +484,7 @@ class DeviceMgr(ThreadJob, PrintError):
|
||||||
for info in infos:
|
for info in infos:
|
||||||
if info.label == keystore.label:
|
if info.label == keystore.label:
|
||||||
return info
|
return info
|
||||||
msg = _("Please select which %s device to use:") % plugin.device
|
msg = _("Please select which {} device to use:").format(plugin.device)
|
||||||
descriptions = [info.label + ' (%s)'%(_("initialized") if info.initialized else _("wiped")) for info in infos]
|
descriptions = [info.label + ' (%s)'%(_("initialized") if info.initialized else _("wiped")) for info in infos]
|
||||||
c = handler.query_choice(msg, descriptions)
|
c = handler.query_choice(msg, descriptions)
|
||||||
if c is None:
|
if c is None:
|
||||||
|
|
|
@ -531,7 +531,7 @@ class Abstract_Wallet(PrintError):
|
||||||
height, conf, timestamp = self.get_tx_height(tx_hash)
|
height, conf, timestamp = self.get_tx_height(tx_hash)
|
||||||
if height > 0:
|
if height > 0:
|
||||||
if conf:
|
if conf:
|
||||||
status = _("%d confirmations") % conf
|
status = _("{} confirmations").format(conf)
|
||||||
else:
|
else:
|
||||||
status = _('Not verified')
|
status = _('Not verified')
|
||||||
elif height in (TX_HEIGHT_UNCONF_PARENT, TX_HEIGHT_UNCONFIRMED):
|
elif height in (TX_HEIGHT_UNCONF_PARENT, TX_HEIGHT_UNCONFIRMED):
|
||||||
|
|
|
@ -421,7 +421,7 @@ class DigitalBitbox_KeyStore(Hardware_KeyStore):
|
||||||
|
|
||||||
|
|
||||||
def decrypt_message(self, pubkey, message, password):
|
def decrypt_message(self, pubkey, message, password):
|
||||||
raise RuntimeError(_('Encryption and decryption are currently not supported for %s') % self.device)
|
raise RuntimeError(_('Encryption and decryption are currently not supported for {}').format(self.device))
|
||||||
|
|
||||||
|
|
||||||
def sign_message(self, sequence, message, password):
|
def sign_message(self, sequence, message, password):
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Plugin(DigitalBitboxPlugin, QtPluginBase):
|
||||||
}
|
}
|
||||||
self.comserver_post_notification(verify_request_payload)
|
self.comserver_post_notification(verify_request_payload)
|
||||||
|
|
||||||
menu.addAction(_("Show on %s") % self.device, show_address)
|
menu.addAction(_("Show on {}").format(self.device), show_address)
|
||||||
|
|
||||||
|
|
||||||
class DigitalBitbox_Handler(QtHandlerBase):
|
class DigitalBitbox_Handler(QtHandlerBase):
|
||||||
|
|
|
@ -96,9 +96,9 @@ class Plugin(BasePlugin):
|
||||||
|
|
||||||
# 3. display the result
|
# 3. display the result
|
||||||
if response.get('verified'):
|
if response.get('verified'):
|
||||||
d.show_message(_('%s is covered by GreenAddress instant confirmation') % (tx.txid()), title=_('Verification successful!'))
|
d.show_message(_('{} is covered by GreenAddress instant confirmation').format(tx.txid()), title=_('Verification successful!'))
|
||||||
else:
|
else:
|
||||||
d.show_critical(_('%s is not covered by GreenAddress instant confirmation') % (tx.txid()), title=_('Verification failed!'))
|
d.show_critical(_('{} is not covered by GreenAddress instant confirmation').format(tx.txid()), title=_('Verification failed!'))
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
|
|
|
@ -144,7 +144,7 @@ class QtHandlerBase(QObject, PrintError):
|
||||||
def message_dialog(self, msg, on_cancel):
|
def message_dialog(self, msg, on_cancel):
|
||||||
# Called more than once during signing, to confirm output and fee
|
# Called more than once during signing, to confirm output and fee
|
||||||
self.clear_dialog()
|
self.clear_dialog()
|
||||||
title = _('Please check your %s device') % self.device
|
title = _('Please check your {} device').format(self.device)
|
||||||
self.dialog = dialog = WindowModalDialog(self.top_level_window(), title)
|
self.dialog = dialog = WindowModalDialog(self.top_level_window(), title)
|
||||||
l = QLabel(msg)
|
l = QLabel(msg)
|
||||||
vbox = QVBoxLayout(dialog)
|
vbox = QVBoxLayout(dialog)
|
||||||
|
|
|
@ -11,15 +11,15 @@ class GuiMixin(object):
|
||||||
# Requires: self.proto, self.device
|
# Requires: self.proto, self.device
|
||||||
|
|
||||||
messages = {
|
messages = {
|
||||||
3: _("Confirm the transaction output on your %s device"),
|
3: _("Confirm the transaction output on your {} device"),
|
||||||
4: _("Confirm internal entropy on your %s device to begin"),
|
4: _("Confirm internal entropy on your {} device to begin"),
|
||||||
5: _("Write down the seed word shown on your %s"),
|
5: _("Write down the seed word shown on your {}"),
|
||||||
6: _("Confirm on your %s that you want to wipe it clean"),
|
6: _("Confirm on your {} that you want to wipe it clean"),
|
||||||
7: _("Confirm on your %s device the message to sign"),
|
7: _("Confirm on your {} device the message to sign"),
|
||||||
8: _("Confirm the total amount spent and the transaction fee on your "
|
8: _("Confirm the total amount spent and the transaction fee on your "
|
||||||
"%s device"),
|
"{} device"),
|
||||||
10: _("Confirm wallet address on your %s device"),
|
10: _("Confirm wallet address on your {} device"),
|
||||||
'default': _("Check your %s device to continue"),
|
'default': _("Check your {} device to continue"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def callback_Failure(self, msg):
|
def callback_Failure(self, msg):
|
||||||
|
@ -38,18 +38,18 @@ class GuiMixin(object):
|
||||||
message = self.msg
|
message = self.msg
|
||||||
if not message:
|
if not message:
|
||||||
message = self.messages.get(msg.code, self.messages['default'])
|
message = self.messages.get(msg.code, self.messages['default'])
|
||||||
self.handler.show_message(message % self.device, self.cancel)
|
self.handler.show_message(message.format(self.device), self.cancel)
|
||||||
return self.proto.ButtonAck()
|
return self.proto.ButtonAck()
|
||||||
|
|
||||||
def callback_PinMatrixRequest(self, msg):
|
def callback_PinMatrixRequest(self, msg):
|
||||||
if msg.type == 2:
|
if msg.type == 2:
|
||||||
msg = _("Enter a new PIN for your %s:")
|
msg = _("Enter a new PIN for your {}:")
|
||||||
elif msg.type == 3:
|
elif msg.type == 3:
|
||||||
msg = (_("Re-enter the new PIN for your %s.\n\n"
|
msg = (_("Re-enter the new PIN for your {}.\n\n"
|
||||||
"NOTE: the positions of the numbers have changed!"))
|
"NOTE: the positions of the numbers have changed!"))
|
||||||
else:
|
else:
|
||||||
msg = _("Enter your current %s PIN:")
|
msg = _("Enter your current {} PIN:")
|
||||||
pin = self.handler.get_pin(msg % self.device)
|
pin = self.handler.get_pin(msg.format(self.device))
|
||||||
if not pin:
|
if not pin:
|
||||||
return self.proto.Cancel()
|
return self.proto.Cancel()
|
||||||
return self.proto.PinMatrixAck(pin=pin)
|
return self.proto.PinMatrixAck(pin=pin)
|
||||||
|
@ -57,9 +57,9 @@ class GuiMixin(object):
|
||||||
def callback_PassphraseRequest(self, req):
|
def callback_PassphraseRequest(self, req):
|
||||||
if self.creating_wallet:
|
if self.creating_wallet:
|
||||||
msg = _("Enter a passphrase to generate this wallet. Each time "
|
msg = _("Enter a passphrase to generate this wallet. Each time "
|
||||||
"you use this wallet your %s will prompt you for the "
|
"you use this wallet your {} will prompt you for the "
|
||||||
"passphrase. If you forget the passphrase you cannot "
|
"passphrase. If you forget the passphrase you cannot "
|
||||||
"access the bitcoins in the wallet.") % self.device
|
"access the bitcoins in the wallet.").format(self.device)
|
||||||
else:
|
else:
|
||||||
msg = _("Enter the passphrase to unlock this wallet:")
|
msg = _("Enter the passphrase to unlock this wallet:")
|
||||||
passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
|
passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
|
||||||
|
@ -70,8 +70,8 @@ class GuiMixin(object):
|
||||||
|
|
||||||
def callback_WordRequest(self, msg):
|
def callback_WordRequest(self, msg):
|
||||||
self.step += 1
|
self.step += 1
|
||||||
msg = _("Step %d/24. Enter seed word as explained on "
|
msg = _("Step {}/24. Enter seed word as explained on "
|
||||||
"your %s:") % (self.step, self.device)
|
"your {}:").format(self.step, self.device)
|
||||||
word = self.handler.get_word(msg)
|
word = self.handler.get_word(msg)
|
||||||
# Unfortunately the device can't handle self.proto.Cancel()
|
# Unfortunately the device can't handle self.proto.Cancel()
|
||||||
return self.proto.WordAck(word=word)
|
return self.proto.WordAck(word=word)
|
||||||
|
@ -155,27 +155,27 @@ class KeepKeyClientBase(GuiMixin, PrintError):
|
||||||
|
|
||||||
def toggle_passphrase(self):
|
def toggle_passphrase(self):
|
||||||
if self.features.passphrase_protection:
|
if self.features.passphrase_protection:
|
||||||
self.msg = _("Confirm on your %s device to disable passphrases")
|
self.msg = _("Confirm on your {} device to disable passphrases")
|
||||||
else:
|
else:
|
||||||
self.msg = _("Confirm on your %s device to enable passphrases")
|
self.msg = _("Confirm on your {} device to enable passphrases")
|
||||||
enabled = not self.features.passphrase_protection
|
enabled = not self.features.passphrase_protection
|
||||||
self.apply_settings(use_passphrase=enabled)
|
self.apply_settings(use_passphrase=enabled)
|
||||||
|
|
||||||
def change_label(self, label):
|
def change_label(self, label):
|
||||||
self.msg = _("Confirm the new label on your %s device")
|
self.msg = _("Confirm the new label on your {} device")
|
||||||
self.apply_settings(label=label)
|
self.apply_settings(label=label)
|
||||||
|
|
||||||
def change_homescreen(self, homescreen):
|
def change_homescreen(self, homescreen):
|
||||||
self.msg = _("Confirm on your %s device to change your home screen")
|
self.msg = _("Confirm on your {} device to change your home screen")
|
||||||
self.apply_settings(homescreen=homescreen)
|
self.apply_settings(homescreen=homescreen)
|
||||||
|
|
||||||
def set_pin(self, remove):
|
def set_pin(self, remove):
|
||||||
if remove:
|
if remove:
|
||||||
self.msg = _("Confirm on your %s device to disable PIN protection")
|
self.msg = _("Confirm on your {} device to disable PIN protection")
|
||||||
elif self.features.pin_protection:
|
elif self.features.pin_protection:
|
||||||
self.msg = _("Confirm on your %s device to change your PIN")
|
self.msg = _("Confirm on your {} device to change your PIN")
|
||||||
else:
|
else:
|
||||||
self.msg = _("Confirm on your %s device to set a PIN")
|
self.msg = _("Confirm on your {} device to set a PIN")
|
||||||
self.change_pin(remove)
|
self.change_pin(remove)
|
||||||
|
|
||||||
def clear_session(self):
|
def clear_session(self):
|
||||||
|
|
|
@ -30,7 +30,7 @@ class KeepKeyCompatibleKeyStore(Hardware_KeyStore):
|
||||||
return self.plugin.get_client(self, force_pair)
|
return self.plugin.get_client(self, force_pair)
|
||||||
|
|
||||||
def decrypt_message(self, sequence, message, password):
|
def decrypt_message(self, sequence, message, password):
|
||||||
raise RuntimeError(_('Encryption and decryption are not implemented by %s') % self.device)
|
raise RuntimeError(_('Encryption and decryption are not implemented by {}').format(self.device))
|
||||||
|
|
||||||
def sign_message(self, sequence, message, password):
|
def sign_message(self, sequence, message, password):
|
||||||
client = self.get_client()
|
client = self.get_client()
|
||||||
|
@ -119,9 +119,9 @@ class KeepKeyCompatiblePlugin(HW_PluginBase):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if not client.atleast_version(*self.minimum_firmware):
|
if not client.atleast_version(*self.minimum_firmware):
|
||||||
msg = (_('Outdated %s firmware for device labelled %s. Please '
|
msg = (_('Outdated {} firmware for device labelled {}. Please '
|
||||||
'download the updated firmware from %s') %
|
'download the updated firmware from {}')
|
||||||
(self.device, client.label(), self.firmware_URL))
|
.format(self.device, client.label(), self.firmware_URL))
|
||||||
self.print_error(msg)
|
self.print_error(msg)
|
||||||
handler.show_error(msg)
|
handler.show_error(msg)
|
||||||
return None
|
return None
|
||||||
|
@ -143,14 +143,14 @@ class KeepKeyCompatiblePlugin(HW_PluginBase):
|
||||||
|
|
||||||
def initialize_device(self, device_id, wizard, handler):
|
def initialize_device(self, device_id, wizard, handler):
|
||||||
# Initialization method
|
# Initialization method
|
||||||
msg = _("Choose how you want to initialize your %s.\n\n"
|
msg = _("Choose how you want to initialize your {}.\n\n"
|
||||||
"The first two methods are secure as no secret information "
|
"The first two methods are secure as no secret information "
|
||||||
"is entered into your computer.\n\n"
|
"is entered into your computer.\n\n"
|
||||||
"For the last two methods you input secrets on your keyboard "
|
"For the last two methods you input secrets on your keyboard "
|
||||||
"and upload them to your %s, and so you should "
|
"and upload them to your {}, and so you should "
|
||||||
"only do those on a computer you know to be trustworthy "
|
"only do those on a computer you know to be trustworthy "
|
||||||
"and free of malware."
|
"and free of malware."
|
||||||
) % (self.device, self.device)
|
).format(self.device, self.device)
|
||||||
choices = [
|
choices = [
|
||||||
# Must be short as QT doesn't word-wrap radio button text
|
# Must be short as QT doesn't word-wrap radio button text
|
||||||
(TIM_NEW, _("Let the device generate a completely new seed randomly")),
|
(TIM_NEW, _("Let the device generate a completely new seed randomly")),
|
||||||
|
|
|
@ -194,7 +194,7 @@ class QtPlugin(QtPluginBase):
|
||||||
if type(keystore) == self.keystore_class and len(addrs) == 1:
|
if type(keystore) == self.keystore_class and len(addrs) == 1:
|
||||||
def show_address():
|
def show_address():
|
||||||
keystore.thread.add(partial(self.show_address, wallet, addrs[0]))
|
keystore.thread.add(partial(self.show_address, wallet, addrs[0]))
|
||||||
menu.addAction(_("Show on %s") % self.device, show_address)
|
menu.addAction(_("Show on {}").format(self.device), show_address)
|
||||||
|
|
||||||
def show_settings_dialog(self, window, keystore):
|
def show_settings_dialog(self, window, keystore):
|
||||||
device_id = self.choose_device(window, keystore)
|
device_id = self.choose_device(window, keystore)
|
||||||
|
@ -227,7 +227,7 @@ class QtPlugin(QtPluginBase):
|
||||||
bg = QButtonGroup()
|
bg = QButtonGroup()
|
||||||
for i, count in enumerate([12, 18, 24]):
|
for i, count in enumerate([12, 18, 24]):
|
||||||
rb = QRadioButton(gb)
|
rb = QRadioButton(gb)
|
||||||
rb.setText(_("%d words") % count)
|
rb.setText(_("{} words").format(count))
|
||||||
bg.addButton(rb)
|
bg.addButton(rb)
|
||||||
bg.setId(rb, i)
|
bg.setId(rb, i)
|
||||||
hbox1.addWidget(rb)
|
hbox1.addWidget(rb)
|
||||||
|
@ -292,7 +292,7 @@ class SettingsDialog(WindowModalDialog):
|
||||||
their PIN.'''
|
their PIN.'''
|
||||||
|
|
||||||
def __init__(self, window, plugin, keystore, device_id):
|
def __init__(self, window, plugin, keystore, device_id):
|
||||||
title = _("%s Settings") % plugin.device
|
title = _("{} Settings").format(plugin.device)
|
||||||
super(SettingsDialog, self).__init__(window, title)
|
super(SettingsDialog, self).__init__(window, title)
|
||||||
self.setMaximumWidth(540)
|
self.setMaximumWidth(540)
|
||||||
|
|
||||||
|
@ -457,9 +457,9 @@ class SettingsDialog(WindowModalDialog):
|
||||||
settings_glayout = QGridLayout()
|
settings_glayout = QGridLayout()
|
||||||
|
|
||||||
# Settings tab - Label
|
# Settings tab - Label
|
||||||
label_msg = QLabel(_("Name this %s. If you have mutiple devices "
|
label_msg = QLabel(_("Name this {}. If you have mutiple devices "
|
||||||
"their labels help distinguish them.")
|
"their labels help distinguish them.")
|
||||||
% plugin.device)
|
.format(plugin.device))
|
||||||
label_msg.setWordWrap(True)
|
label_msg.setWordWrap(True)
|
||||||
label_label = QLabel(_("Device Label"))
|
label_label = QLabel(_("Device Label"))
|
||||||
label_edit = QLineEdit()
|
label_edit = QLineEdit()
|
||||||
|
@ -482,7 +482,7 @@ class SettingsDialog(WindowModalDialog):
|
||||||
pin_msg = QLabel(_("PIN protection is strongly recommended. "
|
pin_msg = QLabel(_("PIN protection is strongly recommended. "
|
||||||
"A PIN is your only protection against someone "
|
"A PIN is your only protection against someone "
|
||||||
"stealing your bitcoins if they obtain physical "
|
"stealing your bitcoins if they obtain physical "
|
||||||
"access to your %s.") % plugin.device)
|
"access to your {}.").format(plugin.device))
|
||||||
pin_msg.setWordWrap(True)
|
pin_msg.setWordWrap(True)
|
||||||
pin_msg.setStyleSheet("color: red")
|
pin_msg.setStyleSheet("color: red")
|
||||||
settings_glayout.addWidget(pin_msg, 3, 1, 1, -1)
|
settings_glayout.addWidget(pin_msg, 3, 1, 1, -1)
|
||||||
|
@ -497,8 +497,8 @@ class SettingsDialog(WindowModalDialog):
|
||||||
homescreen_clear_button.clicked.connect(clear_homescreen)
|
homescreen_clear_button.clicked.connect(clear_homescreen)
|
||||||
homescreen_msg = QLabel(_("You can set the homescreen on your "
|
homescreen_msg = QLabel(_("You can set the homescreen on your "
|
||||||
"device to personalize it. You must "
|
"device to personalize it. You must "
|
||||||
"choose a %d x %d monochrome black and "
|
"choose a {} x {} monochrome black and "
|
||||||
"white image.") % (hs_rows, hs_cols))
|
"white image.").format(hs_rows, hs_cols))
|
||||||
homescreen_msg.setWordWrap(True)
|
homescreen_msg.setWordWrap(True)
|
||||||
settings_glayout.addWidget(homescreen_label, 4, 0)
|
settings_glayout.addWidget(homescreen_label, 4, 0)
|
||||||
settings_glayout.addWidget(homescreen_change_button, 4, 1)
|
settings_glayout.addWidget(homescreen_change_button, 4, 1)
|
||||||
|
@ -541,7 +541,7 @@ class SettingsDialog(WindowModalDialog):
|
||||||
clear_pin_button.clicked.connect(clear_pin)
|
clear_pin_button.clicked.connect(clear_pin)
|
||||||
clear_pin_warning = QLabel(
|
clear_pin_warning = QLabel(
|
||||||
_("If you disable your PIN, anyone with physical access to your "
|
_("If you disable your PIN, anyone with physical access to your "
|
||||||
"%s device can spend your bitcoins.") % plugin.device)
|
"{} device can spend your bitcoins.").format(plugin.device))
|
||||||
clear_pin_warning.setWordWrap(True)
|
clear_pin_warning.setWordWrap(True)
|
||||||
clear_pin_warning.setStyleSheet("color: red")
|
clear_pin_warning.setStyleSheet("color: red")
|
||||||
advanced_glayout.addWidget(clear_pin_button, 0, 2)
|
advanced_glayout.addWidget(clear_pin_button, 0, 2)
|
||||||
|
|
|
@ -164,7 +164,7 @@ class LedgerAuthDialog(QDialog):
|
||||||
if not self.cfg['pair']:
|
if not self.cfg['pair']:
|
||||||
self.modes.addItem(_("Mobile - Not paired"))
|
self.modes.addItem(_("Mobile - Not paired"))
|
||||||
else:
|
else:
|
||||||
self.modes.addItem(_("Mobile - %s") % self.cfg['pair'][1])
|
self.modes.addItem(_("Mobile - {}").format(self.cfg['pair'][1]))
|
||||||
self.modes.blockSignals(False)
|
self.modes.blockSignals(False)
|
||||||
|
|
||||||
def update_dlg(self):
|
def update_dlg(self):
|
||||||
|
|
|
@ -236,7 +236,7 @@ class Ledger_KeyStore(Hardware_KeyStore):
|
||||||
return address_path[2:]
|
return address_path[2:]
|
||||||
|
|
||||||
def decrypt_message(self, pubkey, message, password):
|
def decrypt_message(self, pubkey, message, password):
|
||||||
raise RuntimeError(_('Encryption and decryption are currently not supported for %s') % self.device)
|
raise RuntimeError(_('Encryption and decryption are currently not supported for {}').format(self.device))
|
||||||
|
|
||||||
def sign_message(self, sequence, message, password):
|
def sign_message(self, sequence, message, password):
|
||||||
self.signing = True
|
self.signing = True
|
||||||
|
|
|
@ -11,15 +11,15 @@ class GuiMixin(object):
|
||||||
# Requires: self.proto, self.device
|
# Requires: self.proto, self.device
|
||||||
|
|
||||||
messages = {
|
messages = {
|
||||||
3: _("Confirm the transaction output on your %s device"),
|
3: _("Confirm the transaction output on your {} device"),
|
||||||
4: _("Confirm internal entropy on your %s device to begin"),
|
4: _("Confirm internal entropy on your {} device to begin"),
|
||||||
5: _("Write down the seed word shown on your %s"),
|
5: _("Write down the seed word shown on your {}"),
|
||||||
6: _("Confirm on your %s that you want to wipe it clean"),
|
6: _("Confirm on your {} that you want to wipe it clean"),
|
||||||
7: _("Confirm on your %s device the message to sign"),
|
7: _("Confirm on your {} device the message to sign"),
|
||||||
8: _("Confirm the total amount spent and the transaction fee on your "
|
8: _("Confirm the total amount spent and the transaction fee on your "
|
||||||
"%s device"),
|
"{} device"),
|
||||||
10: _("Confirm wallet address on your %s device"),
|
10: _("Confirm wallet address on your {} device"),
|
||||||
'default': _("Check your %s device to continue"),
|
'default': _("Check your {} device to continue"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def callback_Failure(self, msg):
|
def callback_Failure(self, msg):
|
||||||
|
@ -38,18 +38,18 @@ class GuiMixin(object):
|
||||||
message = self.msg
|
message = self.msg
|
||||||
if not message:
|
if not message:
|
||||||
message = self.messages.get(msg.code, self.messages['default'])
|
message = self.messages.get(msg.code, self.messages['default'])
|
||||||
self.handler.show_message(message % self.device, self.cancel)
|
self.handler.show_message(message.format(self.device), self.cancel)
|
||||||
return self.proto.ButtonAck()
|
return self.proto.ButtonAck()
|
||||||
|
|
||||||
def callback_PinMatrixRequest(self, msg):
|
def callback_PinMatrixRequest(self, msg):
|
||||||
if msg.type == 2:
|
if msg.type == 2:
|
||||||
msg = _("Enter a new PIN for your %s:")
|
msg = _("Enter a new PIN for your {}:")
|
||||||
elif msg.type == 3:
|
elif msg.type == 3:
|
||||||
msg = (_("Re-enter the new PIN for your %s.\n\n"
|
msg = (_("Re-enter the new PIN for your {}.\n\n"
|
||||||
"NOTE: the positions of the numbers have changed!"))
|
"NOTE: the positions of the numbers have changed!"))
|
||||||
else:
|
else:
|
||||||
msg = _("Enter your current %s PIN:")
|
msg = _("Enter your current {} PIN:")
|
||||||
pin = self.handler.get_pin(msg % self.device)
|
pin = self.handler.get_pin(msg.format(self.device))
|
||||||
if not pin:
|
if not pin:
|
||||||
return self.proto.Cancel()
|
return self.proto.Cancel()
|
||||||
return self.proto.PinMatrixAck(pin=pin)
|
return self.proto.PinMatrixAck(pin=pin)
|
||||||
|
@ -57,9 +57,9 @@ class GuiMixin(object):
|
||||||
def callback_PassphraseRequest(self, req):
|
def callback_PassphraseRequest(self, req):
|
||||||
if self.creating_wallet:
|
if self.creating_wallet:
|
||||||
msg = _("Enter a passphrase to generate this wallet. Each time "
|
msg = _("Enter a passphrase to generate this wallet. Each time "
|
||||||
"you use this wallet your %s will prompt you for the "
|
"you use this wallet your {} will prompt you for the "
|
||||||
"passphrase. If you forget the passphrase you cannot "
|
"passphrase. If you forget the passphrase you cannot "
|
||||||
"access the bitcoins in the wallet.") % self.device
|
"access the bitcoins in the wallet.").format(self.device)
|
||||||
else:
|
else:
|
||||||
msg = _("Enter the passphrase to unlock this wallet:")
|
msg = _("Enter the passphrase to unlock this wallet:")
|
||||||
passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
|
passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
|
||||||
|
@ -70,8 +70,8 @@ class GuiMixin(object):
|
||||||
|
|
||||||
def callback_WordRequest(self, msg):
|
def callback_WordRequest(self, msg):
|
||||||
self.step += 1
|
self.step += 1
|
||||||
msg = _("Step %d/24. Enter seed word as explained on "
|
msg = _("Step {}/24. Enter seed word as explained on "
|
||||||
"your %s:") % (self.step, self.device)
|
"your {}:").format(self.step, self.device)
|
||||||
word = self.handler.get_word(msg)
|
word = self.handler.get_word(msg)
|
||||||
# Unfortunately the device can't handle self.proto.Cancel()
|
# Unfortunately the device can't handle self.proto.Cancel()
|
||||||
return self.proto.WordAck(word=word)
|
return self.proto.WordAck(word=word)
|
||||||
|
@ -155,27 +155,27 @@ class TrezorClientBase(GuiMixin, PrintError):
|
||||||
|
|
||||||
def toggle_passphrase(self):
|
def toggle_passphrase(self):
|
||||||
if self.features.passphrase_protection:
|
if self.features.passphrase_protection:
|
||||||
self.msg = _("Confirm on your %s device to disable passphrases")
|
self.msg = _("Confirm on your {} device to disable passphrases")
|
||||||
else:
|
else:
|
||||||
self.msg = _("Confirm on your %s device to enable passphrases")
|
self.msg = _("Confirm on your {} device to enable passphrases")
|
||||||
enabled = not self.features.passphrase_protection
|
enabled = not self.features.passphrase_protection
|
||||||
self.apply_settings(use_passphrase=enabled)
|
self.apply_settings(use_passphrase=enabled)
|
||||||
|
|
||||||
def change_label(self, label):
|
def change_label(self, label):
|
||||||
self.msg = _("Confirm the new label on your %s device")
|
self.msg = _("Confirm the new label on your {} device")
|
||||||
self.apply_settings(label=label)
|
self.apply_settings(label=label)
|
||||||
|
|
||||||
def change_homescreen(self, homescreen):
|
def change_homescreen(self, homescreen):
|
||||||
self.msg = _("Confirm on your %s device to change your home screen")
|
self.msg = _("Confirm on your {} device to change your home screen")
|
||||||
self.apply_settings(homescreen=homescreen)
|
self.apply_settings(homescreen=homescreen)
|
||||||
|
|
||||||
def set_pin(self, remove):
|
def set_pin(self, remove):
|
||||||
if remove:
|
if remove:
|
||||||
self.msg = _("Confirm on your %s device to disable PIN protection")
|
self.msg = _("Confirm on your {} device to disable PIN protection")
|
||||||
elif self.features.pin_protection:
|
elif self.features.pin_protection:
|
||||||
self.msg = _("Confirm on your %s device to change your PIN")
|
self.msg = _("Confirm on your {} device to change your PIN")
|
||||||
else:
|
else:
|
||||||
self.msg = _("Confirm on your %s device to set a PIN")
|
self.msg = _("Confirm on your {} device to set a PIN")
|
||||||
self.change_pin(remove)
|
self.change_pin(remove)
|
||||||
|
|
||||||
def clear_session(self):
|
def clear_session(self):
|
||||||
|
|
|
@ -42,7 +42,7 @@ class TrezorCompatibleKeyStore(Hardware_KeyStore):
|
||||||
return self.plugin.get_client(self, force_pair)
|
return self.plugin.get_client(self, force_pair)
|
||||||
|
|
||||||
def decrypt_message(self, sequence, message, password):
|
def decrypt_message(self, sequence, message, password):
|
||||||
raise RuntimeError(_('Encryption and decryption are not implemented by %s') % self.device)
|
raise RuntimeError(_('Encryption and decryption are not implemented by {}').format(self.device))
|
||||||
|
|
||||||
def sign_message(self, sequence, message, password):
|
def sign_message(self, sequence, message, password):
|
||||||
client = self.get_client()
|
client = self.get_client()
|
||||||
|
@ -126,9 +126,9 @@ class TrezorCompatiblePlugin(HW_PluginBase):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if not client.atleast_version(*self.minimum_firmware):
|
if not client.atleast_version(*self.minimum_firmware):
|
||||||
msg = (_('Outdated %s firmware for device labelled %s. Please '
|
msg = (_('Outdated {} firmware for device labelled {}. Please '
|
||||||
'download the updated firmware from %s') %
|
'download the updated firmware from {}')
|
||||||
(self.device, client.label(), self.firmware_URL))
|
.format(self.device, client.label(), self.firmware_URL))
|
||||||
self.print_error(msg)
|
self.print_error(msg)
|
||||||
handler.show_error(msg)
|
handler.show_error(msg)
|
||||||
return None
|
return None
|
||||||
|
@ -150,14 +150,14 @@ class TrezorCompatiblePlugin(HW_PluginBase):
|
||||||
|
|
||||||
def initialize_device(self, device_id, wizard, handler):
|
def initialize_device(self, device_id, wizard, handler):
|
||||||
# Initialization method
|
# Initialization method
|
||||||
msg = _("Choose how you want to initialize your %s.\n\n"
|
msg = _("Choose how you want to initialize your {}.\n\n"
|
||||||
"The first two methods are secure as no secret information "
|
"The first two methods are secure as no secret information "
|
||||||
"is entered into your computer.\n\n"
|
"is entered into your computer.\n\n"
|
||||||
"For the last two methods you input secrets on your keyboard "
|
"For the last two methods you input secrets on your keyboard "
|
||||||
"and upload them to your %s, and so you should "
|
"and upload them to your {}, and so you should "
|
||||||
"only do those on a computer you know to be trustworthy "
|
"only do those on a computer you know to be trustworthy "
|
||||||
"and free of malware."
|
"and free of malware."
|
||||||
) % (self.device, self.device)
|
).format(self.device, self.device)
|
||||||
choices = [
|
choices = [
|
||||||
# Must be short as QT doesn't word-wrap radio button text
|
# Must be short as QT doesn't word-wrap radio button text
|
||||||
(TIM_NEW, _("Let the device generate a completely new seed randomly")),
|
(TIM_NEW, _("Let the device generate a completely new seed randomly")),
|
||||||
|
|
|
@ -194,7 +194,7 @@ class QtPlugin(QtPluginBase):
|
||||||
if type(keystore) == self.keystore_class:
|
if type(keystore) == self.keystore_class:
|
||||||
def show_address():
|
def show_address():
|
||||||
keystore.thread.add(partial(self.show_address, wallet, keystore, addrs[0]))
|
keystore.thread.add(partial(self.show_address, wallet, keystore, addrs[0]))
|
||||||
menu.addAction(_("Show on %s") % self.device, show_address)
|
menu.addAction(_("Show on {}").format(self.device), show_address)
|
||||||
break
|
break
|
||||||
|
|
||||||
def show_settings_dialog(self, window, keystore):
|
def show_settings_dialog(self, window, keystore):
|
||||||
|
@ -293,7 +293,7 @@ class SettingsDialog(WindowModalDialog):
|
||||||
their PIN.'''
|
their PIN.'''
|
||||||
|
|
||||||
def __init__(self, window, plugin, keystore, device_id):
|
def __init__(self, window, plugin, keystore, device_id):
|
||||||
title = _("%s Settings") % plugin.device
|
title = _("{} Settings").format(plugin.device)
|
||||||
super(SettingsDialog, self).__init__(window, title)
|
super(SettingsDialog, self).__init__(window, title)
|
||||||
self.setMaximumWidth(540)
|
self.setMaximumWidth(540)
|
||||||
|
|
||||||
|
@ -464,9 +464,9 @@ class SettingsDialog(WindowModalDialog):
|
||||||
settings_glayout = QGridLayout()
|
settings_glayout = QGridLayout()
|
||||||
|
|
||||||
# Settings tab - Label
|
# Settings tab - Label
|
||||||
label_msg = QLabel(_("Name this %s. If you have mutiple devices "
|
label_msg = QLabel(_("Name this {}. If you have mutiple devices "
|
||||||
"their labels help distinguish them.")
|
"their labels help distinguish them.")
|
||||||
% plugin.device)
|
.format(plugin.device))
|
||||||
label_msg.setWordWrap(True)
|
label_msg.setWordWrap(True)
|
||||||
label_label = QLabel(_("Device Label"))
|
label_label = QLabel(_("Device Label"))
|
||||||
label_edit = QLineEdit()
|
label_edit = QLineEdit()
|
||||||
|
@ -489,7 +489,7 @@ class SettingsDialog(WindowModalDialog):
|
||||||
pin_msg = QLabel(_("PIN protection is strongly recommended. "
|
pin_msg = QLabel(_("PIN protection is strongly recommended. "
|
||||||
"A PIN is your only protection against someone "
|
"A PIN is your only protection against someone "
|
||||||
"stealing your bitcoins if they obtain physical "
|
"stealing your bitcoins if they obtain physical "
|
||||||
"access to your %s.") % plugin.device)
|
"access to your {}.").format(plugin.device))
|
||||||
pin_msg.setWordWrap(True)
|
pin_msg.setWordWrap(True)
|
||||||
pin_msg.setStyleSheet("color: red")
|
pin_msg.setStyleSheet("color: red")
|
||||||
settings_glayout.addWidget(pin_msg, 3, 1, 1, -1)
|
settings_glayout.addWidget(pin_msg, 3, 1, 1, -1)
|
||||||
|
@ -504,8 +504,8 @@ class SettingsDialog(WindowModalDialog):
|
||||||
homescreen_clear_button.clicked.connect(clear_homescreen)
|
homescreen_clear_button.clicked.connect(clear_homescreen)
|
||||||
homescreen_msg = QLabel(_("You can set the homescreen on your "
|
homescreen_msg = QLabel(_("You can set the homescreen on your "
|
||||||
"device to personalize it. You must "
|
"device to personalize it. You must "
|
||||||
"choose a %d x %d monochrome black and "
|
"choose a {} x {} monochrome black and "
|
||||||
"white image.") % (hs_rows, hs_cols))
|
"white image.").format(hs_rows, hs_cols))
|
||||||
homescreen_msg.setWordWrap(True)
|
homescreen_msg.setWordWrap(True)
|
||||||
settings_glayout.addWidget(homescreen_label, 4, 0)
|
settings_glayout.addWidget(homescreen_label, 4, 0)
|
||||||
settings_glayout.addWidget(homescreen_change_button, 4, 1)
|
settings_glayout.addWidget(homescreen_change_button, 4, 1)
|
||||||
|
@ -548,7 +548,7 @@ class SettingsDialog(WindowModalDialog):
|
||||||
clear_pin_button.clicked.connect(clear_pin)
|
clear_pin_button.clicked.connect(clear_pin)
|
||||||
clear_pin_warning = QLabel(
|
clear_pin_warning = QLabel(
|
||||||
_("If you disable your PIN, anyone with physical access to your "
|
_("If you disable your PIN, anyone with physical access to your "
|
||||||
"%s device can spend your bitcoins.") % plugin.device)
|
"{} device can spend your bitcoins.").format(plugin.device))
|
||||||
clear_pin_warning.setWordWrap(True)
|
clear_pin_warning.setWordWrap(True)
|
||||||
clear_pin_warning.setStyleSheet("color: red")
|
clear_pin_warning.setStyleSheet("color: red")
|
||||||
advanced_glayout.addWidget(clear_pin_button, 0, 2)
|
advanced_glayout.addWidget(clear_pin_button, 0, 2)
|
||||||
|
|
|
@ -173,7 +173,7 @@ class Plugin(TrustedCoinPlugin):
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
n = wallet.billing_info.get('tx_remaining', 0)
|
n = wallet.billing_info.get('tx_remaining', 0)
|
||||||
grid.addWidget(QLabel(_("Your wallet has %d prepaid transactions.")%n), i, 0)
|
grid.addWidget(QLabel(_("Your wallet has {} prepaid transactions.").format(n)), i, 0)
|
||||||
vbox.addLayout(Buttons(CloseButton(d)))
|
vbox.addLayout(Buttons(CloseButton(d)))
|
||||||
d.exec_()
|
d.exec_()
|
||||||
|
|
||||||
|
|
|
@ -430,13 +430,13 @@ class TrustedCoinPlugin(BasePlugin):
|
||||||
wizard.storage.put('x2/', k2.dump())
|
wizard.storage.put('x2/', k2.dump())
|
||||||
wizard.storage.write()
|
wizard.storage.write()
|
||||||
msg = [
|
msg = [
|
||||||
_("Your wallet file is: %s.")%os.path.abspath(wizard.storage.path),
|
_("Your wallet file is: {}.").format(os.path.abspath(wizard.storage.path)),
|
||||||
_("You need to be online in order to complete the creation of "
|
_("You need to be online in order to complete the creation of "
|
||||||
"your wallet. If you generated your seed on an offline "
|
"your wallet. If you generated your seed on an offline "
|
||||||
'computer, click on "%s" to close this window, move your '
|
'computer, click on "{}" to close this window, move your '
|
||||||
"wallet file to an online computer, and reopen it with "
|
"wallet file to an online computer, and reopen it with "
|
||||||
"Electrum.") % _('Cancel'),
|
"Electrum.").format(_('Cancel')),
|
||||||
_('If you are online, click on "%s" to continue.') % _('Next')
|
_('If you are online, click on "{}" to continue.').format(_('Next'))
|
||||||
]
|
]
|
||||||
msg = '\n\n'.join(msg)
|
msg = '\n\n'.join(msg)
|
||||||
wizard.stack = []
|
wizard.stack = []
|
||||||
|
|
Loading…
Reference in New Issue