Browse Source

rebase to master and add resources, numerous other small fixes

283
qua-non 11 years ago
committed by ThomasV
parent
commit
1bbb211671
  1. BIN
      data/fonts/Roboto-Bold.ttf
  2. BIN
      data/fonts/Roboto.ttf
  3. 4
      data/fonts/tron/License.txt
  4. 21
      data/fonts/tron/Readme.txt
  5. BIN
      data/fonts/tron/Tr2n.ttf
  6. 2
      gui/kivy/dialog.py
  7. 29
      gui/kivy/installwizard.py
  8. 32
      gui/kivy/main_window.py
  9. 1
      gui/kivy/plugins/__init__.py
  10. 179
      gui/kivy/plugins/exchange_rate.py
  11. BIN
      gui/kivy/theming/light/stepper_restore_password.png
  12. BIN
      gui/kivy/theming/light/stepper_restore_seed.png
  13. BIN
      icons/electrum_android_launcher_icon.png

BIN
data/fonts/Roboto-Bold.ttf

Binary file not shown.

BIN
data/fonts/Roboto.ttf

Binary file not shown.

4
data/fonts/tron/License.txt

@ -0,0 +1,4 @@
Copyright (c) 2010-2011, Jeff Bell [www.randombell.com] | [jeffbell@randombell.com].
This font may be distributed freely however must retain this document as well as the Readme.txt file.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is available with a FAQ at: http://scripts.sil.org/OFL

21
data/fonts/tron/Readme.txt

@ -0,0 +1,21 @@
TR2N v1.3
ABOUT THE FONT:
A font based upon the poster text for TRON LEGACY.
The font is different from the pre-existing TRON font currently on the web. Similar in minor aspects but different in most. Style based upon text from different region posters.
UPDATE HISTORY:
3/7/11 - Adjusted the letter B (both lowercase and uppercase), capped off the ends of T, P and R, added a few more punctuation marks, as well as added the TR and TP ligature to allow for the solid bar connect as in the poster art.
1/22/11 - Made minor corrections to all previous letters and punctuation. Corrected issue with number 8's top filling in.
ABOUT THE AUTHOR:
Jeff Bell has produced fonts before, but this is the first one in over 10 years. His original 3 fonts were under the name DJ-JOHNNYRKA and include "CASPER", "BEVERLY HILLS COP", "THE GODFATHER" and "FIDDUMS FAMILY".
For more information on Jeff Bell and his work can be found online:
www.randombell.com
www.damovieman.deviantart.com
http://www.imdb.com/name/nm3983081/
http://www.vimeo.com/user4004969/videos

BIN
data/fonts/tron/Tr2n.ttf

Binary file not shown.

2
gui/kivy/dialog.py

@ -501,7 +501,7 @@ class RestoreSeedDialog(CreateAccountDialog):
app.navigation_higherarchy.append(_back)
def on_key_down(self, keyboard, keycode, key, modifiers):
if keycode[1] == 'enter':
if keycode[0] in (13, 271):
self.on_enter()
return True
#super

29
gui/kivy/installwizard.py

@ -68,18 +68,19 @@ class InstallWizard(Widget):
if not button:
return self.dispatch('on_wizard_complete', None)
wallet = Wallet(self.storage)
gap = self.config.get('gap_limit', 5)
if gap !=5:
wallet.gap_limit = gap_limit
wallet.storage.put('gap_limit', gap, True)
#gap = self.config.get('gap_limit', 5)
#if gap !=5:
# wallet.gap_limit = gap_limit
# wallet.storage.put('gap_limit', gap, True)
dialog.close()
if button == dialog.ids.create:
# create
wallet = Wallet(self.storage)
self.change_password_dialog(wallet=wallet)
elif button == dialog.ids.restore:
# restore
wallet = None
self.restore_seed_dialog(wallet)
#if button == dialog.ids.watching:
#TODO: not available in the new design
@ -102,20 +103,18 @@ class InstallWizard(Widget):
seed = unicode(_dlg.ids.text_input_seed.text)
if not seed:
app.show_error(_("No seed!"))
app.show_error(_("No seed!"), duration=.5)
return
try:
wallet.init_seed(seed)
except Exception:
import traceback
traceback.print_exc(file=sys.stdout)
app.show_error(_('No account tied to this seedphrase'))#, exit=True)
return
wallet = Wallet.from_seed(seed, self.storage)
except Exception as err:
_dlg.close()
return app.show_error(str(err) + '\n App will now exit',
exit=True, modal=True, duration=.5)
_dlg.close()
self.change_password_dialog(wallet=wallet, mode='restore')
return
return self.change_password_dialog(wallet=wallet, mode='restore')
def init_seed_dialog(self, wallet=None, instance=None, password=None,
wallet_name=None, mode='create'):

