form_action

class camelot.admin.action.form_action.CloseForm[source]

Validte the form can be closed, and close it

class camelot.admin.action.form_action.FormActionGuiContext[source]

The context for an Action on a form. On top of the attributes of the camelot.admin.action.application_action.ApplicationActionGuiContext, this context contains :

widget_mapper

the QtGui.QDataWidgetMapper class that relates the form widget to the model.

view

a camelot.view.controls.view.AbstractView class that represents the view in which the action is triggered.

model_context

alias of FormActionModelContext

class camelot.admin.action.form_action.FormActionModelContext[source]

On top of the attributes of the camelot.admin.action.application_action.ApplicationActionModelContext, this context contains :

current_row

the row in the list that is currently displayed in the form

collection_count

the number of objects that can be reached in the form.

selection_count

the number of objects displayed in the form, at most 1.

session

The session to which the objects in the list belong.

The selection_count attribute allows the model_run() to quickly evaluate the size of the collection without calling the potetially time consuming method get_collection().

get_collection(yield_per=None)[source]
Parameters:yield_per – an integer number giving a hint on how many objects should fetched from the database at the same time.
Returns:a generator over the objects in the list
get_object()[source]
Returns:the object currently displayed in the form, None if no object

is displayed yet

get_selection(yield_per=None)[source]

Method to be compatible with a camelot.admin.action.list_action.ListActionModelContext, this allows creating a single Action to be used on a form and on list.

Parameters:yield_per – this parameter has no effect, it’s here only for compatibility with camelot.admin.action.list_action.ListActionModelContext.get_selection()
Returns:a generator that yields the current object displayed in the form and does not yield anything if no object is displayed yet in the form.
class camelot.admin.action.form_action.ToFirstForm[source]

Move to the form

class camelot.admin.action.form_action.ToLastForm[source]

Move to the last form

class camelot.admin.action.form_action.ToNextForm[source]

Move to the next form

class camelot.admin.action.form_action.ToPreviousForm[source]

Move to the previous form

camelot.admin.action.form_action.structure_to_form_actions(structure)[source]

Convert a list of python objects to a list of form actions. If the python object is a tuple, a CallMethod is constructed with this tuple as arguments. If the python object is an instance of as Action, it is kept as is.

Previous topic

document_action

Next topic

list_action

This Page