def _import(self): self.loading_start() if not validate(self, lambda x: x, "Please input the password", self.password.value): self.loading_over() return if not validate(self, lambda x: x, "Please select a file", self.file.file): self.loading_over() return try: def exec_(): account = import_account(self.file.file, self.password.value) self.username.account = account def cb(status): self.imported.emit(status) if account: public_key = ECCipher.serialize_public_key( account.public_key) wallet.market_client.isRegistered(public_key).addCallbacks( cb) deferToThread(exec_) except Exception as e: logger.error(e) QMessageBox.information(self, "error", "Failed!") self.loading_over()
def enter(self): if not validate(self, lambda x: x, 'Please input username', self.username.value) or \ not validate(self, lambda x: x, 'No Account!', self.account): return self.hide() app.username = self.username.value app.event.emit(app.events.LOGIN_CLOSE) app.enterPDash(self.account)
def create(self): # Create Keystore if not validate(self, lambda x: x, "Please input password", self.password.value): return if not validate(self, lambda x: x, "Please repeat password", self.repeat.value): return if not validate(self, lambda x, y: x == y, "The passwords do not match", self.password.value, self.repeat.value): return if not validate(self, lambda x: x is True, "You haven't agreed to the agreement", self.check.value): return def _create(): self.username.account = create_account(self.password.value, self.PATH, self.NAME) deferToThread(_create).addCallback(lambda _: self.created.emit()) self.to(self.loading)