replace all of arg() occurrences to format()

This commit is contained in:
Kashiko Koibumi 2024-05-22 17:14:00 +09:00
parent 3a04e351cc
commit f181b85d97
No known key found for this signature in database
GPG Key ID: 8F06E069E37C40C4
12 changed files with 118 additions and 119 deletions

View File

@ -646,9 +646,9 @@ class MyForm(settingsmixin.SMainWindow):
if addressVersionNumber == 1: if addressVersionNumber == 1:
displayMsg = _translate( displayMsg = _translate(
"MainWindow", "MainWindow",
"One of your addresses, %1, is an old version 1 address. " "One of your addresses, {0}, is an old version 1 address. "
"Version 1 addresses are no longer supported. " "Version 1 addresses are no longer supported. "
"May we delete it now?").arg(addressInKeysFile) "May we delete it now?").format(addressInKeysFile)
reply = QtGui.QMessageBox.question( reply = QtGui.QMessageBox.question(
self, 'Message', displayMsg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) self, 'Message', displayMsg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes: if reply == QtGui.QMessageBox.Yes:
@ -1140,20 +1140,20 @@ class MyForm(settingsmixin.SMainWindow):
elif status == 'msgsent': elif status == 'msgsent':
statusText = _translate( statusText = _translate(
"MainWindow", "MainWindow",
"Message sent. Waiting for acknowledgement. Sent at %1" "Message sent. Waiting for acknowledgement. Sent at {0}"
).arg(l10n.formatTimestamp(lastactiontime)) ).format(l10n.formatTimestamp(lastactiontime))
elif status == 'msgsentnoackexpected': elif status == 'msgsentnoackexpected':
statusText = _translate( statusText = _translate(
"MainWindow", "Message sent. Sent at %1" "MainWindow", "Message sent. Sent at {0}"
).arg(l10n.formatTimestamp(lastactiontime)) ).format(l10n.formatTimestamp(lastactiontime))
elif status == 'doingmsgpow': elif status == 'doingmsgpow':
statusText = _translate( statusText = _translate(
"MainWindow", "Doing work necessary to send message.") "MainWindow", "Doing work necessary to send message.")
elif status == 'ackreceived': elif status == 'ackreceived':
statusText = _translate( statusText = _translate(
"MainWindow", "MainWindow",
"Acknowledgement of the message received %1" "Acknowledgement of the message received {0}"
).arg(l10n.formatTimestamp(lastactiontime)) ).format(l10n.formatTimestamp(lastactiontime))
elif status == 'broadcastqueued': elif status == 'broadcastqueued':
statusText = _translate( statusText = _translate(
"MainWindow", "Broadcast queued.") "MainWindow", "Broadcast queued.")
@ -1161,27 +1161,27 @@ class MyForm(settingsmixin.SMainWindow):
statusText = _translate( statusText = _translate(
"MainWindow", "Doing work necessary to send broadcast.") "MainWindow", "Doing work necessary to send broadcast.")
elif status == 'broadcastsent': elif status == 'broadcastsent':
statusText = _translate("MainWindow", "Broadcast on %1").arg( statusText = _translate("MainWindow", "Broadcast on {0}").format(
l10n.formatTimestamp(lastactiontime)) l10n.formatTimestamp(lastactiontime))
elif status == 'toodifficult': elif status == 'toodifficult':
statusText = _translate( statusText = _translate(
"MainWindow", "MainWindow",
"Problem: The work demanded by the recipient is more" "Problem: The work demanded by the recipient is more"
" difficult than you are willing to do. %1" " difficult than you are willing to do. {0}"
).arg(l10n.formatTimestamp(lastactiontime)) ).format(l10n.formatTimestamp(lastactiontime))
elif status == 'badkey': elif status == 'badkey':
statusText = _translate( statusText = _translate(
"MainWindow", "MainWindow",
"Problem: The recipient\'s encryption key is no good." "Problem: The recipient\'s encryption key is no good."
" Could not encrypt message. %1" " Could not encrypt message. {0}"
).arg(l10n.formatTimestamp(lastactiontime)) ).format(l10n.formatTimestamp(lastactiontime))
elif status == 'forcepow': elif status == 'forcepow':
statusText = _translate( statusText = _translate(
"MainWindow", "MainWindow",
"Forced difficulty override. Send should start soon.") "Forced difficulty override. Send should start soon.")
else: else:
statusText = _translate( statusText = _translate(
"MainWindow", "Unknown status: %1 %2").arg(status).arg( "MainWindow", "Unknown status: {0} {1}").format(status,
l10n.formatTimestamp(lastactiontime)) l10n.formatTimestamp(lastactiontime))
items = [ items = [
@ -1599,9 +1599,9 @@ class MyForm(settingsmixin.SMainWindow):
_translate( _translate(
"MainWindow", "MainWindow",
"You may manage your keys by editing the keys.dat file stored in" "You may manage your keys by editing the keys.dat file stored in"
"\n %1 \n" "\n {0} \n"
"It is important that you back up this file." "It is important that you back up this file."
).arg(state.appdata), ).format(state.appdata),
QtGui.QMessageBox.Ok) QtGui.QMessageBox.Ok)
elif sys.platform == 'win32' or sys.platform == 'win64': elif sys.platform == 'win32' or sys.platform == 'win64':
if state.appdata == '': if state.appdata == '':
@ -1622,9 +1622,9 @@ class MyForm(settingsmixin.SMainWindow):
_translate("MainWindow", "Open keys.dat?"), _translate("MainWindow", "Open keys.dat?"),
_translate( _translate(
"MainWindow", "MainWindow",
"You may manage your keys by editing the keys.dat file stored in\n %1 \n" "You may manage your keys by editing the keys.dat file stored in\n {0} \n"
"It is important that you back up this file. Would you like to open the file now?" "It is important that you back up this file. Would you like to open the file now?"
"(Be sure to close Bitmessage before making any changes.)").arg(state.appdata), "(Be sure to close Bitmessage before making any changes.)").format(state.appdata),
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes: if reply == QtGui.QMessageBox.Yes:
openKeysFile() openKeysFile()
@ -1967,9 +1967,9 @@ class MyForm(settingsmixin.SMainWindow):
self.notifiedNewVersion = ".".join(str(n) for n in version) self.notifiedNewVersion = ".".join(str(n) for n in version)
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
"New version of PyBitmessage is available: %1. Download it" "New version of PyBitmessage is available: {0}. Download it"
" from https://github.com/Bitmessage/PyBitmessage/releases/latest" " from https://github.com/Bitmessage/PyBitmessage/releases/latest"
).arg(self.notifiedNewVersion) ).format(self.notifiedNewVersion)
) )
def displayAlert(self, title, text, exitAfterUserClicksOk): def displayAlert(self, title, text, exitAfterUserClicksOk):
@ -2105,9 +2105,9 @@ class MyForm(settingsmixin.SMainWindow):
_translate( _translate(
"MainWindow", "MainWindow",
"The message that you are trying to send is too long" "The message that you are trying to send is too long"
" by %1 bytes. (The maximum is 261644 bytes). Please" " by {0} bytes. (The maximum is 261644 bytes). Please"
" cut it down before sending." " cut it down before sending."
).arg(len(message) - (2 ** 18 - 500))) ).format(len(message) - (2 ** 18 - 500)))
return return
acct = accountClass(fromAddress) acct = accountClass(fromAddress)
@ -2156,9 +2156,9 @@ class MyForm(settingsmixin.SMainWindow):
"MainWindow", "MainWindow",
"Error: Your account wasn't registered at" "Error: Your account wasn't registered at"
" an email gateway. Sending registration" " an email gateway. Sending registration"
" now as %1, please wait for the registration" " now as {0}, please wait for the registration"
" to be processed before retrying sending." " to be processed before retrying sending."
).arg(email) ).format(email)
) )
return return
status, addressVersionNumber, streamNumber = decodeAddress(toAddress)[:3] status, addressVersionNumber, streamNumber = decodeAddress(toAddress)[:3]
@ -2173,58 +2173,58 @@ class MyForm(settingsmixin.SMainWindow):
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
"Error: Bitmessage addresses start with" "Error: Bitmessage addresses start with"
" BM- Please check the recipient address %1" " BM- Please check the recipient address {0}"
).arg(toAddress)) ).format(toAddress))
elif status == 'checksumfailed': elif status == 'checksumfailed':
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
"Error: The recipient address %1 is not" "Error: The recipient address {0} is not"
" typed or copied correctly. Please check it." " typed or copied correctly. Please check it."
).arg(toAddress)) ).format(toAddress))
elif status == 'invalidcharacters': elif status == 'invalidcharacters':
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
"Error: The recipient address %1 contains" "Error: The recipient address {0} contains"
" invalid characters. Please check it." " invalid characters. Please check it."
).arg(toAddress)) ).format(toAddress))
elif status == 'versiontoohigh': elif status == 'versiontoohigh':
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
"Error: The version of the recipient address" "Error: The version of the recipient address"
" %1 is too high. Either you need to upgrade" " {0} is too high. Either you need to upgrade"
" your Bitmessage software or your" " your Bitmessage software or your"
" acquaintance is being clever." " acquaintance is being clever."
).arg(toAddress)) ).format(toAddress))
elif status == 'ripetooshort': elif status == 'ripetooshort':
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
"Error: Some data encoded in the recipient" "Error: Some data encoded in the recipient"
" address %1 is too short. There might be" " address {0} is too short. There might be"
" something wrong with the software of" " something wrong with the software of"
" your acquaintance." " your acquaintance."
).arg(toAddress)) ).format(toAddress))
elif status == 'ripetoolong': elif status == 'ripetoolong':
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
"Error: Some data encoded in the recipient" "Error: Some data encoded in the recipient"
" address %1 is too long. There might be" " address {0} is too long. There might be"
" something wrong with the software of" " something wrong with the software of"
" your acquaintance." " your acquaintance."
).arg(toAddress)) ).format(toAddress))
elif status == 'varintmalformed': elif status == 'varintmalformed':
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
"Error: Some data encoded in the recipient" "Error: Some data encoded in the recipient"
" address %1 is malformed. There might be" " address {0} is malformed. There might be"
" something wrong with the software of" " something wrong with the software of"
" your acquaintance." " your acquaintance."
).arg(toAddress)) ).format(toAddress))
else: else:
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
"Error: Something is wrong with the" "Error: Something is wrong with the"
" recipient address %1." " recipient address {0}."
).arg(toAddress)) ).format(toAddress))
elif fromAddress == '': elif fromAddress == '':
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
@ -2241,9 +2241,9 @@ class MyForm(settingsmixin.SMainWindow):
_translate("MainWindow", "Address version number"), _translate("MainWindow", "Address version number"),
_translate( _translate(
"MainWindow", "MainWindow",
"Concerning the address %1, Bitmessage cannot understand address version numbers" "Concerning the address {0}, Bitmessage cannot understand address version numbers"
" of %2. Perhaps upgrade Bitmessage to the latest version." " of {1}. Perhaps upgrade Bitmessage to the latest version."
).arg(toAddress).arg(str(addressVersionNumber))) ).format(toAddress, str(addressVersionNumber)))
continue continue
if streamNumber > 1 or streamNumber == 0: if streamNumber > 1 or streamNumber == 0:
QtGui.QMessageBox.about( QtGui.QMessageBox.about(
@ -2251,9 +2251,9 @@ class MyForm(settingsmixin.SMainWindow):
_translate("MainWindow", "Stream number"), _translate("MainWindow", "Stream number"),
_translate( _translate(
"MainWindow", "MainWindow",
"Concerning the address %1, Bitmessage cannot handle stream numbers of %2." "Concerning the address {0}, Bitmessage cannot handle stream numbers of {1}."
" Perhaps upgrade Bitmessage to the latest version." " Perhaps upgrade Bitmessage to the latest version."
).arg(toAddress).arg(str(streamNumber))) ).format(toAddress, str(streamNumber)))
continue continue
self.statusbar.clearMessage() self.statusbar.clearMessage()
if state.statusIconColor == 'red': if state.statusIconColor == 'red':
@ -2342,7 +2342,7 @@ class MyForm(settingsmixin.SMainWindow):
err, addr = self.namecoin.query(identities[-1].strip()) err, addr = self.namecoin.query(identities[-1].strip())
if err is not None: if err is not None:
self.updateStatusBar( self.updateStatusBar(
_translate("MainWindow", "Error: %1").arg(err)) _translate("MainWindow", "Error: {0}").format(err))
else: else:
identities[-1] = addr identities[-1] = addr
self.ui.lineEditTo.setText("; ".join(identities)) self.ui.lineEditTo.setText("; ".join(identities))
@ -2497,7 +2497,7 @@ class MyForm(settingsmixin.SMainWindow):
'bitmessagesettings', 'showtraynotifications'): 'bitmessagesettings', 'showtraynotifications'):
self.notifierShow( self.notifierShow(
_translate("MainWindow", "New Message"), _translate("MainWindow", "New Message"),
_translate("MainWindow", "From %1").arg( _translate("MainWindow", "From {0}").format(
unicode(acct.fromLabel, 'utf-8')), unicode(acct.fromLabel, 'utf-8')),
sound.SOUND_UNKNOWN sound.SOUND_UNKNOWN
) )
@ -2787,7 +2787,7 @@ class MyForm(settingsmixin.SMainWindow):
self.quitAccepted = True self.quitAccepted = True
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "Shutting down PyBitmessage... %1%").arg(0)) "MainWindow", "Shutting down PyBitmessage... {0}%").format(0))
if waitForConnection: if waitForConnection:
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
@ -2821,8 +2821,8 @@ class MyForm(settingsmixin.SMainWindow):
maxWorkerQueue = curWorkerQueue maxWorkerQueue = curWorkerQueue
if curWorkerQueue > 0: if curWorkerQueue > 0:
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "Waiting for PoW to finish... %1%" "MainWindow", "Waiting for PoW to finish... {0}%"
).arg(50 * (maxWorkerQueue - curWorkerQueue) / ).format(50 * (maxWorkerQueue - curWorkerQueue) /
maxWorkerQueue)) maxWorkerQueue))
time.sleep(0.5) time.sleep(0.5)
QtCore.QCoreApplication.processEvents( QtCore.QCoreApplication.processEvents(
@ -2830,7 +2830,7 @@ class MyForm(settingsmixin.SMainWindow):
) )
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "Shutting down Pybitmessage... %1%").arg(50)) "MainWindow", "Shutting down Pybitmessage... {0}%").format(50))
QtCore.QCoreApplication.processEvents( QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000 QtCore.QEventLoop.AllEvents, 1000
@ -2844,14 +2844,14 @@ class MyForm(settingsmixin.SMainWindow):
# check if upload (of objects created locally) pending # check if upload (of objects created locally) pending
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "Waiting for objects to be sent... %1%").arg(50)) "MainWindow", "Waiting for objects to be sent... {0}%").format(50))
maxPendingUpload = max(1, pendingUpload()) maxPendingUpload = max(1, pendingUpload())
while pendingUpload() > 1: while pendingUpload() > 1:
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "MainWindow",
"Waiting for objects to be sent... %1%" "Waiting for objects to be sent... {0}%"
).arg(int(50 + 20 * (pendingUpload() / maxPendingUpload)))) ).format(int(50 + 20 * (pendingUpload() / maxPendingUpload))))
time.sleep(0.5) time.sleep(0.5)
QtCore.QCoreApplication.processEvents( QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000 QtCore.QEventLoop.AllEvents, 1000
@ -2866,7 +2866,7 @@ class MyForm(settingsmixin.SMainWindow):
# save state and geometry self and all widgets # save state and geometry self and all widgets
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "Saving settings... %1%").arg(70)) "MainWindow", "Saving settings... {0}%").format(70))
QtCore.QCoreApplication.processEvents( QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000 QtCore.QEventLoop.AllEvents, 1000
) )
@ -2879,18 +2879,18 @@ class MyForm(settingsmixin.SMainWindow):
obj.saveSettings() obj.saveSettings()
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "Shutting down core... %1%").arg(80)) "MainWindow", "Shutting down core... {0}%").format(80))
QtCore.QCoreApplication.processEvents( QtCore.QCoreApplication.processEvents(
QtCore.QEventLoop.AllEvents, 1000 QtCore.QEventLoop.AllEvents, 1000
) )
shutdown.doCleanShutdown() shutdown.doCleanShutdown()
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "Stopping notifications... %1%").arg(90)) "MainWindow", "Stopping notifications... {0}%").format(90))
self.tray.hide() self.tray.hide()
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "Shutdown imminent... %1%").arg(100)) "MainWindow", "Shutdown imminent... {0}%").format(100))
logger.info("Shutdown complete") logger.info("Shutdown complete")
self.close() self.close()
@ -3063,9 +3063,9 @@ class MyForm(settingsmixin.SMainWindow):
self, _translate("MainWindow", "Address is gone"), self, _translate("MainWindow", "Address is gone"),
_translate( _translate(
"MainWindow", "MainWindow",
"Bitmessage cannot find your address %1. Perhaps you" "Bitmessage cannot find your address {0}. Perhaps you"
" removed it?" " removed it?"
).arg(toAddressAtCurrentInboxRow), QtGui.QMessageBox.Ok) ).format(toAddressAtCurrentInboxRow), QtGui.QMessageBox.Ok)
elif not config.getboolean( elif not config.getboolean(
toAddressAtCurrentInboxRow, 'enabled'): toAddressAtCurrentInboxRow, 'enabled'):
QtGui.QMessageBox.information( QtGui.QMessageBox.information(

View File

@ -64,8 +64,8 @@ class IconGlossaryDialog(QtGui.QDialog):
self.labelPortNumber.setText(_translate( self.labelPortNumber.setText(_translate(
"iconGlossaryDialog", "iconGlossaryDialog",
"You are using TCP port %1. (This can be changed in the settings)." "You are using TCP port {0}. (This can be changed in the settings)."
).arg(config.getint('bitmessagesettings', 'port'))) ).format(config.getint('bitmessagesettings', 'port')))
self.setFixedSize(QtGui.QWidget.sizeHint(self)) self.setFixedSize(QtGui.QWidget.sizeHint(self))

View File

@ -24,7 +24,7 @@ class MessageCompose(QtGui.QTextEdit):
self.zoomOut(1) self.zoomOut(1)
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
QtGui.QApplication.activeWindow().statusBar().showMessage( QtGui.QApplication.activeWindow().statusBar().showMessage(
QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg( QtGui.QApplication.translate("MainWindow", "Zoom level {0}%").format(
str(zoom) str(zoom)
) )
) )

View File

@ -56,7 +56,7 @@ class MessageView(QtGui.QTextBrowser):
) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical: ) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
QtGui.QApplication.activeWindow().statusBar().showMessage(_translate( QtGui.QApplication.activeWindow().statusBar().showMessage(_translate(
"MainWindow", "Zoom level %1%").arg(str(zoom))) "MainWindow", "Zoom level {0}%").format(str(zoom)))
def setWrappingWidth(self, width=None): def setWrappingWidth(self, width=None):
"""Set word-wrapping width""" """Set word-wrapping width"""
@ -90,8 +90,8 @@ class MessageView(QtGui.QTextBrowser):
"Follow external link"), "Follow external link"),
QtGui.QApplication.translate( QtGui.QApplication.translate(
"MessageView", "MessageView",
"The link \"%1\" will open in a browser. It may be a security risk, it could de-anonymise you" "The link \"{0}\" will open in a browser. It may be a security risk, it could de-anonymise you"
" or download malicious data. Are you sure?").arg(unicode(link.toString())), " or download malicious data. Are you sure?").format(unicode(link.toString())),
QtGui.QMessageBox.Yes, QtGui.QMessageBox.Yes,
QtGui.QMessageBox.No) QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes: if reply == QtGui.QMessageBox.Yes:

