V0.6 #852
|
@ -39,6 +39,7 @@ from specialaddressbehavior import *
|
||||||
from emailgateway import *
|
from emailgateway import *
|
||||||
from settings import *
|
from settings import *
|
||||||
import settingsmixin
|
import settingsmixin
|
||||||
|
import support
|
||||||
from about import *
|
from about import *
|
||||||
from help import *
|
from help import *
|
||||||
from iconglossary import *
|
from iconglossary import *
|
||||||
|
@ -152,6 +153,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
"triggered()"), self.click_actionSettings)
|
"triggered()"), self.click_actionSettings)
|
||||||
QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL(
|
||||||
"triggered()"), self.click_actionAbout)
|
"triggered()"), self.click_actionAbout)
|
||||||
|
QtCore.QObject.connect(self.ui.actionSupport, QtCore.SIGNAL(
|
||||||
|
"triggered()"), self.click_actionSupport)
|
||||||
QtCore.QObject.connect(self.ui.actionHelp, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.ui.actionHelp, QtCore.SIGNAL(
|
||||||
"triggered()"), self.click_actionHelp)
|
"triggered()"), self.click_actionHelp)
|
||||||
|
|
||||||
|
@ -2555,6 +2558,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.helpDialogInstance = helpDialog(self)
|
self.helpDialogInstance = helpDialog(self)
|
||||||
self.helpDialogInstance.exec_()
|
self.helpDialogInstance.exec_()
|
||||||
|
|
||||||
|
def click_actionSupport(self):
|
||||||
|
support.createSupportMessage(self)
|
||||||
|
|
||||||
def click_actionAbout(self):
|
def click_actionAbout(self):
|
||||||
self.aboutDialogInstance = aboutDialog(self)
|
self.aboutDialogInstance = aboutDialog(self)
|
||||||
self.aboutDialogInstance.exec_()
|
self.aboutDialogInstance.exec_()
|
||||||
|
|
|
@ -687,6 +687,10 @@ class Ui_MainWindow(object):
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("help-contents"))
|
icon = QtGui.QIcon.fromTheme(_fromUtf8("help-contents"))
|
||||||
self.actionHelp.setIcon(icon)
|
self.actionHelp.setIcon(icon)
|
||||||
self.actionHelp.setObjectName(_fromUtf8("actionHelp"))
|
self.actionHelp.setObjectName(_fromUtf8("actionHelp"))
|
||||||
|
self.actionSupport = QtGui.QAction(MainWindow)
|
||||||
|
icon = QtGui.QIcon.fromTheme(_fromUtf8("help-support"))
|
||||||
|
self.actionSupport.setIcon(icon)
|
||||||
|
self.actionSupport.setObjectName(_fromUtf8("actionSupport"))
|
||||||
self.actionAbout = QtGui.QAction(MainWindow)
|
self.actionAbout = QtGui.QAction(MainWindow)
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("help-about"))
|
icon = QtGui.QIcon.fromTheme(_fromUtf8("help-about"))
|
||||||
self.actionAbout.setIcon(icon)
|
self.actionAbout.setIcon(icon)
|
||||||
|
@ -713,6 +717,7 @@ class Ui_MainWindow(object):
|
||||||
self.menuFile.addAction(self.actionExit)
|
self.menuFile.addAction(self.actionExit)
|
||||||
self.menuSettings.addAction(self.actionSettings)
|
self.menuSettings.addAction(self.actionSettings)
|
||||||
self.menuHelp.addAction(self.actionHelp)
|
self.menuHelp.addAction(self.actionHelp)
|
||||||
|
self.menuHelp.addAction(self.actionSupport)
|
||||||
self.menuHelp.addAction(self.actionAbout)
|
self.menuHelp.addAction(self.actionAbout)
|
||||||
self.menubar.addAction(self.menuFile.menuAction())
|
self.menubar.addAction(self.menuFile.menuAction())
|
||||||
self.menubar.addAction(self.menuSettings.menuAction())
|
self.menubar.addAction(self.menuSettings.menuAction())
|
||||||
|
@ -851,6 +856,7 @@ class Ui_MainWindow(object):
|
||||||
self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q", None))
|
self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q", None))
|
||||||
self.actionHelp.setText(_translate("MainWindow", "Help", None))
|
self.actionHelp.setText(_translate("MainWindow", "Help", None))
|
||||||
self.actionHelp.setShortcut(_translate("MainWindow", "F1", None))
|
self.actionHelp.setShortcut(_translate("MainWindow", "F1", None))
|
||||||
|
self.actionSupport.setText(_translate("MainWindow", "Contact support", None))
|
||||||
self.actionAbout.setText(_translate("MainWindow", "About", None))
|
self.actionAbout.setText(_translate("MainWindow", "About", None))
|
||||||
self.actionSettings.setText(_translate("MainWindow", "Settings", None))
|
self.actionSettings.setText(_translate("MainWindow", "Settings", None))
|
||||||
self.actionRegenerateDeterministicAddresses.setText(_translate("MainWindow", "Regenerate deterministic addresses", None))
|
self.actionRegenerateDeterministicAddresses.setText(_translate("MainWindow", "Regenerate deterministic addresses", None))
|
||||||
|
|
108
src/bitmessageqt/support.py
Normal file
108
src/bitmessageqt/support.py
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
import ctypes
|
||||||
|
from PyQt4 import QtCore, QtGui
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import account
|
||||||
|
from debug import logger
|
||||||
|
from foldertree import AccountMixin
|
||||||
|
from helper_sql import *
|
||||||
|
from l10n import getTranslationLanguage
|
||||||
|
from openclpow import has_opencl
|
||||||
|
from proofofwork import bmpow
|
||||||
|
import shared
|
||||||
|
|
||||||
|
# this is BM support address going to Peter Surda
|
||||||
|
SUPPORT_ADDRESS = 'BM-2cTkCtMYkrSPwFTpgcBrMrf5d8oZwvMZWK'
|
||||||
|
SUPPORT_LABEL = 'PyBitmessage support'
|
||||||
|
SUPPORT_MY_LABEL = '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.
|
||||||
|
|
||||||
|
Please describe what are you trying to do:
|
||||||
|
|
||||||
|
Please describe what you expect to happen:
|
||||||
|
|
||||||
|
Please describe what you happens instead:
|
||||||
|
|
||||||
|
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
Please write above this line and if possible, keep the information about your environment below intact.
|
||||||
|
|
||||||
|
Operating system: {}
|
||||||
|
Architecture: {}bit
|
||||||
|
Frozen: {}
|
||||||
|
C PoW: {}
|
||||||
|
OpenCL PoW: {}
|
||||||
|
Locale: {}
|
||||||
|
SOCKS: {}
|
||||||
|
UPnP: {}
|
||||||
|
Connected hosts: {}
|
||||||
|
'''
|
||||||
|
|
||||||
|
def checkAddressBook(myapp):
|
||||||
|
queryreturn = sqlQuery('''SELECT * FROM addressbook WHERE address=?''', SUPPORT_ADDRESS)
|
||||||
|
if queryreturn == []:
|
||||||
|
sqlExecute('''INSERT INTO addressbook VALUES (?,?)''', str(QtGui.QApplication.translate("Support", SUPPORT_LABEL)), SUPPORT_ADDRESS)
|
||||||
|
myapp.rerenderAddressBook()
|
||||||
|
|
||||||
|
def checkHasNormalAddress():
|
||||||
|
for address in account.getSortedAccounts():
|
||||||
|
acct = account.accountClass(address)
|
||||||
|
if acct.type == AccountMixin.NORMAL and shared.safeConfigGetBoolean(address, 'enabled'):
|
||||||
|
return address
|
||||||
|
return False
|
||||||
|
|
||||||
|
def createAddressIfNeeded(myapp):
|
||||||
|
if not checkHasNormalAddress():
|
||||||
|
shared.addressGeneratorQueue.put(('createRandomAddress', 4, 1, str(QtGui.QApplication.translate("Support", SUPPORT_MY_LABEL)), 1, "", False, shared.networkDefaultProofOfWorkNonceTrialsPerByte, shared.networkDefaultPayloadLengthExtraBytes))
|
||||||
|
while shared.shutdown == 0 and not checkHasNormalAddress():
|
||||||
|
time.sleep(.2)
|
||||||
|
myapp.rerenderComboBoxSendFrom()
|
||||||
|
return checkHasNormalAddress()
|
||||||
|
|
||||||
|
def createSupportMessage(myapp):
|
||||||
|
checkAddressBook(myapp)
|
||||||
|
address = createAddressIfNeeded(myapp)
|
||||||
|
if shared.shutdown:
|
||||||
|
return
|
||||||
|
|
||||||
|
myapp.ui.lineEditSubject.setText(str(QtGui.QApplication.translate("Support", SUPPORT_SUBJECT)))
|
||||||
|
addrIndex = myapp.ui.comboBoxSendFrom.findData(address, QtCore.Qt.UserRole, QtCore.Qt.MatchFixedString | QtCore.Qt.MatchCaseSensitive)
|
||||||
|
if addrIndex == -1: # something is very wrong
|
||||||
|
return
|
||||||
|
myapp.ui.comboBoxSendFrom.setCurrentIndex(addrIndex)
|
||||||
|
myapp.ui.lineEditTo.setText(SUPPORT_ADDRESS)
|
||||||
|
|
||||||
|
os = sys.platform
|
||||||
|
if os == "win32":
|
||||||
|
windowsversion = sys.getwindowsversion()
|
||||||
|
os = "Windows " + str(windowsversion[0]) + "." + str(windowsversion[1])
|
||||||
|
else:
|
||||||
|
unixversion = os.uname()
|
||||||
|
os = unixversion[0] + " " + unixversion[2]
|
||||||
|
architecture = "32" if ctypes.sizeof(ctypes.c_voidp) == 4 else "64"
|
||||||
|
frozen = "N/A"
|
||||||
|
if shared.frozen:
|
||||||
|
frozen = shared.frozen
|
||||||
|
cpow = "Yes" if bmpow else "No"
|
||||||
|
#cpow = QtGui.QApplication.translate("Support", cpow)
|
||||||
|
openclpow = "Yes" if shared.safeConfigGetBoolean('bitmessagesettings', 'opencl') and has_opencl() else "No"
|
||||||
|
#openclpow = QtGui.QApplication.translate("Support", openclpow)
|
||||||
|
locale = getTranslationLanguage()
|
||||||
|
try:
|
||||||
|
socks = shared.config.get('bitmessagesettings', 'socksproxytype')
|
||||||
|
except:
|
||||||
|
socks = "N/A"
|
||||||
|
try:
|
||||||
|
upnp = shared.config.get('bitmessagesettings', 'upnp')
|
||||||
|
except:
|
||||||
|
upnp = "N/A"
|
||||||
|
connectedhosts = len(shared.connectedHostsList)
|
||||||
|
|
||||||
|
myapp.ui.textEditMessage.setText(str(QtGui.QApplication.translate("Support", SUPPORT_MESSAGE)).format(os, architecture, frozen, cpow, openclpow, locale, socks, upnp, connectedhosts))
|
||||||
|
|
||||||
|
# single msg tab
|
||||||
|
myapp.ui.tabWidgetSend.setCurrentIndex(0)
|
||||||
|
# send tab
|
||||||
|
myapp.ui.tabWidget.setCurrentIndex(1)
|
Reference in New Issue
Block a user