completion support for destination addresses.
This commit is contained in:
@@ -44,6 +44,7 @@ class ElectrumGui:
|
|||||||
timer = Timer()
|
timer = Timer()
|
||||||
timer.start()
|
timer.start()
|
||||||
self.expert = gui_qt.ElectrumWindow(self.wallet)
|
self.expert = gui_qt.ElectrumWindow(self.wallet)
|
||||||
|
self.expert.app = self.app
|
||||||
self.expert.connect_slots(timer)
|
self.expert.connect_slots(timer)
|
||||||
self.expert.update_wallet()
|
self.expert.update_wallet()
|
||||||
|
|
||||||
@@ -100,7 +101,6 @@ class MiniWindow(QDialog):
|
|||||||
self.connect(copy_button, SIGNAL("clicked()"),
|
self.connect(copy_button, SIGNAL("clicked()"),
|
||||||
self.actuator.copy_address)
|
self.actuator.copy_address)
|
||||||
|
|
||||||
# Use QCompleter
|
|
||||||
self.address_input = TextedLineEdit(_("Enter a Bitcoin address..."))
|
self.address_input = TextedLineEdit(_("Enter a Bitcoin address..."))
|
||||||
self.address_input.setObjectName("address_input")
|
self.address_input.setObjectName("address_input")
|
||||||
self.connect(self.address_input, SIGNAL("textEdited(QString)"),
|
self.connect(self.address_input, SIGNAL("textEdited(QString)"),
|
||||||
@@ -109,6 +109,13 @@ class MiniWindow(QDialog):
|
|||||||
self.address_input.setMinimumWidth(
|
self.address_input.setMinimumWidth(
|
||||||
metrics.width("1E4vM9q25xsyDwWwdqHUWnwshdWC9PykmL"))
|
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 = QCheckBox()
|
||||||
self.valid_address.setObjectName("valid_address")
|
self.valid_address.setObjectName("valid_address")
|
||||||
self.valid_address.setEnabled(False)
|
self.valid_address.setEnabled(False)
|
||||||
@@ -223,6 +230,9 @@ class MiniWindow(QDialog):
|
|||||||
else:
|
else:
|
||||||
self.valid_address.setChecked(False)
|
self.valid_address.setChecked(False)
|
||||||
|
|
||||||
|
def update_completions(self, completions):
|
||||||
|
self.address_completions.setStringList(completions)
|
||||||
|
|
||||||
def show_about(self):
|
def show_about(self):
|
||||||
QMessageBox.about(self, "Electrum",
|
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."))
|
_("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:
|
if self.wallet.up_to_date:
|
||||||
self.update_balance()
|
self.update_balance()
|
||||||
|
self.update_completions()
|
||||||
|
|
||||||
def initializing(self):
|
def initializing(self):
|
||||||
if self.state == self.INITIALIZING:
|
if self.state == self.INITIALIZING:
|
||||||
@@ -492,6 +503,14 @@ class MiniDriver(QObject):
|
|||||||
balance = D(conf_balance + unconf_balance)
|
balance = D(conf_balance + unconf_balance)
|
||||||
self.window.set_balances(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__":
|
if __name__ == "__main__":
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
with open("data/style.css") as style_file:
|
with open("data/style.css") as style_file:
|
||||||
|
|||||||
Reference in New Issue
Block a user