### Navigation

- index
- modules |
- Camelot documentation »

# action_steps Package

## `action_steps` Package

class `camelot.view.action_steps.``ChangeObject`(obj, admin=None)

  Bases: `camelot.admin.action.base.ActionStep`

  Pop up a form for the user to change an object

  Parameters: | obj – the object to change admin – an instance of an admin class to use to edit the object, None if the default is to be taken

  `get_object`()

    Use this method to get access to the object to change in unit tests

    Returns: | the object to change

  `gui_run`(gui_context)

class `camelot.view.action_steps.``ChangeObjects`(objects, admin)

  Bases: `camelot.admin.action.base.ActionStep`

  Pop up a list for the user to change objects

  Parameters: | objects – a list of objects to change admin – an instance of an admin class to use to edit the objects.

  `get_objects`()

    Use this method to get access to the objects to change in unit tests

    Returns: | the object to change

  `gui_run`(gui_context)

class `camelot.view.action_steps.``CreateObject`(obj)

  Bases: `camelot.admin.action.base.ActionStep`

  Inform the GUI that obj was created.

  Parameters: | obj – the object that was created

  `gui_run`(gui_context)

class `camelot.view.action_steps.``DeleteObject`(obj)

  Bases: `camelot.admin.action.base.ActionStep`

  Inform the GUI that obj is going to be deleted.

  Parameters: | obj – the object that is going to be deleted

  `gui_run`(gui_context)

class `camelot.view.action_steps.``FlushSession`(session)

  Bases: `camelot.admin.action.base.ActionStep`

  Flushes the session and informs the GUI about the changes.

  Parameters: | session – an instance of `sqlalchemy.orm.Session`

  `gui_run`(gui_context)

class `camelot.view.action_steps.``OpenFile`(path)

  Bases: `camelot.admin.action.base.ActionStep`

  Open a file with the preferred application from the user. The absolute path is preferred, as this is most likely to work when running from an egg and in all kinds of setups.

  Parameters: | path – the absolute path to the file to open

  The `yield` statement will return `True` if the file was opend successfull.

  classmethod `create_temporary_file`(suffix)

    Create a temporary filename that can be used to write to, and open later on.

    Parameters: | suffix – the suffix of the file to create
    Returns: | the filename of the temporary file

  `get_path`()

    Returns: | the path to the file that will be opened, use this method

    to verify the content of the file in unit tests

  `gui_run`(gui_context)

class `camelot.view.action_steps.``OpenFormView`(objects, admin)

  Bases: `camelot.admin.action.base.ActionStep`

  Open the form view for a list of objects, in a non blocking way :param objects: the list of objects to display in the form view :param admin: the admin class to use to display the form

  `blocking` = False
  `gui_run`(gui_context)

class `camelot.view.action_steps.``OpenJinjaTemplate`(environment, template, suffix='.txt', context={})

  Bases: `camelot.view.action_steps.open_file.OpenStream`

  Render a jinja template into a temporary file and open that file with the prefered application of the user.

  Parameters: | environment – a `jinja2.Environment` object to be used to load templates from. template – the name of the template as it can be fetched from the Jinja environment. suffix – the suffix of the temporary file to create, this will determine the application used to open the file. context – a dictionary with objects to be used when rendering the template

class `camelot.view.action_steps.``OpenStream`(stream, suffix='.txt')

  Bases: `camelot.view.action_steps.open_file.OpenFile`

  Write a stream to a temporary file and open that file with the preferred application of the user.

  Parameters: | stream – the stream to write to a file suffix – the suffix of the temporary file

class `camelot.view.action_steps.``OpenString`(string, suffix='.txt')

  Bases: `camelot.view.action_steps.open_file.OpenFile`

class `camelot.view.action_steps.``PrintHtml`(html)

  Bases: `camelot.view.action_steps.print_preview.PrintPreview`

  Display a print preview dialog box for an html string.

  Parameters: | html – a string containing the html to render in the print preview.

  the rendering of the html can be customised using the same attributes as those of the `PrintPreview` class.

class `camelot.view.action_steps.``PrintJinjaTemplate`(template, context={}, environment=<camelot.core.templates.environment>)

  Bases: `camelot.view.action_steps.print_preview.PrintHtml`

  Render a jinja template into a print preview dialog.

  Parameters: | template – the name of the template as it can be fetched from the Jinja environment. context – a dictionary with objects to be used when rendering the template environment – a `jinja2.Environment` object to be used to load templates from. This defaults to the environment object available in `camelot.core.templates`

