mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-14 06:29:51 +00:00
Reworked the logic for the send button, you can only press it when the amount and a valid address is given
This commit is contained in:
parent
9619cef342
commit
7ba5f07629
2 changed files with 26 additions and 4 deletions
|
@ -25,6 +25,17 @@ MiniWindow QPushButton {
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#send_button:disabled{
|
||||||
|
color: #D3E8FE;
|
||||||
|
border: 1px solid #6DAEF7;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||||
|
stop: 0 #A5CFFA, stop: 1 #72B2F8);
|
||||||
|
min-width: 80px;
|
||||||
|
min-height: 23px;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
#address_input[readOnly=true], #amount_input[readOnly=true]
|
#address_input[readOnly=true], #amount_input[readOnly=true]
|
||||||
{
|
{
|
||||||
color: #ABABAB;
|
color: #ABABAB;
|
||||||
|
|
|
@ -191,9 +191,10 @@ class MiniWindow(QDialog):
|
||||||
amount_layout.addWidget(self.amount_input)
|
amount_layout.addWidget(self.amount_input)
|
||||||
amount_layout.addStretch()
|
amount_layout.addStretch()
|
||||||
|
|
||||||
send_button = QPushButton(_("&Send"))
|
self.send_button = QPushButton(_("&Send"))
|
||||||
send_button.setObjectName("send_button")
|
self.send_button.setObjectName("send_button")
|
||||||
self.connect(send_button, SIGNAL("clicked()"), self.send)
|
self.send_button.setDisabled(True);
|
||||||
|
self.connect(self.send_button, SIGNAL("clicked()"), self.send)
|
||||||
|
|
||||||
main_layout = QGridLayout(self)
|
main_layout = QGridLayout(self)
|
||||||
main_layout.addWidget(accounts_button, 0, 0)
|
main_layout.addWidget(accounts_button, 0, 0)
|
||||||
|
@ -206,7 +207,7 @@ class MiniWindow(QDialog):
|
||||||
main_layout.addLayout(address_layout, 1, 1, 1, -1)
|
main_layout.addLayout(address_layout, 1, 1, 1, -1)
|
||||||
|
|
||||||
main_layout.addLayout(amount_layout, 2, 1)
|
main_layout.addLayout(amount_layout, 2, 1)
|
||||||
main_layout.addWidget(send_button, 2, 2)
|
main_layout.addWidget(self.send_button, 2, 2)
|
||||||
|
|
||||||
quit_shortcut = QShortcut(QKeySequence("Ctrl+Q"), self)
|
quit_shortcut = QShortcut(QKeySequence("Ctrl+Q"), self)
|
||||||
self.connect(quit_shortcut, SIGNAL("activated()"), self.close)
|
self.connect(quit_shortcut, SIGNAL("activated()"), self.close)
|
||||||
|
@ -272,6 +273,8 @@ class MiniWindow(QDialog):
|
||||||
quote_text))
|
quote_text))
|
||||||
|
|
||||||
def amount_input_changed(self, amount_text):
|
def amount_input_changed(self, amount_text):
|
||||||
|
self.check_button_status()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
amount = D(str(amount_text))
|
amount = D(str(amount_text))
|
||||||
except decimal.InvalidOperation:
|
except decimal.InvalidOperation:
|
||||||
|
@ -300,11 +303,19 @@ class MiniWindow(QDialog):
|
||||||
self.address_input.become_inactive()
|
self.address_input.become_inactive()
|
||||||
self.amount_input.become_inactive()
|
self.amount_input.become_inactive()
|
||||||
|
|
||||||
|
def check_button_status(self):
|
||||||
|
if self.amount_input.text() != _("... and amount") and len(self.amount_input.text()) != 0:
|
||||||
|
self.send_button.setDisabled(False)
|
||||||
|
else:
|
||||||
|
self.send_button.setDisabled(True)
|
||||||
|
|
||||||
def address_field_changed(self, address):
|
def address_field_changed(self, address):
|
||||||
if self.actuator.is_valid(address):
|
if self.actuator.is_valid(address):
|
||||||
self.valid_address.setChecked(True)
|
self.valid_address.setChecked(True)
|
||||||
|
self.check_button_status()
|
||||||
else:
|
else:
|
||||||
self.valid_address.setChecked(False)
|
self.valid_address.setChecked(False)
|
||||||
|
self.send_button.setDisabled(True)
|
||||||
|
|
||||||
def copy_address(self):
|
def copy_address(self):
|
||||||
receive_popup = ReceivePopup(self.receive_button)
|
receive_popup = ReceivePopup(self.receive_button)
|
||||||
|
|
Loading…
Add table
Reference in a new issue