mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 17:01:34 +00:00
changes to make kivy branch with master
This commit is contained in:
parent
f442cc31e4
commit
f2fc18fe32
3 changed files with 14 additions and 69 deletions
|
@ -21,7 +21,7 @@
|
||||||
import sys
|
import sys
|
||||||
#, time, datetime, re, threading
|
#, time, datetime, re, threading
|
||||||
#from electrum.i18n import _, set_language
|
#from electrum.i18n import _, set_language
|
||||||
from electrum.util import print_error, print_msg, parse_url
|
from electrum.util import print_error, print_msg
|
||||||
|
|
||||||
#:TODO: replace this with kivy's own plugin managment
|
#:TODO: replace this with kivy's own plugin managment
|
||||||
#from electrum.plugins import run_hook
|
#from electrum.plugins import run_hook
|
||||||
|
@ -73,46 +73,8 @@ class ElectrumGui:
|
||||||
#init_plugins(self)
|
#init_plugins(self)
|
||||||
|
|
||||||
def set_url(self, url):
|
def set_url(self, url):
|
||||||
from electrum import util
|
#self.current_window.pary_from_URI
|
||||||
from decimal import Decimal
|
pass
|
||||||
|
|
||||||
try:
|
|
||||||
address, amount, label, message,\
|
|
||||||
request_url, url = util.parse_url(url)
|
|
||||||
except Exception:
|
|
||||||
self.main_window.show_error(_('Invalid bitcoin URL'))
|
|
||||||
return
|
|
||||||
|
|
||||||
if amount:
|
|
||||||
try:
|
|
||||||
if main_window.base_unit == 'mBTC':
|
|
||||||
amount = str( 1000* Decimal(amount))
|
|
||||||
else:
|
|
||||||
amount = str(Decimal(amount))
|
|
||||||
except Exception:
|
|
||||||
amount = "0.0"
|
|
||||||
self.main_window.show_error(_('Invalid Amount'))
|
|
||||||
|
|
||||||
if request_url:
|
|
||||||
try:
|
|
||||||
from electrum import paymentrequest
|
|
||||||
except:
|
|
||||||
self.main_window.show_error("cannot import payment request")
|
|
||||||
request_url = None
|
|
||||||
|
|
||||||
if not request_url:
|
|
||||||
self.main_window.set_send(address, amount, label, message)
|
|
||||||
return
|
|
||||||
|
|
||||||
def payment_request():
|
|
||||||
self.payment_request = paymentrequest.PaymentRequest(request_url)
|
|
||||||
if self.payment_request.verify():
|
|
||||||
Clock.schedule_once(self.main_window.payment_request_ok)
|
|
||||||
else:
|
|
||||||
Clock.schedule_once(self.main_window.payment_request_error)
|
|
||||||
|
|
||||||
threading.Thread(target=payment_request).start()
|
|
||||||
self.main_window.prepare_for_payment_request()
|
|
||||||
|
|
||||||
def main(self, url):
|
def main(self, url):
|
||||||
''' The main entry point of the kivy ux
|
''' The main entry point of the kivy ux
|
||||||
|
|
|
@ -25,7 +25,7 @@ Factory.register('QrScannerDialog', module='electrum_gui.kivy.uix.dialogs.qr_sca
|
||||||
|
|
||||||
|
|
||||||
# delayed imports: for startup speed on android
|
# delayed imports: for startup speed on android
|
||||||
notification = app = Decimal = ref = format_satoshis = is_valid = Builder = None
|
notification = app = Decimal = ref = format_satoshis = bitcoin = Builder = None
|
||||||
inch = None
|
inch = None
|
||||||
util = False
|
util = False
|
||||||
re = None
|
re = None
|
||||||
|
@ -557,16 +557,10 @@ class ElectrumWindow(App):
|
||||||
'''
|
'''
|
||||||
global format_satoshis
|
global format_satoshis
|
||||||
if not format_satoshis:
|
if not format_satoshis:
|
||||||
from electrum.wallet import format_satoshis
|
from electrum.util import format_satoshis
|
||||||
return format_satoshis(x, is_diff, self.num_zeros,
|
return format_satoshis(x, is_diff, self.num_zeros,
|
||||||
self.decimal_point, whitespaces)
|
self.decimal_point, whitespaces)
|
||||||
|
|
||||||
def read_amount(self, x):
|
|
||||||
if x in['.', '']:
|
|
||||||
return None
|
|
||||||
p = pow(10, self.decimal_point)
|
|
||||||
return int( p * Decimal(x) )
|
|
||||||
|
|
||||||
def update_wallet(self, *dt):
|
def update_wallet(self, *dt):
|
||||||
'''
|
'''
|
||||||
'''
|
'''
|
||||||
|
@ -802,13 +796,8 @@ class ElectrumWindow(App):
|
||||||
def do_send(self):
|
def do_send(self):
|
||||||
app = App.get_running_app()
|
app = App.get_running_app()
|
||||||
screen_send = app.root.main_screen.ids.tabs.ids.screen_send
|
screen_send = app.root.main_screen.ids.tabs.ids.screen_send
|
||||||
scrn = screen_send.content.ids
|
scrn = screen_send.ids
|
||||||
label = unicode(scrn.message_e.text)
|
label = unicode(scrn.message_e.text)
|
||||||
# TODO
|
|
||||||
#if self.gui_object.payment_request:
|
|
||||||
# outputs = self.gui_object.payment_request.outputs
|
|
||||||
# amount = self.gui_object.payment_request.get_amount()
|
|
||||||
#else:
|
|
||||||
|
|
||||||
r = unicode(scrn.payto_e.text).strip()
|
r = unicode(scrn.payto_e.text).strip()
|
||||||
|
|
||||||
|
@ -819,24 +808,18 @@ class ElectrumWindow(App):
|
||||||
m = re.match('(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>', r)
|
m = re.match('(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>', r)
|
||||||
to_address = m.group(2) if m else r
|
to_address = m.group(2) if m else r
|
||||||
|
|
||||||
global is_valid
|
global bitcoin
|
||||||
if not is_valid:
|
if not bitcoin:
|
||||||
from electrum.bitcoin import is_valid
|
from electrum import bitcoin
|
||||||
|
|
||||||
if not is_valid(to_address):
|
if not bitcoin.is_address(to_address):
|
||||||
app.show_error(_('Invalid Bitcoin Address') +
|
app.show_error(_('Invalid Bitcoin Address') +
|
||||||
':\n' + to_address)
|
':\n' + to_address)
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
amount = scrn.amount_e.text
|
||||||
amount = self.read_amount(unicode(scrn.amount_e.text))
|
fee = scrn.fee_e.amt
|
||||||
except Exception:
|
if not fee:
|
||||||
app.show_error(_('Invalid Amount'))
|
|
||||||
return
|
|
||||||
try:
|
|
||||||
fee = self.read_amount(unicode(scrn.fee_e.amt))
|
|
||||||
except Exception as err:
|
|
||||||
print err
|
|
||||||
app.show_error(_('Invalid Fee'))
|
app.show_error(_('Invalid Fee'))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ source.exclude_exts = spec
|
||||||
version = 1.9.8
|
version = 1.9.8
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
requirements = pil, qrcode, ecdsa, pbkdf2, openssl, pyopenssl, plyer==master, kivy==master
|
requirements = pil, qrcode, ecdsa, pbkdf2, openssl, pyopenssl, pyasn, pyasn-modules, plyer==master, kivy==master
|
||||||
|
|
||||||
# (str) Presplash of the application
|
# (str) Presplash of the application
|
||||||
presplash.filename = %(source.dir)s/gui/kivy/theming/splash.png
|
presplash.filename = %(source.dir)s/gui/kivy/theming/splash.png
|
||||||
|
|
Loading…
Add table
Reference in a new issue