import wallet
import webbrowser
import history_widget
+import receiving_widget
import util
import csv
import datetime
qt_gui_object = gui_qt.ElectrumGui(self.wallet, self.app)
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):
def __init__(self, actuator, expand_callback, config):
super(MiniWindow, self).__init__()
+ tx = "e08115d0f7819aee65b9d24f81ef9d46eb62bb67ddef5318156cbc3ceb7b703e"
self.actuator = actuator
self.config = config
-
self.btc_balance = None
self.quote_currencies = ["EUR", "USD", "GBP"]
self.actuator.set_configured_currency(self.set_quote_currency)
self.balance_label = BalanceLabel(self.change_quote_currency)
self.balance_label.setObjectName("balance_label")
- self.receive_button = QPushButton(_("&Receive"))
- self.receive_button.setObjectName("receive_button")
- self.receive_button.setDefault(True)
- self.receive_button.clicked.connect(self.copy_address)
# Bitcoin address code
self.address_input = QLineEdit()
self.address_input.setPlaceholderText(_("Enter a Bitcoin address..."))
self.address_input.setObjectName("address_input")
+ self.address_input.setFocusPolicy(Qt.ClickFocus)
self.address_input.textEdited.connect(self.address_field_changed)
resize_line_edit_width(self.address_input,
self.amount_input = QLineEdit()
self.amount_input.setPlaceholderText(_("... and amount"))
self.amount_input.setObjectName("amount_input")
+
+ self.amount_input.setFocusPolicy(Qt.ClickFocus)
# This is changed according to the user's displayed balance
self.amount_validator = QDoubleValidator(self.amount_input)
self.amount_validator.setNotation(QDoubleValidator.StandardNotation)
self.send_button.setDisabled(True);
self.send_button.clicked.connect(self.send)
+ # Creating the receive button
+ self.receive_button = QPushButton(_("&Receive"))
+ self.receive_button.setObjectName("receive_button")
+ self.receive_button.setDefault(True)
+
main_layout = QGridLayout(self)
main_layout.addWidget(self.balance_label, 0, 0)
main_layout.addWidget(self.receive_button, 0, 1)
- main_layout.addWidget(self.address_input, 1, 0, 1, -1)
+ main_layout.addWidget(self.address_input, 1, 0)
main_layout.addWidget(self.amount_input, 2, 0)
main_layout.addWidget(self.send_button, 2, 1)
self.history_list.setObjectName("history")
self.history_list.hide()
self.history_list.setAlternatingRowColors(True)
- main_layout.addWidget(self.history_list, 3, 0, 1, -1)
+ main_layout.addWidget(self.history_list, 3, 0, 1, 2)
+
+
+ self.receiving = receiving_widget.ReceivingWidget(self)
+ self.receiving.setObjectName("receiving")
+
+ # Add to the right side
+ self.receiving_box = QGroupBox(_("Select a receiving address"))
+ extra_layout = QGridLayout()
+
+ # Checkbox to filter used addresses
+ hide_used = QCheckBox(_('Hide used addresses'))
+ hide_used.setChecked(True)
+ hide_used.stateChanged.connect(self.receiving.toggle_used)
+
+ # Events for receiving addresses
+ self.receiving.clicked.connect(self.receiving.copy_address)
+ self.receiving.itemDoubleClicked.connect(self.receiving.edit_label)
+ self.receiving.itemChanged.connect(self.receiving.update_label)
+
+ # Label
+ extra_layout.addWidget( QLabel(_('Selecting an address will copy it to the clipboard.\nDouble clicking the label will allow you to edit it.') ),0,0)
+
+ extra_layout.addWidget(self.receiving, 1,0)
+ extra_layout.addWidget(hide_used, 2,0)
+ extra_layout.setColumnMinimumWidth(0,200)
+
+ self.receiving_box.setLayout(extra_layout)
+ main_layout.addWidget(self.receiving_box,0,3,-1,3)
+ self.receiving_box.hide()
+
+ self.receive_button.clicked.connect(self.toggle_receiving_layout)
+
+ # Creating the menu bar
menubar = QMenuBar()
electrum_menu = menubar.addMenu(_("&Bitcoin"))
electrum_menu.addSeparator()
- brain_seed = electrum_menu.addAction(_("&BrainWallet Info"))
- brain_seed.triggered.connect(self.actuator.show_seed_dialog)
quit_option = electrum_menu.addAction(_("&Quit"))
quit_option.triggered.connect(self.close)
export_csv = extra_menu.addAction( _("&Export transactions to CSV") )
export_csv.triggered.connect(self.actuator.csv_transaction)
+
+ master_key = extra_menu.addAction( _("Copy master public key to clipboard") )
+ master_key.triggered.connect(self.actuator.copy_master_public_key)
expert_gui = view_menu.addAction(_("&Classic GUI"))
expert_gui.triggered.connect(expand_callback)
show_about = help_menu.addAction(_("&About"))
show_about.triggered.connect(self.show_about)
main_layout.setMenuBar(menubar)
+ self.main_layout = main_layout
quit_shortcut = QShortcut(QKeySequence("Ctrl+Q"), self)
quit_shortcut.activated.connect(self.close)
self.setObjectName("main_window")
self.show()
+ def toggle_receiving_layout(self):
+ if self.receiving_box.isVisible():
+ self.receiving_box.hide()
+ self.receive_button.setProperty("isActive", False)
+
+ qApp.style().unpolish(self.receive_button)
+ qApp.style().polish(self.receive_button)
+ else:
+ self.receiving_box.show()
+ self.receive_button.setProperty("isActive", 'true')
+
+ qApp.style().unpolish(self.receive_button)
+ qApp.style().polish(self.receive_button)
+
def toggle_theme(self, theme_name):
old_path = QDir.currentPath()
self.actuator.change_theme(theme_name)
def show_history(self, toggle_state):
if toggle_state:
+ self.main_layout.setRowMinimumHeight(3,200)
self.history_list.show()
else:
+ self.main_layout.setRowMinimumHeight(3,0)
self.history_list.hide()
def backup_wallet(self):
print "Dumped error tx to", dumpf.name
QMessageBox.warning(parent_window, _('Error'), message, _('OK'))
return False
-
- QMessageBox.information(parent_window, '',
- _('Your transaction has been sent.') + '\n' + message, _('OK'))
+
+ TransactionWindow(message, self)
+# QMessageBox.information(parent_window, '',
+# _('Your transaction has been sent.') + '\n' + message, _('OK'))
return True
def fetch_destination(self, address):
"""Check if bitcoin address is valid."""
return self.wallet.is_valid(address)
+ def copy_master_public_key(self):
+ master_pubkey = self.wallet.master_public_key
+ qApp.clipboard().setText(master_pubkey)
+ QMessageBox.information(None,"Copy succesful", "Your public master key has been copied to your clipboard.")
+
+
def acceptbit(self, currency):
master_pubkey = self.wallet.master_public_key
url = "http://acceptbit.com/mpk/%s/%s" % (master_pubkey, currency)
tx_history = self.wallet.get_tx_history()
self.window.update_history(tx_history)
+
if __name__ == "__main__":
app = QApplication(sys.argv)
with open(rsrc("style.css")) as style_file: