commit 9fd9f27408209787f419ac4a1ecd268252b12382
parent 690908ddce50dec74c935d6d5c7e071cff1b5789
Author: Amir Taaki <genjix@riseup.net>
Date: Mon, 2 Jul 2012 22:11:13 +0200
bitcoin URIs in lite mode.
Diffstat:
1 file changed, 24 insertions(+), 0 deletions(-)
diff --git a/lib/gui_lite.py b/lib/gui_lite.py
@@ -41,6 +41,9 @@ class ElectrumGui:
self.mini = MiniWindow(actuator, self.expand)
driver = MiniDriver(self.wallet, self.mini)
+ if url:
+ self.set_url(url)
+
timer = Timer()
timer.start()
self.expert = gui_qt.ElectrumWindow(self.wallet)
@@ -54,6 +57,20 @@ class ElectrumGui:
self.mini.hide()
self.expert.show()
+ def set_url(self, url):
+ payto, amount, label, message, signature, identity, url = \
+ self.wallet.parse_url(url, self.show_message, self.show_question)
+ self.mini.set_payment_fields(payto, amount)
+
+ def show_message(self, message):
+ QMessageBox.information(self.mini, _("Message"), message, _("OK"))
+
+ def show_question(self, message):
+ choice = QMessageBox.question(self.mini, _("Message"), message,
+ QMessageBox.Yes|QMessageBox.No,
+ QMessageBox.No)
+ return choice == QMessageBox.Yes
+
class MiniWindow(QDialog):
def __init__(self, actuator, expand_callback):
@@ -167,6 +184,13 @@ class MiniWindow(QDialog):
super(MiniWindow, self).closeEvent(event)
qApp.quit()
+ def set_payment_fields(self, dest_address, amount):
+ self.address_input.become_active()
+ self.address_input.setText(dest_address)
+ self.address_field_changed(dest_address)
+ self.amount_input.become_active()
+ self.amount_input.setText(amount)
+
def activate(self):
pass