From f2994bff1278656b94c51a2df7f3558da2798e51 Mon Sep 17 00:00:00 2001 From: Franz Ehrlich Date: Fri, 17 Nov 2017 14:36:14 +0100 Subject: [PATCH] add current address to address book --- Resources/www/css/app.css | 276 +++++++++ Resources/www/index.html | 1114 +++++++++++++++++++++++++++++++++++++ app/hub.py | 39 +- html/index.py | 346 +++--------- settings/__init__.py | 2 +- 5 files changed, 1476 insertions(+), 301 deletions(-) create mode 100644 Resources/www/css/app.css create mode 100644 Resources/www/index.html diff --git a/Resources/www/css/app.css b/Resources/www/css/app.css new file mode 100644 index 0000000..cbf0af2 --- /dev/null +++ b/Resources/www/css/app.css @@ -0,0 +1,276 @@ +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +body { + -webkit-user-select: none; + user-select: none; + + cursor: default; + background-color: #fff; + color: #76A500; + background-position: center center; + font-family: "RoboReg", "Helvetica Neue",Helvetica,Arial,sans-serif; + font-size: 14px; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow: hidden; +} + +a, a:hover, a:active, a:focus { + text-decoration: none; + outline: 0; + cursor: default; +} + +a, a:active, a:focus{ + color: #337AB7; +} + +a:hover{ + color: #fff; +} + +.nav-tabs{ + /*width: 760px;*/ +} +.nav-tabs li{ + width: 20%; + text-align: center; + font-size: 120% +} + +.container{ + width: 760px; + padding: 0; + margin: 5px 0px 5px 20px; +} + +h3{ + text-align: center; + margin-bottom: 1em; + font-size: 180%; +} + + +.tab-content{ + font-size: 12px; +} + +.tab-content h3{ + margin-top: 0; +} + +#balance_tab h4, #balance_tab h5{ + color: #76A500; +} + +#balance_tab h5 span{ + color: #ccc; +} + +#settings_tab h3{ + margin-top: 20px; + margin-bottom: 30px; +} + +.syncing{ + font-size: 60%; +} + +.tab-content .tab-pane { + position: relative; +} + +.form-horizontal .control-label{ + text-align: left; +} + + +.progress{ + height: 22px; + text-align: center; + background: #ddd; +} + +#progress_bar_text_high{ + font-size: 90%; + display: none; +} + +#progress_bar_text_low{ + font-size: 80%; + color: #c7254e; +} + +.control-label{ + font-weight: bold; +} + +.tx-list{ + color: #666; + margin-right: 20px; + font-weight: bold; +} + +.tx-list a{ + cursor: pointer; +} + +.tx-list.tx-out, .tx-list.tx-in, .tx-list.tx-pool, .tx-list.tx-pending, .tx-list.tx-out a, .tx-list.tx-out a:active, .tx-list.tx-out a:focus{ + color: #c7254e; + margin-bottom: 0; +} + +.tx-list.tx-in, .tx-list.tx-in a, .tx-list.tx-in a:active, .tx-list.tx-in a:focus{ + color: green; +} + +.tx-list.tx-pool, .tx-list.tx-pending, .tx-list.tx-pending a, .tx-list.tx-pending a:active, .tx-list.tx-pending a:focus, .tx-list.tx-pool a, .tx-list.tx-pool a:active, .tx-list.tx-pool a:focus{ + color: orange; +} + +.tx-list a:hover{ + color: #337AB7; +} + +.tx-list.txid{ + color: inherit; +} + +.tx-list.tx-payment-id{ + font-weight: normal; +} + +.tx-fee-hide, .tx-note-hide, .tx-destinations-hide{ + display: none; +} + +.tx-list.tx-lock{ + color: #666; +} + +.modal-progress-text{ + color: #333; + font-size: 90%; + font-weight: bold; + margin-left: 10px; +} + +#form_receive input, #form_send_tx input, #form_send_tx select{ + font-size: 14px; +} + +.btn-sm{ + border-radius: 0; +} + +table { + border-spacing: 0; + border-collapse: collapse; + font-size: 12px; +} + +table thead tr{ + height: 3em; +} + +table tbody tr { + color: #aaa; + height: 3em; + line-height: 1.6em; +} + +table thead tr th{ + text-align: left; + text-size: 18px; + padding: auto 1em; +} + +table tbody tr td a:hover{ + color: #666; + cursor: pointer; +} + +.address-book-row{ + cursor: pointer; +} + +#address-book-box{ + max-height: 450px; +} + +#address-book-box table{ + width: 100%; +} + +#address-book-box table thead { + display: inline-block; + width: 100%; +} + +#address-book-box table tbody { + border-top: none; + max-height: 300px; + display: inline-block; + width: 100%; + overflow: auto; +} + +#address-book-box table tbody::-webkit-scrollbar-track, +.tx-destinations::-webkit-scrollbar-track +{ + -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); + background-color: #F5F5F5; +} + + +#address-book-box table tbody::-webkit-scrollbar, +.tx-destinations::-webkit-scrollbar +{ + width: 8px; + background-color: #F5F5F5; +} + +.tx-destinations::-webkit-scrollbar{ + height: 8px; +} + +#address-book-box table tbody::-webkit-scrollbar-thumb, +.tx-destinations::-webkit-scrollbar-thumb +{ + -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); + background-color: #ccc; +} + +.tx-destinations { + width: 100%; + max-height: 200px; + overflow: auto; + font-size: 90%; +} + +.wallet-settings{ + text-align: center; +} + +.wallet-settings button{ + margin-left: 20px; +} + +.form-control.address-box{ + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-size: 85%; + color: #000; +} + +textarea{ + border:none; + width:100%; + resize:none; + font-weight:bold; +} \ No newline at end of file diff --git a/Resources/www/index.html b/Resources/www/index.html new file mode 100644 index 0000000..ce59e97 --- /dev/null +++ b/Resources/www/index.html @@ -0,0 +1,1114 @@ + + + + + + + + + + + + + + + +
+ +
+
+

RECEIVE

+
+
+
+ +
+ + + + +
+
+
+
+
+ +
+ + + + +
+
+
+
+
+ +
+ + + + +
+
+
+
+
+
+
+
+

BALANCE

+
+
+
+
Balance:
+
Unlocked Balance:
+
+
+
0.00 ETN (syncing)
+
0.00 ETN (syncing)
+
+
+ + +
+
+
+
+

RECENT TRANSACTIONS

+
+

NO TRANSACTIONS FOUND

+
+
+
+

SEND

+
+
+
+
+ +
+ + + + +
+
+
+
+
+ +
+ + + + +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+
+
+ +
+ + + +
+
+
+
+
+ +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + +
?I/ODate/TimeTx IDPayment IDAmount 
+ + +
+
+
+
+

WALLET

+
+
+ + + + +
+
+
+

DAEMON

+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + + +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+   Connecting to network... +
+
+ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/hub.py b/app/hub.py index e5f74fa..55b4d4d 100644 --- a/app/hub.py +++ b/app/hub.py @@ -392,23 +392,30 @@ def send_tx(self, amount, address, payment_id, priority, mixin, tx_desc, save_ad self.ui.update_wallet_info() if save_address: - desc, _ = self._custom_input_dialog(self.ui, \ - 'Saving Address...', \ - "Address description/note (optional):") - ret = self.ui.wallet_rpc_manager.rpc_request.add_address_book(address, \ - payment_id, desc) - if ret['status'] == "OK": - if self.ui.wallet_info.wallet_address_book: - address_entry = {"address": address, - "payment_id": payment_id, - "description": desc[0:200], - "index": ret["index"] - } - self.ui.wallet_info.wallet_address_book.append(address_entry) - - QMessageBox.information(self.ui, "Address Saved", \ - "Address (and payment ID) saved to address book.") + self.addAdress(address, payment_id, ""); + @Slot(str, str, str) + def addAdress(self, address, payment_id, desc = ""): + + if desc == "" : + desc, _ = self._custom_input_dialog(self.ui, \ + 'Saving Address...', \ + "Address description/note (optional):") + + ret = self.ui.wallet_rpc_manager.rpc_request.add_address_book(address, \ + payment_id, desc) + if ret['status'] == "OK": + if self.ui.wallet_info.wallet_address_book: + address_entry = {"address": address, + "payment_id": payment_id, + "description": desc[0:200], + "index": ret["index"] + } + self.ui.wallet_info.wallet_address_book.append(address_entry) + + QMessageBox.information(self.ui, "Address Saved", \ + "Address (and payment ID) saved to address book.") + @Slot(int) def generate_payment_id(self, hex_length=16): diff --git a/html/index.py b/html/index.py index 7fea4a1..0451535 100644 --- a/html/index.py +++ b/html/index.py @@ -11,285 +11,7 @@ - + @@ -395,8 +117,21 @@ } html += ""; } + var addButton = {}; + + if($('#send_address').val() != ""){ + addButton['addAddress'] = { + 'text': 'add current', + 'click': function(){ + var address = $('#send_address').val() + var payment_id = $('#send_payment_id').val() + app_hub.addAdress(address, payment_id, ""); + } + }; + } + + show_app_dialog(html, addButton); - show_app_dialog(html); $(".address-book-row").click(function() { $("#send_address").val( $(this).data("address") ); @@ -814,10 +549,51 @@ return false; } - function show_app_dialog(msg, title){ + function show_app_dialog(msg, buttons){ + buttons = typeof buttons == "undefined" ? {} : buttons; + $('#app_model_body').css("color", "#666"); $('#app_model_body').html(msg); - $('#btn_copy').text('Copy'); + + if($('#app_model_body').find('copied').length > 0 && !buttons['btn_copy']){ + buttons['btn_copy'] = { + 'text': 'Copy', + 'click': function(){ + copy_dialog_content() + } + }; + } + + if(!buttons['close']){ + buttons['close'] = { + 'text': 'Close', + click: function(){ + hide_app_dialog(); + }, + data: { + 'dismiss': 'modal' + } + }; + } + + $('#app_modal_dialog .modal-footer').html(""); + for(var buttonId in buttons){ + var buttonData = buttons[buttonId]; + var button = $(' - diff --git a/settings/__init__.py b/settings/__init__.py index 8dba51c..e90e805 100644 --- a/settings/__init__.py +++ b/settings/__init__.py @@ -15,7 +15,7 @@ USER_AGENT = "Electroneum GUI Wallet" APP_NAME = "Electroneum Wallet" -VERSION = [0, 0, 1] +VERSION = [0, 4, 0] _data_dir = makeDir(os.path.join(os.getcwd(), 'data'))