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[source]

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)[source]
classmethod affiliated_website(parent, slot, **kwargs)[source]
classmethod backup(parent, slot, **kwargs)[source]
classmethod copy(parent, slot, **kwargs)[source]
classmethod create_action(*a, **kw)[source]

creates and returns a QAction object

classmethod delete(parent, slot, **kwargs)[source]
classmethod duplicate(parent, slot, **kwargs)[source]
classmethod exit(parent, slot, **kwargs)[source]
classmethod export_excel(parent, slot, **kwargs)[source]
classmethod export_mail(parent, slot, **kwargs)[source]
classmethod export_ooxml(parent, slot, **kwargs)[source]
classmethod export_word(parent, slot, **kwargs)[source]
classmethod help(parent, slot, **kwargs)[source]
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)[source]
classmethod merge_document(parent, slot, **kwargs)[source]
classmethod new(parent, slot, **kwargs)[source]
classmethod new_tab(parent, slot, **kwargs)[source]
classmethod page_setup(parent, slot, **kwargs)[source]
classmethod paste(parent, slot, **kwargs)[source]
classmethod print_(parent, slot, **kwargs)[source]
classmethod print_preview(parent, slot, **kwargs)[source]
classmethod refresh(parent, slot, **kwargs)[source]
classmethod remote_support(parent, slot, **kwargs)[source]
classmethod restore(parent, slot, **kwargs)[source]
classmethod select_all(parent, slot, **kwargs)[source]
classmethod update_values(parent, slot, **kwargs)[source]
classmethod view_first(parent, slot, **kwargs)[source]
classmethod view_last(parent, slot, **kwargs)[source]
classmethod view_next(parent, slot, **kwargs)[source]
classmethod view_previous(parent, slot, **kwargs)[source]
classmethod whats_new(parent, slot, **kwargs)[source]

action_runner Module

class camelot.view.action_runner.ActionRunner(generator_function, gui_context)[source]

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)[source]

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)[source]

Handle the creation of the generator

next(yielded)[source]

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)[source]
non_blocking_action_step_signal

art Module

Manages icons and artworks

class camelot.view.art.ColorScheme[source]

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)[source]

Bases: camelot.view.art.Pixmap

Manages paths to the icons images

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

QPixmaps can only be used in the gui thread

class camelot.view.art.Pixmap(path, module=None)[source]

Bases: object

Load pixmaps from the camelot art library

fullpath()[source]

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)[source]

QPixmaps can only be used in the gui thread

camelot.view.art.file_(name)[source]
camelot.view.art.read(fname)[source]

database_selection Module

class camelot.view.database_selection.ProfileWizard(profiles, parent=None)[source]

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()[source]
connect_buttons()[source]
connect_widgets()[source]
create_buttons()[source]
create_labels_and_widgets(*args, **kwargs)[source]
current_profile()[source]
dialects = []
fill_media_location()[source]
get_profile_value(key)[source]
is_connection_valid()[source]
languages = []
load_profiles_from_file()[source]
new_network_request()[source]
proceed()[source]
proxy_authentication_required(proxy, authenticator)[source]
save_profiles_to_file()[source]
set_tab_order()[source]
set_widgets_values()[source]
setup_extension()[source]
test_connection(dialect, host, port, user, passwd, db)[source]
toggle_ok_button(enabled)[source]
update_network_status(reply)[source]
update_wizard_values()[source]
camelot.view.database_selection.create_new_profile(app_admin, profiles)[source]
camelot.view.database_selection.new_profile_item_selected(input_dialog)[source]
camelot.view.database_selection.select_database(app_admin)[source]
camelot.view.database_selection.select_profile(profiles_dict)[source]

field_attributes Module

Field types handled through introspection :