class `camelot.view.action_steps.``PrintPreview`(document)

  Bases: `camelot.admin.action.base.ActionStep`

  Display a print preview dialog box.

  Parameters: | document – an instance of `QtGui.QTextDocument` or `QtWebKit.QWebView` that has a `print_()` method. The thread affinity of this object will be changed to be able to use it in the GUI.

  the print preview can be customised using these attributes :

  `page_size`

    the page size, by default `QtGui.QPrinter.A4` is used

  `page_orientation`

    the page orientation, by default `QtGui.QPrinter.Portrait` is used.

  `gui_run`(gui_context)
  `paint_on_printer`(printer)
  `render`()

    create the print preview widget. this method is used to unit test the action step.

class `camelot.view.action_steps.``Refresh`

  Bases: `camelot.admin.action.base.ActionStep`

  Refresh all the open screens on the desktop, this will reload queries from the database

  `gui_run`(gui_context)

class `camelot.view.action_steps.``SelectFile`(file_name_filter='')

  Bases: `camelot.admin.action.base.ActionStep`

  Select one or more files to open or to process.

  Parameters: | file_name_filter – Filter on the names of the files that can be selected, such as ‘All files (*)’. See `QtGui.QFileDialog` for more documentation.

  `single`

    defaults to `True`, set to `False` if selection of multiple files is allowed

  `existing`

    defaults to `True`, set to `False` if non existing files are allowed (to save something)

  The `yield` statement of `SelectFile` returns a list of selected file names. This list has only one element when single is set to `True`. Raises a `camelot.core.exception.CancelRequest` when no file was selected.

  `gui_run`(gui_context)
  `render`()

    create the file dialog widget. this method is used to unit test the action step.

class `camelot.view.action_steps.``ShowChart`(chart)

  Bases: `camelot.admin.action.base.ActionStep`

  Show a full screen chart.

  Parameters: | chart – a `camelot.core.container.FigureContainer` or `camelot.core.container.AxesContainer`

  `gui_run`(gui_context)

class `camelot.view.action_steps.``ShowPixmap`(pixmap)

  Bases: `camelot.admin.action.base.ActionStep`

  Show a full screen pixmap

  Parameters: | pixmap – a `camelot.view.art.Pixmap` object

  `gui_run`(gui_context)

class `camelot.view.action_steps.``UpdateObject`(obj)

  Bases: `camelot.admin.action.base.ActionStep`

  Inform the GUI that obj has changed.

  Parameters: | obj – the object that has changed

  `gui_run`(gui_context)

class `camelot.view.action_steps.``UpdateProgress`(value=0, maximum=0, text=None, detail=None, clear_details=False)

  Bases: `camelot.admin.action.base.ActionStep`

  Inform the user about the progress the application is making while executing an action. This ActionStep is not blocking. So it can be used inside transactions and will result in a minimum of delay when yielded. Each time an object is yielded, the progress dialog will be updated.

  Parameters: | value – the current step maximum – the maximum number of steps that will be executed. set it to 0 to display a busy indicator instead of a progres bar text – the text to be displayed inside the progres bar detail – the text to be displayed below the progres bar, this text is appended to the text already there clear_details – clear the details text already there before putting the new detail text.

  `blocking` = False
  `gui_run`(gui_context)

    This method will update the progress dialog, if such dialog exists within the GuiContext

    Parameters: | gui_context – a `camelot.admin.action.GuiContext` instance

## `change_object` Module

class `camelot.view.action_steps.change_object.``ChangeObject`(obj, admin=None)

  Bases: `camelot.admin.action.base.ActionStep`

  Pop up a form for the user to change an object

  Parameters: | obj – the object to change admin – an instance of an admin class to use to edit the object, None if the default is to be taken

  `get_object`()

    Use this method to get access to the object to change in unit tests

    Returns: | the object to change

  `gui_run`(gui_context)

class `camelot.view.action_steps.change_object.``ChangeObjectDialog`(obj, admin, title=_('Please complete'), subtitle=_('Complete the form and press the OK button'), icon=Icon('tango/22x22/categories/preferences-system.png'), parent=None, flags=<PyQt4.QtCore.WindowFlags object at 0xaac74fc>)

  Bases: `camelot.view.controls.standalone_wizard_page.StandaloneWizardPage`

  A dialog to change an object. This differs from a FormView in that it does not contains Actions, and has an OK button that is enabled when the object is valid.

  Parameters: | obj – The object to change admin – The admin class used to create a form