View File

@ -134,12 +134,12 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
self.labelBytesRecvCount.setText( self.labelBytesRecvCount.setText(
_translate( _translate(
"networkstatus", "networkstatus",
"Down: %1/s Total: %2").arg( "Down: {0}/s Total: {1}").format(
self.formatByteRate(network.stats.downloadSpeed()), self.formatByteRate(network.stats.downloadSpeed()),
self.formatBytes(network.stats.receivedBytes()))) self.formatBytes(network.stats.receivedBytes())))
self.labelBytesSentCount.setText( self.labelBytesSentCount.setText(
_translate( _translate(
"networkstatus", "Up: %1/s Total: %2").arg( "networkstatus", "Up: {0}/s Total: {1}").format(
self.formatByteRate(network.stats.uploadSpeed()), self.formatByteRate(network.stats.uploadSpeed()),
self.formatBytes(network.stats.sentBytes()))) self.formatBytes(network.stats.sentBytes())))
@ -214,7 +214,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
self.tableWidgetConnectionCount.setSortingEnabled(True) self.tableWidgetConnectionCount.setSortingEnabled(True)
self.labelTotalConnections.setText( self.labelTotalConnections.setText(
_translate( _translate(
"networkstatus", "Total Connections: %1").arg( "networkstatus", "Total Connections: {0}").format(
str(self.tableWidgetConnectionCount.rowCount()))) str(self.tableWidgetConnectionCount.rowCount())))
# FYI: The 'singlelistener' thread sets the icon color to green when it # FYI: The 'singlelistener' thread sets the icon color to green when it
# receives an incoming connection, meaning that the user's firewall is # receives an incoming connection, meaning that the user's firewall is
@ -227,7 +227,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
# timer driven # timer driven
def runEveryTwoSeconds(self): def runEveryTwoSeconds(self):
"""Updates counters, runs every 2 seconds if the timer is running""" """Updates counters, runs every 2 seconds if the timer is running"""
self.labelLookupsPerSecond.setText(_translate("networkstatus", "Inventory lookups per second: %1").arg( self.labelLookupsPerSecond.setText(_translate("networkstatus", "Inventory lookups per second: {0}").format(
str(state.Inventory.numberOfInventoryLookupsPerformed / 2))) str(state.Inventory.numberOfInventoryLookupsPerformed / 2)))
state.Inventory.numberOfInventoryLookupsPerformed = 0 state.Inventory.numberOfInventoryLookupsPerformed = 0
self.updateNumberOfBytes() self.updateNumberOfBytes()
@ -238,11 +238,11 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
super(NetworkStatus, self).retranslateUi() super(NetworkStatus, self).retranslateUi()
self.labelTotalConnections.setText( self.labelTotalConnections.setText(
_translate( _translate(
"networkstatus", "Total Connections: %1").arg( "networkstatus", "Total Connections: {0}").format(
str(self.tableWidgetConnectionCount.rowCount()))) str(self.tableWidgetConnectionCount.rowCount())))
self.labelStartupTime.setText(_translate( self.labelStartupTime.setText(_translate(
"networkstatus", "Since startup on %1" "networkstatus", "Since startup on {0}"
).arg(l10n.formatTimestamp(self.startup))) ).format(l10n.formatTimestamp(self.startup)))
self.updateNumberOfMessagesProcessed() self.updateNumberOfMessagesProcessed()
self.updateNumberOfBroadcastsProcessed() self.updateNumberOfBroadcastsProcessed()
self.updateNumberOfPubkeysProcessed() self.updateNumberOfPubkeysProcessed()