Field type Default delegate Default editor
BOOLEAN BoolDelegate ../_images/BoolEditor_editable.png
Boolean BoolDelegate ../_images/BoolEditor_editable.png
Code CodeDelegate ../_images/CodeEditor_editable.png
Color ColorDelegate ../_images/ColorEditor_editable.png
Date DateDelegate ../_images/DateEditor_editable.png
DateTime DateTimeDelegate ../_images/DateTimeEditor_editable.png
Enumeration EnumerationDelegate ../_images/ChoicesEditor_editable.png
File FileDelegate ../_images/FileEditor_editable.png
Float FloatDelegate ../_images/FloatEditor_editable.png
INTEGER IntegerDelegate ../_images/IntegerEditor_editable.png
IPAddress CodeDelegate ../_images/CodeEditor_editable.png
Image ImageDelegate ../_images/ImageEditor_editable.png
Integer IntegerDelegate ../_images/IntegerEditor_editable.png
Language LanguageDelegate ../_images/LanguageEditor_editable.png
Numeric FloatDelegate ../_images/FloatEditor_editable.png
Rating StarDelegate ../_images/StarEditor_editable.png
RichText RichTextDelegate ../_images/RichTextEditor_editable.png
String PlainTextDelegate ../_images/TextLineEditor_editable.png
TEXT PlainTextDelegate ../_images/TextLineEditor_editable.png
Time TimeDelegate ../_images/TimeEditor_editable.png
Unicode PlainTextDelegate ../_images/TextLineEditor_editable.png
VirtualAddress VirtualAddressDelegate ../_images/VirtualAddressEditor_editable.png
class camelot.view.field_attributes.DummyField[source]

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)[source]

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)[source]

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

delete_by_entity(entity)[source]

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)[source]

Remove the data and the reference to the object at row

get_data_at_row(row)[source]
Returns:the data at row
get_entity_at_row(row)[source]
Returns:the entity that is stored at a row
get_row_by_entity(entity)[source]
Returns:the row at which an entity is stored
has_data_at_row(row)[source]
Returns:True if there is data in the cache for the row, False if

there isn’t

rows()[source]
Returns:a interator of the row numbers for which this fifo

had data

shallow_copy(max_entries)[source]

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'>)[source]

Bases: camelot.view.filters.Filter

Filter where the items are displayed in a QComboBox

render(*args, **kwargs)[source]
class camelot.view.filters.DateFilterWidget(name, query_decorator, default, parent)[source]

Bases: PyQt4.QtGui.QGroupBox

Filter widget based on a DateEditor

decorate_query(query)[source]
emit_filter_changed()[source]
filter_changed_signal
class camelot.view.filters.EditorFilter(field_name, verbose_name=None)[source]

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)[source]
render(parent, name, options)[source]
class camelot.view.filters.Filter(attribute, default=<class 'camelot.view.filters.All'>)[source]

Bases: object

Base class for filters

class All[source]

Bases: object

Filter.get_name_and_options(admin)[source]

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)[source]

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)[source]

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)[source]
emit_filter_changed(state)[source]
filter_changed_signal
setChoices(choices)[source]
class camelot.view.filters.GroupBoxFilter(attribute, default=<class 'camelot.view.filters.All'>)[source]

Bases: camelot.view.filters.Filter

Filter where the items are displayed in a QGroupBox

render(*args, **kwargs)[source]
class camelot.view.filters.GroupBoxFilterWidget(name, choices, parent)[source]

Bases: PyQt4.QtGui.QGroupBox

Flter widget based on a QGroupBox

decorate_query(query)[source]
emit_filter_changed(index)[source]
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>)[source]

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)[source]
render(parent, name, options)[source]
camelot.view.filters.structure_to_filter(structure)[source]

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)[source]

Bases: camelot.view.forms.Form

class camelot.view.forms.DelayedTabWidget(widgets, tabs, parent=None)[source]

Bases: PyQt4.QtGui.QTabWidget

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

render_tab(index)[source]

Render the tab at index

