Runnable with both Python3 and Python2, with both PyQt5 and PyQt4 by using Qt.py #2250

Open
kashikoibumi wants to merge 127 commits from kashikoibumi/py3qt into v0.6
12 changed files with 118 additions and 119 deletions
Showing only changes of commit f181b85d97 - Show all commits

View File

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

View File

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

View File

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

View File

@ -56,7 +56,7 @@ class MessageView(QtGui.QTextBrowser):
) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
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):
"""Set word-wrapping width"""
@ -90,8 +90,8 @@ class MessageView(QtGui.QTextBrowser):
"Follow external link"),
QtGui.QApplication.translate(
"MessageView",
"The link \"%1\" 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())),
"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?").format(unicode(link.toString())),
QtGui.QMessageBox.Yes,
QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:

View File

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

View File

@ -66,7 +66,7 @@ class NewChanDialog(QtGui.QDialog):
addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True)
if addressGeneratorReturnValue and addressGeneratorReturnValue[0] != 'chan name does not match address':
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.indexOf(self.parent.ui.chans)
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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