Implemented labeling after making a transaction

This commit is contained in:
Maran 2012-12-10 20:51:14 +01:00
parent a296350994
commit 7f76ac4aeb
3 changed files with 43 additions and 11 deletions

View File

@ -51,7 +51,7 @@ MiniWindow QPushButton {
stop: 0 white, stop: 1 #D1D1D1); stop: 0 white, stop: 1 #D1D1D1);
} }
#address_input, #amount_input #address_input, #amount_input, #label_input
{ {
color: #000; color: #000;
padding: 5px; padding: 5px;

View File

@ -153,14 +153,48 @@ class ElectrumGui(QObject):
qt_gui_object = gui_qt.ElectrumGui(self.wallet, self.app) qt_gui_object = gui_qt.ElectrumGui(self.wallet, self.app)
return qt_gui_object.restore_or_create() return qt_gui_object.restore_or_create()
class TransactionWindow(QDialog):
def set_label(self):
label = unicode(self.label_edit.text())
self.parent.wallet.labels[self.tx_id] = label
super(TransactionWindow, self).accept()
def __init__(self, transaction_id, parent):
super(TransactionWindow, self).__init__()
self.tx_id = str(transaction_id)
self.parent = parent
self.setModal(True)
self.resize(200,100)
self.setWindowTitle("Transaction successfully sent")
self.layout = QGridLayout(self)
self.layout.addWidget(QLabel("Your transaction has been sent.\nPlease enter a label for this transaction for future reference."))
self.label_edit = QLineEdit()
self.label_edit.setPlaceholderText(_("Transaction label"))
self.label_edit.setObjectName("label_input")
self.label_edit.setAttribute(Qt.WA_MacShowFocusRect, 0)
self.label_edit.setFocusPolicy(Qt.ClickFocus)
self.layout.addWidget(self.label_edit)
self.save_button = QPushButton(_("Save"))
self.layout.addWidget(self.save_button)
self.save_button.clicked.connect(self.set_label)
self.exec_()
class MiniWindow(QDialog): class MiniWindow(QDialog):
def __init__(self, actuator, expand_callback, config): def __init__(self, actuator, expand_callback, config):
super(MiniWindow, self).__init__() super(MiniWindow, self).__init__()
tx = "e08115d0f7819aee65b9d24f81ef9d46eb62bb67ddef5318156cbc3ceb7b703e"
self.actuator = actuator self.actuator = actuator
self.config = config self.config = config
self.btc_balance = None self.btc_balance = None
self.quote_currencies = ["EUR", "USD", "GBP"] self.quote_currencies = ["EUR", "USD", "GBP"]
self.actuator.set_configured_currency(self.set_quote_currency) self.actuator.set_configured_currency(self.set_quote_currency)
@ -178,6 +212,7 @@ class MiniWindow(QDialog):
self.address_input.setPlaceholderText(_("Enter a Bitcoin address...")) self.address_input.setPlaceholderText(_("Enter a Bitcoin address..."))
self.address_input.setObjectName("address_input") self.address_input.setObjectName("address_input")
self.address_input.setFocusPolicy(Qt.ClickFocus)
self.address_input.textEdited.connect(self.address_field_changed) self.address_input.textEdited.connect(self.address_field_changed)
resize_line_edit_width(self.address_input, resize_line_edit_width(self.address_input,
@ -195,6 +230,8 @@ class MiniWindow(QDialog):
self.amount_input = QLineEdit() self.amount_input = QLineEdit()
self.amount_input.setPlaceholderText(_("... and amount")) self.amount_input.setPlaceholderText(_("... and amount"))
self.amount_input.setObjectName("amount_input") self.amount_input.setObjectName("amount_input")
self.amount_input.setFocusPolicy(Qt.ClickFocus)
# This is changed according to the user's displayed balance # This is changed according to the user's displayed balance
self.amount_validator = QDoubleValidator(self.amount_input) self.amount_validator = QDoubleValidator(self.amount_input)
self.amount_validator.setNotation(QDoubleValidator.StandardNotation) self.amount_validator.setNotation(QDoubleValidator.StandardNotation)
@ -813,9 +850,10 @@ class MiniActuator:
print "Dumped error tx to", dumpf.name print "Dumped error tx to", dumpf.name
QMessageBox.warning(parent_window, _('Error'), message, _('OK')) QMessageBox.warning(parent_window, _('Error'), message, _('OK'))
return False return False
QMessageBox.information(parent_window, '', TransactionWindow(message, self)
_('Your transaction has been sent.') + '\n' + message, _('OK')) # QMessageBox.information(parent_window, '',
# _('Your transaction has been sent.') + '\n' + message, _('OK'))
return True return True
def fetch_destination(self, address): def fetch_destination(self, address):

View File

@ -64,9 +64,3 @@ class ReceivingWidget(QTreeWidget):
self.hide_used = True self.hide_used = True
self.setColumnHidden(2, True) self.setColumnHidden(2, True)
self.update_list() self.update_list()