View File

@ -66,7 +66,7 @@ class NewChanDialog(QtGui.QDialog):
addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True) addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True)
if addressGeneratorReturnValue and addressGeneratorReturnValue[0] != 'chan name does not match address': if addressGeneratorReturnValue and addressGeneratorReturnValue[0] != 'chan name does not match address':
UISignalQueue.put(('updateStatusBar', _translate( UISignalQueue.put(('updateStatusBar', _translate(
"newchandialog", "Successfully created / joined chan %1").arg(unicode(self.chanPassPhrase.text())))) "newchandialog", "Successfully created / joined chan {0}").format(unicode(self.chanPassPhrase.text()))))
self.parent.ui.tabWidget.setCurrentIndex( self.parent.ui.tabWidget.setCurrentIndex(
self.parent.ui.tabWidget.indexOf(self.parent.ui.chans) self.parent.ui.tabWidget.indexOf(self.parent.ui.chans)
) )

View File

@ -211,8 +211,8 @@ class addressGenerator(StoppableThread):
'updateStatusBar', 'updateStatusBar',
_translate( _translate(
"MainWindow", "MainWindow",
"Generating %1 new addresses." "Generating {0} new addresses."
).arg(str(numberOfAddressesToMake)) ).format(str(numberOfAddressesToMake))
)) ))
signingKeyNonce = 0 signingKeyNonce = 0
encryptionKeyNonce = 1 encryptionKeyNonce = 1
@ -302,9 +302,9 @@ class addressGenerator(StoppableThread):
'updateStatusBar', 'updateStatusBar',
_translate( _translate(
"MainWindow", "MainWindow",
"%1 is already in 'Your Identities'." "{0} is already in 'Your Identities'."
" Not adding it again." " Not adding it again."
).arg(address) ).format(address)
)) ))
else: else:
self.logger.debug('label: %s', label) self.logger.debug('label: %s', label)

