-class Timer(QtCore.QThread):
- def run(self):
- while True:
- self.emit(QtCore.SIGNAL('timersignal'))
- time.sleep(0.5)
-
-class HelpButton(QPushButton):
- def __init__(self, text):
- QPushButton.__init__(self, '?')
- self.setFocusPolicy(Qt.NoFocus)
- self.setFixedWidth(20)
- self.clicked.connect(lambda: QMessageBox.information(self, 'Help', text, 'OK') )
-
-
-class EnterButton(QPushButton):
- def __init__(self, text, func):
- QPushButton.__init__(self, text)
- self.func = func
- self.clicked.connect(func)
-
- def keyPressEvent(self, e):
- if e.key() == QtCore.Qt.Key_Return:
- apply(self.func,())
class MyTreeWidget(QTreeWidget):
def __init__(self, parent):
-def waiting_dialog(f):
-
- s = Timer()
- s.start()
- w = QDialog()
- w.resize(200, 70)
- w.setWindowTitle('Electrum')
- l = QLabel('')
- vbox = QVBoxLayout()
- vbox.addWidget(l)
- w.setLayout(vbox)
- w.show()
- def ff():
- s = f()
- if s: l.setText(s)
- else: w.close()
- w.connect(s, QtCore.SIGNAL('timersignal'), ff)
- w.exec_()
- w.destroy()
-
import PyQt4.QtCore as QtCore
from i18n import _
-from electrum import Wallet, mnemonic
+from electrum import Wallet, mnemonic, WalletVerifier, WalletSynchronizer
+
from seed_dialog import SeedDialog
from network_dialog import NetworkDialog
from qt_util import *
+from amountedit import AmountEdit
+
+import sys
class InstallWizard(QDialog):
d.run()
- def restore_wallet(self):
- wallet = self.wallet
+ 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..."))
wallet.interface.poke('synchronizer')
waiting_dialog(waiting)
if wallet.is_found():
- print_error( "Recovery successful" )
+ QMessageBox.information(None, _('Information'), _("Recovery successful"), _('OK'))
else:
- QMessageBox.information(None, _('Error'), _("No transactions found for this seed"), _('OK'))
+ QMessageBox.information(None, _('Information'), _("No transactions found for this seed"), _('OK'))
return True
exit()
else:
# ask for seed and gap.
- sg = gui.seed_dialog()
+ sg = self.seed_dialog()
if not sg: exit()
seed, gap = sg
if not seed: exit()
self.config.set_key("server", None, True)
self.config.set_key('auto_cycle', False, True)
+ self.interface.start(wait = False)
+
+ # start wallet threads
+ verifier = WalletVerifier(self.interface, self.config)
+ verifier.start()
+ wallet.set_verifier(verifier)
+ synchronizer = WalletSynchronizer(wallet, self.config)
+ synchronizer.start()
+
+
# generate the first addresses, in case we are offline
if s is None or a == 'create':
wallet.synchronize()
if a == 'restore' and s is not None:
try:
- keep_it = gui.restore_wallet()
+ keep_it = self.restore_wallet(wallet)
wallet.fill_addressbook()
except:
import traceback
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import os.path
+import time
+
+
+class Timer(QThread):
+ def run(self):
+ while True:
+ self.emit(SIGNAL('timersignal'))
+ time.sleep(0.5)
+
+
+class EnterButton(QPushButton):
+ def __init__(self, text, func):
+ QPushButton.__init__(self, text)
+ self.func = func
+ self.clicked.connect(func)
+
+ def keyPressEvent(self, e):
+ if e.key() == Qt.Key_Return:
+ apply(self.func,())
+
+
+def waiting_dialog(f):
+
+ s = Timer()
+ s.start()
+ w = QDialog()
+ w.resize(200, 70)
+ w.setWindowTitle('Electrum')
+ l = QLabel('')
+ vbox = QVBoxLayout()
+ vbox.addWidget(l)
+ w.setLayout(vbox)
+ w.show()
+ def ff():
+ s = f()
+ if s: l.setText(s)
+ else: w.close()
+ w.connect(s, SIGNAL('timersignal'), ff)
+ w.exec_()
+ w.destroy()
+
+
+class HelpButton(QPushButton):
+ def __init__(self, text):
+ QPushButton.__init__(self, '?')
+ self.setFocusPolicy(Qt.NoFocus)
+ self.setFixedWidth(20)
+ self.clicked.connect(lambda: QMessageBox.information(self, 'Help', text, 'OK') )
+
+
def backup_wallet(path):
import shutil
o = self.get_account_addresses(-1, include_change)
for a in self.accounts.keys():
o += self.get_account_addresses(a, include_change)
+ o += self.first_addresses.values()
return o
def create_pending_accounts(self):
-
for account_type in ['1','2of2','2of3']:
a = self.new_account_address(account_type)
if self.address_is_old(a):