commit 1bf54a0bc51351fa3a914270440960a6e05e7fc1
parent c7b4ef82bcfceabddaf59eacb742120af05502b8
Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 29 Jan 2018 15:05:30 +0100
clean-up in gui/qt/main_window.py: use string.format for translated strings, and some indentation
Diffstat:
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -553,24 +553,24 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
return
self.print_error("Notifying GUI")
if len(self.tx_notifications) > 0:
- # Combine the transactions if there are more then three
- tx_amount = len(self.tx_notifications)
- if(tx_amount >= 3):
+ # Combine the transactions if there are at least three
+ num_txns = len(self.tx_notifications)
+ if num_txns >= 3:
total_amount = 0
for tx in self.tx_notifications:
is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx)
- if(v > 0):
+ if v > 0:
total_amount += v
- self.notify(_("%(txs)s new transactions received: Total amount received in the new transactions %(amount)s") \
- % { 'txs' : tx_amount, 'amount' : self.format_amount_and_units(total_amount)})
+ self.notify(_("{} new transactions received: Total amount received in the new transactions {}")
+ .format(num_txns, self.format_amount_and_units(total_amount)))
self.tx_notifications = []
else:
- for tx in self.tx_notifications:
- if tx:
- self.tx_notifications.remove(tx)
- is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx)
- if(v > 0):
- self.notify(_("New transaction received: %(amount)s") % { 'amount' : self.format_amount_and_units(v)})
+ for tx in self.tx_notifications:
+ if tx:
+ self.tx_notifications.remove(tx)
+ is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx)
+ if v > 0:
+ self.notify(_("New transaction received: {}").format(self.format_amount_and_units(v)))
def notify(self, message):
if self.tray:
@@ -698,7 +698,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
text = _("Synchronizing...")
icon = QIcon(":icons/status_waiting.png")
elif server_lag > 1:
- text = _("Server is lagging (%d blocks)"%server_lag)
+ text = _("Server is lagging ({} blocks)").format(server_lag)
icon = QIcon(":icons/status_lagging.png")
else:
c, u, x = self.wallet.get_balance()
@@ -1425,7 +1425,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
if self.payto_e.is_alias and self.payto_e.validated is False:
alias = self.payto_e.toPlainText()
- msg = _('WARNING: the alias "%s" could not be validated via an additional security check, DNSSEC, and thus may not be correct.'%alias) + '\n'
+ msg = _('WARNING: the alias "{}" could not be validated via an additional '
+ 'security check, DNSSEC, and thus may not be correct.').format(alias) + '\n'
msg += _('Do you wish to continue?')
if not self.question(msg):
return
@@ -1788,8 +1789,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
return True
def delete_contacts(self, labels):
- if not self.question(_("Remove %s from your list of contacts?")
- % " + ".join(labels)):
+ if not self.question(_("Remove {} from your list of contacts?")
+ .format(" + ".join(labels))):
return
for label in labels:
self.contacts.pop(label)