View File

@ -151,8 +151,8 @@ class objectProcessor(threading.Thread):
data[readPosition:], data[readPosition:],
_translate( _translate(
"MainWindow", "MainWindow",
"Acknowledgement of the message received %1" "Acknowledgement of the message received {0}"
).arg(l10n.formatTimestamp())) ).format(l10n.formatTimestamp()))
)) ))
else: else:
logger.debug('This object is not an acknowledgement bound for me.') logger.debug('This object is not an acknowledgement bound for me.')

View File

@ -697,8 +697,8 @@ class singleWorker(StoppableThread):
ackdata, ackdata,
tr._translate( tr._translate(
"MainWindow", "MainWindow",
"Broadcast sent on %1" "Broadcast sent on {0}"
).arg(l10n.formatTimestamp())) ).format(l10n.formatTimestamp()))
)) ))
# Update the status of the message in the 'sent' table to have # Update the status of the message in the 'sent' table to have
@ -969,8 +969,8 @@ class singleWorker(StoppableThread):
" device who requests that the" " device who requests that the"
" destination be included in the" " destination be included in the"
" message but this is disallowed in" " message but this is disallowed in"
" your settings. %1" " your settings. {0}"
).arg(l10n.formatTimestamp())) ).format(l10n.formatTimestamp()))
)) ))
# if the human changes their setting and then # if the human changes their setting and then
# sends another message or restarts their client, # sends another message or restarts their client,
@ -1035,14 +1035,13 @@ class singleWorker(StoppableThread):
tr._translate( tr._translate(
"MainWindow", "MainWindow",
"Doing work necessary to send message.\n" "Doing work necessary to send message.\n"
"Receiver\'s required difficulty: %1" "Receiver\'s required difficulty: {0}"
" and %2" " and {1}"
).arg( ).format(
str( str(
float(requiredAverageProofOfWorkNonceTrialsPerByte) float(requiredAverageProofOfWorkNonceTrialsPerByte)
/ defaults.networkDefaultProofOfWorkNonceTrialsPerByte / defaults.networkDefaultProofOfWorkNonceTrialsPerByte
) ),
).arg(
str( str(
float(requiredPayloadLengthExtraBytes) float(requiredPayloadLengthExtraBytes)
/ defaults.networkDefaultPayloadLengthExtraBytes / defaults.networkDefaultPayloadLengthExtraBytes
@ -1075,14 +1074,14 @@ class singleWorker(StoppableThread):
tr._translate( tr._translate(
"MainWindow", "MainWindow",
"Problem: The work demanded by" "Problem: The work demanded by"
" the recipient (%1 and %2) is" " the recipient ({0} and {1}) is"
" more difficult than you are" " more difficult than you are"
" willing to do. %3" " willing to do. {2}"
).arg(str(float(requiredAverageProofOfWorkNonceTrialsPerByte) ).format(str(float(requiredAverageProofOfWorkNonceTrialsPerByte)
/ defaults.networkDefaultProofOfWorkNonceTrialsPerByte) / defaults.networkDefaultProofOfWorkNonceTrialsPerByte),
).arg(str(float(requiredPayloadLengthExtraBytes) str(float(requiredPayloadLengthExtraBytes)
/ defaults.networkDefaultPayloadLengthExtraBytes) / defaults.networkDefaultPayloadLengthExtraBytes),
).arg(l10n.formatTimestamp())))) l10n.formatTimestamp()))))
continue continue
else: # if we are sending a message to ourselves or a chan.. else: # if we are sending a message to ourselves or a chan..
self.logger.info('Sending a message.') self.logger.info('Sending a message.')
@ -1103,8 +1102,8 @@ class singleWorker(StoppableThread):
" message to yourself or a chan but your" " message to yourself or a chan but your"
" encryption key could not be found in" " encryption key could not be found in"
" the keys.dat file. Could not encrypt" " the keys.dat file. Could not encrypt"
" message. %1" " message. {0}"
).arg(l10n.formatTimestamp())) ).format(l10n.formatTimestamp()))
)) ))
self.logger.error( self.logger.error(
'Error within sendMsg. Could not read the keys' 'Error within sendMsg. Could not read the keys'
@ -1241,8 +1240,8 @@ class singleWorker(StoppableThread):
tr._translate( tr._translate(
"MainWindow", "MainWindow",
"Problem: The recipient\'s encryption key is" "Problem: The recipient\'s encryption key is"
" no good. Could not encrypt message. %1" " no good. Could not encrypt message. {0}"
).arg(l10n.formatTimestamp())) ).format(l10n.formatTimestamp()))
)) ))
continue continue
@ -1309,8 +1308,8 @@ class singleWorker(StoppableThread):
ackdata, ackdata,
tr._translate( tr._translate(
"MainWindow", "MainWindow",
"Message sent. Sent at %1" "Message sent. Sent at {0}"
).arg(l10n.formatTimestamp())))) ).format(l10n.formatTimestamp()))))
else: else:
# not sending to a chan or one of my addresses # not sending to a chan or one of my addresses
queues.UISignalQueue.put(( queues.UISignalQueue.put((
@ -1319,8 +1318,8 @@ class singleWorker(StoppableThread):
tr._translate( tr._translate(
"MainWindow", "MainWindow",
"Message sent. Waiting for acknowledgement." "Message sent. Waiting for acknowledgement."
" Sent on %1" " Sent on {0}"
).arg(l10n.formatTimestamp())) ).format(l10n.formatTimestamp()))
)) ))
self.logger.info( self.logger.info(
'Broadcasting inv for my msg(within sendmsg function): %s', 'Broadcasting inv for my msg(within sendmsg function): %s',
@ -1483,8 +1482,8 @@ class singleWorker(StoppableThread):
tr._translate( tr._translate(
"MainWindow", "MainWindow",
"Sending public key request. Waiting for reply." "Sending public key request. Waiting for reply."
" Requested at %1" " Requested at {0}"
).arg(l10n.formatTimestamp())) ).format(l10n.formatTimestamp()))
)) ))
def generateFullAckMessage(self, ackdata, _, TTL): def generateFullAckMessage(self, ackdata, _, TTL):

