The action module contains various QAction classes, representing commands that can be invoked via menus, toolbar buttons, and keyboard shortcuts.
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.
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.
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.
Reimplementation of exit to store the return code
Handle the result of the next call of the generator
Parameters: | yielded – the object that was yielded by the generator in the model thread |
---|
Manages icons and artworks
Bases: object
The default color scheme for camelot, based on the Tango icon set see http://tango.freedesktop.org/Generic_Icon_Theme_Guidelines
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)
Bases: camelot.view.art.Pixmap
Manages paths to the icons images
Bases: camelot.view.controls.standalone_wizard_page.StandaloneWizardPage
Wizard for the creation of a new database profile.
A list of languages allowed in the profile selection, an empty list will allow all languages
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 | ![]() |
Module containing the FIFO cache used in the collection proxy to store the data that is passed between the model and the gui thread
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.
The entity might already be on another row, and this row might already contain an 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
Python structures to represent filters. These structures can be transformed to QT forms.
Bases: camelot.view.filters.Filter
Filter where the items are displayed in a QComboBox
Bases: PyQt4.QtGui.QGroupBox
Filter widget based on a DateEditor
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’
Bases: object
Base class for filters
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), ...)
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
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
Bases: camelot.view.filters.Filter
Filter where the items are displayed in a QGroupBox
Bases: PyQt4.QtGui.QGroupBox
Flter widget based on a QGroupBox
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
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.
Bases: camelot.view.forms.Form
Bases: PyQt4.QtGui.QTabWidget
Helper class for TabForm to delay the creation of tabs to the moment the tab is shown.
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
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 |
Parameters: |
|
---|---|
Returns: | a QWidget into which the form is rendered |
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 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.
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']])
Parameters: | column – the list of fields that should come in the additional column |
---|
use this method to modify inherited grid forms
Bases: camelot.view.forms.Form
Renders a form within a QGroupBox:
class Admin(EntityAdmin):
form_display = GroupBoxForm('Movie', ['title', 'short_description'])
Bases: camelot.view.forms.Form
Render different forms in a horizontal box:
form = forms.HBoxForm([['title', 'short_description'], ['director', 'release_date']])
Bases: camelot.view.forms.Form
Render a label with a QLabel
Bases: camelot.view.forms.Form
Render forms within a QTabWidget:
from = TabForm([('First tab', ['title', 'short_description']),
('Second tab', ['director', 'release_date'])])
Add a tab to the form
Parameters: |
|
---|
Add a tab to the form at the specified index
Parameters: |
|
---|
Bases: camelot.view.forms.Form
Render different forms or widgets in a vertical box:
form = forms.VBoxForm([['title', 'short_description'], ['director', 'release_date']])
Bases: camelot.view.forms.Form
Renders a single widget without its label, typically a one2many widget
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 function, to be called to start the GUI interface
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.
closes the splashcreen on appearance of the main window :param splash_window: the splash screen window, as generated by the show splashcreen function
Returns: | a QWidget representing the main window, upon its appearance, the splash |
---|
screen will be closed
Method that is called afther the model has been set up, before the main window is constructed
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 |
---|
Fill the QApplication with the needed translations :param application: the QApplication on which to install the translator
the main function of the application, this will call all other functions before starting the event loop
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.
Sets the attributes of the QApplication object :param application: the QApplication object
Parameters: | message – displays a message on the splash screen, informing |
---|
the user of the status of the application
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
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.
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.
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)
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 the SignalHandlers its signals to the slots of obj, while the mutex is locked
Callback message for stomp to inform it is connected to a messaging queue, this method will subscribe to the camelot topic
Callback message for stomp to inform it is connecting to a messaging queue
Callback message for stomp to inform it is disconnected from the messaging queue
Call this method to inform the whole application an entity was created
Call this method to inform the whole application an entity is about to be deleted
Helper functions to search through a collection of entities
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
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
Helper functions for the view subpackage
takes arguments, to be able to use this function as a default field attribute
Get the local datatime format and cache it for reuse
Convenience functions and classes to present views to the user
Bases: PyQt4.QtGui.QWidget
Bases: PyQt4.QtGui.QWidget
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.
Bases: PyQt4.QtGui.QTabBar
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.
The widget class to be used as the view for the uncloseable ‘Start’ tab.
Slot to be called when the icon of a view needs to change.
Note: the icon of the ‘Start’ tab cannot be overwritten.
Slot to be called when the tile of a view needs to change.
Note: the title of the ‘Start’ tab cannot be overwritten.
Remove the currently active view and replace it with a new view.