Clean up block explorer handling. Add menu item to go to block explorer for an address.
Block explorer code is data-driven now. Put block explorer defaulting in one place. Fix URLs for insight.is and blockr.io. Add tradeblock.com explorer. Add menu item to view address on block explorer provided only one is selected.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
import sys, time, re, threading
|
||||
from electrum.i18n import _, set_language
|
||||
from electrum.util import block_explorer, block_explorer_info, block_explorer_URL
|
||||
from electrum.util import print_error, print_msg
|
||||
import os.path, json, ast, traceback
|
||||
import shutil
|
||||
@@ -1402,6 +1403,9 @@ class ElectrumWindow(QMainWindow):
|
||||
menu.addAction(_("Encrypt/decrypt message"), lambda: self.encrypt_message(addr))
|
||||
if self.wallet.is_imported(addr):
|
||||
menu.addAction(_("Remove from wallet"), lambda: self.delete_imported_key(addr))
|
||||
addr_URL = block_explorer_URL(self.config, 'addr', addr)
|
||||
if addr_URL:
|
||||
menu.addAction(_("View on block explorer"), lambda: webbrowser.open(addr_URL))
|
||||
|
||||
if any(addr not in self.wallet.frozen_addresses for addr in addrs):
|
||||
menu.addAction(_("Freeze"), lambda: self.set_addrs_frozen(addrs, True))
|
||||
@@ -2562,11 +2566,11 @@ class ElectrumWindow(QMainWindow):
|
||||
unit_combo.currentIndexChanged.connect(on_unit)
|
||||
widgets.append((unit_label, unit_combo, unit_help))
|
||||
|
||||
block_explorers = ['Blockchain.info', 'Blockr.io', 'Insight.is', "Blocktrail.com"]
|
||||
block_explorers = sorted(block_explorer_info.keys())
|
||||
block_ex_label = QLabel(_('Online Block Explorer') + ':')
|
||||
block_ex_combo = QComboBox()
|
||||
block_ex_combo.addItems(block_explorers)
|
||||
block_ex_combo.setCurrentIndex(block_explorers.index(self.config.get('block_explorer', 'Blockchain.info')))
|
||||
block_ex_combo.setCurrentIndex(block_explorers.index(block_explorer(self.config)))
|
||||
block_ex_help = HelpButton(_('Choose which online block explorer to use for functions that open a web browser'))
|
||||
def on_be(x):
|
||||
be_result = block_explorers[block_ex_combo.currentIndex()]
|
||||
|
||||
Reference in New Issue
Block a user