def load_wallet_file(self, filename): try: storage = WalletStorage(filename) except Exception as e: QMessageBox.information(None, _('Error'), str(e), _('OK')) return if not storage.file_exists: recent = self.config.get('recently_open', []) if filename in recent: recent.remove(filename) self.config.set_key('recently_open', recent) action = 'new' else: try: wallet = Wallet(storage) except BaseException as e: traceback.print_exc(file=sys.stdout) QMessageBox.warning(None, _('Warning'), str(e), _('OK')) return action = wallet.get_action() # run wizard if action is not None: wizard = InstallWizard(self.config, self.network, storage) wallet = wizard.run(action) # keep current wallet if not wallet: return else: wallet.start_threads(self.network) return wallet
def load_wallet_file(self, filename): try: storage = WalletStorage(filename) except Exception as e: QMessageBox.information(None, _('Error'), str(e), _('OK')) return if not storage.file_exists: recent = self.config.get('recently_open', []) if filename in recent: recent.remove(filename) self.config.set_key('recently_open', recent) action = 'new' else: try: wallet = Wallet(storage) except BaseException as e: traceback.print_exc(file=sys.stdout) QMessageBox.warning(None, _('Warning'), str(e), _('OK')) return action = wallet.get_action() # run wizard if action is not None: wizard = InstallWizard(self.app, self.config, self.network, storage) wallet = wizard.run(action) # keep current wallet if not wallet: return else: wallet.start_threads(self.network) return wallet
def new_wallet(self): wallet_folder = self.get_wallet_folder() i = 1 while True: filename = "wallet_%d"%i if filename in os.listdir(wallet_folder): i += 1 else: break filename = line_dialog(None, _('New Wallet'), _('Enter file name') + ':', _('OK'), filename) if not filename: return full_path = os.path.join(wallet_folder, filename) storage = WalletStorage(full_path) if storage.file_exists: QMessageBox.critical(None, "Error", _("File exists")) return wizard = InstallWizard(self.app, self.config, self.network, storage) wallet = wizard.run('new') if wallet: self.new_window(full_path)