lino.core.callbacks

Callback handling

(This module's source code is available here.)

Functions

add_callback(ar, *msgs[, uid])

Returns an action callback which will initiate a dialog thread by asking a question to the user and suspending execution until the user's answer arrives in a next HTTP request.

applyCallbackChoice([resp, data, choice])

Looks up all other callback IDs from a previous responce as well as adds your new choice to the data for resending.

popCallBack(resp)

param resp

a dict which has some callback choices in it

set_callback(ar, cb)

Runs when confimation is requred, checks if answer is present in request data, if so, runs corisponding function Otherwise returns with data that will pop up a dialog.

Classes

Callback(ar, message[, uid])

A callback is a question that rose during an AJAX action.

CallbackChoice(name, func, label)

unused_CallbackManager()

class lino.core.callbacks.Callback(ar, message, uid=None)

Bases: object

A callback is a question that rose during an AJAX action. The original action is pending until we get a request that answers the question.

TODO: move all callback-related code out of lino.core.kernel into to a separate module and install it as a "kernel plugin" in a similar way as lino.core.web and lino.utils.config.

add_choice(name, func, label)

Add a possible answer to this callback. - name: "yes", "no", "ok" or "cancel" - func: a callable to be executed when user selects this choice - the label of the button

lino.core.callbacks.add_callback(ar, *msgs, uid=None)

Returns an action callback which will initiate a dialog thread by asking a question to the user and suspending execution until the user's answer arrives in a next HTTP request.

Calling this from an Action's run_from_ui method will interrupt the execution, send the specified message back to the client.

The client will display the prompt and do another request on the same action but with the given answer.

lino.core.callbacks.set_callback(ar, cb)

Runs when confimation is requred, checks if answer is present in request data, if so, runs corisponding function Otherwise returns with data that will pop up a dialog.

lino.core.callbacks.popCallBack(resp)
Parameters

resp -- a dict which has some callback choices in it

Returns

dict of all callback choices

lino.core.callbacks.applyCallbackChoice(resp={}, data={}, choice='yes')

Looks up all other callback IDs from a previous responce as well as adds your new choice to the data for resending. Used in testing