Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
cb16863953
|
@ -221,9 +221,10 @@ def run_network_dialog( network, parent ):
|
||||||
image = Gtk.Image()
|
image = Gtk.Image()
|
||||||
image.set_from_stock(Gtk.STOCK_NETWORK, Gtk.IconSize.DIALOG)
|
image.set_from_stock(Gtk.STOCK_NETWORK, Gtk.IconSize.DIALOG)
|
||||||
host, port, protocol, proxy_config, auto_connect = network.get_parameters()
|
host, port, protocol, proxy_config, auto_connect = network.get_parameters()
|
||||||
|
server = "%s:%s:%s"%(host, port, protocol)
|
||||||
if parent:
|
if parent:
|
||||||
if network.is_connected():
|
if network.is_connected():
|
||||||
status = "Connected to %s:%d\n%d blocks"%(host, port, network.blockchain.height())
|
status = "Connected to %s\n%d blocks"%(host, network.get_local_height())
|
||||||
else:
|
else:
|
||||||
status = "Not connected"
|
status = "Not connected"
|
||||||
else:
|
else:
|
||||||
|
@ -340,13 +341,12 @@ def run_network_dialog( network, parent ):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
host, port, protocol = server.split(':')
|
host, port, protocol = server.split(':')
|
||||||
proxy = network.config.get('proxy')
|
|
||||||
auto_connect = network.config.get('auto_cycle')
|
|
||||||
network.set_parameters(host, port, protocol, proxy, auto_connect)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
show_message("error:" + server)
|
show_message("error:" + server)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
network.set_parameters(host, port, protocol, proxy_config, auto_connect)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,9 @@ class InstallWizard(QDialog):
|
||||||
|
|
||||||
|
|
||||||
def network_dialog(self):
|
def network_dialog(self):
|
||||||
|
# skip this if config already exists
|
||||||
|
if self.config.get('server') is not None:
|
||||||
|
return
|
||||||
|
|
||||||
grid = QGridLayout()
|
grid = QGridLayout()
|
||||||
grid.setSpacing(5)
|
grid.setSpacing(5)
|
||||||
|
@ -289,15 +292,10 @@ class InstallWizard(QDialog):
|
||||||
|
|
||||||
if b2.isChecked():
|
if b2.isChecked():
|
||||||
return NetworkDialog(self.network, self.config, None).do_exec()
|
return NetworkDialog(self.network, self.config, None).do_exec()
|
||||||
|
else:
|
||||||
elif b1.isChecked():
|
|
||||||
self.config.set_key('auto_cycle', True, True)
|
self.config.set_key('auto_cycle', True, True)
|
||||||
return
|
return
|
||||||
|
|
||||||
else:
|
|
||||||
self.config.set_key("server", None, True)
|
|
||||||
self.config.set_key('auto_cycle', False, True)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def show_message(self, msg, icon=None):
|
def show_message(self, msg, icon=None):
|
||||||
|
|
|
@ -898,13 +898,16 @@ class ElectrumWindow(QMainWindow):
|
||||||
grid.addWidget(self.amount_e, 4, 1, 1, 2)
|
grid.addWidget(self.amount_e, 4, 1, 1, 2)
|
||||||
grid.addWidget(self.amount_help, 4, 3)
|
grid.addWidget(self.amount_help, 4, 3)
|
||||||
|
|
||||||
|
self.fee_e_label = QLabel(_('Fee'))
|
||||||
self.fee_e = BTCAmountEdit(self.get_decimal_point)
|
self.fee_e = BTCAmountEdit(self.get_decimal_point)
|
||||||
grid.addWidget(QLabel(_('Fee')), 5, 0)
|
grid.addWidget(self.fee_e_label, 5, 0)
|
||||||
grid.addWidget(self.fee_e, 5, 1, 1, 2)
|
grid.addWidget(self.fee_e, 5, 1, 1, 2)
|
||||||
grid.addWidget(HelpButton(
|
msg = _('Bitcoin transactions are in general not free. A transaction fee is paid by the sender of the funds.') + '\n\n'\
|
||||||
_('Bitcoin transactions are in general not free. A transaction fee is paid by the sender of the funds.') + '\n\n'\
|
+ _('The amount of fee can be decided freely by the sender. However, transactions with low fees take more time to be processed.') + '\n\n'\
|
||||||
+ _('The amount of fee can be decided freely by the sender. However, transactions with low fees take more time to be processed.') + '\n\n'\
|
+ _('A suggested fee is automatically added to this field. You may override it. The suggested fee increases with the size of the transaction.')
|
||||||
+ _('A suggested fee is automatically added to this field. You may override it. The suggested fee increases with the size of the transaction.')), 5, 3)
|
self.fee_e_help = HelpButton(msg)
|
||||||
|
grid.addWidget(self.fee_e_help, 5, 3)
|
||||||
|
self.update_fee_edit()
|
||||||
|
|
||||||
self.send_button = EnterButton(_("Send"), self.do_send)
|
self.send_button = EnterButton(_("Send"), self.do_send)
|
||||||
grid.addWidget(self.send_button, 6, 1)
|
grid.addWidget(self.send_button, 6, 1)
|
||||||
|
@ -970,6 +973,12 @@ class ElectrumWindow(QMainWindow):
|
||||||
run_hook('create_send_tab', grid)
|
run_hook('create_send_tab', grid)
|
||||||
return w
|
return w
|
||||||
|
|
||||||
|
def update_fee_edit(self):
|
||||||
|
b = self.config.get('can_edit_fees', False)
|
||||||
|
self.fee_e.setVisible(b)
|
||||||
|
self.fee_e_label.setVisible(b)
|
||||||
|
self.fee_e_help.setVisible(b)
|
||||||
|
|
||||||
def from_list_delete(self, item):
|
def from_list_delete(self, item):
|
||||||
i = self.from_list.indexOfTopLevelItem(item)
|
i = self.from_list.indexOfTopLevelItem(item)
|
||||||
self.pay_from.pop(i)
|
self.pay_from.pop(i)
|
||||||
|
@ -1054,10 +1063,14 @@ class ElectrumWindow(QMainWindow):
|
||||||
if not self.question(_("send %(amount)s to %(address)s?")%{ 'amount' : self.format_amount(amount) + ' '+ self.base_unit(), 'address' : o}):
|
if not self.question(_("send %(amount)s to %(address)s?")%{ 'amount' : self.format_amount(amount) + ' '+ self.base_unit(), 'address' : o}):
|
||||||
return
|
return
|
||||||
|
|
||||||
confirm_fee = self.config.get('confirm_fee', 100000)
|
if not self.config.get('can_edit_fees', False):
|
||||||
if fee >= confirm_fee:
|
if not self.question(_("A fee of %(fee)s will be added to this transaction.\nProceed?")%{ 'fee' : self.format_amount(fee) + ' '+ self.base_unit()}):
|
||||||
if not self.question(_("The fee for this transaction seems unusually high.\nAre you really sure you want to pay %(fee)s in fees?")%{ 'fee' : self.format_amount(fee) + ' '+ self.base_unit()}):
|
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
confirm_fee = self.config.get('confirm_fee', 100000)
|
||||||
|
if fee >= confirm_fee:
|
||||||
|
if not self.question(_("The fee for this transaction seems unusually high.\nAre you really sure you want to pay %(fee)s in fees?")%{ 'fee' : self.format_amount(fee) + ' '+ self.base_unit()}):
|
||||||
|
return
|
||||||
|
|
||||||
coins = self.get_coins()
|
coins = self.get_coins()
|
||||||
return outputs, fee, label, coins
|
return outputs, fee, label, coins
|
||||||
|
@ -2496,6 +2509,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
|
|
||||||
|
|
||||||
def settings_dialog(self):
|
def settings_dialog(self):
|
||||||
|
self.need_restart = False
|
||||||
d = QDialog(self)
|
d = QDialog(self)
|
||||||
d.setWindowTitle(_('Electrum Settings'))
|
d.setWindowTitle(_('Electrum Settings'))
|
||||||
d.setModal(1)
|
d.setModal(1)
|
||||||
|
@ -2512,6 +2526,16 @@ class ElectrumWindow(QMainWindow):
|
||||||
grid.addWidget(HelpButton(msg), 0, 2)
|
grid.addWidget(HelpButton(msg), 0, 2)
|
||||||
if not self.config.is_modifiable('num_zeros'):
|
if not self.config.is_modifiable('num_zeros'):
|
||||||
for w in [nz_e, nz_label]: w.setEnabled(False)
|
for w in [nz_e, nz_label]: w.setEnabled(False)
|
||||||
|
def on_nz():
|
||||||
|
nz = nz_e.get_amount()
|
||||||
|
if nz>8:
|
||||||
|
nz = 8
|
||||||
|
if self.num_zeros != nz:
|
||||||
|
self.num_zeros = nz
|
||||||
|
self.config.set_key('num_zeros', nz, True)
|
||||||
|
self.update_history_tab()
|
||||||
|
self.update_address_tab()
|
||||||
|
nz_e.editingFinished.connect(on_nz)
|
||||||
|
|
||||||
lang_label=QLabel(_('Language') + ':')
|
lang_label=QLabel(_('Language') + ':')
|
||||||
grid.addWidget(lang_label, 1, 0)
|
grid.addWidget(lang_label, 1, 0)
|
||||||
|
@ -2527,7 +2551,12 @@ class ElectrumWindow(QMainWindow):
|
||||||
grid.addWidget(HelpButton(_('Select which language is used in the GUI (after restart).')+' '), 1, 2)
|
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):
|
||||||
|
lang_request = languages.keys()[lang_combo.currentIndex()]
|
||||||
|
if lang_request != self.config.get('language'):
|
||||||
|
self.config.set_key("language", lang_request, True)
|
||||||
|
self.need_restart = True
|
||||||
|
lang_combo.currentIndexChanged.connect(on_lang)
|
||||||
|
|
||||||
fee_label = QLabel(_('Transaction fee') + ':')
|
fee_label = QLabel(_('Transaction fee') + ':')
|
||||||
grid.addWidget(fee_label, 2, 0)
|
grid.addWidget(fee_label, 2, 0)
|
||||||
|
@ -2539,6 +2568,10 @@ class ElectrumWindow(QMainWindow):
|
||||||
grid.addWidget(HelpButton(msg), 2, 2)
|
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():
|
||||||
|
fee = fee_e.get_amount()
|
||||||
|
self.wallet.set_fee(fee)
|
||||||
|
fee_e.editingFinished.connect(on_fee)
|
||||||
|
|
||||||
units = ['BTC', 'mBTC', 'bits']
|
units = ['BTC', 'mBTC', 'bits']
|
||||||
unit_label = QLabel(_('Base unit') + ':')
|
unit_label = QLabel(_('Base unit') + ':')
|
||||||
|
@ -2547,15 +2580,38 @@ class ElectrumWindow(QMainWindow):
|
||||||
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)
|
grid.addWidget(unit_combo, 3, 1)
|
||||||
grid.addWidget(HelpButton(_('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')+' '), 3, 2)
|
+ _(' These settings affects the fields in the Send tab')+' '
|
||||||
|
grid.addWidget(HelpButton(msg), 3, 2)
|
||||||
|
def on_unit(x):
|
||||||
|
unit_result = units[unit_combo.currentIndex()]
|
||||||
|
if self.base_unit() == unit_result:
|
||||||
|
return
|
||||||
|
if unit_result == 'BTC':
|
||||||
|
self.decimal_point = 8
|
||||||
|
elif unit_result == 'mBTC':
|
||||||
|
self.decimal_point = 5
|
||||||
|
elif unit_result == 'bits':
|
||||||
|
self.decimal_point = 2
|
||||||
|
else:
|
||||||
|
raise Exception('Unknown base unit')
|
||||||
|
self.config.set_key('decimal_point', self.decimal_point, True)
|
||||||
|
self.update_history_tab()
|
||||||
|
self.update_status()
|
||||||
|
unit_combo.currentIndexChanged.connect(on_unit)
|
||||||
|
|
||||||
usechange_cb = QCheckBox(_('Use change addresses'))
|
usechange_cb = QCheckBox(_('Use change addresses'))
|
||||||
usechange_cb.setChecked(self.wallet.use_change)
|
usechange_cb.setChecked(self.wallet.use_change)
|
||||||
grid.addWidget(usechange_cb, 4, 0)
|
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)
|
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)
|
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') + ':')
|
||||||
|
@ -2565,19 +2621,21 @@ class ElectrumWindow(QMainWindow):
|
||||||
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)
|
grid.addWidget(block_ex_combo, 5, 1)
|
||||||
grid.addWidget(HelpButton(_('Choose which online block explorer to use for functions that open a web browser')+' '), 5, 2)
|
grid.addWidget(HelpButton(_('Choose which online block explorer to use for functions that open a web browser')+' '), 5, 2)
|
||||||
|
def on_be(x):
|
||||||
|
be_result = block_explorers[block_ex_combo.currentIndex()]
|
||||||
|
self.config.set_key('block_explorer', be_result, True)
|
||||||
|
block_ex_combo.currentIndexChanged.connect(on_be)
|
||||||
|
|
||||||
show_tx = self.config.get('show_before_broadcast', False)
|
show_tx = self.config.get('show_before_broadcast', False)
|
||||||
showtx_cb = QCheckBox(_('Show before broadcast'))
|
showtx_cb = QCheckBox(_('Show before broadcast'))
|
||||||
showtx_cb.setChecked(show_tx)
|
showtx_cb.setChecked(show_tx)
|
||||||
grid.addWidget(showtx_cb, 6, 0)
|
grid.addWidget(showtx_cb, 6, 0)
|
||||||
grid.addWidget(HelpButton(_('Display the details of your transactions before broadcasting it.')), 6, 2)
|
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()
|
||||||
qr_combo = QComboBox()
|
qr_combo = QComboBox()
|
||||||
on_change = lambda x: self.config.set_key("video_device", str(qr_combo.itemData(x).toString()), True)
|
|
||||||
qr_combo.currentIndexChanged.connect(on_change)
|
|
||||||
qr_combo.addItem("Default","default")
|
qr_combo.addItem("Default","default")
|
||||||
for camera, device in system_cameras.items():
|
for camera, device in system_cameras.items():
|
||||||
qr_combo.addItem(camera, device)
|
qr_combo.addItem(camera, device)
|
||||||
|
@ -2590,74 +2648,32 @@ class ElectrumWindow(QMainWindow):
|
||||||
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'")
|
help_msg = _("Install the zbar package to enable this.\nOn linux, type: 'apt-get install python-zbar'")
|
||||||
grid.addWidget(HelpButton(help_msg), 7, 2)
|
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)
|
||||||
|
qr_combo.currentIndexChanged.connect(on_video_device)
|
||||||
|
|
||||||
|
can_edit_fees_cb = QCheckBox(_('Set transaction fees manually'))
|
||||||
|
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):
|
||||||
|
self.config.set_key('can_edit_fees', x == Qt.Checked)
|
||||||
|
self.update_fee_edit()
|
||||||
|
can_edit_fees_cb.stateChanged.connect(on_editfees)
|
||||||
|
|
||||||
vbox.addLayout(grid)
|
vbox.addLayout(grid)
|
||||||
vbox.addStretch(1)
|
vbox.addStretch(1)
|
||||||
vbox.addLayout(ok_cancel_buttons(d))
|
vbox.addLayout(close_button(d))
|
||||||
d.setLayout(vbox)
|
d.setLayout(vbox)
|
||||||
|
|
||||||
# run the dialog
|
# run the dialog
|
||||||
if not d.exec_(): return
|
d.exec_()
|
||||||
|
|
||||||
fee = fee_e.get_amount()
|
|
||||||
if fee is None:
|
|
||||||
QMessageBox.warning(self, _('Error'), _('Invalid value') +': %s'%fee, _('OK'))
|
|
||||||
return
|
|
||||||
|
|
||||||
self.wallet.set_fee(fee)
|
|
||||||
|
|
||||||
nz = unicode(nz_e.text())
|
|
||||||
try:
|
|
||||||
nz = int( nz )
|
|
||||||
if nz>8: nz=8
|
|
||||||
except Exception:
|
|
||||||
QMessageBox.warning(self, _('Error'), _('Invalid value')+':%s'%nz, _('OK'))
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.num_zeros != nz:
|
|
||||||
self.num_zeros = nz
|
|
||||||
self.config.set_key('num_zeros', nz, True)
|
|
||||||
self.update_history_tab()
|
|
||||||
self.update_address_tab()
|
|
||||||
|
|
||||||
usechange_result = usechange_cb.isChecked()
|
|
||||||
if self.wallet.use_change != usechange_result:
|
|
||||||
self.wallet.use_change = usechange_result
|
|
||||||
self.wallet.storage.put('use_change', self.wallet.use_change)
|
|
||||||
|
|
||||||
if showtx_cb.isChecked() != show_tx:
|
|
||||||
self.config.set_key('show_before_broadcast', not show_tx)
|
|
||||||
|
|
||||||
unit_result = units[unit_combo.currentIndex()]
|
|
||||||
if self.base_unit() != unit_result:
|
|
||||||
if unit_result == 'BTC':
|
|
||||||
self.decimal_point = 8
|
|
||||||
elif unit_result == 'mBTC':
|
|
||||||
self.decimal_point = 5
|
|
||||||
elif unit_result == 'bits':
|
|
||||||
self.decimal_point = 2
|
|
||||||
else:
|
|
||||||
raise Exception('Unknown base unit')
|
|
||||||
self.config.set_key('decimal_point', self.decimal_point, True)
|
|
||||||
self.update_history_tab()
|
|
||||||
self.update_status()
|
|
||||||
|
|
||||||
need_restart = False
|
|
||||||
|
|
||||||
lang_request = languages.keys()[lang_combo.currentIndex()]
|
|
||||||
if lang_request != self.config.get('language'):
|
|
||||||
self.config.set_key("language", lang_request, True)
|
|
||||||
need_restart = True
|
|
||||||
|
|
||||||
be_result = block_explorers[block_ex_combo.currentIndex()]
|
|
||||||
self.config.set_key('block_explorer', be_result, True)
|
|
||||||
|
|
||||||
run_hook('close_settings_dialog')
|
run_hook('close_settings_dialog')
|
||||||
|
if self.need_restart:
|
||||||
if need_restart:
|
|
||||||
QMessageBox.warning(self, _('Success'), _('Please restart Electrum to activate the new GUI settings'), _('OK'))
|
QMessageBox.warning(self, _('Success'), _('Please restart Electrum to activate the new GUI settings'), _('OK'))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def run_network_dialog(self):
|
def run_network_dialog(self):
|
||||||
if not self.network:
|
if not self.network:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue