diff --git a/templates/wallets/base.html b/templates/wallets/base.html index 632e5d17c0a4cfa7303eca05f6aafaaef3efa736..44bed71852d186ab79e0398c2a2956cfb660467f 100644 --- a/templates/wallets/base.html +++ b/templates/wallets/base.html @@ -13,6 +13,7 @@ <div class="list-group" style="background-color: #f7f5fa;"> <a id="new" href="{{ url_for('new_wallet') }}" class="list-group-item"><i class="glyphicon glyphicon-plus-sign"></i> New</a> <a id="list" href="{{ url_for('wallets') }}" class="list-group-item"><i class="glyphicon glyphicon-credit-card"></i> Wallets</a> + <a id="contacts" href="{{ url_for('wallet_contacts') }}" class="list-group-item"><i class="glyphicon glyphicon-user"></i> Contacts</a> </div> {% if key -%} @@ -40,6 +41,7 @@ '/': 'list', '{{ url_for('new_wallet') }}': 'new', '{{ url_for('wallets') }}': 'list', + '{{ url_for('wallet_contacts') }}': 'contacts', {% if key -%} '{{ url_for('wallet_history', pgp_fingerprint=key.fingerprint) }}': 'history', diff --git a/templates/wallets/contacts.html b/templates/wallets/contacts.html new file mode 100644 index 0000000000000000000000000000000000000000..333eb98bb95a6dbd337b73ad81c6ebe1306c6d28 --- /dev/null +++ b/templates/wallets/contacts.html @@ -0,0 +1,15 @@ +{% extends "wallets/base.html" %} + +{% block sub_content %} +<h1><span class="label label-default">Contacts</span></h1> + +<div class="list-group"> + {% for fp,k in settings.public_keys.items() %} + <a href="#" class="list-group-item {% if k.keyid == settings.keyid %}active{% endif %}"> + <h4 class="list-group-item-heading">{{k.uids.0}}</h4> + <p class="list-group-item-text">{{fp}}</p> + </a> + {% endfor %} +</div> + +{% endblock %} diff --git a/webclient.py b/webclient.py index ff27b23ae0f56ececd3a596a689a7f7c59c7d59d..a50c5246ae01c8b3e8def43a7376011d2237593c 100755 --- a/webclient.py +++ b/webclient.py @@ -30,7 +30,6 @@ from flask import\ flash from io import StringIO from werkzeug.contrib.cache import SimpleCache -from itertools import combinations, chain logger = logging.getLogger("cli") app = Flask(__name__) @@ -233,27 +232,6 @@ Comment: return False -def powerset(iterable): - xs = list(iterable) - return chain.from_iterable( combinations(xs,n) for n in range(len(xs)+1) ) - -def powerset_bis(iterable, low=0, step=1): - xs = list(iterable) - - combins = [] - sums = [] - for n in range(low, len(xs)+1, step): - for c in combinations(xs,n): - __sum = sum(c) - if __sum not in sums: - combins.append(c) - sums.append(__sum) - - res = list(zip(sums, combins)) - res.sort() - return res - # return sums, combins - @app.route('/wallets/<pgp_fingerprint>/transfer', methods=['GET', 'POST']) def wallet_transfer(pgp_fingerprint): balance, __clist = clist(pgp_fingerprint) @@ -310,6 +288,11 @@ def wallet_public_keys(): v['name'] = v['uids'][0] return json.dumps(list(keys.values())) +@app.route('/wallets/contacts') +def wallet_contacts(): + return render_template('wallets/contacts.html', + settings=ucoin.settings) + def issue(pgp_fingerprint, amendment, coins, message=''): try: last_tx = ucoin.hdc.transactions.sender.Last(pgp_fingerprint).get() @@ -379,6 +362,7 @@ Comment: def compute_dividend_remainders(pgp_fingerprint): remainders = {} for am in ucoin.hdc.amendments.List().get(): + if not am['dividend']: continue if not am['dividend']: continue dividend_sum = 0 for x in ucoin.hdc.transactions.sender.issuance.Dividend(pgp_fingerprint, am['number']).get():