electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 690908ddce50dec74c935d6d5c7e071cff1b5789
parent f2b8837fbcd3ee9672cb85322047d9675dff93dc
Author: Amir Taaki <genjix@riseup.net>
Date:   Mon,  2 Jul 2012 21:49:14 +0200

completion support for destination addresses.

Diffstat:
Mlib/gui_lite.py | 21++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/lib/gui_lite.py b/lib/gui_lite.py @@ -44,6 +44,7 @@ class ElectrumGui: timer = Timer() timer.start() self.expert = gui_qt.ElectrumWindow(self.wallet) + self.expert.app = self.app self.expert.connect_slots(timer) self.expert.update_wallet() @@ -100,7 +101,6 @@ class MiniWindow(QDialog): self.connect(copy_button, SIGNAL("clicked()"), self.actuator.copy_address) - # Use QCompleter self.address_input = TextedLineEdit(_("Enter a Bitcoin address...")) self.address_input.setObjectName("address_input") self.connect(self.address_input, SIGNAL("textEdited(QString)"), @@ -109,6 +109,13 @@ class MiniWindow(QDialog): self.address_input.setMinimumWidth( metrics.width("1E4vM9q25xsyDwWwdqHUWnwshdWC9PykmL")) + self.address_completions = QStringListModel() + address_completer = QCompleter(self.address_input) + address_completer.setCaseSensitivity(False) + address_completer.setModel(self.address_completions) + self.address_input.setCompleter(address_completer) + self.address_completions.setStringList(["1brmlab", "hello"]) + self.valid_address = QCheckBox() self.valid_address.setObjectName("valid_address") self.valid_address.setEnabled(False) @@ -223,6 +230,9 @@ class MiniWindow(QDialog): else: self.valid_address.setChecked(False) + def update_completions(self, completions): + self.address_completions.setStringList(completions) + def show_about(self): QMessageBox.about(self, "Electrum", _("Electrum's focus is speed, with low resource usage and simplifying Bitcoin. You do not need to perform regular backups, because your wallet can be recovered from a secret phrase that you can memorize or write on paper. Startup times are instant because it operates in conjuction with high-performance servers that handle the most complicated parts of the Bitcoin system.")) @@ -462,6 +472,7 @@ class MiniDriver(QObject): if self.wallet.up_to_date: self.update_balance() + self.update_completions() def initializing(self): if self.state == self.INITIALIZING: @@ -492,6 +503,14 @@ class MiniDriver(QObject): balance = D(conf_balance + unconf_balance) self.window.set_balances(balance) + def update_completions(self): + completions = [] + for addr, label in self.wallet.labels.items(): + if addr in self.wallet.addressbook: + completions.append("%s <%s>" % (label, addr)) + completions = completions + self.wallet.aliases.keys() + self.window.update_completions(completions) + if __name__ == "__main__": app = QApplication(sys.argv) with open("data/style.css") as style_file: