don't show gap limit in GUI
[electrum-nvc.git] / gui / gui_classic / installwizard.py
index 8157936..7d2b13c 100644 (file)
@@ -1,8 +1,8 @@
 from PyQt4.QtGui import *
 from PyQt4.QtCore import *
 import PyQt4.QtCore as QtCore
-from i18n import _
 
+from electrum.i18n import _
 from electrum import Wallet, mnemonic
 
 from seed_dialog import SeedDialog
@@ -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):
@@ -242,17 +213,16 @@ class InstallWizard(QDialog):
     def restore_wallet(self, wallet):
 
         # wait until we are connected, because the user might have selected another server
-        if not wallet.interface.is_connected:
-            waiting = lambda: False if wallet.interface.is_connected else "%s \n" % (_("Connecting..."))
+        if not self.network.interface.is_connected:
+            waiting = lambda: False if self.network.interface.is_connected else "%s \n" % (_("Connecting..."))
             waiting_dialog(waiting)
 
         waiting = lambda: False if wallet.is_up_to_date() else "%s\n%s %d\n%s %.1f"\
-            %(_("Please wait..."),_("Addresses generated:"),len(wallet.addresses(True)),_("Kilobytes received:"), wallet.interface.bytes_received/1024.)
+            %(_("Please wait..."),_("Addresses generated:"),len(wallet.addresses(True)),_("Kilobytes received:"), self.network.interface.bytes_received/1024.)
 
         # try to restore old account
         wallet.create_old_account()
         wallet.set_up_to_date(False)
-        wallet.interface.poke('synchronizer')
         waiting_dialog(waiting)
 
         if wallet.is_found():
@@ -262,7 +232,6 @@ class InstallWizard(QDialog):
             wallet.accounts.pop(0)
             wallet.create_accounts()
             wallet.set_up_to_date(False)
-            wallet.interface.poke('synchronizer')
             waiting_dialog(waiting)
 
         if wallet.is_found():
@@ -279,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)
@@ -293,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)