1
0

move set_url to __init__. fixes #672

This commit is contained in:
ThomasV
2014-04-30 07:59:59 +02:00
parent 9196e9feea
commit bb88c891dc
3 changed files with 29 additions and 30 deletions

View File

@@ -147,6 +147,29 @@ class ElectrumGui:
return int(qtVersion[0]) >= 4 and int(qtVersion[2]) >= 7
def set_url(self, url):
from electrum import util
from decimal import Decimal
try:
address, amount, label, message, url = util.parse_url(url)
except Exception:
QMessageBox.warning(self.main_window, _('Error'), _('Invalid bitcoin URL'), _('OK'))
return
try:
if amount and self.main_window.base_unit() == 'mBTC':
amount = str( 1000* Decimal(amount))
elif amount:
amount = str(Decimal(amount))
except Exception:
amount = "0.0"
QMessageBox.warning(self.main_window, _('Error'), _('Invalid Amount'), _('OK'))
self.main_window.set_send(address, amount, label, message)
if self.lite_window:
self.lite_window.set_payment_fields(address, amount)
def main(self, url):
@@ -191,7 +214,9 @@ class ElectrumGui:
s.start()
self.windows.append(w)
if url: w.set_url(url)
if url:
self.set_url(url)
w.app = self.app
w.connect_slots(s)
w.update_wallet()