Bases: camelot.admin.action.base.ActionStep
An action has a set of attributes that define its appearance in the GUI.
The internal name of the action, this can be used to store preferences concerning the action in the settings
These attributes are used at the default values for the creation of a camelot.admin.action.base.State object that defines the appearance of the action button. Subclasses of Action that require dynamic values for these attributes can reimplement the Action.get_state method.
The name as displayed to the user, this should be of type camelot.core.utils.ugettext_lazy
The icon that represents the action, of type camelot.view.art.Icon
The tooltip as displayed to the user, this should be of type camelot.core.utils.ugettext_lazy
For each of these attributes there is a corresponding getter method which is used by the view. Subclasses of Action that require dynamic values for these attributes can reimplement the getter methods.
The shortcut that can be used to trigger the action, this should be of type camelot.core.utils.ugettext_lazy
An action has two important methods that can be reimplemented. These are model_run() for manipulations of the model and gui_run() for direct manipulations of the user interface without a need to access the model.
Returns: | a camelot.core.utils.ugettext_lazy, by default the |
---|
shortcut attribute
This method is called inside the Model thread to verify if the state of the action widget visible to the current user.
Parameters: | model_context – the context available in the Model thread |
---|---|
Returns: | an instance of camelot.action.base.State |
This method is called inside the GUI thread, by default it executes the model_run() in the Model thread.
Parameters: | gui_context – the context available in the GUI thread, of type GuiContext |
---|
Create a widget to trigger the action. Depending on the type of gui_context and parent, a different widget type might be returned.
Parameters: |
|
---|---|
Returns: | a QtGui.QWidget which when triggered will execute the gui_run() method. |
Bases: object
A reusable part of an action. Action step object can be yielded inside the model_run(). When this happens, their gui_run() method will be called inside the GUI thread. The gui_run() can pop up a dialog box or perform other GUI related tasks.
When the ActionStep is blocking, it will return control after the gui_run() is finished, and the return value of gui_run() will be the result of the yield statement.
When the ActionStep is not blocking, the yield statement will return immediately and the model_run() will not be blocked.
a boolean indicating if the ActionStep is blocking, defaults to True
This method is called in the GUI thread upon execution of the action step. The return value of this method is the result of the yield statement in the model thread.
The default behavior of this method is to call the model_run generator in the model thread until it is finished.
Parameters: | gui_context – An object of type camelot.admin.action.GuiContext, which is the context of this action available in the GUI thread. What is in the context depends on how the action was called. |
---|
this method will raise a camelot.core.exception.CancelRequest exception, if the user canceled the operation.
A generator that yields camelot.admin.action.ActionStep objects. This generator can be called in the model thread.
Parameters: | context – An object of type camelot.admin.action.ModelContext, which is context of this action available in the model_thread. What is in the context depends on how the action was called. |
---|
Bases: camelot.admin.action.base.GuiContext
The GUI context for an camelot.admin.action.Action. On top of the attributes of the camelot.admin.action.base.GuiContext, this context contains :
the the camelot.view.workspace.DesktopWorkspace of the application in which views can be opened or adapted.
the application admin.
alias of ApplicationActionModelContext
Bases: camelot.admin.action.base.Action
Call a method on all objects in a selection, and flush the session.
Parameters: |
|
---|
This action can be used either within list_actions or within form_actions.
Bases: camelot.admin.action.application_action.EntityAction
An application action that opens a new view of an Entity
Parameters: | entity_admin – an instance of camelot.admin.entity_admin.EntityAdmin to be used to visualize the entities |
---|
Returns: | a new view |
---|
Bases: camelot.admin.action.application_action.EntityAction
An application action that opens a TableView of an Entity
Parameters: | entity_admin – an instance of camelot.admin.entity_admin.EntityAdmin to be used to visualize the entities |
---|
Bases: object
The GUI context in which an action is running. This object can contain references to widgets and other usefull information. This object cannot contain reference to anything database or model related, as those belong strictly to the ModelContext
an instance of QtGui.QProgressDialog or None
the name of the mode in which the action was triggered
a subclass of ModelContext to be used in create_model_context() as the type of object to return.
Create a copy of the GuiContext, this function is used to create new GuiContext’s that are more specialized without modifying the original one.
Create a ModelContext filled with base information, extracted from this GuiContext. This function will be called in the GUI thread, so it should not access the model directly, but rather extract all information needed from te GUI to be available in the model.
Returns: | a ModelContext |
---|
alias of ModelContext
Bases: object
A mode is a way in which an action can be triggered, a print action could be triggered as ‘Export to PDF’ or ‘Export to Word’. None always represents the default mode.
a string representing the mode to the developer and the authentication system. this name will be used in the GuiContext
The name shown to the user
The icon of the mode
Create a QtGui.QAction that can be used to enable widget to trigger the action in a specific mode. The data attribute of the action will contain the name of the mode.
Returns: | a QtGui.QAction class to use this mode |
---|
Bases: object
A state represents the appearance and behavior of the widget that triggers the action. When the objects in the model change, the Action.get_state() method will be called, which should return the updated state for the widget.
The name of the action as it will appear in the button, this defaults to the verbose_name of the action.
The icon that represents the action, of type camelot.view.art.Icon, this defaults to the icon of the action.
The tooltip as displayed to the user, this should be of type camelot.core.utils.ugettext_lazy, this defaults to the tooltip op the action.
True if the widget should be enabled (the default), False otherwise
True if the widget should be visible (the default), False otherwise
True if the buttons should attract the attention of the user, defaults to False.
Bases: camelot.admin.action.base.GuiContext
The GUI context for an camelot.admin.action.Action. On top of the attributes of the camelot.admin.action.base.GuiContext, this context contains :
the the camelot.view.workspace.DesktopWorkspace of the application in which views can be opened or adapted.
the application admin.
alias of ApplicationActionModelContext
Bases: camelot.admin.action.base.ModelContext
The Model context for an camelot.admin.action.Action. On top of the attributes of the camelot.admin.action.base.ModelContext, this context contains :
the application admin.
Bases: camelot.admin.action.base.Action
Generic ApplicationAction that acts upon an Entity class
Bases: camelot.admin.action.application_action.EntityAction
An application action that opens a new view of an Entity
Parameters: | entity_admin – an instance of camelot.admin.entity_admin.EntityAdmin to be used to visualize the entities |
---|
Bases: camelot.admin.action.application_action.EntityAction
An application action that opens a TableView of an Entity
Parameters: | entity_admin – an instance of camelot.admin.entity_admin.EntityAdmin to be used to visualize the entities |
---|
Bases: camelot.admin.action.base.Action
Display the help window
Convert a python structure to an ApplicationAction
Parameters: | application_admin – the camelot.admin.application_admin.ApplicationAdmin to use to create other Admin classes. |
---|
Bases: camelot.admin.action.base.ActionStep
An action has a set of attributes that define its appearance in the GUI.
The internal name of the action, this can be used to store preferences concerning the action in the settings
These attributes are used at the default values for the creation of a camelot.admin.action.base.State object that defines the appearance of the action button. Subclasses of Action that require dynamic values for these attributes can reimplement the Action.get_state method.
The name as displayed to the user, this should be of type camelot.core.utils.ugettext_lazy
The icon that represents the action, of type camelot.view.art.Icon
The tooltip as displayed to the user, this should be of type camelot.core.utils.ugettext_lazy
For each of these attributes there is a corresponding getter method which is used by the view. Subclasses of Action that require dynamic values for these attributes can reimplement the getter methods.
The shortcut that can be used to trigger the action, this should be of type camelot.core.utils.ugettext_lazy
An action has two important methods that can be reimplemented. These are model_run() for manipulations of the model and gui_run() for direct manipulations of the user interface without a need to access the model.
Returns: | a camelot.core.utils.ugettext_lazy, by default the |
---|
shortcut attribute
This method is called inside the Model thread to verify if the state of the action widget visible to the current user.
Parameters: | model_context – the context available in the Model thread |
---|---|
Returns: | an instance of camelot.action.base.State |
This method is called inside the GUI thread, by default it executes the model_run() in the Model thread.
Parameters: | gui_context – the context available in the GUI thread, of type GuiContext |
---|
Create a widget to trigger the action. Depending on the type of gui_context and parent, a different widget type might be returned.
Parameters: |
|
---|---|
Returns: | a QtGui.QWidget which when triggered will execute the gui_run() method. |
Bases: object
A reusable part of an action. Action step object can be yielded inside the model_run(). When this happens, their gui_run() method will be called inside the GUI thread. The gui_run() can pop up a dialog box or perform other GUI related tasks.
When the ActionStep is blocking, it will return control after the gui_run() is finished, and the return value of gui_run() will be the result of the yield statement.
When the ActionStep is not blocking, the yield statement will return immediately and the model_run() will not be blocked.
a boolean indicating if the ActionStep is blocking, defaults to True
This method is called in the GUI thread upon execution of the action step. The return value of this method is the result of the yield statement in the model thread.
The default behavior of this method is to call the model_run generator in the model thread until it is finished.
Parameters: | gui_context – An object of type camelot.admin.action.GuiContext, which is the context of this action available in the GUI thread. What is in the context depends on how the action was called. |
---|
this method will raise a camelot.core.exception.CancelRequest exception, if the user canceled the operation.
A generator that yields camelot.admin.action.ActionStep objects. This generator can be called in the model thread.
Parameters: | context – An object of type camelot.admin.action.ModelContext, which is context of this action available in the model_thread. What is in the context depends on how the action was called. |
---|
Bases: object
The GUI context in which an action is running. This object can contain references to widgets and other usefull information. This object cannot contain reference to anything database or model related, as those belong strictly to the ModelContext
an instance of QtGui.QProgressDialog or None
the name of the mode in which the action was triggered
a subclass of ModelContext to be used in create_model_context() as the type of object to return.
Create a copy of the GuiContext, this function is used to create new GuiContext’s that are more specialized without modifying the original one.
Create a ModelContext filled with base information, extracted from this GuiContext. This function will be called in the GUI thread, so it should not access the model directly, but rather extract all information needed from te GUI to be available in the model.
Returns: | a ModelContext |
---|
alias of ModelContext
Bases: object
A mode is a way in which an action can be triggered, a print action could be triggered as ‘Export to PDF’ or ‘Export to Word’. None always represents the default mode.
a string representing the mode to the developer and the authentication system. this name will be used in the GuiContext
The name shown to the user
The icon of the mode
Bases: object
The Model context in which an action is running. The model context can contain reference to database sessions or other model related data. This object can not contain references to widgets as those belong strictly to the GuiContext.
the name of the mode in which the action was triggered
Bases: object
A state represents the appearance and behavior of the widget that triggers the action. When the objects in the model change, the Action.get_state() method will be called, which should return the updated state for the widget.
The name of the action as it will appear in the button, this defaults to the verbose_name of the action.
The icon that represents the action, of type camelot.view.art.Icon, this defaults to the icon of the action.
The tooltip as displayed to the user, this should be of type camelot.core.utils.ugettext_lazy, this defaults to the tooltip op the action.
True if the widget should be enabled (the default), False otherwise
True if the widget should be visible (the default), False otherwise
True if the buttons should attract the attention of the user, defaults to False.
Bases: camelot.admin.action.application_action.ApplicationActionGuiContext
The context for an Action on a form. On top of the attributes of the camelot.admin.action.application_action.ApplicationActionGuiContext, this context contains :
the QtGui.QDataWidgetMapper class that relates the form widget to the model.
alias of FormActionModelContext
Bases: camelot.admin.action.application_action.ApplicationActionModelContext
On top of the attributes of the camelot.admin.action.application_action.ApplicationActionModelContext, this context contains :
the row in the list that is currently displayed in the form
the number of objects that can be reached in the form.
the number of objects displayed in the form, at most 1.
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().
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 |
Returns: | the object currently displayed in the form, None if no object |
---|
is displayed yet
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. |
Bases: camelot.admin.action.base.Action
Call a method on all objects in a selection, and flush the session.
Parameters: |
|
---|
This action can be used either within list_actions or within form_actions.
Bases: camelot.admin.action.base.Action
Delete the selected rows in a table
Bases: camelot.admin.action.base.Action
Duplicate the selected rows in a table
Bases: camelot.admin.action.base.Action
Export all rows in a table to a word document
Bases: camelot.admin.action.base.Action
Export all rows in a table to a spreadsheet
Bases: camelot.admin.action.application_action.ApplicationActionGuiContext
The context for an Action on a table view. On top of the attributes of the camelot.admin.action.application_action.ApplicationActionGuiContext, this context contains :
the QtGui.QAbstractItemView class that relates to the table view on which the widget will be placed.
alias of ListActionModelContext
Bases: camelot.admin.action.application_action.ApplicationActionModelContext
On top of the attributes of the camelot.admin.action.application_action.ApplicationActionModelContext, this context contains :
the number of selected rows.
the number of rows in the list.
an ordered list with tuples of selected row ranges. the range is inclusive.
the current row in the list
The collection_count and selection_count attributes allow the model_run() to quickly evaluate the size of the collection or the selection without calling the potentially time consuming methods get_collection() and get_selection().
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 |
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 selected |
Bases: camelot.admin.action.base.Action
Open a form view for the current row of a list.
Bases: camelot.admin.action.base.Action
Print all rows in a table
Bases: camelot.admin.action.base.Action
Send all rows in a table by mail
Bases: camelot.admin.action.list_action.ToPreviousRow
Move to the first row in a table
Bases: camelot.admin.action.list_action.ToNextRow
Move to the last row in a table