view Package — Camelot documentation

### Navigation

- index
- modules |
- Camelot documentation »

# view Package

## `view` Package

## `action` Module

The action module contains various QAction classes, representing commands that can be invoked via menus, toolbar buttons, and keyboard shortcuts.

class `camelot.view.action.` `ActionFactory`

  Bases: `object`

  Utility class to generate some default actions we need in several places.

  Each method of this class, returns a certain action with a default text, icon and shortcut.

  classmethod `about`(parent, slot, **kwargs)
  classmethod `affiliated_website`(parent, slot, **kwargs)
  classmethod `backup`(parent, slot, **kwargs)
  classmethod `copy`(parent, slot, **kwargs)
  classmethod `create_action`(*a, **kw)

    creates and returns a QAction object

  classmethod `delete`(parent, slot, **kwargs)
  classmethod `duplicate`(parent, slot, **kwargs)
  classmethod `exit`(parent, slot, **kwargs)
  classmethod `export_excel`(parent, slot, **kwargs)
  classmethod `export_mail`(parent, slot, **kwargs)
  classmethod `export_ooxml`(parent, slot, **kwargs)
  classmethod `export_word`(parent, slot, **kwargs)
  classmethod `help`(parent, slot, **kwargs)
  `icon_backup` = Icon('tango/16x16/actions/document-save.png')
  `icon_copy` = Icon('tango/16x16/actions/edit-copy.png')
  `icon_delete` = Icon('tango/16x16/places/user-trash.png')
  `icon_excel` = Icon('tango/16x16/mimetypes/x-office-spreadsheet.png')
  `icon_help` = Icon('tango/16x16/apps/help-browser.png')
  `icon_import` = Icon('tango/16x16/mimetypes/text-x-generic.png')
  `icon_mail` = Icon('tango/16x16/actions/mail-message-new.png')
  `icon_new` = Icon('tango/16x16/actions/document-new.png')
  `icon_pgsetup` = Icon('tango/16x16/actions/document-properties.png')
  `icon_preview` = Icon('tango/16x16/actions/document-print-preview.png')
  `icon_print` = Icon('tango/16x16/actions/document-print.png')
  `icon_restore` = Icon('tango/16x16/devices/drive-harddisk.png')
  `icon_word` = Icon('tango/16x16/mimetypes/x-office-document.png')
  classmethod `import_file`(parent, slot, **kwargs)
  classmethod `merge_document`(parent, slot, **kwargs)
  classmethod `new`(parent, slot, **kwargs)
  classmethod `new_tab`(parent, slot, **kwargs)
  classmethod `page_setup`(parent, slot, **kwargs)
  classmethod `paste`(parent, slot, **kwargs)
  classmethod `print_`(parent, slot, **kwargs)
  classmethod `print_preview`(parent, slot, **kwargs)
  classmethod `refresh`(parent, slot, **kwargs)
  classmethod `remote_support`(parent, slot, **kwargs)
  classmethod `restore`(parent, slot, **kwargs)
  classmethod `select_all`(parent, slot, **kwargs)
  classmethod `update_values`(parent, slot, **kwargs)
  classmethod `view_first`(parent, slot, **kwargs)
  classmethod `view_last`(parent, slot, **kwargs)
  classmethod `view_next`(parent, slot, **kwargs)
  classmethod `view_previous`(parent, slot, **kwargs)
  classmethod `whats_new`(parent, slot, **kwargs)

## `action_runner` Module

class `camelot.view.action_runner.` `ActionRunner`(generator_function, gui_context)

  Bases: `PyQt4.QtCore.QEventLoop`

  Helper class for handling the signals and slots when an action is running. This class takes a generator and iterates it within the model thread while taking care of Exceptions raised and ActionSteps yielded by the generator.

  This is class is intended for internal Camelot use only.

  `exception`(exception_info)

    Handle an exception raised by the generator

  `exec_`(flags=0)

    Reimplementation of exec_ to prevent the event loop being started when exit has been called prior to calling exec_.

    This can be the case when running in single threaded mode.

  `exit`(return_code=0)

    Reimplementation of exit to store the return code

  `generator`(generator)

    Handle the creation of the generator

  `next`(yielded)

    Handle the result of the next call of the generator

    Parameters: | yielded – the object that was yielded by the generator in the model thread

  `non_blocking_action_step`(action_step)
  `non_blocking_action_step_signal`

## `art` Module

Manages icons and artworks

