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 ctypes
import ssl import ssl
import sys import sys
import os
import time import time
import account import account
@ -23,8 +24,8 @@ from version import softwareVersion
# this is BM support address going to Peter Surda # this is BM support address going to Peter Surda
OLD_SUPPORT_ADDRESS = 'BM-2cTkCtMYkrSPwFTpgcBrMrf5d8oZwvMZWK' OLD_SUPPORT_ADDRESS = 'BM-2cTkCtMYkrSPwFTpgcBrMrf5d8oZwvMZWK'
SUPPORT_ADDRESS = 'BM-2cUdgkDDAahwPAU6oD2A7DnjqZz3hgY832' SUPPORT_ADDRESS = 'BM-2cUdgkDDAahwPAU6oD2A7DnjqZz3hgY832'
SUPPORT_LABEL = 'PyBitmessage support' SUPPORT_LABEL = _translate("Support", "PyBitmessage support")
SUPPORT_MY_LABEL = 'My new address' SUPPORT_MY_LABEL = _translate("Support", "My new address")
SUPPORT_SUBJECT = 'Support request' 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. 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 Architecture: {}bit
Python Version: {} Python Version: {}
OpenSSL Version: {} OpenSSL Version: {}
Qt API: {}
Frozen: {} Frozen: {}
Portable mode: {} Portable mode: {}
C PoW: {} C PoW: {}
@ -62,7 +64,7 @@ def checkAddressBook(myapp):
if queryreturn == []: if queryreturn == []:
sqlExecute( sqlExecute(
'''INSERT INTO addressbook VALUES (?,?)''', '''INSERT INTO addressbook VALUES (?,?)''',
str(_translate("Support", SUPPORT_LABEL)), SUPPORT_ADDRESS SUPPORT_LABEL, SUPPORT_ADDRESS
) )
myapp.rerenderAddressBook() myapp.rerenderAddressBook()
@ -80,7 +82,7 @@ def createAddressIfNeeded(myapp):
if not checkHasNormalAddress(): if not checkHasNormalAddress():
queues.addressGeneratorQueue.put(( queues.addressGeneratorQueue.put((
'createRandomAddress', 4, 1, 'createRandomAddress', 4, 1,
str(_translate("Support", SUPPORT_MY_LABEL)), 1, "", False, SUPPORT_MY_LABEL, 1, "", False,
defaults.networkDefaultProofOfWorkNonceTrialsPerByte, defaults.networkDefaultProofOfWorkNonceTrialsPerByte,
defaults.networkDefaultPayloadLengthExtraBytes defaults.networkDefaultPayloadLengthExtraBytes
)) ))
@ -96,8 +98,7 @@ def createSupportMessage(myapp):
if state.shutdown: if state.shutdown:
return return
myapp.ui.lineEditSubject.setText( myapp.ui.lineEditSubject.setText(SUPPORT_SUBJECT)
str(_translate("Support", SUPPORT_SUBJECT)))
addrIndex = myapp.ui.comboBoxSendFrom.findData( addrIndex = myapp.ui.comboBoxSendFrom.findData(
address, QtCore.Qt.UserRole, address, QtCore.Qt.UserRole,
QtCore.Qt.MatchFixedString | QtCore.Qt.MatchCaseSensitive QtCore.Qt.MatchFixedString | QtCore.Qt.MatchCaseSensitive
@ -113,12 +114,11 @@ def createSupportMessage(myapp):
version += " GIT " + commit version += " GIT " + commit
if sys.platform == "win32": if sys.platform == "win32":
os = "Windows %s.%s" % sys.getwindowsversion() osname = "Windows %s.%s" % sys.getwindowsversion()
else: else:
try: try:
from os import uname unixversion = os.uname()
unixversion = uname() osname = unixversion[0] + " " + unixversion[2]
os = unixversion[0] + " " + unixversion[2]
except: except:
pass pass
architecture = "32" if ctypes.sizeof(ctypes.c_voidp) == 4 else "64" 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) opensslversion = "%s (Python internal), %s (external for PyElliptic)" % (ssl.OPENSSL_VERSION, OpenSSL._version)
qtapi = os.environ['QT_API']
frozen = "N/A" frozen = "N/A"
if paths.frozen: if paths.frozen:
frozen = paths.frozen frozen = paths.frozen
portablemode = "True" \ portablemode = "True" \
if state.appdata == paths.lookupExeFolder() else "False" if state.appdata == paths.lookupExeFolder() else "False"
cpow = "True" if proofofwork.bmpow 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 = str(BMConfigParser().safeGet('bitmessagesettings', 'opencl')) if openclEnabled() else "None"
# openclpow = QtGui.QApplication.translate("Support", openclpow)
locale = getTranslationLanguage() locale = getTranslationLanguage()
try: try:
socks = BMConfigParser().get('bitmessagesettings', 'socksproxytype') socks = BMConfigParser().get('bitmessagesettings', 'socksproxytype')
@ -147,10 +147,10 @@ def createSupportMessage(myapp):
connectedhosts = len(network.stats.connectedHostsList()) connectedhosts = len(network.stats.connectedHostsList())
myapp.ui.textEditMessage.setText( myapp.ui.textEditMessage.setText(
str(_translate("Support", SUPPORT_MESSAGE)).format( SUPPORT_MESSAGE.format(
version, os, architecture, pythonversion, opensslversion, version, osname, architecture, pythonversion, opensslversion,
frozen, portablemode, cpow, openclpow, locale, socks, upnp, qtapi, frozen, portablemode, cpow, openclpow, locale, socks,
connectedhosts upnp, connectedhosts
)) ))
# single msg tab # single msg tab