Skip to content

Commit

Permalink
[ALL] Update GUI to v0.4.0
Browse files Browse the repository at this point in the history
- Update binaries to Sumokoin Niigata v0.8.0.0
- Many bug fixes: address book, tx history, address copying etc.
  • Loading branch information
sumoprojects committed Jan 12, 2021
1 parent 24eac24 commit bcc9953
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 41 deletions.
7 changes: 0 additions & 7 deletions app/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,6 @@ def load_address_book(self):
ret = self.ui.wallet_rpc_manager.rpc_request.get_address_book()
if ret['status'] == "OK" and "entries" in ret:
address_book = ret["entries"]
for a in address_book:
if a['payment_id'][16:] == "000000000000000000000000000000000000000000000000":
# convert short payment id into integrated address
addr = Address(a['address'])
ia = addr.with_payment_id(a['payment_id'][:16])
a['address'] = str(ia)
a['payment_id'] = "0000000000000000"
self.ui.wallet_info.wallet_address_book = address_book

self.on_load_address_book_completed_event.emit( json.dumps(self.ui.wallet_info.wallet_address_book) )
Expand Down
43 changes: 18 additions & 25 deletions html/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@
<script src="./scripts/jquery.qrcode.min.js"></script>
<script src="./scripts/utils.js"></script>
<script type="text/javascript">
var block_sync_size = 50;
block_sync_size = 50;
function app_ready(){
setTimeout(app_hub.load_app_settings, 2000);
app_hub.on_load_app_settings_completed_event.connect(function(app_settings_json){
Expand Down Expand Up @@ -454,29 +455,20 @@
var html = "Address book empty!";
if(address_book.length > 0){
html = '<div id="address-book-box" class="table-responsive">';
html += '<table class="table table-hover table-condensed"><thead><tr><th width="160px" style="border:none">Address</th><th width="150px" style="border:none">Payment ID</th><th width="200px" style="border:none">Description</th><th width="50px" style="border:none">&nbsp;</th></tr></thead><tbody>';
html += '<table class="table table-hover table-condensed"><thead><tr><th width="200px" style="border:none">Address</th><th width="300px" style="border:none">Description</th><th width="50px" style="border:none">&nbsp;</th></tr></thead><tbody>';
var row_tmpl = $('#address_book_row_templ').html();
for(var i=0; i<address_book.length; i++){
var entry = address_book[i];
var address = entry['address'];
var payment_id = entry['payment_id'];
if(payment_id.substring(16) == "000000000000000000000000000000000000000000000000"){
payment_id = payment_id.substring(0, 16);
}
if(payment_id == "0000000000000000"){
payment_id = "";
}
var payment_id_short = payment_id.length > 16 ? payment_id.substring(0,18) + '...' : payment_id;
var address_short = address.substring(0,18) + '...';
var address_short = address.substring(0,12) + '...' + address.substring(address.length - 8, address.length);
var desc_short = entry['description'].length > 50 ? entry['description'].substring(0, 50) + '...' : entry['description'];
var row_html = Mustache.render(row_tmpl,
{
'address': address,
'payment_id': payment_id,
'payment_id': '',
'address_short': address_short,
'payment_id_short': payment_id_short,
'payment_id_short': '',
'desc_short': desc_short,
'index': entry['index']
});
Expand Down Expand Up @@ -673,15 +665,17 @@
var status = $.parseJSON(status_json);
var daemon_status = status['status'];
var current_height = status['current_height'];
var network_height = status['network_height'];
var target_height = status['target_height'];
untrusted_node = status['untrusted'];
sync_pct = target_height > 0 ? parseInt(current_height*100/target_height) : 0;
var status_text = "Network: " + daemon_status;
if(daemon_status == "Connected"){
if(sync_pct == 100){
status_text = '<i class="fa fa-rss fa-flip-horizontal"></i>&nbsp;&nbsp;Network synced (<strong>100%</strong>)';
status_text = '<i class="fa fa-rss fa-flip-horizontal"></i>&nbsp;&nbsp;Network synced ' + current_height + '/' + target_height + '(<strong>100%</strong>)';
}
else {
status_text = '<i class="fa fa-refresh"></i>&nbsp;&nbsp;Synced '
status_text = '<i class="fa fa-refresh"></i>&nbsp;&nbsp;Syncing '
+ current_height + '/' + target_height + ' (<strong>' + sync_pct + '%, '
+ (target_height - current_height) + ' left</strong>)';
}
Expand Down Expand Up @@ -717,7 +711,7 @@
progress_bar.css("width", sync_pct + "%");
progress_bar.attr("aria-valuenow", sync_pct);
disable_buttons(sync_pct < 100);
disable_buttons(sync_pct < 100 || untrusted_node);
}, 1);
}
Expand Down Expand Up @@ -760,7 +754,7 @@
}
}
disable_buttons(sync_pct < 100);
disable_buttons(sync_pct < 100 || untrusted_node);
if(current_balance != wallet_info['balance']){
balance_span.delay(100).fadeOut(function(){
Expand Down Expand Up @@ -1105,6 +1099,7 @@
current_tx_history_page = 1;
sync_pct = 0;
untrusted_node = false;
show_app_progress("Loading wallet...");
receive_address = $('#receive_address');
Expand All @@ -1130,9 +1125,8 @@
$('[data-toggle="tooltip"]').tooltip();
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
var target = $(this).attr('href');
if(current_tx_history_page == 1 && target == "#tx_history_tab"){
setTimeout(function(){
load_tx_history(current_tx_history_page);
Expand Down Expand Up @@ -1175,7 +1169,7 @@
<div class="col-sm-12">
<label for="receive_address" class="col-xs-2 control-label">Main Address</label>
<div class="col-xs-10 input-group" style="padding-left: 15px; padding-right: 15px;">
<input id="receive_address" type="text" class="form-control" style="font-weight: bold" maxlength="64" readonly />
<input id="receive_address" type="text" class="form-control" style="font-weight: bold" readonly />
<span class="input-group-btn">
<button id="btn_copy_address" class="btn btn-primary btn-sm" style="text-transform: none" type="button" tabindex="-1" onclick="copy_address()" data-toggle="tooltip" data-placement="bottom" data-trigger="manual" title="Address copied"><i class="fa fa-copy"></i></button>
<button id="btn_qr_address" class="btn btn-primary btn-sm" style="text-transform: none" type="button" tabindex="-1" onclick="qr_address()" title="Show QR code"><i class="fa fa-qrcode"></i></button>
Expand Down Expand Up @@ -1612,15 +1606,14 @@
<script id="address_book_row_templ" type="x-tmpl-mustache">
<tr>
<td width="160px" class="address-book-row" data-address="{{ address }}" data-payment-id="{{ payment_id }}"><a href="#" title="{{ address }}">{{ address_short }}</a></td>
<td width="150px" class="address-book-row" data-address="{{ address }}" data-payment-id="{{ payment_id }}">{{ payment_id_short }}</a></td>
<td width="200px" class="address-book-row" data-address="{{ address }}" data-payment-id="{{ payment_id }}">{{ desc_short }}</a></td>
<td width="200px" class="address-book-row" data-address="{{ address }}" data-payment-id="{{ payment_id }}" style="font-family:'Courier New'"><a href="#" title="{{ address }}">{{ address_short }}</a></td>
<td width="300px" class="address-book-row" data-address="{{ address }}" data-payment-id="{{ payment_id }}">{{ desc_short }}</a></td>
<td width="50px"><button type="button" class="btn btn-default btn-xs" onclick="delete_address({{ index }})"><i class="fa fa-remove"></i> Delete</button></td>
</tr>
</script>
<script id="tx_history_row" type="x-tmpl-mustache">
<tr class="tx-list tx-{{ cls_in_out }}" style="font-weight: normal;">
<tr class="tx-list tx-{{ cls_in_out }}" style="font-weight: normal">
<td align="center">{{{ tx_status }}}</td>
<td align="center">{{{ tx_direction }}}</td>
<td>{{ tx_date_time }}</td>
Expand Down
2 changes: 1 addition & 1 deletion settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from utils.common import getHomeDir, makeDir

VERSION = [0, 3, 0]
VERSION = [0, 4, 0]
APP_NAME = "Sumo GUI Wallet"
USER_AGENT = '%s v%s' % (APP_NAME, '.'.join(str(v) for v in VERSION))

Expand Down
28 changes: 20 additions & 8 deletions webui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,15 @@ def run_wallet_rpc(self, log_level=2):

def _update_daemon_status(self):
target_height = 0
network_height = 0
untrusted = False
sumokoind_info = self.daemon_rpc_request.get_info()
if sumokoind_info['status'] == "OK":
status = "Connected"
self.current_height = int(sumokoind_info['height'])
self.current_height = int(sumokoind_info['height_without_bootstrap'])
network_height = int(sumokoind_info['height'])
target_height = int(sumokoind_info['target_height'])
untrusted = bool(sumokoind_info['untrusted'])
if target_height == 0 or target_height < self.current_height:
target_height = self.current_height
if self.target_height < target_height:
Expand All @@ -359,14 +363,16 @@ def _update_daemon_status(self):

info = {"status": status,
"current_height": self.current_height,
"network_height": network_height,
"target_height": self.target_height,
"untrusted": untrusted
}

self.hub.update_daemon_status(json.dumps(info))

sync_status = "Disconnected" if sumokoind_info['status'] != "OK" else "Synchronizing..."
sync_status = "Disconnected" if sumokoind_info['status'] != "OK" else "Syncing..."
if sumokoind_info['status'] == "OK" and self.current_height == self.target_height:
sync_status = "Network synchronized"
sync_status = "Network synced"

self.trayIcon.setToolTip("%s\n%s (%d/%d)" % (tray_icon_tooltip, sync_status,
self.current_height, self.target_height))
Expand Down Expand Up @@ -467,11 +473,17 @@ def update_wallet_info(self):

# auto-generate new subaddresses if not enough available
if len(wallet_info['new_subaddresses']) < MAX_NEW_SUBADDRESSES:
for _ in range(MAX_NEW_SUBADDRESSES - len(wallet_info['new_subaddresses'])):
new_subaddress = self.wallet_rpc_manager.rpc_request.create_address()
new_subaddress['label'] = ""
new_subaddress['used'] = False
wallet_info['new_subaddresses'].append(new_subaddress)
count = MAX_NEW_SUBADDRESSES - len(wallet_info['new_subaddresses'])
new_subaddress = self.wallet_rpc_manager.rpc_request.create_address(count)
i = 0
for addr in new_subaddress['addresses']:
wallet_info['new_subaddresses'].append({
'label': '',
'used': False,
'address': addr,
'address_index': new_subaddress['address_indices'][i]
})
i += 1

if len(wallet_info['new_subaddresses']) > MAX_NEW_SUBADDRESSES:
wallet_info['new_subaddresses'] = wallet_info['new_subaddresses'][0:MAX_NEW_SUBADDRESSES]
Expand Down

0 comments on commit bcc9953

Please sign in to comment.