View File

@ -96,8 +96,8 @@ class namecoinConnection(object):
res = res["reply"] res = res["reply"]
if not res: if not res:
return (_translate( return (_translate(
"MainWindow", "The name %1 was not found." "MainWindow", "The name {0} was not found."
).arg(identity.decode("utf-8", "ignore")), None) ).format(identity.decode("utf-8", "ignore")), None)
else: else:
assert False assert False
except RPCError as exc: except RPCError as exc:
@ -107,12 +107,12 @@ class namecoinConnection(object):
else: else:
errmsg = exc.error errmsg = exc.error
return (_translate( return (_translate(
"MainWindow", "The namecoin query failed (%1)" "MainWindow", "The namecoin query failed ({0})"
).arg(errmsg.decode("utf-8", "ignore")), None) ).format(errmsg.decode("utf-8", "ignore")), None)
except AssertionError: except AssertionError:
return (_translate( return (_translate(
"MainWindow", "Unknown namecoin interface type: %1" "MainWindow", "Unknown namecoin interface type: {0}"
).arg(self.nmctype.decode("utf-8", "ignore")), None) ).format(self.nmctype.decode("utf-8", "ignore")), None)
except Exception: except Exception:
logger.exception("Namecoin query exception") logger.exception("Namecoin query exception")
return (_translate( return (_translate(
@ -135,8 +135,8 @@ class namecoinConnection(object):
) if valid else ( ) if valid else (
_translate( _translate(
"MainWindow", "MainWindow",
"The name %1 has no associated Bitmessage address." "The name {0} has no associated Bitmessage address."
).arg(identity.decode("utf-8", "ignore")), None) ).format(identity.decode("utf-8", "ignore")), None)
def test(self): def test(self):
""" """
@ -164,7 +164,7 @@ class namecoinConnection(object):
"success", "success",
_translate( _translate(
"MainWindow", "MainWindow",
"Success! Namecoind version %1 running.").arg( "Success! Namecoind version {0} running.").format(
versStr.decode("utf-8", "ignore"))) versStr.decode("utf-8", "ignore")))
elif self.nmctype == "nmcontrol": elif self.nmctype == "nmcontrol":

View File

@ -138,9 +138,9 @@ class TCPConnection(BMProto, TLSDispatcher):
'updateStatusBar', 'updateStatusBar',
_translate( _translate(
"MainWindow", "MainWindow",
"The time on your computer, %1, may be wrong. " "The time on your computer, {0}, may be wrong. "
"Please verify your settings." "Please verify your settings."
).arg(l10n.formatTimestamp()))) ).format(l10n.formatTimestamp())))
def state_connection_fully_established(self): def state_connection_fully_established(self):
""" """

View File

@ -269,8 +269,8 @@ class uPnPThread(StoppableThread):
knownnodes.addKnownNode( knownnodes.addKnownNode(
1, self_peer, is_self=True) 1, self_peer, is_self=True)
queues.UISignalQueue.put(('updateStatusBar', tr._translate( queues.UISignalQueue.put(('updateStatusBar', tr._translate(
"MainWindow", 'UPnP port mapping established on port %1' "MainWindow", 'UPnP port mapping established on port {0}'
).arg(str(self.extPort)))) ).format(str(self.extPort))))
break break
except socket.timeout: except socket.timeout:
pass pass