def run(self, action = None): if action is None: action = self.restore_or_create() if action is None: return if action == 'create': t = self.choose_wallet_type() if t == '2of3': run_hook('create_cold_seed', self.storage, self) return if action in ['create', 'create2of3']: wallet = Wallet(self.storage) wallet.init_seed(None) seed = wallet.get_mnemonic(None) if not self.show_seed(seed, 'hot' if action == 'create2of3' else None): return if not self.verify_seed(seed): return ok, old_password, password = self.password_dialog(wallet) wallet.save_seed(password) if action == 'create2of3': run_hook('create_hot_seed', wallet, self) wallet.create_accounts(password) def create(): wallet.synchronize() # generate first addresses offline self.waiting_dialog(create) elif action == 'restore': seed = self.seed_dialog() if not Wallet.is_seed(seed): return wallet = Wallet.from_seed(seed, self.storage) ok, old_password, password = self.password_dialog(wallet) wallet.save_seed(password) wallet.create_accounts(password) elif action == 'watching': mpk = self.mpk_dialog() if not mpk: return wallet = Wallet.from_mpk(mpk, self.storage) else: raise #if not self.config.get('server'): if self.network: if self.network.interfaces: self.network_dialog() else: QMessageBox.information(None, _('Warning'), _('You are offline'), _('OK')) self.network.stop() self.network = None # start wallet threads wallet.start_threads(self.network) if action == 'restore': self.waiting_dialog(lambda: wallet.restore(self.waiting_label.setText)) if self.network: if wallet.is_found(): QMessageBox.information(None, _('Information'), _("Recovery successful"), _('OK')) else: QMessageBox.information(None, _('Information'), _("No transactions found for this seed"), _('OK')) else: QMessageBox.information(None, _('Information'), _("This wallet was restored offline. It may contain more addresses than displayed."), _('OK')) return wallet