Module support rewrite:

- removed _translate calls except for address labels
 - added Qt API string into support request
This commit is contained in:
Dmitri Bogomolov 2018-02-21 19:10:32 +02:00
parent 132d20d698
commit a01910fb49
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -1,6 +1,7 @@
import ctypes
import ssl
import sys
import os
import time
import account
@ -23,8 +24,8 @@ from version import softwareVersion
# this is BM support address going to Peter Surda
OLD_SUPPORT_ADDRESS = 'BM-2cTkCtMYkrSPwFTpgcBrMrf5d8oZwvMZWK'
SUPPORT_ADDRESS = 'BM-2cUdgkDDAahwPAU6oD2A7DnjqZz3hgY832'
SUPPORT_LABEL = 'PyBitmessage support'
SUPPORT_MY_LABEL = 'My new address'
SUPPORT_LABEL = _translate("Support", "PyBitmessage support")
SUPPORT_MY_LABEL = _translate("Support", "My new address")
SUPPORT_SUBJECT = 'Support request'
SUPPORT_MESSAGE = '''You can use this message to send a report to one of the PyBitmessage core developers regarding PyBitmessage or the mailchuck.com email service. If you are using PyBitmessage involuntarily, for example because your computer was infected with ransomware, this is not an appropriate venue for resolving such issues.
@ -43,6 +44,7 @@ Operating system: {}
Architecture: {}bit
Python Version: {}
OpenSSL Version: {}
Qt API: {}
Frozen: {}
Portable mode: {}
C PoW: {}
@ -62,7 +64,7 @@ def checkAddressBook(myapp):
if queryreturn == []:
sqlExecute(
'''INSERT INTO addressbook VALUES (?,?)''',
str(_translate("Support", SUPPORT_LABEL)), SUPPORT_ADDRESS
SUPPORT_LABEL, SUPPORT_ADDRESS
)
myapp.rerenderAddressBook()
@ -80,7 +82,7 @@ def createAddressIfNeeded(myapp):
if not checkHasNormalAddress():
queues.addressGeneratorQueue.put((
'createRandomAddress', 4, 1,
str(_translate("Support", SUPPORT_MY_LABEL)), 1, "", False,
SUPPORT_MY_LABEL, 1, "", False,
defaults.networkDefaultProofOfWorkNonceTrialsPerByte,
defaults.networkDefaultPayloadLengthExtraBytes
))
@ -96,8 +98,7 @@ def createSupportMessage(myapp):
if state.shutdown:
return
myapp.ui.lineEditSubject.setText(
str(_translate("Support", SUPPORT_SUBJECT)))
myapp.ui.lineEditSubject.setText(SUPPORT_SUBJECT)
addrIndex = myapp.ui.comboBoxSendFrom.findData(
address, QtCore.Qt.UserRole,
QtCore.Qt.MatchFixedString | QtCore.Qt.MatchCaseSensitive
@ -113,12 +114,11 @@ def createSupportMessage(myapp):
version += " GIT " + commit
if sys.platform == "win32":
os = "Windows %s.%s" % sys.getwindowsversion()
osname = "Windows %s.%s" % sys.getwindowsversion()
else:
try:
from os import uname
unixversion = uname()
os = unixversion[0] + " " + unixversion[2]
unixversion = os.uname()
osname = unixversion[0] + " " + unixversion[2]
except:
pass
architecture = "32" if ctypes.sizeof(ctypes.c_voidp) == 4 else "64"
@ -126,15 +126,15 @@ def createSupportMessage(myapp):
opensslversion = "%s (Python internal), %s (external for PyElliptic)" % (ssl.OPENSSL_VERSION, OpenSSL._version)
qtapi = os.environ['QT_API']
frozen = "N/A"
if paths.frozen:
frozen = paths.frozen
portablemode = "True" \
if state.appdata == paths.lookupExeFolder() else "False"
cpow = "True" if proofofwork.bmpow else "False"
# cpow = QtGui.QApplication.translate("Support", cpow)
openclpow = str(BMConfigParser().safeGet('bitmessagesettings', 'opencl')) if openclEnabled() else "None"
# openclpow = QtGui.QApplication.translate("Support", openclpow)
locale = getTranslationLanguage()
try:
socks = BMConfigParser().get('bitmessagesettings', 'socksproxytype')
@ -147,10 +147,10 @@ def createSupportMessage(myapp):
connectedhosts = len(network.stats.connectedHostsList())
myapp.ui.textEditMessage.setText(
str(_translate("Support", SUPPORT_MESSAGE)).format(
version, os, architecture, pythonversion, opensslversion,
frozen, portablemode, cpow, openclpow, locale, socks, upnp,
connectedhosts
SUPPORT_MESSAGE.format(
version, osname, architecture, pythonversion, opensslversion,
qtapi, frozen, portablemode, cpow, openclpow, locale, socks,
upnp, connectedhosts
))
# single msg tab