Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
lino.core.callbacks¶
Callback handling
Functions
|
Returns an action callback that 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. |
|
Looks up all other callback IDs from a previous responce as well as adds your new choice to the data for resending. |
|
|
|
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
|
A callback is a question that rose during an action. |
|
|
|
- class lino.core.callbacks.Callback(ar, message, uid=None)¶
Bases:
object
A callback is a question that rose during an action. The action’s execution is pending until we get a request that answers the question.
- 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 that 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