fixed CQ for bitmessageqt.newaddresswizard module
This commit is contained in:
parent
e372459737
commit
5b3139c4d1
|
@ -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")
|
||||
|
@ -22,30 +26,33 @@ class NewAddressWizardIntroPage(QtGui.QWizardPage):
|
|||
layout.addWidget(self.emailAsWell)
|
||||
layout.addWidget(self.onlyBM)
|
||||
self.setLayout(layout)
|
||||
|
||||
|
||||
def nextId(self):
|
||||
if self.emailAsWell.isChecked():
|
||||
return 4
|
||||
else:
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
class NewAddressWizardRngPassphrasePage(QtGui.QWizardPage):
|
||||
def __init__(self):
|
||||
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 "deterministic" 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 "deterministic" 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)
|
||||
|
@ -86,10 +97,13 @@ class NewAddressWizardRandomPage(QtGui.QWizardPage):
|
|||
|
||||
for address in addresses:
|
||||
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)
|
||||
layout.addWidget(labelLabel, 1, 0)
|
||||
|
@ -100,8 +114,11 @@ 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)
|
||||
self.registerField("radioButtonExisting", self.radioButtonExisting)
|
||||
|
@ -114,7 +131,7 @@ class NewAddressWizardRandomPage(QtGui.QWizardPage):
|
|||
def nextId(self):
|
||||
return 6
|
||||
|
||||
|
||||
|
||||
class NewAddressWizardPassphrasePage(QtGui.QWizardPage):
|
||||
def __init__(self):
|
||||
super(QtGui.QWizardPage, self).__init__()
|
||||
|
@ -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)
|
||||
|
@ -139,7 +159,7 @@ class NewAddressWizardPassphrasePage(QtGui.QWizardPage):
|
|||
label2 = QtGui.QLabel("In addition to your passphrase, you must remember these numbers:")
|
||||
label3 = QtGui.QLabel("Address version number: 4")
|
||||
label4 = QtGui.QLabel("Stream number: 1")
|
||||
|
||||
|
||||
layout = QtGui.QGridLayout()
|
||||
layout.addWidget(label, 0, 0, 1, 4)
|
||||
layout.addWidget(passphraseLabel, 1, 0, 1, 4)
|
||||
|
@ -157,15 +177,17 @@ class NewAddressWizardPassphrasePage(QtGui.QWizardPage):
|
|||
def nextId(self):
|
||||
return 6
|
||||
|
||||
|
||||
|
||||
class NewAddressWizardEmailProviderPage(QtGui.QWizardPage):
|
||||
def __init__(self):
|
||||
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)")
|
||||
|
@ -179,7 +201,7 @@ class NewAddressWizardEmailProviderPage(QtGui.QWizardPage):
|
|||
def nextId(self):
|
||||
return 5
|
||||
|
||||
|
||||
|
||||
class NewAddressWizardEmailAddressPage(QtGui.QWizardPage):
|
||||
def __init__(self):
|
||||
super(QtGui.QWizardPage, self).__init__()
|
||||
|
@ -192,7 +214,7 @@ class NewAddressWizardEmailAddressPage(QtGui.QWizardPage):
|
|||
self.specificEmail.setChecked(True)
|
||||
self.emailLineEdit = QtGui.QLineEdit()
|
||||
self.randomEmail = QtGui.QRadioButton("Generate a random email address")
|
||||
|
||||
|
||||
QtCore.QObject.connect(self.specificEmail, QtCore.SIGNAL("toggled(bool)"), self.emailLineEdit.setEnabled)
|
||||
|
||||
layout = QtGui.QVBoxLayout()
|
||||
|
@ -205,19 +227,19 @@ class NewAddressWizardEmailAddressPage(QtGui.QWizardPage):
|
|||
def nextId(self):
|
||||
return 6
|
||||
|
||||
|
||||
|
||||
class NewAddressWizardWaitPage(QtGui.QWizardPage):
|
||||
def __init__(self):
|
||||
super(QtGui.QWizardPage, self).__init__()
|
||||
self.setTitle("Wait")
|
||||
|
||||
|
||||
self.label = QtGui.QLabel("Wait!")
|
||||
self.label.setWordWrap(True)
|
||||
self.progressBar = QtGui.QProgressBar()
|
||||
self.progressBar.setMinimum(0)
|
||||
self.progressBar.setMaximum(100)
|
||||
self.progressBar.setValue(0)
|
||||
|
||||
|
||||
# self.emailAsWell = QtGui.QRadioButton("Combined email and bitmessage account")
|
||||
# self.onlyBM = QtGui.QRadioButton("Bitmessage-only account (no email)")
|
||||
# self.emailAsWell.setChecked(True)
|
||||
|
@ -239,14 +261,14 @@ class NewAddressWizardWaitPage(QtGui.QWizardPage):
|
|||
self.progressBar.setValue(i)
|
||||
if i == 50:
|
||||
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:
|
||||
return False
|
||||
|
||||
|
||||
def initializePage(self):
|
||||
if self.field("emailAsWell").toBool():
|
||||
val = "yes/"
|
||||
|
@ -263,11 +285,11 @@ class NewAddressWizardWaitPage(QtGui.QWizardPage):
|
|||
self.thread = NewAddressThread()
|
||||
self.connect(self.thread, self.thread.signal, self.update)
|
||||
self.thread.start()
|
||||
|
||||
|
||||
def nextId(self):
|
||||
return 10
|
||||
|
||||
|
||||
|
||||
class NewAddressWizardConclusionPage(QtGui.QWizardPage):
|
||||
def __init__(self):
|
||||
super(QtGui.QWizardPage, self).__init__()
|
||||
|
@ -278,14 +300,15 @@ class NewAddressWizardConclusionPage(QtGui.QWizardPage):
|
|||
|
||||
layout = QtGui.QVBoxLayout()
|
||||
layout.addWidget(label)
|
||||
self.setLayout(layout)
|
||||
self.setLayout(layout)
|
||||
|
||||
|
||||
class Ui_NewAddressWizard(QtGui.QWizard):
|
||||
def __init__(self, addresses):
|
||||
super(QtGui.QWizard, self).__init__()
|
||||
|
||||
self.pages = {}
|
||||
|
||||
|
||||
page = NewAddressWizardIntroPage()
|
||||
self.setPage(0, page)
|
||||
self.setStartId(0)
|
||||
|
@ -308,6 +331,7 @@ class Ui_NewAddressWizard(QtGui.QWizard):
|
|||
self.adjustSize()
|
||||
self.show()
|
||||
|
||||
|
||||
class NewAddressThread(QtCore.QThread):
|
||||
def __init__(self):
|
||||
QtCore.QThread.__init__(self)
|
||||
|
@ -315,30 +339,31 @@ class NewAddressThread(QtCore.QThread):
|
|||
|
||||
def __del__(self):
|
||||
self.wait()
|
||||
|
||||
|
||||
def createDeterministic(self):
|
||||
pass
|
||||
|
||||
|
||||
def createPassphrase(self):
|
||||
pass
|
||||
|
||||
|
||||
def broadcastAddress(self):
|
||||
pass
|
||||
|
||||
|
||||
def registerMailchuck(self):
|
||||
pass
|
||||
|
||||
|
||||
def waitRegistration(self):
|
||||
pass
|
||||
|
||||
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
|
||||
|
|
Reference in New Issue
Block a user