Chan address validator button feedback

- During validation, the button not only turns gray but also changes
label
This commit is contained in:
Peter Šurda 2017-06-24 12:14:23 +02:00
parent 2685fe29b1
commit bfbdd7e140
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -15,6 +15,8 @@ class AddressPassPhraseValidatorMixin():
self.buttonBox = buttonBox self.buttonBox = buttonBox
self.addressMandatory = addressMandatory self.addressMandatory = addressMandatory
self.isValid = False self.isValid = False
# save default text
self.okButtonLabel = self.buttonBox.button(QtGui.QDialogButtonBox.Ok).text()
def setError(self, string): def setError(self, string):
if string is not None and self.feedBackObject is not None: if string is not None and self.feedBackObject is not None:
@ -26,6 +28,10 @@ class AddressPassPhraseValidatorMixin():
self.isValid = False self.isValid = False
if self.buttonBox: if self.buttonBox:
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False) self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)
if string is not None and self.feedBackObject is not None:
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(_translate("AddressValidator", "Invalid"))
else:
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(_translate("AddressValidator", "Validating..."))
def setOK(self, string): def setOK(self, string):
if string is not None and self.feedBackObject is not None: if string is not None and self.feedBackObject is not None:
@ -37,6 +43,7 @@ class AddressPassPhraseValidatorMixin():
self.isValid = True self.isValid = True
if self.buttonBox: if self.buttonBox:
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True) self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(self.okButtonLabel)
def checkQueue(self): def checkQueue(self):
gotOne = False gotOne = False