class `camelot.view.art.` `ColorScheme`

  Bases: `object`

  The default color scheme for camelot, based on the Tango icon set see http://tango.freedesktop.org/Generic_Icon_Theme_Guidelines

  `NOTIFICATION` = <PyQt4.QtGui.QColor object at 0x954c09c>

    for consistency with QT: Qt::white 3 White (#ffffff) Qt::black 2 Black (#000000) Qt::red 7 Red (#ff0000) Qt::darkRed 13 Dark red (#800000) Qt::green 8 Green (#00ff00) Qt::darkGreen 14 Dark green (#008000) Qt::blue 9 Blue (#0000ff) Qt::darkBlue 15 Dark blue () Qt::cyan 10 Cyan (#00ffff) Qt::darkCyan 16 Dark cyan (#008080) Qt::magenta 11 Magenta (#ff00ff) Qt::darkMagenta 17 Dark magenta (#800080) Qt::yellow 12 Yellow (#ffff00) Qt::darkYellow 18 Dark yellow (#808000) Qt::gray 5 Gray (#a0a0a4) Qt::darkGray 4 Dark gray (#808080) Qt::lightGray 6 Light gray (#c0c0c0) Qt::transparent 19 a transparent black value (i.e., QColor(0, 0, 0, 0)) Qt::color0 0 0 pixel value (for bitmaps) Qt::color1 1 1 pixel value (for bitmaps)

  `VALIDATION_ERROR` = <PyQt4.QtGui.QColor object at 0x954c2cc>
  `aluminium` = <PyQt4.QtGui.QColor object at 0x954c56c>
  `aluminium_0` = <PyQt4.QtGui.QColor object at 0x954c56c>
  `aluminium_1` = <PyQt4.QtGui.QColor object at 0x954c5a4>
  `aluminium_2` = <PyQt4.QtGui.QColor object at 0x954c5dc>
  `blue` = <PyQt4.QtGui.QColor object at 0x954c374>
  `blue_0` = <PyQt4.QtGui.QColor object at 0x954c374>
  `blue_1` = <PyQt4.QtGui.QColor object at 0x954c3ac>
  `brown_1` = <PyQt4.QtGui.QColor object at 0x954c1ec>
  `brown_2` = <PyQt4.QtGui.QColor object at 0x954c224>
  `brown_3` = <PyQt4.QtGui.QColor object at 0x954c25c>
  `cyan` = <PyQt4.QtGui.QColor object at 0x954c41c>
  `cyan_0` = <PyQt4.QtGui.QColor object at 0x954c41c>
  `cyan_1` = <PyQt4.QtGui.QColor object at 0x954c454>
  `green` = <PyQt4.QtGui.QColor object at 0x954c3e4>
  `green_0` = <PyQt4.QtGui.QColor object at 0x954c3e4>
  `grey` = <PyQt4.QtGui.QColor object at 0x954c614>
  `grey_0` = <PyQt4.QtGui.QColor object at 0x954c614>
  `grey_1` = <PyQt4.QtGui.QColor object at 0x954c64c>
  `grey_2` = <PyQt4.QtGui.QColor object at 0x954c684>
  `grey_3` = <PyQt4.QtGui.QColor object at 0x954c6bc>
  `grey_4` = <PyQt4.QtGui.QColor object at 0x954c6f4>
  `magenta` = <PyQt4.QtGui.QColor object at 0x954c48c>
  `magenta_0` = <PyQt4.QtGui.QColor object at 0x954c48c>
  `magenta_1` = <PyQt4.QtGui.QColor object at 0x954c4c4>
  `orange_1` = <PyQt4.QtGui.QColor object at 0x954c144>
  `orange_2` = <PyQt4.QtGui.QColor object at 0x954c17c>
  `orange_3` = <PyQt4.QtGui.QColor object at 0x954c1b4>
  `pink_1` = <PyQt4.QtGui.QColor object at 0x954c4fc>
  `pink_2` = <PyQt4.QtGui.QColor object at 0x954c534>
  `red` = <PyQt4.QtGui.QColor object at 0x954c294>
  `red_0` = <PyQt4.QtGui.QColor object at 0x954c294>
  `red_1` = <PyQt4.QtGui.QColor object at 0x954c2cc>
  `red_2` = <PyQt4.QtGui.QColor object at 0x954c304>
  `red_3` = <PyQt4.QtGui.QColor object at 0x954c33c>
  `yellow` = <PyQt4.QtGui.QColor object at 0x954c064>
  `yellow_0` = <PyQt4.QtGui.QColor object at 0x954c064>
  `yellow_1` = <PyQt4.QtGui.QColor object at 0x954c09c>
  `yellow_2` = <PyQt4.QtGui.QColor object at 0x954c0d4>
  `yellow_3` = <PyQt4.QtGui.QColor object at 0x954c10c>

class `camelot.view.art.` `Icon`(path, module=None)

  Bases: `camelot.view.art.Pixmap`

  Manages paths to the icons images

  `getQIcon`(*args, **kwargs)

    QPixmaps can only be used in the gui thread

class `camelot.view.art.` `Pixmap`(path, module=None)

  Bases: `object`

  Load pixmaps from the camelot art library

  `fullpath`()

    Obsolete : avoid this method, since it will copy the resource file from its package and copy it to a temp folder if the resource is packaged.

  `getQPixmap`(*args, **kwargs)

    QPixmaps can only be used in the gui thread

`camelot.view.art.` `file_`(name)

`camelot.view.art.` `read`(fname)

## `database_selection` Module

class `camelot.view.database_selection.` `ProfileWizard`(profiles, parent=None)

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

  Wizard for the creation of a new database profile.

  `languages`
  `dialects`

  A list of languages allowed in the profile selection, an empty list will allow all languages

  `collect_info`()
  `connect_buttons`()
  `connect_widgets`()
  `create_buttons`()
  `create_labels_and_widgets`(*args, **kwargs)
  `current_profile`()
  `dialects` = []
  `fill_media_location`()
  `get_profile_value`(key)
  `is_connection_valid`()
  `languages` = []
  `load_profiles_from_file`()
  `new_network_request`()
  `proceed`()
  `proxy_authentication_required`(proxy, authenticator)
  `save_profiles_to_file`()
  `set_tab_order`()
  `set_widgets_values`()
  `setup_extension`()
  `test_connection`(dialect, host, port, user, passwd, db)
  `toggle_ok_button`(enabled)
  `update_network_status`(reply)
  `update_wizard_values`()

`camelot.view.database_selection.` `create_new_profile`(app_admin, profiles)

`camelot.view.database_selection.` `new_profile_item_selected`(input_dialog)

`camelot.view.database_selection.` `select_database`(app_admin)

`camelot.view.database_selection.` `select_profile`(profiles_dict)

## `field_attributes` Module

Field types handled through introspection :

Field type | Default delegate | Default editor
BOOLEAN | BoolDelegate |
Boolean | BoolDelegate |
Code | CodeDelegate |
Color | ColorDelegate |
Date | DateDelegate |
DateTime | DateTimeDelegate |
Enumeration | EnumerationDelegate |
File | FileDelegate |
Float | FloatDelegate |
INTEGER | IntegerDelegate |
IPAddress | CodeDelegate |
Image | ImageDelegate |
Integer | IntegerDelegate |
Language | LanguageDelegate |
Numeric | FloatDelegate |
Rating | StarDelegate |
RichText | RichTextDelegate |
String | PlainTextDelegate |
TEXT | PlainTextDelegate |
Time | TimeDelegate |
Unicode | PlainTextDelegate |
VirtualAddress | VirtualAddressDelegate |

class `camelot.view.field_attributes.` `DummyField`

  Bases: `object`

## `fifo` Module

Module containing the FIFO cache used in the collection proxy to store the data that is passed between the model and the gui thread

class `camelot.view.fifo.` `Fifo`(max_entries)

  Bases: `object`

  Fifo, is the actual cache containing a limited set of copies of row data so the data in Fifo, is always immediately accessible to the gui thread, with zero delay as you scroll down the table view, Fifo is filled and refilled with data queried from the database

  the cache can be queried either by the row number or by object represented by the row data.

  `add_data`(row, entity, value)

    The entity might already be on another row, and this row might already contain an entity

  `delete_by_entity`(entity)

    Remove everything in the cache related to an entity instance returns the row at which the data was stored if the data was in the cache, return None otherwise

  `delete_by_row`(row)

    Remove the data and the reference to the object at row

  `get_data_at_row`(row)

    Returns: | the data at row

  `get_entity_at_row`(row)

    Returns: | the entity that is stored at a row

  `get_row_by_entity`(entity)

    Returns: | the row at which an entity is stored

  `has_data_at_row`(row)

    Returns: | True if there is data in the cache for the row, False if

    there isn’t

  `rows`()

    Returns: | a interator of the row numbers for which this fifo

    had data

  `shallow_copy`(max_entries)

    Copy the cache without the actual data but with the references to which object is stored in which row

## `filters` Module

Python structures to represent filters. These structures can be transformed to QT forms.

class `camelot.view.filters.` `ComboBoxFilter`(attribute, default=<class 'camelot.view.filters.All'>)

  Bases: `camelot.view.filters.Filter`

  Filter where the items are displayed in a QComboBox

  `render`(*args, **kwargs)

class `camelot.view.filters.` `DateFilterWidget`(name, query_decorator, default, parent)

  Bases: `PyQt4.QtGui.QGroupBox`

  Filter widget based on a DateEditor

  `decorate_query`(query)
  `emit_filter_changed`()
  `filter_changed_signal`

class `camelot.view.filters.` `EditorFilter`(field_name, verbose_name=None)

  Bases: `camelot.view.filters.Filter`

  Filter that presents the user with an editor, allowing the user to enter a value on which to filter, and at the same time to show ‘All’ or ‘None’

  `get_name_and_options`(admin)
  `render`(parent, name, options)

class `camelot.view.filters.` `Filter`(attribute, default=<class 'camelot.view.filters.All'>)

  Bases: `object`

  Base class for filters

  class `All`

    Bases: `object`

  `Filter.` `get_name_and_options`(admin)

    return a tuple of the name of the filter and a list of options that can be selected. Each option is a tuple of the name of the option, and a filter function to decorate a query @return: (filter_name, [(option_name, query_decorator), ...)

  `Filter.` `render`(*args, **kwargs)

    Render this filter as a qt object @param parent: its parent widget @param name: the name of the filter @param options: the options that can be selected, where each option is a list of tuples containting (option_name, query_decorator)

    The name and the list of options can be fetched with get_name_and_options

class `camelot.view.filters.` `FilterWidget`(name, choices, parent)

  Bases: `PyQt4.QtGui.QGroupBox`

  A box containing a filter that can be applied on a table view, this filter is based on the distinct values in a certain column

  `decorate_query`(query)
  `emit_filter_changed`(state)
  `filter_changed_signal`
  `setChoices`(choices)

class `camelot.view.filters.` `GroupBoxFilter`(attribute, default=<class 'camelot.view.filters.All'>)

  Bases: `camelot.view.filters.Filter`

  Filter where the items are displayed in a QGroupBox

  `render`(*args, **kwargs)

class `camelot.view.filters.` `GroupBoxFilterWidget`(name, choices, parent)

  Bases: `PyQt4.QtGui.QGroupBox`

  Flter widget based on a QGroupBox

  `decorate_query`(query)
  `emit_filter_changed`(index)
  `filter_changed_signal`

class `camelot.view.filters.` `ValidDateFilter`(from_attribute='from_date', thru_attribute='thru_date', verbose_name=_('Valid at'), default=<built-in method today of type object at 0x42c26440>)

  Bases: `camelot.view.filters.Filter`

  Filters entities that are valid a certain date. This filter will present a date to the user and filter the entities that have their from date before this date and their end date after this date. If no date is given, all entities will be shown

  `get_name_and_options`(admin)
  `render`(parent, name, options)

`camelot.view.filters.` `structure_to_filter`(structure)

  Convert a python data structure to a filter, using the following rules :

  if structure is an instance of Filter, return structure else create a GroupBoxFilter from the structure

## `forms` Module

Classes to layout fields on a form. These are mostly used for specifying the form_display attribute in Admin classes, but they can be used on their own as well. Form classes can be used recursive.

class `camelot.view.forms.` `ColumnSpan`(field=None, num=2)

  Bases: `camelot.view.forms.Form`

class `camelot.view.forms.` `DelayedTabWidget`(widgets, tabs, parent=None)

  Bases: `PyQt4.QtGui.QTabWidget`

  Helper class for `TabForm` to delay the creation of tabs to the moment the tab is shown.

  `render_tab`(index)

    Render the tab at index

class `camelot.view.forms.` `Form`(content, scrollbars=False, columns=1)

  Bases: `list`

  Base Form class to put fields on a form. The base class of a form is a list. So the form itself is nothing more than a list of field names or sub-forms. A form can thus be manipulated using the list’s method such as append or insert.

  A form can be converted to a QT widget by calling its render method. The base form uses the QFormLayout to render a form:

      class Admin(EntityAdmin):
        form_display = Form(['title', 'short_description', 'director', 'release_date'])

  ..image:: /_static/form/form.png

  `add_field`(new_field)
  `get_fields`()

    Returns: | the fields, visible in this form

  `remove_field`(original_field)

    Remove a field from the form, This function can be used to modify inherited forms.

    Parameters: | original_field – the name of the field to be removed
    Returns: | True if the field was found and removed

  `render`(*args, **kwargs)

    Parameters: | widgets – a `camelot.view.controls.formview.FormEditors` object that is able to create the widgets for this form parent – the `QtGui.QWidget` in which the form is placed toplevel – a `boolean` indicating if this form is toplevel, or a child form of another form. A toplevel form will be expanding, while a non toplevel form is only expanding if it contains other expanding elements.
    Returns: | a QWidget into which the form is rendered

  `render_ooxml`(obj, delegates)

    Generator for lines of text in Office Open XML representing this form, using tables :param obj: the object or entity that will be rendered :param delegates: a dictionary mapping field names to their delegate

  `replace_field`(original_field, new_field)

    Replace a field on this form with another field. This function can be used to modify inherited forms.

    :param original_field : the name of the field to be replace :param new_field : the name of the new field :return: True if the original field was found and replaced.

class `camelot.view.forms.` `GridForm`(grid, nomargins=False)

  Bases: `camelot.view.forms.Form`

  Put different fields into a grid, without a label. Row or column labels can be added using the Label form:

      GridForm([['title', 'short_description'], ['director','release_date']])

  `append_column`(column)

    Parameters: | column – the list of fields that should come in the additional column

    use this method to modify inherited grid forms

  `append_row`(row)

    Parameters: | row – the list of fields that should come in the additional row

    use this method to modify inherited grid forms

  `render`(*args, **kwargs)

class `camelot.view.forms.` `GroupBoxForm`(title, content, scrollbars=None, min_width=None, min_height=None, columns=1)

  Bases: `camelot.view.forms.Form`

  Renders a form within a QGroupBox:

      class Admin(EntityAdmin):
        form_display = GroupBoxForm('Movie', ['title', 'short_description'])

  `render`(*args, **kwargs)

class `camelot.view.forms.` `HBoxForm`(columns, scrollbars=False)

  Bases: `camelot.view.forms.Form`

  Render different forms in a horizontal box:

      form = forms.HBoxForm([['title', 'short_description'], ['director', 'release_date']])

  `render`(*args, **kwargs)
  `replace_field`(original_field, new_field)

class `camelot.view.forms.` `Label`(label, alignment='left', style=None)

  Bases: `camelot.view.forms.Form`

  Render a label with a QLabel

  `render`(*args, **kwargs)
  `render_ooxml`()

    Generator for label text in Office Open XML representing this form

class `camelot.view.forms.` `TabForm`(tabs, position='North')

  Bases: `camelot.view.forms.Form`

  Render forms within a QTabWidget:

      from = TabForm([('First tab', ['title', 'short_description']),
                      ('Second tab', ['director', 'release_date'])])

  `EAST` = 'East'
  `NORTH` = 'North'
  `SOUTH` = 'South'
  `WEST` = 'West'
  `add_tab`(tab_label, tab_form)

    Add a tab to the form

    Parameters: | tab_label – the name of the tab tab_form – the form to display in the tab or a list of field names.

  `add_tab_at_index`(tab_label, tab_form, index)

    Add a tab to the form at the specified index

    Parameters: | tab_label – the name to the tab tab_form – the form to display in the tab or a list of field names. index – the position of tab in the tabs list.

  `get_tab`(tab_label)

    Get the tab form of associated with a tab_label, use this function to modify the underlying tab_form in case of inheritance

    :param tab_label : a label of a tab as passed in the construction method :return: the tab_form corresponding to tab_label

  `remove_field`(original_field)
  `render`(*args, **kwargs)
  `replace_field`(original_field, new_field)

class `camelot.view.forms.` `VBoxForm`(rows)

  Bases: `camelot.view.forms.Form`

  Render different forms or widgets in a vertical box:

      form = forms.VBoxForm([['title', 'short_description'], ['director', 'release_date']])

  `render`(*args, **kwargs)
  `replace_field`(original_field, new_field)

class `camelot.view.forms.` `WidgetOnlyForm`(field)

  Bases: `camelot.view.forms.Form`

  Renders a single widget without its label, typically a one2many widget

  `render`(*args, **kwargs)

`camelot.view.forms.` `structure_to_form`(structure)

  Convert a python data structure to a form, using the following rules :

  > - if structure is an instance of Form, return structure
  > - if structure is a list, create a Form from this list

  This function is mainly used in the Admin class to construct forms out of the form_display attribute

## `main` Module

Main function, to be called to start the GUI interface

class `camelot.view.main.` `Application`(application_admin)

  Bases: `PyQt4.QtCore.QObject`

  The camelot application. This class will take care of the order of initialization of various stuff needed to get the application up and running, each of its methods will be called in subsequent order, overwrite any of them to customize its behaviour.

  This class will create the QApplication and call its processEvents method regulary while starting up the application.

  `close_splashscreen`(splash_window, main_window)

    closes the splashcreen on appearance of the main window :param splash_window: the splash screen window, as generated by the show splashcreen function

  `create_main_window`()

    Returns: | a QWidget representing the main window, upon its appearance, the splash

    screen will be closed

  `initialization`()

    Method that is called afther the model has been set up, before the main window is constructed

  `initialization_exception`(exception_info)

    This method is called whenever an exception occurs before the event loop has been started, or if the setup of the model thread failed. By default this pops up a dialog.

    Parameters: | exception_info – a serialized form of the exception

  `load_translations`(application)

    Fill the QApplication with the needed translations :param application: the QApplication on which to install the translator

  `main`()

    the main function of the application, this will call all other functions before starting the event loop

  `pre_initialization`()

    Method that is called before the model thread is started, while the app is still running single threaded.

    The default implementation verifies if the select_database attribute is set to True on the ApplicationAdmin, and if this is the case, present the user with a database selection wizard.

  `set_application_attributes`(application)

    Sets the attributes of the QApplication object :param application: the QApplication object

  `show_splash_message`(splash_window, message)

    Parameters: | message – displays a message on the splash screen, informing

    the user of the status of the application

  `show_splashscreen`()

    Returns: | the splash window

  `start_event_loop`(application)

    Starts the application’s main event loop, wait until it is finished, then exit :param application: the QApplication to run

  `start_model_thread`()

    Launch the second thread where the model lives

`camelot.view.main.` `main`(application_admin)

  shortcut main function, call this function to start the GUI interface with minimal hassle and without the need to construct an Application object. If you need to customize the initialization process, construct an Application subclass and use it’s main method.

  Parameters: | application_admin – object of type ApplicationAdmin (as defined in application_admin.py)

  that specifies the look of the GUI interface

## `mainwindow` Module

class `camelot.view.mainwindow.` `MainWindow`(app_admin, parent=None)

  Bases: `PyQt4.QtGui.QMainWindow`

  Main window GUI

  `about`()
  `activeMdiChild`()
  `affiliated_website`()
  `backup`()
  `change_view_mode`()
  `closeEvent`(event)
  `copy`()
  `createActions`()
  `createMenus`()
  `createNavigationPane`()
  `createStatusBar`()
  `createToolBars`()
  `delete`()
  `display_exception_message_box`(exc_info)
  `exportToExcel`()

    creates an excel file from the view

  `exportToMail`()
  `exportToWord`()

    Use windows COM to export the active child window to MS word, by using its to_html function

  `get_tool_bar`()
  `help`()
  `importFromFile`()
  `merge_document`()

    Run the merge document wizard on the selection in the current table view

  `new`()
  `pageSetup`()
  `previewDoc`()
  `readSettings`()
  `refresh_session`()
  `remote_support`()
  `restore`()
  `runAction`(name, callable)
  `saveAs`()
  `select_all`()
  `unmaximize_view`()
  `updateMenus`()

    Toggle the status of the menus, depending on the active view

  `updateValue`()
  `viewFirst`()

    selects view’s first row

  `viewLast`()

    selects view’s last row

  `viewNext`()

    selects view’s next row

  `viewPrevious`()

    selects view’s previous row

  `whats_new`()
  `writeSettings`()

`camelot.view.mainwindow.` `addActions`(target, actions)

  add action objects to menus, menubars, and toolbars if action is None, add a separator.

## `register` Module

Global registry to register that an Python Object should be scheduled for garbage collection, when a QObject is destroyed.

This is used to combine models and views, where the model should be garbage collected once it has no views any more. But as long as it has views, it should be kept alive.

class `camelot.view.register.` `Register`

  Bases: `PyQt4.QtCore.QObject`

  The register that takes care of the dependencies. It monitors an object and when the monitored object is destroyed, its registered object is scheduled for collection.

  `register`(registered, monitored)

    Parameters: | registered – the object that will be registered monitored – the object that will be monitored

`camelot.view.register.` `dump_register`()

  Method to see the currently monitored objects, for debugging purposes

`camelot.view.register.` `register`(registered, monitored)

  Global function to register an object and start monitoring the dependent object

  This function takes care of creating the global register as well.

## `remote_signals` Module

Classes to connect the QT event loop with a messaging server. To enable multiple clients to push model updates to each other or messages for the users.

As a messaging server, Apache active MQ was tested in combination with the stomp library (http://docs.codehaus.org/display/STOMP/Python)

class `camelot.view.remote_signals.` `SignalHandler`

  Bases: `PyQt4.QtCore.QObject`

  The signal handler connects multiple collection proxy classes to inform each other when they have changed an object.

  If the object is persistent (eg mapped by SQLAlchemy), the signal hanler can inform other signal handlers on the network of the change.

  A couple of the methods of this thread are protected by a QMutex through the synchronized decorator. It appears that python/qt deadlocks when the entity_update_signal is connected to and emitted at the same time. This can happen when the user closes a window that is still building up (the CollectionProxies are being constructed and they connect to the signal handler).

  These deadlock issues are resolved in recent PyQt, so comment out the mutex stuff. (2011-08-12)

  `connect_signals`(obj)

    Connect the SignalHandlers its signals to the slots of obj, while the mutex is locked

  `entity_create_signal`
  `entity_delete_signal`
  `entity_update_pattern` = '^/topic/Camelot.Entity.(?P<entity>.*).update$'
  `entity_update_signal`
  `on_connected`(*args, **kwargs)

    Callback message for stomp to inform it is connected to a messaging queue, this method will subscribe to the camelot topic

  `on_connecting`(server)

    Callback message for stomp to inform it is connecting to a messaging queue

  `on_disconnected`()

    Callback message for stomp to inform it is disconnected from the messaging queue

  `on_error`(headers, message)

    Callback function for stomp to receive errors

  `on_message`(headers, message)

    Callback function for stomp to receive messages

  `sendEntityCreate`(sender, entity, scope='local')

    Call this method to inform the whole application an entity was created

  `sendEntityDelete`(sender, entity, scope='local')

    Call this method to inform the whole application an entity is about to be deleted

  `sendEntityUpdate`(sender, entity, scope='local')

    Call this method to inform the whole application an entity has changed

  `send_entity_update`(sender, entity, scope='local')

    Call this method to inform the whole application an entity has changed

`camelot.view.remote_signals.` `construct_signal_handler`(*args, **kwargs)

  Construct the singleton signal handler

`camelot.view.remote_signals.` `get_signal_handler`()

  Get the singleton signal handler

`camelot.view.remote_signals.` `has_signal_handler`()

  Request if the singleton signal handler was constructed

## `search` Module

Helper functions to search through a collection of entities

`camelot.view.search.` `create_entity_search_query_decorator`(admin, text)

  create a query decorator to search through a collection of entities @param admin: the admin interface of the entity @param text: the text to search for @return: a function that can be applied to a query to make the query filter only the objects related to the requested text or None if no such decorator could be build

## `storage` Module

class `camelot.view.storage.` `OpenFileProgressDialog`

  Bases: `PyQt4.QtGui.QProgressDialog`

  `file_stored`()

    Called when the file has been stored at path

  `open_path`(path)

class `camelot.view.storage.` `SaveFileProgressDialog`

  Bases: `PyQt4.QtGui.QProgressDialog`

  `finish`(on_finish)

`camelot.view.storage.` `create_stored_file`(parent, storage, on_finish, filter='All files (*)', remove_original=False, filename=None)

  Popup a QFileDialog, put the selected file in the storage and return the call on_finish with the StoredFile when done

  Parameters: | on_finish – function that will be called in the gui thread when

  the file is stored. the first argument of the function should be the StoredFile

  Parameters: | filename – if None, a dialog will pop up, asking the user for

  the file, otherwise a string with the name of the file to be stored

`camelot.view.storage.` `open_stored_file`(parent, stored_file)

  Open the stored file with the default system editor for this file type

`camelot.view.storage.` `save_stored_file`(parent, stored_file)

  Save a stored file as another file

## `utils` Module

Helper functions for the view subpackage

exception `camelot.view.utils.` `ParsingError`

  Bases: `exceptions.Exception`

`camelot.view.utils.` `bool_from_string`(s)

`camelot.view.utils.` `code_from_string`(s, separator)

`camelot.view.utils.` `date_from_string`(s)

`camelot.view.utils.` `datetime_from_string`(s)

`camelot.view.utils.` `default_language`(*args)

  takes arguments, to be able to use this function as a default field attribute

`camelot.view.utils.` `enumeration_to_string`(value)

`camelot.view.utils.` `float_from_string`(s)

`camelot.view.utils.` `int_from_string`(s)

`camelot.view.utils.` `local_date_format`()

  Get the local data format and cache it for reuse

`camelot.view.utils.` `local_datetime_format`()

  Get the local datatime format and cache it for reuse

`camelot.view.utils.` `local_time_format`()

  Get the local time format and cache it for reuse

`camelot.view.utils.` `pyvalue_from_string`(pytype, s)

`camelot.view.utils.` `string_from_string`(s)

`camelot.view.utils.` `text_from_richtext`(unstripped_text)

  funciton that returns a list of lines with escaped data, to be used in templates for example :arg unstripped_text: string :return: list of strings

`camelot.view.utils.` `time_from_string`(s)

## `workspace` Module

Convenience functions and classes to present views to the user

class `camelot.view.workspace.` `ActionButtonContainer`(actionButton, parent=None)

  Bases: `PyQt4.QtGui.QWidget`

  `mousePressEvent`(event)

class `camelot.view.workspace.` `ActionButtonInfoWidget`(parent=None)

  Bases: `PyQt4.QtGui.QWidget`

  `resetInfo`()
  `setInfoFromState`(state)

class `camelot.view.workspace.` `DesktopBackground`(gui_context, parent)

  Bases: `PyQt4.QtGui.QWidget`

  A custom background widget for the desktop. This widget is contained by the first tab (‘Start’ tab) of the desktop workspace.

  `makeInteractive`(interactive=True)
  `onActionButtonEntered`()
  `onActionButtonLeft`()
  `refresh`()
  `resizeEvent`(event)
  `set_actions`(actions)

    Parameters: | actions – a list of EntityActions

class `camelot.view.workspace.` `DesktopTabbar`

  Bases: `PyQt4.QtGui.QTabBar`

  `change_view_mode_signal`
  `mouseDoubleClickEvent`(event)
  `tabSizeHint`(index)

class `camelot.view.workspace.` `DesktopWorkspace`(*args, **kwargs)

  Bases: `PyQt4.QtGui.QWidget`

  A tab based workspace that can be used by views to display themselves.

  In essence this is a wrapper around QTabWidget to do some initial setup and provide it with a background widget. This was originallly implemented using the QMdiArea, but the QMdiArea has too many drawbacks, like not being able to add close buttons to the tabs in a decent way.

  `background`

  The widget class to be used as the view for the uncloseable ‘Start’ tab.

  `active_view`()

    Returns: | The currently active view or None in case of the ‘Start’ tab.

  `add_view`(*args, **kwargs)

    Add a Widget implementing AbstractView to the workspace.

  `change_icon`(new_icon)

    Slot to be called when the icon of a view needs to change.

    Note: the icon of the ‘Start’ tab cannot be overwritten.

  `change_title`(new_title)

    Slot to be called when the tile of a view needs to change.

    Note: the title of the ‘Start’ tab cannot be overwritten.

  `change_view_mode_signal`
  `close_all_views`()

    Remove all views, except the ‘Start’ tab, from the workspace.

  `last_view_closed_signal`
  `refresh`()

    Refresh all views on the desktop

  `reload_background_widget`()
  `set_view`(view, icon=None, title='...')

    Remove the currently active view and replace it with a new view.

  `view_activated_signal`

`camelot.view.workspace.` `show_top_level`(view, parent)

  Show a widget as a top level window :param view: the widget extend AbstractView :param parent: the widget with regard to which the top level window will be placed.

## Subpackages

- action_steps Package
  - `action_steps` Package
  - `change_object` Module
  - `gui` Module
  - `open_file` Module
  - `orm` Module
  - `print_preview` Module
  - `select_file` Module
  - `update_progress` Module
- controls Package
  - `controls` Package
  - `abstract_widget` Module
  - `action_widget` Module
  - `actionsbox` Module
  - `appscheme` Module
  - `busy_widget` Module
  - `calculator` Module
  - `combobox_input_dialog` Module
  - `dashboard` Module
  - `decorated_line_edit` Module
  - `exception` Module
  - `field_label` Module
  - `filter_operator` Module
  - `filterlist` Module
  - `formview` Module
  - `inheritance` Module
  - `liteboxview` Module
  - `modeltree` Module
  - `navpane2` Module
  - `progress_dialog` Module
  - `search` Module
  - `standalone_wizard_page` Module
  - `statusbar` Module
  - `tableview` Module
  - `user_translatable_label` Module
  - `view` Module
  - Subpackages
    - delegates Package
      - `delegates` Package
        - BoolDelegate
        - ChartDelegate
        - CodeDelegate
        - ColorDelegate
        - ColoredFloatDelegate
        - ComboBoxDelegate
        - CurrencyDelegate
        - DateDelegate
        - DateTimeDelegate
        - EnumerationDelegate
        - FileDelegate
        - FloatDelegate
        - ImageDelegate
        - IntegerDelegate
        - IntervalsDelegate
        - LabelDelegate
        - LanguageDelegate
        - LocalFileDelegate
        - Many2OneDelegate
        - ManyToManyDelegate
        - ManyToOneChoicesDelegate
        - MonthsDelegate
        - NoteDelegate
        - One2ManyDelegate
        - PlainTextDelegate
        - RichTextDelegate
        - SmileyDelegate
        - StarDelegate
        - TextBoolDelegate
        - TextEditDelegate
        - TimeDelegate
        - VirtualAddressDelegate
      - `booldelegate` Module
      - `chartdelegate` Module
      - `codedelegate` Module
      - `colordelegate` Module
      - `coloredfloatdelegate` Module
      - `comboboxdelegate` Module
      - `currencydelegate` Module
      - `customdelegate` Module
      - `datedelegate` Module
      - `datetimedelegate` Module
      - `delegatemanager` Module
      - `enumerationdelegate` Module
      - `filedelegate` Module
      - `floatdelegate` Module
      - `imagedelegate` Module
      - `integerdelegate` Module
      - `intervalsdelegate` Module
      - `labeldelegate` Module
      - `languagedelegate` Module
      - `localfiledelegate` Module
      - `many2onedelegate` Module
      - `manytomanydelegate` Module
      - `manytoonechoicesdelegate` Module
      - `monthsdelegate` Module
      - `notedelegate` Module
      - `one2manydelegate` Module
      - `plaintextdelegate` Module
      - `richtextdelegate` Module
      - `smileydelegate` Module
      - `stardelegate` Module
      - `texteditdelegate` Module
      - `timedelegate` Module
      - `virtualaddressdelegate` Module
    - editors Package
      - `editors` Package
      - `abstractmanytooneeditor` Module
      - `booleditor` Module
      - `charteditor` Module
      - `choiceseditor` Module
      - `codeeditor` Module
      - `coloredfloateditor` Module
      - `coloreditor` Module
      - `customeditor` Module
      - `dateeditor` Module
      - `datetimeeditor` Module
      - `embeddedmany2oneeditor` Module
      - `fileeditor` Module
      - `floateditor` Module
      - `imageeditor` Module
      - `integereditor` Module
      - `labeleditor` Module
      - `languageeditor` Module
      - `localfileeditor` Module
      - `many2oneeditor` Module
      - `manytomanyeditor` Module
      - `monthseditor` Module
      - `noteeditor` Module
      - `one2manyeditor` Module
      - `onetomanychoiceseditor` Module
      - `richtexteditor` Module
      - `smileyeditor` Module
      - `stareditor` Module
      - `textediteditor` Module
      - `textlineeditor` Module
      - `timeeditor` Module
      - `virtualaddresseditor` Module
      - `wideeditor` Module
- export Package
  - `export` Package
  - `desktop_service` Module
  - `excel` Module
  - `outlook` Module
  - `word` Module
- model_thread Package
  - `model_thread` Package
  - `garbage_collector` Module
  - `no_thread_model_thread` Module
  - `signal_slot_model_thread` Module
- proxy Package
  - `proxy` Package
  - `collection_proxy` Module
  - `queryproxy` Module
- templates Package
  - `templates` Package
- wizard Package
  - `wizard` Package
  - `backup` Module
  - `importwizard` Module
  - `merge_document` Module
  - `new` Module
  - `new_company` Module
  - `update_value` Module
  - Subpackages
    - pages Package
      - `pages` Package
      - `backup_page` Module
      - `form_page` Module
      - `progress_page` Module
      - `select` Module
      - `update_entities_page` Module

### Navigation

- index
- modules |
- Camelot documentation »

Comments
blog comments powered by Disqus