fix #2439
This commit is contained in:
parent
d4b9b1f3f9
commit
828b0e5d70
|
@ -45,8 +45,7 @@ from electrum import keystore
|
||||||
from electrum.bitcoin import COIN, is_valid, TYPE_ADDRESS
|
from electrum.bitcoin import COIN, is_valid, TYPE_ADDRESS
|
||||||
from electrum.plugins import run_hook
|
from electrum.plugins import run_hook
|
||||||
from electrum.i18n import _
|
from electrum.i18n import _
|
||||||
from electrum.util import (block_explorer, block_explorer_info, format_time,
|
from electrum.util import (format_time, format_satoshis, PrintError,
|
||||||
block_explorer_URL, format_satoshis, PrintError,
|
|
||||||
format_satoshis_plain, NotEnoughFunds,
|
format_satoshis_plain, NotEnoughFunds,
|
||||||
UserCancelled)
|
UserCancelled)
|
||||||
from electrum import Transaction, mnemonic
|
from electrum import Transaction, mnemonic
|
||||||
|
@ -2526,12 +2525,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
unit_combo.currentIndexChanged.connect(on_unit)
|
unit_combo.currentIndexChanged.connect(on_unit)
|
||||||
gui_widgets.append((unit_label, unit_combo))
|
gui_widgets.append((unit_label, unit_combo))
|
||||||
|
|
||||||
block_explorers = sorted(block_explorer_info.keys())
|
block_explorers = sorted(util.block_explorer_info().keys())
|
||||||
msg = _('Choose which online block explorer to use for functions that open a web browser')
|
msg = _('Choose which online block explorer to use for functions that open a web browser')
|
||||||
block_ex_label = HelpLabel(_('Online Block Explorer') + ':', msg)
|
block_ex_label = HelpLabel(_('Online Block Explorer') + ':', msg)
|
||||||
block_ex_combo = QComboBox()
|
block_ex_combo = QComboBox()
|
||||||
block_ex_combo.addItems(block_explorers)
|
block_ex_combo.addItems(block_explorers)
|
||||||
block_ex_combo.setCurrentIndex(block_ex_combo.findText(block_explorer(self.config)))
|
block_ex_combo.setCurrentIndex(block_ex_combo.findText(util.block_explorer(self.config)))
|
||||||
def on_be(x):
|
def on_be(x):
|
||||||
be_result = block_explorers[block_ex_combo.currentIndex()]
|
be_result = block_explorers[block_ex_combo.currentIndex()]
|
||||||
self.config.set_key('block_explorer', be_result, True)
|
self.config.set_key('block_explorer', be_result, True)
|
||||||
|
|
17
lib/util.py
17
lib/util.py
|
@ -343,7 +343,7 @@ def time_difference(distance_in_time, include_seconds):
|
||||||
else:
|
else:
|
||||||
return "over %d years" % (round(distance_in_minutes / 525600))
|
return "over %d years" % (round(distance_in_minutes / 525600))
|
||||||
|
|
||||||
block_explorer_info = {
|
mainnet_block_explorers = {
|
||||||
'Biteasy.com': ('https://www.biteasy.com/blockchain',
|
'Biteasy.com': ('https://www.biteasy.com/blockchain',
|
||||||
{'tx': 'transactions', 'addr': 'addresses'}),
|
{'tx': 'transactions', 'addr': 'addresses'}),
|
||||||
'Bitflyer.jp': ('https://chainflyer.bitflyer.jp',
|
'Bitflyer.jp': ('https://chainflyer.bitflyer.jp',
|
||||||
|
@ -370,11 +370,22 @@ block_explorer_info = {
|
||||||
{'tx': 'tx', 'addr': 'address'}),
|
{'tx': 'tx', 'addr': 'address'}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testnet_block_explorers = {
|
||||||
|
'Blocktrail.com': ('https://www.blocktrail.com/tBTC',
|
||||||
|
{'tx': 'tx', 'addr': 'address'}),
|
||||||
|
'system default': ('blockchain:',
|
||||||
|
{'tx': 'tx', 'addr': 'address'}),
|
||||||
|
}
|
||||||
|
|
||||||
|
def block_explorer_info():
|
||||||
|
import bitcoin
|
||||||
|
return testnet_block_explorers if bitcoin.TESTNET else mainnet_block_explorers
|
||||||
|
|
||||||
def block_explorer(config):
|
def block_explorer(config):
|
||||||
return config.get('block_explorer', 'Blockchain.info')
|
return config.get('block_explorer', 'Blocktrail.com')
|
||||||
|
|
||||||
def block_explorer_tuple(config):
|
def block_explorer_tuple(config):
|
||||||
return block_explorer_info.get(block_explorer(config))
|
return block_explorer_info().get(block_explorer(config))
|
||||||
|
|
||||||
def block_explorer_URL(config, kind, item):
|
def block_explorer_URL(config, kind, item):
|
||||||
be_tuple = block_explorer_tuple(config)
|
be_tuple = block_explorer_tuple(config)
|
||||||
|
|
Loading…
Reference in New Issue