class `camelot.view.action_steps.change_object.``ChangeObjects`(objects, admin)

  Bases: `camelot.admin.action.base.ActionStep`

  Pop up a list for the user to change objects

  Parameters: | objects – a list of objects to change admin – an instance of an admin class to use to edit the objects.

  `get_objects`()

    Use this method to get access to the objects to change in unit tests

    Returns: | the object to change

  `gui_run`(gui_context)

class `camelot.view.action_steps.change_object.``ChangeObjectsDialog`(objects, admin, parent=None, flags=<PyQt4.QtCore.WindowFlags object at 0xaac75dc>)

  Bases: `camelot.view.controls.standalone_wizard_page.StandaloneWizardPage`

  A dialog to change a list of objects. This differs from a ListView in that it does not contains Actions, and has an OK button that is enabled when all objects are valid.

  Parameters: | objects – The object to change admin – The admin class used to create a form

  `update_complete`(row=0)
  `validate_all_rows`()

## `gui` Module

Various `ActionStep` subclasses that manipulate the GUI of the application.

class `camelot.view.action_steps.gui.``OpenFormView`(objects, admin)

  Bases: `camelot.admin.action.base.ActionStep`

  Open the form view for a list of objects, in a non blocking way :param objects: the list of objects to display in the form view :param admin: the admin class to use to display the form

  `blocking` = False
  `gui_run`(gui_context)

class `camelot.view.action_steps.gui.``Refresh`

  Bases: `camelot.admin.action.base.ActionStep`

  Refresh all the open screens on the desktop, this will reload queries from the database

  `gui_run`(gui_context)

class `camelot.view.action_steps.gui.``ShowChart`(chart)

  Bases: `camelot.admin.action.base.ActionStep`

  Show a full screen chart.

  Parameters: | chart – a `camelot.core.container.FigureContainer` or `camelot.core.container.AxesContainer`

  `gui_run`(gui_context)

class `camelot.view.action_steps.gui.``ShowPixmap`(pixmap)

  Bases: `camelot.admin.action.base.ActionStep`

  Show a full screen pixmap

  Parameters: | pixmap – a `camelot.view.art.Pixmap` object

  `gui_run`(gui_context)

## `open_file` Module

class `camelot.view.action_steps.open_file.``OpenFile`(path)

  Bases: `camelot.admin.action.base.ActionStep`

  Open a file with the preferred application from the user. The absolute path is preferred, as this is most likely to work when running from an egg and in all kinds of setups.

  Parameters: | path – the absolute path to the file to open

  The `yield` statement will return `True` if the file was opend successfull.

  classmethod `create_temporary_file`(suffix)

    Create a temporary filename that can be used to write to, and open later on.

    Parameters: | suffix – the suffix of the file to create
    Returns: | the filename of the temporary file

  `get_path`()

    Returns: | the path to the file that will be opened, use this method

    to verify the content of the file in unit tests

  `gui_run`(gui_context)

class `camelot.view.action_steps.open_file.``OpenJinjaTemplate`(environment, template, suffix='.txt', context={})

  Bases: `camelot.view.action_steps.open_file.OpenStream`

  Render a jinja template into a temporary file and open that file with the prefered application of the user.

  Parameters: | environment – a `jinja2.Environment` object to be used to load templates from. template – the name of the template as it can be fetched from the Jinja environment. suffix – the suffix of the temporary file to create, this will determine the application used to open the file. context – a dictionary with objects to be used when rendering the template

class `camelot.view.action_steps.open_file.``OpenStream`(stream, suffix='.txt')

  Bases: `camelot.view.action_steps.open_file.OpenFile`

  Write a stream to a temporary file and open that file with the preferred application of the user.

  Parameters: | stream – the stream to write to a file suffix – the suffix of the temporary file

class `camelot.view.action_steps.open_file.``OpenString`(string, suffix='.txt')

  Bases: `camelot.view.action_steps.open_file.OpenFile`

## `orm` Module

Various `ActionStep` subclasses that inform the GUI of changes in the model.

