def sign_tx_with_password(
        self,
        tx: PartialTransaction,
        *,
        callback,
        password,
        external_keypairs: Mapping[bytes, bytes] = None,
    ):
        '''Sign the transaction in a separate thread.  When done, calls
        the callback with a success code of True or False.
        '''

        def on_success(result):
            callback(True)
        def on_failure(exc_info):
            self.on_error(exc_info)
            callback(False)
        on_success = run_hook('tc_sign_wrapper', self.wallet, tx, on_success, on_failure) or on_success
        if external_keypairs:
            # can sign directly
            task = partial(tx.sign, external_keypairs)
        else:
            # ignore_warnings=True, because UI checks and asks user confirmation itself
            task = partial(self.wallet.sign_transaction, tx, password, ignore_warnings=True)
        msg = _('Signing transaction...')
        WaitingDialog(self, msg, task, on_success, on_failure)
Sign the transaction in a separate thread.  When done, calls
        the callback with a success code of True or False.
        
electrum/gui/qt/main_window.py