application_admin

class camelot.admin.application_admin.ApplicationAdmin[source]

The ApplicationAdmin class defines how the application should look like, it also ties Python classes to their associated camelot.admin.object_admin.ObjectAdmin class or subclass. It’s behaviour can be steered by overwriting its static attributes or it’s methods :

name

The name of the application, as it will appear in the title of the main window.

application_url

The url of the web site where the user can find more information on the application.

help_url

Points to either a local html file or a web site that contains the documentation of the application.

author

The name of the author of the application

domain

The domain name of the author of the application, eg ‘mydomain.com’, this domain will be used to store settings of the application.

version

A string with the version of the application

database_profile_wizard

The wizard that should be used to create new database profiles. Defaults to camelot.view.database_selection.ProfileWizard

database_selection

if this is set to True, present the user with a database selection wizard prior to starting the application. Defaults to False.

When the same action is returned in the get_toolbar_actions() and get_main_menu() method, it should be exactly the same object, to avoid shortcut confusion and reduce the number of status updates.

create_main_window()[source]

Create the main window that will be shown when the application starts up. By default, returns an instance of

Returns:a PyQt4.QtGui.QWidget
database_profile_wizard

alias of ProfileWizard

get_about()[source]
Returns:the content of the About dialog, a string with html

syntax

get_actions()[source]
Returns:a list of camelot.admin.action.base.Action objects

that should be displayed on the desktop of the user.

get_application_admin()[source]

Get the ApplicationAdmin class of this application, this method is here for compatibility with the ObjectAdmin

Returns:this object itself
get_entity_admin(entity)[source]

Get the default camelot.admin.object_admin.ObjectAdmin class for a specific entity, return None, if not known. The ObjectAdmin should either be registered through the register() method or be defined as an inner class with name Admin of the entity.

Parameters:entity – a class

deprecated : use get_related_admin instead

get_form_actions()[source]

Specify the action buttons that should appear on each form in the application. The camelot.admin.object_admin.ObjectAdmin.get_form_actions() method will call this method and prepend the result to the actions of that specific form.

Returns:a list of camelot.admin.action.base.Action objects
get_form_toolbar_actions(toolbar_area)[source]
Parameters:toolbar_area – an instance of Qt.ToolBarArea indicating where the toolbar actions will be positioned
Returns:a list of camelot.admin.action.base.Action objects that should be displayed on the toolbar of a form view. return None if no toolbar should be created.
get_help_url()[source]
Returns:a PyQt4.QtCore.QUrl pointing to the index page for help
get_hidden_actions()[source]
Returns:a list of camelot.admin.action.base.Action objects

that can only be triggered using shortcuts and are not visibile in the UI.

get_icon()[source]
Returns:the camelot.view.art.Icon that should be used for the application
get_main_menu()[source]
Returns:a list of camelot.admin.menu.Menu objects, or None if

there should be no main menu

get_memento()[source]

Returns an instance of camelot.core.memento.SqlMemento that can be used to store changes made to objects. Overwrite this method to make it return None if no changes should be stored to the database, or to return another instance if the changes should be stored elsewhere.

Returns:None or an camelot.core.memento.SqlMemento instance
get_name()[source]
Returns:the name of the application, by default this is the class

attribute name

get_organization_domain()[source]
Returns:a string with the domain name of the organization that wrote the

application. By default returns the ApplicationAdmin.domain attribute.

get_organization_name()[source]
Returns:a string with the name of the organization that wrote the

application. By default returns the ApplicationAdmin.author attribute.

Get the default camelot.admin.object_admin.ObjectAdmin class for a specific class, return None, if not known. The ObjectAdmin should either be registered through the register() method or be defined as an inner class with name Admin of the entity.

Parameters:entity – a class

Specify the toolbar actions that should appear by default on every OneToMany editor in the application.

Parameters:
  • toolbar_area – the position of the toolbar
  • direction – the direction of the relation : ‘onetomany’ or ‘manytomany’
Returns:

a list of camelot.admin.action.base.Action objects

get_sections(*args, **kwargs)[source]

A list of camelot.admin.section.Section objects, these are the sections to be displayed in the left panel.

../../_images/picture2.png
get_settings()[source]

A QtCore.QSettings object in which Camelot related settings can be stored. This object is intended for Camelot internal use. If an application specific settings object is needed, simply construct one.

Returns:a QtCore.QSettings object
get_splashscreen()[source]
Returns:a PyQt4.QtGui.QPixmap to be used as splash screen
get_stylesheet()[source]
Returns:a string with the content of a qt stylesheet to be used for

this application as a string or None if no stylesheet needed.

Camelot comes with a couple of default stylesheets :

  • stylesheet/office2007_blue.qss
  • stylesheet/office2007_black.qss
  • stylesheet/office2007_silver.qss

Have a look at the default implementation to use another stylesheet.

get_toolbar_actions(toolbar_area)[source]
Parameters:toolbar_area – an instance of Qt.ToolBarArea indicating where the toolbar actions will be positioned
Returns:a list of camelot.admin.action.base.Action objects that should be displayed on the toolbar of the application. return None if no toolbar should be created.
get_translator()[source]

Reimplement this method to add application specific translations to your application. The default method returns a list with the default Qt and the default Camelot translator for the current system locale. Call QLocale.setDefault() before this method is called if you want to load different translations then the system default.

Returns:a list of QtCore.QTranslator objects that should be used to translate the application
get_version()[source]
Returns:string representing version of the application, by default this

is the class attribute verion

register(entity, admin_class)[source]

Associate a certain ObjectAdmin class with another class. This ObjectAdmin will be used as default to render object the specified type.

Parameters:

Previous topic

list_action

Next topic

entity_admin

This Page