Browse Source

don't show gap limit in GUI

283
thomasv 12 years ago
parent
commit
ee08b2bfa6
  1. 1
      electrum
  2. 51
      gui/gui_classic/installwizard.py
  3. 16
      gui/gui_classic/main_window.py

1
electrum

@ -82,6 +82,7 @@ def arg_parser():
parser.add_option("-P", "--portable", action="store_true", dest="portable", default=False, help="portable wallet") parser.add_option("-P", "--portable", action="store_true", dest="portable", default=False, help="portable wallet")
parser.add_option("-L", "--lang", dest="language", default=None, help="defaut language used in GUI") parser.add_option("-L", "--lang", dest="language", default=None, help="defaut language used in GUI")
parser.add_option("-u", "--usb", dest="bitkey", action="store_true", help="Turn on support for hardware wallets (EXPERIMENTAL)") parser.add_option("-u", "--usb", dest="bitkey", action="store_true", help="Turn on support for hardware wallets (EXPERIMENTAL)")
parser.add_option("-G", "--gap", dest="gap_limit", default=None, help="gap limit")
return parser return parser

51
gui/gui_classic/installwizard.py

@ -99,16 +99,6 @@ class InstallWizard(QDialog):
seed_e.setMaximumHeight(100) seed_e.setMaximumHeight(100)
vbox.addWidget(seed_e) vbox.addWidget(seed_e)
if is_restore:
grid = QGridLayout()
grid.setSpacing(8)
gap_e = AmountEdit(None, True)
gap_e.setText("5")
grid.addWidget(QLabel(_('Gap limit')), 2, 0)
grid.addWidget(gap_e, 2, 1)
grid.addWidget(HelpButton(_('Keep the default value unless you modified this parameter in your wallet.')), 2, 3)
vbox.addLayout(grid)
vbox.addLayout(ok_cancel_buttons(d, _('Next'))) vbox.addLayout(ok_cancel_buttons(d, _('Next')))
d.setLayout(vbox) d.setLayout(vbox)
@ -128,15 +118,8 @@ class InstallWizard(QDialog):
QMessageBox.warning(None, _('Error'), _('No seed'), _('OK')) QMessageBox.warning(None, _('Error'), _('No seed'), _('OK'))
return return
if not is_restore: return seed
return seed
else:
try:
gap = int(unicode(gap_e.text()))
except:
QMessageBox.warning(None, _('Error'), 'error', 'OK')
return
return seed, gap
def mpk_dialog(self): def mpk_dialog(self):
@ -156,11 +139,6 @@ class InstallWizard(QDialog):
grid = QGridLayout() grid = QGridLayout()
grid.setSpacing(8) grid.setSpacing(8)
gap_e = AmountEdit(None, True)
gap_e.setText("5")
grid.addWidget(QLabel(_('Gap limit')), 2, 0)
grid.addWidget(gap_e, 2, 1)
grid.addWidget(HelpButton(_('Keep the default value unless you modified this parameter in your wallet.')), 2, 3)
vbox.addLayout(grid) vbox.addLayout(grid)
vbox.addLayout(ok_cancel_buttons(d, _('Next'))) vbox.addLayout(ok_cancel_buttons(d, _('Next')))
@ -169,14 +147,7 @@ class InstallWizard(QDialog):
if not d.exec_(): return if not d.exec_(): return
mpk = str(mpk_e.toPlainText()) mpk = str(mpk_e.toPlainText())
return mpk
try:
gap = int(unicode(gap_e.text()))
except:
QMessageBox.warning(None, _('Error'), 'error', 'OK')
return
return mpk, gap
def network_dialog(self): def network_dialog(self):
@ -277,6 +248,10 @@ class InstallWizard(QDialog):
if not action: exit() if not action: exit()
wallet = Wallet(self.storage) wallet = Wallet(self.storage)
gap = self.config.get('gap_limit',5)
if gap !=5:
wallet.gap_limit = gap
wallet.storage.put('gap_limit', gap,True)
if action == 'create': if action == 'create':
wallet.init_seed(None) wallet.init_seed(None)
@ -291,25 +266,17 @@ class InstallWizard(QDialog):
elif action == 'restore': elif action == 'restore':
# ask for seed and gap. # ask for seed and gap.
sg = self.seed_dialog() seed = self.seed_dialog()
if not sg:
return
seed, gap = sg
if not seed: if not seed:
return return
wallet.gap_limit = gap
wallet.init_seed(str(seed)) wallet.init_seed(str(seed))
wallet.save_seed() wallet.save_seed()
elif action == 'watching': elif action == 'watching':
# ask for seed and gap. # ask for seed and gap.
sg = self.mpk_dialog() mpk = self.mpk_dialog()
if not sg:
return
mpk, gap = sg
if not mpk: if not mpk:
return return
wallet.gap_limit = gap
wallet.seed = '' wallet.seed = ''
print eval(mpk) print eval(mpk)

16
gui/gui_classic/main_window.py

@ -2019,22 +2019,6 @@ class ElectrumWindow(QMainWindow):
grid_wallet.addWidget(HelpButton(_('Using change addresses makes it more difficult for other people to track your transactions.')+' '), 1, 3) grid_wallet.addWidget(HelpButton(_('Using change addresses makes it more difficult for other people to track your transactions.')+' '), 1, 3)
if not self.config.is_modifiable('use_change'): usechange_cb.setEnabled(False) if not self.config.is_modifiable('use_change'): usechange_cb.setEnabled(False)
gap_label = QLabel(_('Gap limit'))
grid_wallet.addWidget(gap_label, 2, 0)
gap_e = AmountEdit(None,True)
gap_e.setText("%d"% self.wallet.gap_limit)
grid_wallet.addWidget(gap_e, 2, 2)
msg = _('The gap limit is the maximal number of contiguous unused addresses in your sequence of receiving addresses.') + '\n' \
+ _('You may increase it if you need more receiving addresses.') + '\n\n' \
+ _('Your current gap limit is') + ': %d'%self.wallet.gap_limit + '\n' \
+ _('Given the current status of your address sequence, the minimum gap limit you can use is:')+' ' + '%d'%self.wallet.min_acceptable_gap() + '\n\n' \
+ _('Warning') + ': ' \
+ _('The gap limit parameter must be provided in order to recover your wallet from seed.') + ' ' \
+ _('Do not modify it if you do not understand what you are doing, or if you expect to recover your wallet without knowing it!') + '\n\n'
grid_wallet.addWidget(HelpButton(msg), 2, 3)
if not self.config.is_modifiable('gap_limit'):
for w in [gap_e, gap_label]: w.setEnabled(False)
units = ['BTC', 'mBTC'] units = ['BTC', 'mBTC']
unit_label = QLabel(_('Base unit')) unit_label = QLabel(_('Base unit'))
grid_wallet.addWidget(unit_label, 3, 0) grid_wallet.addWidget(unit_label, 3, 0)

Loading…
Cancel
Save