class camelot.view.forms.Form(content, scrollbars=False, columns=1)[source]

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)[source]
get_fields()[source]
Returns:the fields, visible in this form
remove_field(original_field)[source]

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)[source]
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)[source]

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)[source]

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)[source]

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']])
../_images/grid_form.png
append_column(column)[source]
Parameters:column – the list of fields that should come in the additional column

use this method to modify inherited grid forms

append_row(row)[source]
Parameters:row – the list of fields that should come in the additional row

use this method to modify inherited grid forms

render(*args, **kwargs)[source]
class camelot.view.forms.GroupBoxForm(title, content, scrollbars=None, min_width=None, min_height=None, columns=1)[source]

Bases: camelot.view.forms.Form

Renders a form within a QGroupBox:

class Admin(EntityAdmin):
  form_display = GroupBoxForm('Movie', ['title', 'short_description'])
../_images/group_box_form.png
render(*args, **kwargs)[source]
class camelot.view.forms.HBoxForm(columns, scrollbars=False)[source]

Bases: camelot.view.forms.Form

Render different forms in a horizontal box:

form = forms.HBoxForm([['title', 'short_description'], ['director', 'release_date']])
../_images/hbox_form.png
render(*args, **kwargs)[source]
replace_field(original_field, new_field)[source]
class camelot.view.forms.Label(label, alignment='left', style=None)[source]

Bases: camelot.view.forms.Form

Render a label with a QLabel

render(*args, **kwargs)[source]
render_ooxml()[source]

Generator for label text in Office Open XML representing this form

class camelot.view.forms.TabForm(tabs, position='North')[source]

Bases: camelot.view.forms.Form

Render forms within a QTabWidget:

from = TabForm([('First tab', ['title', 'short_description']),
                ('Second tab', ['director', 'release_date'])])
../_images/tab_form.png
EAST = 'East'
NORTH = 'North'
SOUTH = 'South'
WEST = 'West'
add_tab(tab_label, tab_form)[source]

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)[source]

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)[source]

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)[source]
render(*args, **kwargs)[source]
replace_field(original_field, new_field)[source]
class camelot.view.forms.VBoxForm(rows)[source]

Bases: camelot.view.forms.Form

Render different forms or widgets in a vertical box:

form = forms.VBoxForm([['title', 'short_description'], ['director', 'release_date']])
../_images/vbox_form.png
render(*args, **kwargs)[source]
replace_field(original_field, new_field)[source]
class camelot.view.forms.WidgetOnlyForm(field)[source]

Bases: camelot.view.forms.Form

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

render(*args, **kwargs)[source]
camelot.view.forms.structure_to_form(structure)[source]

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)[source]

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)[source]

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()[source]
Returns:a QWidget representing the main window, upon its appearance, the splash

screen will be closed

initialization()[source]

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

initialization_exception(exception_info)[source]

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)[source]

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

main()[source]

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

pre_initialization()[source]

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)[source]

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

show_splash_message(splash_window, message)[source]
Parameters:message – displays a message on the splash screen, informing

the user of the status of the application

show_splashscreen()[source]
Returns:the splash window
start_event_loop(application)[source]

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

start_model_thread()[source]

Launch the second thread where the model lives

camelot.view.main.main(application_admin)[source]

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)[source]

Bases: PyQt4.QtGui.QMainWindow

Main window GUI

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

creates an excel file from the view

exportToMail()[source]
exportToWord()[source]

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

get_tool_bar()[source]
help()[source]
importFromFile()[source]
merge_document()[source]

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

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

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

updateValue()[source]
viewFirst()[source]

selects view’s first row

viewLast()[source]

selects view’s last row

viewNext()[source]

selects view’s next row

viewPrevious()[source]

selects view’s previous row

whats_new()[source]
writeSettings()[source]
camelot.view.mainwindow.addActions(target, actions)[source]

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[source]

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)[source]
Parameters:
  • registered – the object that will be registered
  • monitored – the object that will be monitored
camelot.view.register.dump_register()[source]

