|
|
|
@ -2516,29 +2516,10 @@ class ElectrumWindow(QMainWindow): |
|
|
|
vbox = QVBoxLayout() |
|
|
|
vbox = QVBoxLayout() |
|
|
|
grid = QGridLayout() |
|
|
|
grid = QGridLayout() |
|
|
|
grid.setColumnStretch(0,1) |
|
|
|
grid.setColumnStretch(0,1) |
|
|
|
|
|
|
|
widgets = [] |
|
|
|
nz_label = QLabel(_('Zeros after decimal point') + ':') |
|
|
|
|
|
|
|
grid.addWidget(nz_label, 0, 0) |
|
|
|
|
|
|
|
nz = QSpinBox() |
|
|
|
|
|
|
|
nz.setMinimum(0) |
|
|
|
|
|
|
|
nz.setMaximum(self.decimal_point) |
|
|
|
|
|
|
|
nz.setValue(self.num_zeros) |
|
|
|
|
|
|
|
grid.addWidget(nz, 0, 1) |
|
|
|
|
|
|
|
msg = _('Number of zeros displayed after the decimal point. For example, if this is set to 2, "1." will be displayed as "1.00"') |
|
|
|
|
|
|
|
grid.addWidget(HelpButton(msg), 0, 2) |
|
|
|
|
|
|
|
if not self.config.is_modifiable('num_zeros'): |
|
|
|
|
|
|
|
for w in [nz, nz_label]: w.setEnabled(False) |
|
|
|
|
|
|
|
def on_nz(): |
|
|
|
|
|
|
|
value = nz.value() |
|
|
|
|
|
|
|
if self.num_zeros != value: |
|
|
|
|
|
|
|
self.num_zeros = value |
|
|
|
|
|
|
|
self.config.set_key('num_zeros', nz, True) |
|
|
|
|
|
|
|
self.update_history_tab() |
|
|
|
|
|
|
|
self.update_address_tab() |
|
|
|
|
|
|
|
nz.valueChanged.connect(on_nz) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lang_label = QLabel(_('Language') + ':') |
|
|
|
lang_label = QLabel(_('Language') + ':') |
|
|
|
grid.addWidget(lang_label, 1, 0) |
|
|
|
lang_help = HelpButton(_('Select which language is used in the GUI (after restart).')) |
|
|
|
lang_combo = QComboBox() |
|
|
|
lang_combo = QComboBox() |
|
|
|
from electrum.i18n import languages |
|
|
|
from electrum.i18n import languages |
|
|
|
lang_combo.addItems(languages.values()) |
|
|
|
lang_combo.addItems(languages.values()) |
|
|
|
@ -2547,8 +2528,6 @@ class ElectrumWindow(QMainWindow): |
|
|
|
except Exception: |
|
|
|
except Exception: |
|
|
|
index = 0 |
|
|
|
index = 0 |
|
|
|
lang_combo.setCurrentIndex(index) |
|
|
|
lang_combo.setCurrentIndex(index) |
|
|
|
grid.addWidget(lang_combo, 1, 1) |
|
|
|
|
|
|
|
grid.addWidget(HelpButton(_('Select which language is used in the GUI (after restart).')+' '), 1, 2) |
|
|
|
|
|
|
|
if not self.config.is_modifiable('language'): |
|
|
|
if not self.config.is_modifiable('language'): |
|
|
|
for w in [lang_combo, lang_label]: w.setEnabled(False) |
|
|
|
for w in [lang_combo, lang_label]: w.setEnabled(False) |
|
|
|
def on_lang(x): |
|
|
|
def on_lang(x): |
|
|
|
@ -2557,33 +2536,47 @@ class ElectrumWindow(QMainWindow): |
|
|
|
self.config.set_key("language", lang_request, True) |
|
|
|
self.config.set_key("language", lang_request, True) |
|
|
|
self.need_restart = True |
|
|
|
self.need_restart = True |
|
|
|
lang_combo.currentIndexChanged.connect(on_lang) |
|
|
|
lang_combo.currentIndexChanged.connect(on_lang) |
|
|
|
|
|
|
|
widgets.append((lang_label, lang_combo, lang_help)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nz_label = QLabel(_('Zeros after decimal point') + ':') |
|
|
|
|
|
|
|
nz_help = HelpButton(_('Number of zeros displayed after the decimal point. For example, if this is set to 2, "1." will be displayed as "1.00"')) |
|
|
|
|
|
|
|
nz = QSpinBox() |
|
|
|
|
|
|
|
nz.setMinimum(0) |
|
|
|
|
|
|
|
nz.setMaximum(self.decimal_point) |
|
|
|
|
|
|
|
nz.setValue(self.num_zeros) |
|
|
|
|
|
|
|
if not self.config.is_modifiable('num_zeros'): |
|
|
|
|
|
|
|
for w in [nz, nz_label]: w.setEnabled(False) |
|
|
|
|
|
|
|
def on_nz(): |
|
|
|
|
|
|
|
value = nz.value() |
|
|
|
|
|
|
|
if self.num_zeros != value: |
|
|
|
|
|
|
|
self.num_zeros = value |
|
|
|
|
|
|
|
self.config.set_key('num_zeros', nz, True) |
|
|
|
|
|
|
|
self.update_history_tab() |
|
|
|
|
|
|
|
self.update_address_tab() |
|
|
|
|
|
|
|
nz.valueChanged.connect(on_nz) |
|
|
|
|
|
|
|
widgets.append((nz_label, nz, nz_help)) |
|
|
|
|
|
|
|
|
|
|
|
fee_label = QLabel(_('Transaction fee') + ':') |
|
|
|
fee_label = QLabel(_('Transaction fee') + ':') |
|
|
|
grid.addWidget(fee_label, 2, 0) |
|
|
|
fee_help = HelpButton(_('Fee per kilobyte of transaction.') + '\n' + _('Recommended value') + ': ' + self.format_amount(10000) + ' ' + self.base_unit()) |
|
|
|
fee_e = BTCAmountEdit(self.get_decimal_point) |
|
|
|
fee_e = BTCAmountEdit(self.get_decimal_point) |
|
|
|
fee_e.setAmount(self.wallet.fee) |
|
|
|
fee_e.setAmount(self.wallet.fee) |
|
|
|
grid.addWidget(fee_e, 2, 1) |
|
|
|
|
|
|
|
msg = _('Fee per kilobyte of transaction.') + '\n' \ |
|
|
|
|
|
|
|
+ _('Recommended value') + ': ' + self.format_amount(10000) + ' ' + self.base_unit() |
|
|
|
|
|
|
|
grid.addWidget(HelpButton(msg), 2, 2) |
|
|
|
|
|
|
|
if not self.config.is_modifiable('fee_per_kb'): |
|
|
|
if not self.config.is_modifiable('fee_per_kb'): |
|
|
|
for w in [fee_e, fee_label]: w.setEnabled(False) |
|
|
|
for w in [fee_e, fee_label]: w.setEnabled(False) |
|
|
|
def on_fee(): |
|
|
|
def on_fee(): |
|
|
|
fee = fee_e.get_amount() |
|
|
|
fee = fee_e.get_amount() |
|
|
|
self.wallet.set_fee(fee) |
|
|
|
self.wallet.set_fee(fee) |
|
|
|
fee_e.editingFinished.connect(on_fee) |
|
|
|
fee_e.editingFinished.connect(on_fee) |
|
|
|
|
|
|
|
widgets.append((fee_label, fee_e, fee_help)) |
|
|
|
|
|
|
|
|
|
|
|
units = ['BTC', 'mBTC', 'bits'] |
|
|
|
units = ['BTC', 'mBTC', 'bits'] |
|
|
|
unit_label = QLabel(_('Base unit') + ':') |
|
|
|
unit_label = QLabel(_('Base unit') + ':') |
|
|
|
grid.addWidget(unit_label, 3, 0) |
|
|
|
|
|
|
|
unit_combo = QComboBox() |
|
|
|
unit_combo = QComboBox() |
|
|
|
unit_combo.addItems(units) |
|
|
|
unit_combo.addItems(units) |
|
|
|
unit_combo.setCurrentIndex(units.index(self.base_unit())) |
|
|
|
unit_combo.setCurrentIndex(units.index(self.base_unit())) |
|
|
|
grid.addWidget(unit_combo, 3, 1) |
|
|
|
|
|
|
|
msg = _('Base unit of your wallet.')\ |
|
|
|
msg = _('Base unit of your wallet.')\ |
|
|
|
+ '\n1BTC=1000mBTC.\n' \ |
|
|
|
+ '\n1BTC=1000mBTC.\n' \ |
|
|
|
+ _(' These settings affects the fields in the Send tab')+' ' |
|
|
|
+ _(' These settings affects the fields in the Send tab')+' ' |
|
|
|
grid.addWidget(HelpButton(msg), 3, 2) |
|
|
|
unit_help = HelpButton(msg) |
|
|
|
def on_unit(x): |
|
|
|
def on_unit(x): |
|
|
|
unit_result = units[unit_combo.currentIndex()] |
|
|
|
unit_result = units[unit_combo.currentIndex()] |
|
|
|
if self.base_unit() == unit_result: |
|
|
|
if self.base_unit() == unit_result: |
|
|
|
@ -2600,38 +2593,19 @@ class ElectrumWindow(QMainWindow): |
|
|
|
self.update_history_tab() |
|
|
|
self.update_history_tab() |
|
|
|
self.update_status() |
|
|
|
self.update_status() |
|
|
|
unit_combo.currentIndexChanged.connect(on_unit) |
|
|
|
unit_combo.currentIndexChanged.connect(on_unit) |
|
|
|
|
|
|
|
widgets.append((unit_label, unit_combo, unit_help)) |
|
|
|
usechange_cb = QCheckBox(_('Use change addresses')) |
|
|
|
|
|
|
|
usechange_cb.setChecked(self.wallet.use_change) |
|
|
|
|
|
|
|
grid.addWidget(usechange_cb, 4, 0) |
|
|
|
|
|
|
|
grid.addWidget(HelpButton(_('Using change addresses makes it more difficult for other people to track your transactions.')+' '), 4, 2) |
|
|
|
|
|
|
|
if not self.config.is_modifiable('use_change'): usechange_cb.setEnabled(False) |
|
|
|
|
|
|
|
def on_usechange(x): |
|
|
|
|
|
|
|
usechange_result = x == Qt.Checked |
|
|
|
|
|
|
|
if self.wallet.use_change != usechange_result: |
|
|
|
|
|
|
|
self.wallet.use_change = usechange_result |
|
|
|
|
|
|
|
self.wallet.storage.put('use_change', self.wallet.use_change) |
|
|
|
|
|
|
|
usechange_cb.stateChanged.connect(on_usechange) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
block_explorers = ['Blockchain.info', 'Blockr.io', 'Insight.is', "Blocktrail.com"] |
|
|
|
block_explorers = ['Blockchain.info', 'Blockr.io', 'Insight.is', "Blocktrail.com"] |
|
|
|
block_ex_label = QLabel(_('Online Block Explorer') + ':') |
|
|
|
block_ex_label = QLabel(_('Online Block Explorer') + ':') |
|
|
|
grid.addWidget(block_ex_label, 5, 0) |
|
|
|
|
|
|
|
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_explorers.index(self.config.get('block_explorer', 'Blockchain.info'))) |
|
|
|
block_ex_combo.setCurrentIndex(block_explorers.index(self.config.get('block_explorer', 'Blockchain.info'))) |
|
|
|
grid.addWidget(block_ex_combo, 5, 1) |
|
|
|
block_ex_help = HelpButton(_('Choose which online block explorer to use for functions that open a web browser')) |
|
|
|
grid.addWidget(HelpButton(_('Choose which online block explorer to use for functions that open a web browser')+' '), 5, 2) |
|
|
|
|
|
|
|
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) |
|
|
|
block_ex_combo.currentIndexChanged.connect(on_be) |
|
|
|
block_ex_combo.currentIndexChanged.connect(on_be) |
|
|
|
|
|
|
|
widgets.append((block_ex_label, block_ex_combo, block_ex_help)) |
|
|
|
show_tx = self.config.get('show_before_broadcast', False) |
|
|
|
|
|
|
|
showtx_cb = QCheckBox(_('Show before broadcast')) |
|
|
|
|
|
|
|
showtx_cb.setChecked(show_tx) |
|
|
|
|
|
|
|
grid.addWidget(showtx_cb, 6, 0) |
|
|
|
|
|
|
|
grid.addWidget(HelpButton(_('Display the details of your transactions before broadcasting it.')), 6, 2) |
|
|
|
|
|
|
|
showtx_cb.stateChanged.connect(lambda x: self.config.set_key('show_before_broadcast', showtx_cb.isChecked())) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from electrum import qrscanner |
|
|
|
from electrum import qrscanner |
|
|
|
system_cameras = qrscanner._find_system_cameras() |
|
|
|
system_cameras = qrscanner._find_system_cameras() |
|
|
|
@ -2643,22 +2617,47 @@ class ElectrumWindow(QMainWindow): |
|
|
|
index = qr_combo.findData(self.config.get("video_device")) |
|
|
|
index = qr_combo.findData(self.config.get("video_device")) |
|
|
|
qr_combo.setCurrentIndex(index) |
|
|
|
qr_combo.setCurrentIndex(index) |
|
|
|
qr_label = QLabel(_('Video Device') + ':') |
|
|
|
qr_label = QLabel(_('Video Device') + ':') |
|
|
|
grid.addWidget(qr_label, 7, 0) |
|
|
|
|
|
|
|
grid.addWidget(qr_combo, 7, 1) |
|
|
|
|
|
|
|
qr_combo.setEnabled(qrscanner.zbar is not None) |
|
|
|
qr_combo.setEnabled(qrscanner.zbar is not None) |
|
|
|
help_msg = _("Install the zbar package to enable this.\nOn linux, type: 'apt-get install python-zbar'") |
|
|
|
qr_help = HelpButton(_("Install the zbar package to enable this.\nOn linux, type: 'apt-get install python-zbar'")) |
|
|
|
grid.addWidget(HelpButton(help_msg), 7, 2) |
|
|
|
|
|
|
|
on_video_device = lambda x: self.config.set_key("video_device", str(qr_combo.itemData(x).toString()), True) |
|
|
|
on_video_device = lambda x: self.config.set_key("video_device", str(qr_combo.itemData(x).toString()), True) |
|
|
|
qr_combo.currentIndexChanged.connect(on_video_device) |
|
|
|
qr_combo.currentIndexChanged.connect(on_video_device) |
|
|
|
|
|
|
|
widgets.append((qr_label, qr_combo, qr_help)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
usechange_cb = QCheckBox(_('Use change addresses')) |
|
|
|
|
|
|
|
usechange_cb.setChecked(self.wallet.use_change) |
|
|
|
|
|
|
|
usechange_help = HelpButton(_('Using change addresses makes it more difficult for other people to track your transactions.')) |
|
|
|
|
|
|
|
if not self.config.is_modifiable('use_change'): usechange_cb.setEnabled(False) |
|
|
|
|
|
|
|
def on_usechange(x): |
|
|
|
|
|
|
|
usechange_result = x == Qt.Checked |
|
|
|
|
|
|
|
if self.wallet.use_change != usechange_result: |
|
|
|
|
|
|
|
self.wallet.use_change = usechange_result |
|
|
|
|
|
|
|
self.wallet.storage.put('use_change', self.wallet.use_change) |
|
|
|
|
|
|
|
usechange_cb.stateChanged.connect(on_usechange) |
|
|
|
|
|
|
|
widgets.append((usechange_cb, None, usechange_help)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showtx_cb = QCheckBox(_('Show before broadcast')) |
|
|
|
|
|
|
|
showtx_cb.setChecked(self.config.get('show_before_broadcast', False)) |
|
|
|
|
|
|
|
showtx_cb.stateChanged.connect(lambda x: self.config.set_key('show_before_broadcast', showtx_cb.isChecked())) |
|
|
|
|
|
|
|
showtx_help = HelpButton(_('Display the details of your transactions before broadcasting it.')) |
|
|
|
|
|
|
|
widgets.append((showtx_cb, None, showtx_help)) |
|
|
|
|
|
|
|
|
|
|
|
can_edit_fees_cb = QCheckBox(_('Set transaction fees manually')) |
|
|
|
can_edit_fees_cb = QCheckBox(_('Set transaction fees manually')) |
|
|
|
can_edit_fees_cb.setChecked(self.config.get('can_edit_fees', False)) |
|
|
|
can_edit_fees_cb.setChecked(self.config.get('can_edit_fees', False)) |
|
|
|
grid.addWidget(can_edit_fees_cb, 8, 0) |
|
|
|
|
|
|
|
grid.addWidget(HelpButton(_('This option lets you edit fees in the send tab.')+' '), 8, 2) |
|
|
|
|
|
|
|
def on_editfees(x): |
|
|
|
def on_editfees(x): |
|
|
|
self.config.set_key('can_edit_fees', x == Qt.Checked) |
|
|
|
self.config.set_key('can_edit_fees', x == Qt.Checked) |
|
|
|
self.update_fee_edit() |
|
|
|
self.update_fee_edit() |
|
|
|
can_edit_fees_cb.stateChanged.connect(on_editfees) |
|
|
|
can_edit_fees_cb.stateChanged.connect(on_editfees) |
|
|
|
|
|
|
|
can_edit_fees_help = HelpButton(_('This option lets you edit fees in the send tab.')) |
|
|
|
|
|
|
|
widgets.append((can_edit_fees_cb, None, can_edit_fees_help)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for a,b,c in widgets: |
|
|
|
|
|
|
|
i = grid.rowCount() |
|
|
|
|
|
|
|
if b: |
|
|
|
|
|
|
|
grid.addWidget(a, i, 0) |
|
|
|
|
|
|
|
grid.addWidget(b, i, 1) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
grid.addWidget(a, i, 0, 1, 2) |
|
|
|
|
|
|
|
grid.addWidget(c, i, 2) |
|
|
|
|
|
|
|
|
|
|
|
vbox.addLayout(grid) |
|
|
|
vbox.addLayout(grid) |
|
|
|
vbox.addStretch(1) |
|
|
|
vbox.addStretch(1) |
|
|
|
|