fixed CQ for bitmessageqt.newaddresswizard module

This commit is contained in:
coolguy-cell 2020-06-06 20:36:19 +05:30
parent e372459737
commit 5b3139c4d1
No known key found for this signature in database
GPG Key ID: CD3A42E1D470AD70

View File

@ -1,14 +1,18 @@
#!/usr/bin/env python2.7
from PyQt4 import QtCore, QtGui
class NewAddressWizardIntroPage(QtGui.QWizardPage):
def __init__(self):
super(QtGui.QWizardPage, self).__init__()
self.setTitle("Creating a new address")
label = QtGui.QLabel("This wizard will help you create as many addresses as you like. Indeed, creating and abandoning addresses is encouraged.\n\n"
"What type of address would you like? Would you like to send emails or not?\n"
"You can still change your mind later, and register/unregister with an email service provider.\n\n")
label = QtGui.QLabel(
"This wizard will help you create as many addresses"
" as you like. Indeed, creating and abandoning addresses is encouraged.\n\n"
" What type of address would you like? Would you like to send emails or not?\n"
" You can still change your mind later, and register/unregister with an "
" email service provider.\n\n")
label.setWordWrap(True)
self.emailAsWell = QtGui.QRadioButton("Combined email and bitmessage address")
@ -35,17 +39,20 @@ class NewAddressWizardRngPassphrasePage(QtGui.QWizardPage):
super(QtGui.QWizardPage, self).__init__()
self.setTitle("Random or Passphrase")
label = QtGui.QLabel("<html><head/><body><p>You may generate addresses by using either random numbers or by using a passphrase. "
"If you use a passphrase, the address is called a &quot;deterministic&quot; address. "
"The \'Random Number\' option is selected by default but deterministic addresses have several pros and cons:</p>"
"<table border=0><tr><td><span style=\" font-weight:600;\">Pros:</span></td><td><span style=\" font-weight:600;\">Cons:</span></td></tr>"
"<tr><td>You can recreate your addresses on any computer from memory. "
"You need-not worry about backing up your keys.dat file as long as you can remember your passphrase.</td>"
"<td>You must remember (or write down) your passphrase if you expect to be able "
"to recreate your keys if they are lost. "
# "You must remember the address version number and the stream number along with your passphrase. "
"If you choose a weak passphrase and someone on the Internet can brute-force it, they can read your messages and send messages as you."
"</p></body></html>")
label = QtGui.QLabel(
"<html><head/><body><p>You may generate addresses by using either random"
" numbers or by using a passphrase.If you use a passphrase, the address"
" is called a &quot;deterministic&quot; address.The \'Random Number\' option"
" is selected by default but deterministic addresses have several pros"
" and cons:</p><table border=0><tr><td><span style=\" font-weight:600;\">Pros:"
" </span></td><td><span style=\" font-weight:600;\">Cons:</span></td></tr>"
"<tr><td>You can recreate your addresses on any computer from memory."
" You need-not worry about backing up your keys.dat file as long as you can"
" remember your passphrase.</td><td>You must remember (or write down) your"
" passphrase if you expect to be able to recreate your keys if they are lost."
# "You must remember the address version number and the stream number along with your passphrase. "
" If you choose a weak passphrase and someone on the Internet can brute-force it,"
" they can read your messages and send messages as you.</p></body></html>")
label.setWordWrap(True)
self.randomAddress = QtGui.QRadioButton("Use a random number generator to make an address")
@ -64,6 +71,7 @@ class NewAddressWizardRngPassphrasePage(QtGui.QWizardPage):
else:
return 3
class NewAddressWizardRandomPage(QtGui.QWizardPage):
def __init__(self, addresses):
super(QtGui.QWizardPage, self).__init__()
@ -75,10 +83,13 @@ class NewAddressWizardRandomPage(QtGui.QWizardPage):
labelLabel = QtGui.QLabel("Label (not shown to anyone except you):")
self.labelLineEdit = QtGui.QLineEdit()
self.radioButtonMostAvailable = QtGui.QRadioButton("Use the most available stream\n"
self.radioButtonMostAvailable = QtGui.QRadioButton(
"Use the most available stream\n"
"(best if this is the first of many addresses you will create)")
self.radioButtonExisting = QtGui.QRadioButton("Use the same stream as an existing address\n"
"(saves you some bandwidth and processing power)")
self.radioButtonExisting = QtGui.QRadioButton(
"Use the same stream as an existing address\n"
"(saves you some bandwidth and processing power)"
)
self.radioButtonMostAvailable.setChecked(True)
self.comboBoxExisting = QtGui.QComboBox()
self.comboBoxExisting.setEnabled(False)
@ -88,7 +99,10 @@ class NewAddressWizardRandomPage(QtGui.QWizardPage):
self.comboBoxExisting.addItem(address)
# self.comboBoxExisting.setObjectName(_fromUtf8("comboBoxExisting"))
self.checkBoxEighteenByteRipe = QtGui.QCheckBox("Spend several minutes of extra computing time to make the address(es) 1 or 2 characters shorter")
self.checkBoxEighteenByteRipe = QtGui.QCheckBox(
"Spend several minutes of extra computing time to"
" make the address(es) 1 or 2 characters shorter"
)
layout = QtGui.QGridLayout()
layout.addWidget(label, 0, 0)
@ -100,7 +114,10 @@ class NewAddressWizardRandomPage(QtGui.QWizardPage):
layout.addWidget(self.checkBoxEighteenByteRipe, 6, 0)
self.setLayout(layout)
QtCore.QObject.connect(self.radioButtonExisting, QtCore.SIGNAL("toggled(bool)"), self.comboBoxExisting.setEnabled)
QtCore.QObject.connect(
self.radioButtonExisting, QtCore.SIGNAL("toggled(bool)"),
self.comboBoxExisting.setEnabled
)
self.registerField("label", self.labelLineEdit)
self.registerField("radioButtonMostAvailable", self.radioButtonMostAvailable)
@ -126,7 +143,10 @@ class NewAddressWizardPassphrasePage(QtGui.QWizardPage):
passphraseLabel = QtGui.QLabel("Passphrase")
self.lineEditPassphrase = QtGui.QLineEdit()
self.lineEditPassphrase.setEchoMode(QtGui.QLineEdit.Password)
self.lineEditPassphrase.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhNoAutoUppercase|QtCore.Qt.ImhNoPredictiveText)
self.lineEditPassphrase.setInputMethodHints(
QtCore.Qt.ImhHiddenText | QtCore.Qt.ImhNoAutoUppercase
| QtCore.Qt.ImhNoPredictiveText
)
retypePassphraseLabel = QtGui.QLabel("Retype passphrase")
self.lineEditPassphraseAgain = QtGui.QLineEdit()
self.lineEditPassphraseAgain.setEchoMode(QtGui.QLineEdit.Password)
@ -163,9 +183,11 @@ class NewAddressWizardEmailProviderPage(QtGui.QWizardPage):
super(QtGui.QWizardPage, self).__init__()
self.setTitle("Choose email provider")
label = QtGui.QLabel("Currently only Mailchuck email gateway is available "
"(@mailchuck.com email address). In the future, maybe other gateways will be available. "
"Press Next.")
label = QtGui.QLabel(
"Currently only Mailchuck email gateway is available "
"(@mailchuck.com email address). In the future, maybe other gateways"
" will be available.Press Next."
)
label.setWordWrap(True)
# self.mailchuck = QtGui.QRadioButton("Mailchuck email gateway (@mailchuck.com)")
@ -241,7 +263,7 @@ class NewAddressWizardWaitPage(QtGui.QWizardPage):
self.emit(QtCore.SIGNAL('completeChanged()'))
def isComplete(self):
# print "val = " + str(self.progressBar.value())
# print "val = " + str(self.progressBar.value())
if self.progressBar.value() >= 50:
return True
else:
@ -280,6 +302,7 @@ class NewAddressWizardConclusionPage(QtGui.QWizardPage):
layout.addWidget(label)
self.setLayout(layout)
class Ui_NewAddressWizard(QtGui.QWizard):
def __init__(self, addresses):
super(QtGui.QWizard, self).__init__()
@ -308,6 +331,7 @@ class Ui_NewAddressWizard(QtGui.QWizard):
self.adjustSize()
self.show()
class NewAddressThread(QtCore.QThread):
def __init__(self):
QtCore.QThread.__init__(self)
@ -334,11 +358,12 @@ class NewAddressThread(QtCore.QThread):
def run(self):
import time
for i in range(1, 101):
time.sleep(0.1) # artificial time delay
time.sleep(0.1) # artificial time delay
self.emit(self.signal, i)
self.emit(self.signal, 101)
# self.terminate()
if __name__ == '__main__':
import sys