don't show gap limit in GUI
authorthomasv <thomasv@gitorious>
Thu, 12 Sep 2013 14:08:17 +0000 (16:08 +0200)
committerthomasv <thomasv@gitorious>
Thu, 12 Sep 2013 14:08:17 +0000 (16:08 +0200)
electrum
gui/gui_classic/installwizard.py
gui/gui_classic/main_window.py

index 5f3978a..a731e4a 100755 (executable)
--- a/electrum
+++ b/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("-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("-G", "--gap", dest="gap_limit", default=None, help="gap limit")
     return parser
 
 
index a7454a2..7d2b13c 100644 (file)
@@ -99,16 +99,6 @@ class InstallWizard(QDialog):
         seed_e.setMaximumHeight(100)
         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')))
         d.setLayout(vbox) 
 
@@ -128,15 +118,8 @@ class InstallWizard(QDialog):
             QMessageBox.warning(None, _('Error'), _('No seed'), _('OK'))
             return
 
-        if not is_restore:
-            return seed
-        else:
-            try:
-                gap = int(unicode(gap_e.text()))
-            except:
-                QMessageBox.warning(None, _('Error'), 'error', 'OK')
-                return
-            return seed, gap
+        return seed
+
 
 
     def mpk_dialog(self):
@@ -156,11 +139,6 @@ class InstallWizard(QDialog):
 
         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')))
@@ -169,14 +147,7 @@ class InstallWizard(QDialog):
         if not d.exec_(): return
 
         mpk = str(mpk_e.toPlainText())
-
-        try:
-            gap = int(unicode(gap_e.text()))
-        except:
-            QMessageBox.warning(None, _('Error'), 'error', 'OK')
-            return
-
-        return mpk, gap
+        return mpk
 
 
     def network_dialog(self):
@@ -277,6 +248,10 @@ class InstallWizard(QDialog):
         if not action: exit()
 
         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':
             wallet.init_seed(None)
@@ -291,25 +266,17 @@ class InstallWizard(QDialog):
                 
         elif action == 'restore':
             # ask for seed and gap.
-            sg = self.seed_dialog()
-            if not sg:
-                return
-            seed, gap = sg
+            seed = self.seed_dialog()
             if not seed:
                 return
-            wallet.gap_limit = gap
             wallet.init_seed(str(seed))
             wallet.save_seed()
 
         elif action == 'watching':
             # ask for seed and gap.
-            sg = self.mpk_dialog()
-            if not sg:
-                return
-            mpk, gap = sg
+            mpk = self.mpk_dialog()
             if not mpk:
                 return
-            wallet.gap_limit = gap
             wallet.seed = ''
 
             print eval(mpk)
index 003cecc..42c3391 100644 (file)
@@ -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)
         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']
         unit_label = QLabel(_('Base unit'))
         grid_wallet.addWidget(unit_label, 3, 0)