electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 828b0e5d708fec0e6fa1e65de8e1c6ff70ac7420
parent d4b9b1f3f9b7a2afd5b6ee0dbaeb76c61e8c666a
Author: ThomasV <thomasv@electrum.org>
Date:   Fri, 30 Jun 2017 12:11:47 +0200

fix #2439

Diffstat:
Mgui/qt/main_window.py | 7+++----
Mlib/util.py | 17++++++++++++++---
2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -45,8 +45,7 @@ from electrum import keystore from electrum.bitcoin import COIN, is_valid, TYPE_ADDRESS from electrum.plugins import run_hook from electrum.i18n import _ -from electrum.util import (block_explorer, block_explorer_info, format_time, - block_explorer_URL, format_satoshis, PrintError, +from electrum.util import (format_time, format_satoshis, PrintError, format_satoshis_plain, NotEnoughFunds, UserCancelled) from electrum import Transaction, mnemonic @@ -2526,12 +2525,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): unit_combo.currentIndexChanged.connect(on_unit) 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') block_ex_label = HelpLabel(_('Online Block Explorer') + ':', msg) block_ex_combo = QComboBox() 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): be_result = block_explorers[block_ex_combo.currentIndex()] self.config.set_key('block_explorer', be_result, True) diff --git a/lib/util.py b/lib/util.py @@ -343,7 +343,7 @@ def time_difference(distance_in_time, include_seconds): else: return "over %d years" % (round(distance_in_minutes / 525600)) -block_explorer_info = { +mainnet_block_explorers = { 'Biteasy.com': ('https://www.biteasy.com/blockchain', {'tx': 'transactions', 'addr': 'addresses'}), 'Bitflyer.jp': ('https://chainflyer.bitflyer.jp', @@ -370,11 +370,22 @@ block_explorer_info = { {'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): - return config.get('block_explorer', 'Blockchain.info') + return config.get('block_explorer', 'Blocktrail.com') 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): be_tuple = block_explorer_tuple(config)