class `camelot.view.action_steps.orm.``CreateObject`(obj)

  Bases: `camelot.admin.action.base.ActionStep`

  Inform the GUI that obj was created.

  Parameters: | obj – the object that was created

  `gui_run`(gui_context)

class `camelot.view.action_steps.orm.``DeleteObject`(obj)

  Bases: `camelot.admin.action.base.ActionStep`

  Inform the GUI that obj is going to be deleted.

  Parameters: | obj – the object that is going to be deleted

  `gui_run`(gui_context)

class `camelot.view.action_steps.orm.``FlushSession`(session)

  Bases: `camelot.admin.action.base.ActionStep`

  Flushes the session and informs the GUI about the changes.

  Parameters: | session – an instance of `sqlalchemy.orm.Session`

  `gui_run`(gui_context)

class `camelot.view.action_steps.orm.``UpdateObject`(obj)

  Bases: `camelot.admin.action.base.ActionStep`

  Inform the GUI that obj has changed.

  Parameters: | obj – the object that has changed

  `gui_run`(gui_context)

## `print_preview` Module

class `camelot.view.action_steps.print_preview.``PrintHtml`(html)

  Bases: `camelot.view.action_steps.print_preview.PrintPreview`

  Display a print preview dialog box for an html string.

  Parameters: | html – a string containing the html to render in the print preview.

  the rendering of the html can be customised using the same attributes as those of the `PrintPreview` class.

class `camelot.view.action_steps.print_preview.``PrintJinjaTemplate`(template, context={}, environment=<camelot.core.templates.environment>)

  Bases: `camelot.view.action_steps.print_preview.PrintHtml`

  Render a jinja template into a print preview dialog.

  Parameters: | template – the name of the template as it can be fetched from the Jinja environment. context – a dictionary with objects to be used when rendering the template environment – a `jinja2.Environment` object to be used to load templates from. This defaults to the environment object available in `camelot.core.templates`

class `camelot.view.action_steps.print_preview.``PrintPreview`(document)

  Bases: `camelot.admin.action.base.ActionStep`

  Display a print preview dialog box.

  Parameters: | document – an instance of `QtGui.QTextDocument` or `QtWebKit.QWebView` that has a `print_()` method. The thread affinity of this object will be changed to be able to use it in the GUI.

  the print preview can be customised using these attributes :

  `page_size`

    the page size, by default `QtGui.QPrinter.A4` is used

  `page_orientation`

    the page orientation, by default `QtGui.QPrinter.Portrait` is used.

  `gui_run`(gui_context)
  `paint_on_printer`(printer)
  `render`()

    create the print preview widget. this method is used to unit test the action step.

## `select_file` Module

class `camelot.view.action_steps.select_file.``SelectFile`(file_name_filter='')

  Bases: `camelot.admin.action.base.ActionStep`

  Select one or more files to open or to process.

  Parameters: | file_name_filter – Filter on the names of the files that can be selected, such as ‘All files (*)’. See `QtGui.QFileDialog` for more documentation.

  `single`

    defaults to `True`, set to `False` if selection of multiple files is allowed

  `existing`

    defaults to `True`, set to `False` if non existing files are allowed (to save something)

  The `yield` statement of `SelectFile` returns a list of selected file names. This list has only one element when single is set to `True`. Raises a `camelot.core.exception.CancelRequest` when no file was selected.

  `gui_run`(gui_context)
  `render`()

    create the file dialog widget. this method is used to unit test the action step.

## `update_progress` Module

class `camelot.view.action_steps.update_progress.``UpdateProgress`(value=0, maximum=0, text=None, detail=None, clear_details=False)

  Bases: `camelot.admin.action.base.ActionStep`

  Inform the user about the progress the application is making while executing an action. This ActionStep is not blocking. So it can be used inside transactions and will result in a minimum of delay when yielded. Each time an object is yielded, the progress dialog will be updated.

  Parameters: | value – the current step maximum – the maximum number of steps that will be executed. set it to 0 to display a busy indicator instead of a progres bar text – the text to be displayed inside the progres bar detail – the text to be displayed below the progres bar, this text is appended to the text already there clear_details – clear the details text already there before putting the new detail text.

  `blocking` = False
  `gui_run`(gui_context)

    This method will update the progress dialog, if such dialog exists within the GuiContext

    Parameters: | gui_context – a `camelot.admin.action.GuiContext` instance

### Navigation

- index
- modules |
- Camelot documentation »

Comments
blog comments powered by Disqus