Method to see the currently monitored objects, for debugging purposes

camelot.view.register.register(registered, monitored)[source]

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[source]

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)[source]

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)[source]

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

on_connecting(server)[source]

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

on_disconnected()[source]

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

on_error(headers, message)[source]

Callback function for stomp to receive errors

on_message(headers, message)[source]

Callback function for stomp to receive messages

sendEntityCreate(sender, entity, scope='local')[source]

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

sendEntityDelete(sender, entity, scope='local')[source]

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

sendEntityUpdate(sender, entity, scope='local')[source]

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

send_entity_update(sender, entity, scope='local')[source]

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

camelot.view.remote_signals.construct_signal_handler(*args, **kwargs)[source]

Construct the singleton signal handler

camelot.view.remote_signals.get_signal_handler()[source]

Get the singleton signal handler

camelot.view.remote_signals.has_signal_handler()[source]

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)[source]

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[source]

Bases: PyQt4.QtGui.QProgressDialog

file_stored()[source]

Called when the file has been stored at path

open_path(path)[source]
class camelot.view.storage.SaveFileProgressDialog[source]

Bases: PyQt4.QtGui.QProgressDialog

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

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)[source]

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

camelot.view.storage.save_stored_file(parent, stored_file)[source]

Save a stored file as another file

utils Module

Helper functions for the view subpackage

exception camelot.view.utils.ParsingError[source]

Bases: exceptions.Exception

camelot.view.utils.bool_from_string(s)[source]
camelot.view.utils.code_from_string(s, separator)[source]
camelot.view.utils.date_from_string(s)[source]
camelot.view.utils.datetime_from_string(s)[source]
camelot.view.utils.default_language(*args)[source]

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

camelot.view.utils.enumeration_to_string(value)[source]
camelot.view.utils.float_from_string(s)[source]
camelot.view.utils.int_from_string(s)[source]
camelot.view.utils.local_date_format()[source]

Get the local data format and cache it for reuse

camelot.view.utils.local_datetime_format()[source]

Get the local datatime format and cache it for reuse

camelot.view.utils.local_time_format()[source]

Get the local time format and cache it for reuse

camelot.view.utils.pyvalue_from_string(pytype, s)[source]
camelot.view.utils.string_from_string(s)[source]
camelot.view.utils.text_from_richtext(unstripped_text)[source]

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)[source]

workspace Module

Convenience functions and classes to present views to the user

class camelot.view.workspace.ActionButtonContainer(actionButton, parent=None)[source]

Bases: PyQt4.QtGui.QWidget

mousePressEvent(event)[source]
class camelot.view.workspace.ActionButtonInfoWidget(parent=None)[source]

Bases: PyQt4.QtGui.QWidget

resetInfo()[source]
setInfoFromState(state)[source]
class camelot.view.workspace.DesktopBackground(gui_context, parent)[source]

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)[source]
onActionButtonEntered()[source]
onActionButtonLeft()[source]
refresh()[source]
resizeEvent(event)[source]
set_actions(actions)[source]
Parameters:actions – a list of EntityActions
class camelot.view.workspace.DesktopTabbar[source]

Bases: PyQt4.QtGui.QTabBar

change_view_mode_signal
mouseDoubleClickEvent(event)[source]
tabSizeHint(index)[source]
class camelot.view.workspace.DesktopWorkspace(*args, **kwargs)[source]

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()[source]
Returns:The currently active view or None in case of the ‘Start’ tab.
add_view(*args, **kwargs)[source]

Add a Widget implementing AbstractView to the workspace.

change_icon(new_icon)[source]

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)[source]

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()[source]

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

last_view_closed_signal
refresh()[source]

Refresh all views on the desktop

reload_background_widget()[source]
set_view(view, icon=None, title='...')[source]

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

view_activated_signal
camelot.view.workspace.show_top_level(view, parent)[source]

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


Comments
blog comments powered by Disqus