32
gui/kivy/main_window.py

@ -40,7 +40,7 @@ class ElectrumWindow(App):
status = StringProperty(_('Uninitialised'))
'''The status of the connection should show the balance when connected
:attr:`status` is a `StringProperty` defaults to _'uninitialised'
:attr:`status` is a `StringProperty` defaults to 'uninitialised'
'''
def _get_num_zeros(self):
@ -144,14 +144,15 @@ class ElectrumWindow(App):
self.exchanger = None
super(ElectrumWindow, self).__init__(**kwargs)
self.network = network = kwargs.get('network')
self.electrum_config = config = kwargs.get('config')
# create triggers so as to minimize updation a max of 5 times a sec
self._trigger_update_status = Clock.create_trigger(self.update_status,
.2)
self._trigger_update_console = Clock.create_trigger(self.update_console,
.2)
self._trigger_update_status =\
Clock.create_trigger(self.update_status, .2)
self._trigger_update_console =\
Clock.create_trigger(self.update_console, .2)
self._trigger_notify_transactions = \
Clock.create_trigger(self.notify_transactions, .2)
@ -197,7 +198,8 @@ class ElectrumWindow(App):
self.on_resume()
def on_stop(self):
self.wallet.stop_threads()
if self.wallet:
self.wallet.stop_threads()
def on_back(self):
''' Manage screen hierarchy
@ -251,7 +253,6 @@ class ElectrumWindow(App):
Logger.debug('Electrum: No Wallet set/found. Exiting...')
app.show_error('Electrum: No Wallet set/found. Exiting...',
exit=True)
Logger.info('wizard complete')
self.init_ui()
@ -322,7 +323,7 @@ class ElectrumWindow(App):
'''
'''
if not self.exchanger:
from plugins.exchange_rate import Exchanger
from electrum_gui.kivy.plugins.exchange_rate import Exchanger
self.exchanger = Exchanger(self)
self.exchanger.start()
quote_currency = self.electrum_config.get("currency", 'EUR')
@ -701,7 +702,8 @@ class ElectrumWindow(App):
arrow_pos=None,
exit=False,
icon='atlas://gui/kivy/theming/light/error',
duration=0):
duration=0,
modal=False):
''' Show a error Message Bubble.
'''
self.show_info_bubble(
@ -711,18 +713,24 @@ class ElectrumWindow(App):
pos=pos or Window.center,
arrow_pos=arrow_pos,
exit=exit,
duration=duration)
duration=duration,
modal=modal)
def show_info(self, error,
width='200dp',
pos=None,
arrow_pos=None,
exit=False,
duration=0):
duration=0,
modal=False):
''' Show a Info Message Bubble.
'''
self.show_error(error, icon='atlas://gui/kivy/theming/light/error',
duration=duration)
duration=duration,
modal=modal,
exit=exit,
pos=pos,
arrow_pos=arrow_pos)
def show_info_bubble(self,
text=_('Hello World'),

1
gui/kivy/plugins/__init__.py

@ -0,0 +1 @@

179
gui/kivy/plugins/exchange_rate.py

@ -0,0 +1,179 @@
# -*- encoding: utf8 -*-
'''Module exchange_rate:
This module is responsible for getting the conversion rates between different
currencies.
'''
from kivy.network.urlrequest import UrlRequest
#kivy.event import EventDispatcher
from kivy.clock import Clock
import decimal
import json
class Exchanger(object):
'''
'''
symbols = {'ALL': 'Lek', 'AED': 'د.إ', 'AFN':'؋', 'ARS': '$', 'AMD': '֏',
'AWG': 'ƒ', 'ANG': 'ƒ', 'AOA': 'Kz', 'BDT': '', 'BHD': 'BD',
'BIF': 'FBu', 'BTC': 'BTC', 'BTN': 'Nu',
'AUD': '$', 'AZN': 'ман', 'BSD': '$', 'BBD': '$', 'BYR': 'p',
'BZD': 'BZ$', 'BMD': '$', 'BOB': '$b', 'BAM': 'KM', 'BWP': 'P',
'BGN': 'лв', 'BRL': 'R$', 'BND': '$', 'KHR': '', 'CAD': '$',
'KYD': '$', 'USD': '$', 'CLP': '$', 'CNY': '¥', 'COP': '$', 'CRC': '',
'HRK': 'kn', 'CUP':'', 'CZK': '', 'DKK': 'kr', 'DOP': 'RD$',
'XCD': '$', 'EGP': '£', 'SVC': '$' , 'EEK': 'kr', 'EUR': '',
'FKP': '£', 'FJD': '$', 'GHC': '¢', 'GIP': '£', 'GTQ': 'Q', 'GBP': '£',
'GYD': '$', 'HNL': 'L', 'HKD': '$', 'HUF': 'Ft', 'ISK': 'kr',
'INR': '', 'IDR': 'Rp', 'IRR': '', 'IMP': '£', 'ILS': '',
'JMD': 'J$', 'JPY': '¥', 'JEP': '£', 'KZT': 'лв', 'KPW': '',
'KRW': '', 'KGS': 'лв', 'LAK': '', 'LVL': 'Ls'}
def __init__(self, parent):
self.parent = parent
self.quote_currencies = None
self.exchanges = ('BlockChain', 'Coinbase', 'CoinDesk')
try:
self.use_exchange = parent.electrum_config.get('use_exchange',
'BlockChain')
except AttributeError:
self.use_exchange = 'BlockChain'
self.currencies = self.symbols.keys()
def exchange(self, btc_amount, quote_currency):
if self.quote_currencies is None:
return None
quote_currencies = self.quote_currencies.copy()
if quote_currency not in quote_currencies:
return None
if self.use_exchange == "CoinDesk":
try:
connection = httplib.HTTPSConnection('api.coindesk.com')
connection.request("GET", "/v1/bpi/currentprice/" + str(quote_currency) + ".json")
except Exception:
return
resp = connection.getresponse()
if resp.reason == httplib.responses[httplib.NOT_FOUND]:
return
try:
resp_rate = json.loads(resp.read())
except Exception:
return
return btc_amount * decimal.Decimal(str(resp_rate["bpi"][str(quote_currency)]["rate_float"]))
return btc_amount * decimal.Decimal(quote_currencies[quote_currency])
def check_rates(self, dt):
if self.use_exchange == 'BlockChain':
self.check_blockchain()
elif self.use_exchange == 'CoinDesk':
self.check_coindesk()
elif self.use_exchange == 'Coinbase':
self.check_coinbase()
def check_coindesk(self):
def _lookup_rate(response, quote_id):
return decimal.Decimal(str(response[str(quote_id)]["15m"]))
def on_success(request, response):
quote_currencies = {}
try:
for r in response:
quote_currencies[r] = _lookup_rate(response, r)
self.quote_currencies = quote_currencies
except KeyError:
pass
self.parent.set_currencies(quote_currencies)
def on_failure(*args):
pass
def on_error(*args):
pass
def on_redirect(*args):
pass
req = UrlRequest(
url='https://api.coindesk.com/v1/bpi/supported-currencies.json',
on_success=on_success,
on_failure=on_failure,
on_error=on_error,
on_redirect=on_redirect,
timeout=5)
def check_coinbase(self):
def _lookup_rate(response, quote_id):
return decimal.Decimal(str(response[str(quote_id)]))
def on_success(request, response):
quote_currencies = {}
try:
for r in response:
if r[:7] == "btc_to_":
quote_currencies[r[7:].upper()] =\
_lookup_rate(response, r)
self.quote_currencies = quote_currencies
except KeyError:
pass
self.parent.set_currencies(quote_currencies)
def on_failure(*args):
pass
def on_error(*args):
pass
def on_redirect(*args):
pass
req = UrlRequest(
url='https://coinbase.com/api/v1/currencies/exchange_rates',
on_success=on_success,
on_failure=on_failure,
on_error=on_error,
on_redirect=on_redirect,
timeout=5)
def check_blockchain(self):
def _lookup_rate(response, quote_id):
return decimal.Decimal(str(response[str(quote_id)]["15m"]))
def on_success(request, response):
quote_currencies = {}
try:
for r in response:
quote_currencies[r] = _lookup_rate(response, r)
self.quote_currencies = quote_currencies
except KeyError:
pass
self.parent.set_currencies(quote_currencies)
def on_failure(*args):
pass
def on_error(*args):
pass
def on_redirect(*args):
pass
req = UrlRequest(url='https://blockchain.info/ticker',
on_success=on_success,
on_failure=on_failure,
on_error=on_error,
on_redirect=on_redirect,
timeout=5)
def start(self):
# check every 5 seconds
self.check_rates(0)
Clock.schedule_interval(self.check_rates, 5)
def stop(self):
Clock.unschedule(self.check_rates)

BIN
gui/kivy/theming/light/stepper_restore_password.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
gui/kivy/theming/light/stepper_restore_seed.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
icons/electrum_android_launcher_icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Loading…
Cancel
Save