controls Package

controls Package

abstract_widget Module

class camelot.view.controls.abstract_widget.AbstractSearchWidget[source]

Bases: PyQt4.QtGui.QWidget

cancel_signal
expand_search_options_signal
on_arrow_down_signal
search_signal

action_widget Module

Created on May 22, 2010

@author: tw55413

class camelot.view.controls.action_widget.AbstractActionWidget(action, gui_context)[source]

Bases: object

current_row_changed(current_row)[source]
data_changed(index1, index2)[source]
run_action(mode=None)[source]
set_state(state)[source]
class camelot.view.controls.action_widget.ActionLabel(action, gui_context, parent)[source]

Bases: PyQt4.QtGui.QLabel, camelot.view.controls.action_widget.AbstractActionWidget

enterEvent(event)[source]
entered
leaveEvent(event)[source]
left

A custom interactive desktop button for the desktop. Each ‘button’ is actually an animated label.

onContainerMousePressEvent(event)[source]
resetLayout()[source]
setInteractive(interactive)[source]
set_state(state)[source]
startHoverAnimation()[source]
startNotificationAnimation()[source]
startSelectionAnimation()[source]
stopHoverAnimation()[source]
stopNotificationAnimation()[source]
updateSelectionAnimationState(newState, oldState)[source]
class camelot.view.controls.action_widget.ActionPushButton(action, gui_context, parent)[source]

Bases: PyQt4.QtGui.QPushButton, camelot.view.controls.action_widget.AbstractActionWidget

data_changed(index1, index2)[source]
set_state(state)[source]
triggered()[source]

actionsbox Module

Actions box

class camelot.view.controls.actionsbox.ActionsBox(gui_context, parent)[source]

Bases: PyQt4.QtGui.QWidget

A box containing actions to be applied to a view

Parameters:
set_actions(actions)[source]

appscheme Module

Encapsulates various ms office schemes

class camelot.view.controls.appscheme.Scheme(styledict={'ButtonSelectedMiddleBegin': '(255, 187, 110)', 'ButtonNormalEnd': '(192, 219, 255)', 'ButtonSelectedOverMiddleEnd': '(251, 140, 60)', 'ButtonNormalBegin': '(227, 239, 255)', 'CaptionDescBegin': '(227, 239, 255)', 'ButtonSelectedMiddleEnd': '(255, 171, 63)', 'ButtonMouseOverMiddleBegin': '(255, 232, 167)', 'CaptionBegin': '(227, 239, 255)', 'ButtonNormalMiddleBegin': '(196, 221, 255)', 'SplitterDark': '(192, 219, 255)', 'SplitterLight': '(227, 239, 255)', 'ContextMenuBackColor': '(227, 239, 255)', 'BorderColor': '(101, 147, 207)', 'CaptionTextColor': '(21, 66, 139)', 'ButtonMouseOverBegin': '(255, 254, 228)', 'SelectedTextColor': '(0, 0, 0)', 'ButtonMouseOverMiddleEnd': '(255, 215, 103)', 'ButtonMouseOverEnd': '(255, 230, 158)', 'ButtonSelectedOverMiddleBegin': '(255, 172, 66)', 'TextColor': '(32, 77, 137)', 'CaptionEnd': '(173, 209, 255)', 'ButtonSelectedBegin': '(255, 217, 170)', 'ButtonSelectedOverEnd': '(254, 211, 100)', 'ButtonSelectedEnd': '(254, 225, 122)', 'ButtonNormalMiddleEnd': '(173, 209, 255)', 'CaptionDescEnd': '(192, 219, 255)', 'ButtonSelectedOverBegin': '(255, 189, 105)'})[source]

Bases: object

bordercolor()[source]
captionbackground()[source]
captiontextcolor()[source]
color(r, g, b)[source]
fourcolorgradient(rgb1, rgb2, rgb3, rgb4)[source]
hoveredbackground()[source]
normalbackground()[source]
selectedbackground(inverted=False)[source]
selectedcolor()[source]
textcolor()[source]
twocolorgradient(rgb1, rgb2)[source]

busy_widget Module

class camelot.view.controls.busy_widget.BusyWidget(parent=None)[source]

Bases: PyQt4.QtGui.QWidget

A widget indicating the application is performing some background task. The widget acts as an overlay of its parent widget and displays animating orbs

paintEvent(event)[source]

custom paint, painting the orbs

set_busy(busy_state)[source]

start/stop the animation :arg busy_state: True or False

timerEvent(event)[source]

custom timer event, updating the animation

calculator Module

class camelot.view.controls.calculator.Calculator(parent=None)[source]

Bases: PyQt4.QtGui.QDialog

Calculate()[source]
SaveValue()[source]
ShowCalculate()[source]
buttonClick(event)[source]
calculation_finished_signal
clearInput()[source]
discountClick()[source]
keyPressEvent(event)[source]
setValue(value)[source]

combobox_input_dialog Module

class camelot.view.controls.combobox_input_dialog.ComboBoxInputDialog(autoaccept=False, parent=None)[source]

Bases: PyQt4.QtGui.QDialog

count()[source]
get_text()[source]
set_cancel_button_default()[source]
set_cancel_button_text(text)[source]
set_choice_by_index(index)[source]
set_choice_by_text(text)[source]
set_data(index, data, role)[source]
set_items(items)[source]
set_label_text(text)[source]
set_ok_button_default()[source]
set_ok_button_text(text)[source]
set_window_title(title)[source]

dashboard Module

class camelot.view.controls.dashboard.BareFrame(parent=None)[source]

Bases: PyQt4.QtGui.QFrame

setBGColor(color)[source]
class camelot.view.controls.dashboard.CloseMark(pixmap, parent=None)[source]

Bases: PyQt4.QtGui.QLabel

HEIGHT = 31
MARGIN = 10
WIDTH = 31
mousePressEvent(event)[source]
toParentTopRight()[source]
class camelot.view.controls.dashboard.Dashboard(parent=None)[source]

Bases: camelot.view.controls.dashboard.BareFrame

SCALE = 0.85

decorated_line_edit Module

class camelot.view.controls.decorated_line_edit.DecoratedLineEdit(parent=None)[source]

Bases: PyQt4.QtGui.QLineEdit

A QLineEdit with additional decorations :

  • a background text, visible when the line edit doesn’t contain any text
  • a validity, which will trigger the background color

Use the user_input method to get the text that was entered by the user.

Note : since QT 4.7 the background text could be replaced with the setPlaceholderText on a QLineEdit

arrow_down_key_pressed
focusInEvent(e)[source]
focusOutEvent(e)[source]
keyPressEvent(e)[source]
paintEvent(event)[source]
set_background_text(background_text)[source]

Set the text to be displayed in the background when the line input does not contain any text :param background_text: the text to be shown, None if no text should be shown

set_minimum_width(width)[source]

Set the minimum width of the line edit, measured in number of characters. :param width: the number of characters that should be visible in the

editor
set_user_input(text)[source]
set_valid(valid)[source]

Set the validity of the current content of the line edit :param valid: True or False

user_input()[source]

exception Module

Functions and widget to represent exceptions to the user

class camelot.view.controls.exception.ExceptionDialog(exception_info)[source]

Bases: PyQt4.QtGui.QMessageBox

Dialog to display an exception to the user

../_images/user_exception.png
camelot.view.controls.exception.model_thread_exception_message_box(exception_info)[source]

Display an exception that occurred in the model thread in a message box, use this function as the exception argument in the model thread’s post function to represent the exception to the user

Parameters:exception_info – a tuple containing exception information
camelot.view.controls.exception.register_exception(logger, text, exception)[source]

Log an exception and return a serialized form of the exception with exception information in a user readable format, to be used when displaying an exception message box.

that serialized form can be fed to the model_thread_exception_message_box function.

Returns:a tuple with exception information

field_label Module

class camelot.view.controls.field_label.Attribute(name, value)[source]

Bases: object

Helper class representing a field attribute’s name and its value

class Admin(app_admin, entity)[source]

Bases: camelot.admin.object_admin.ObjectAdmin

field_attributes = {'name': {'minimal_column_width': 25}, 'value': {'minimal_column_width': 25}}
list_display = ['name', 'value']
class camelot.view.controls.field_label.FieldLabel(field_name, text, field_attributes, admin, parent=None)[source]

Bases: camelot.view.controls.user_translatable_label.UserTranslatableLabel

A Label widget used to display the name of a field on a form. This label provides the user with the possibility to change the translation of the label and review its field attributes.

font_width = None
get_attributes()[source]
show_field_attributes()[source]
sizeHint()[source]

filter_operator Module

class camelot.view.controls.filter_operator.FilterOperator(entity, field_name, field_attributes, parent)[source]

Bases: PyQt4.QtGui.QWidget

Widget that allows applying various filter operators on a field

combobox_changed(index)[source]

Whenever the combobox changes, show or hide the appropriate editors and emit the filter_changed signal

decorate_query(query)[source]
Parameters:query – an sqlalchemy query
Returns:the input query transformed to take into account the filter of

this widget

editor_editing_finished()[source]

Whenever one of the editors their value changes, emit the filters changed signal

filter_changed_signal
get_operator_and_arity()[source]
Returns:the current operator and its arity

filterlist Module

Controls to filter data

class camelot.view.controls.filterlist.FilterList(items, parent)[source]

Bases: PyQt4.QtGui.QWidget

A list with filters that can be applied on a query in the tableview

decorate_query(query)[source]
emit_filters_changed()[source]
filters_changed_signal

formview Module

form view

class camelot.view.controls.formview.ContextMenuAction(parent, title, icon=None)[source]

Bases: PyQt4.QtGui.QAction

default_icon = Icon('tango/16x16/categories/applications-system.png')
class camelot.view.controls.formview.FormEditors(columns, widget_mapper, delegate, admin)[source]

Bases: object

A class that holds the editors used on a form

bold_font = None
create_editor(field_name, parent)[source]
Returns:a QtGuiQWidget or None if field_name is unknown
create_label(field_name, editor, parent)[source]
option = None
class camelot.view.controls.formview.FormView(title, admin, model, index)[source]

Bases: camelot.view.controls.view.AbstractView

A FormView is the combination of a FormWidget, possible actions and menu items

view

closeEvent(event)[source]
form_widget

alias of FormWidget

refresh()[source]

Refresh the data in the current view

refresh_session()[source]
setActions(actions)[source]
showMessage(valid)[source]
toHtml(*args, **kwargs)[source]

generates html of the form

update_title(current_index)[source]
validateClose()[source]
viewFirst()[source]

select model’s first row

viewLast()[source]

select model’s last row

viewNext()[source]

select model’s next row

viewPrevious()[source]

select model’s previous row

class camelot.view.controls.formview.FormWidget(parent, admin)[source]

Bases: PyQt4.QtGui.QWidget

A form widget comes inside a form view or inside an embedded manytoone editor

changed_signal
clear_mapping()[source]
export_ooxml()[source]
get_index()[source]
get_model()[source]
set_index(index)[source]
set_model(model)[source]
submit()[source]
to_first()[source]
to_last()[source]
to_next()[source]
to_previous()[source]

inheritance Module

Controls related to visualizing object hierarchy

class camelot.view.controls.inheritance.SubclassDialog(parent, admin)[source]

Bases: PyQt4.QtGui.QDialog

A dialog requesting the user to select a subclass

class camelot.view.controls.inheritance.SubclassItem(parent, admin)[source]

Bases: camelot.view.controls.modeltree.ModelItem

class camelot.view.controls.inheritance.SubclassTree(admin, parent)[source]

Bases: camelot.view.controls.modeltree.ModelTree

Widget to select subclasses of a certain entity, where the subclasses are represented in a tree

emits subclassClicked when a subclass has been selected

emit_subclass_clicked(index)[source]
setSubclasses(subclasses)[source]
subclass_clicked_signal

liteboxview Module

class camelot.view.controls.liteboxview.CloseMark(pixmap=None, hover_pixmap=None, parent=None)[source]

Bases: PyQt4.QtGui.QGraphicsPixmapItem

hoverEnterEvent(event)[source]
hoverLeaveEvent(event)[source]
mousePressEvent(event)[source]
class camelot.view.controls.liteboxview.LiteBoxView(parent=None)[source]

Bases: PyQt4.QtGui.QGraphicsView

ALPHA = <PyQt4.QtGui.QColor object at 0x9f639cc>
close()[source]
closed_signal
drawBackground(painter, rect)[source]
show_fullscreen_image(image)[source]
Parameters:image – a QImage
show_fullscreen_item(item)[source]
Parameters:item – a QGraphicsItem to be shown fullscreen
show_fullscreen_pixmap(pixmap)[source]
Parameters:pixmap – a QPixmap
show_fullscreen_svg(path)[source]
Parameters:path – path to an svg file
camelot.view.controls.liteboxview.fit_to_screen(pixmap)[source]
camelot.view.controls.liteboxview.get_desktop()[source]
camelot.view.controls.liteboxview.get_desktop_pixmap()[source]

modeltree Module

custom tree and tree-items widgets

class camelot.view.controls.modeltree.ModelItem(parent, columns_names, section_item)[source]

Bases: PyQt4.QtGui.QTreeWidgetItem

Custom tree item widget

set_icon(icon)[source]
class camelot.view.controls.modeltree.ModelTree(header_labels=[''], parent=None)[source]

Bases: PyQt4.QtGui.QTreeWidget

Custom tree widget

clear_model_items()[source]
clear_section_items()[source]
fix_header_labels()[source]
leaveEvent(event)[source]
mouseMoveEvent(event)[source]
mousePressEvent(event)[source]

Custom context menu

resizeEvent(event)[source]

navpane2 Module

left navigation pane

class camelot.view.controls.navpane2.NavigationPane(app_admin, workspace, parent)[source]

Bases: PyQt4.QtGui.QDockWidget

get_sections()[source]
set_sections(sections)[source]
update_sections()[source]
wheelEvent(wheel_event)[source]
class camelot.view.controls.navpane2.PaneSection(parent, section, workspace)[source]

Bases: PyQt4.QtGui.QWidget

create_context_menu(point)[source]
set_items(items)[source]

progress_dialog Module

Functions and classes to use a progress dialog in combination with a model thread

class camelot.view.controls.progress_dialog.ProgressDialog(name, icon=Icon('tango/32x32/actions/appointment-new.png'))[source]

Bases: PyQt4.QtGui.QProgressDialog

A Progress Dialog to be used in combination with a post to the model thread:

to display a progress dialog until my_function has finished:

d = ProgressDialog()
post(my_function, d.finished, d.exception)
d.exec_()
../_images/progress_dialog.png
display_chart(chart)[source]
display_pixmap(pixmap)[source]
Parameters:image – a camelot.view.art.Pixmap object
exception(exception_info)[source]
exit(return_code)[source]

Stop the application event loop, with the given return code

finished(success=True)[source]
progress_icon = Icon('tango/32x32/actions/appointment-new.png')

search Module

class camelot.view.controls.search.SimpleSearchControl(parent)[source]

Bases: camelot.view.controls.abstract_widget.AbstractSearchWidget

A control that displays a single text field in which search keywords can be typed

emits a search and a cancel signal if the user starts or cancels the search

emit_cancel()[source]
emit_expand_search_options()[source]
on_arrow_down_key_pressed()[source]
search(search_text)[source]

Start searching for search_text

standalone_wizard_page Module

class camelot.view.controls.standalone_wizard_page.HSeparator(parent=None)[source]

Bases: PyQt4.QtGui.QFrame

class camelot.view.controls.standalone_wizard_page.StandaloneWizardPage(window_title=None, parent=None, flags=<PyQt4.QtCore.WindowFlags object at 0x9e62ae4>)[source]

Bases: PyQt4.QtGui.QDialog

A Standalone Wizard Page Dialog for quick configuration windows

banner_layout()[source]
banner_logo_holder()[source]
banner_text_layout()[source]
banner_widget()[source]
buttons_widget()[source]
main_widget()[source]
set_banner_logo_pixmap(pixmap)[source]
set_banner_subtitle(subtitle)[source]
set_banner_title(title)[source]
set_layouts(*args, **kwargs)[source]

statusbar Module

A custom status bar containing a progress indicator

class camelot.view.controls.statusbar.StatusBar(parent)[source]

Bases: PyQt4.QtGui.QStatusBar

tableview Module

Tableview

class camelot.view.controls.tableview.AdminTableWidget(admin, parent=None)[source]

Bases: camelot.view.controls.tableview.TableWidget

A table widget that inspects the admin class and changes the behavior of the table as specified in the admin class

copy_selected_rows()[source]
delete_selected_rows()[source]
class camelot.view.controls.tableview.FrozenTableWidget(parent, columns_frozen)[source]

Bases: PyQt4.QtGui.QTableView

A table widget to be used as the frozen table widget inside a table widget.

currentChanged(current, previous)[source]

When the current index has changed, prevent it to jump to a column that is not frozen

class camelot.view.controls.tableview.HeaderWidget(parent, admin)[source]

Bases: PyQt4.QtGui.QWidget

HeaderWidget for a tableview, containing the title, the search widget, and the number of rows in the table

decorate_query(query)[source]

Apply expanded filters on the query

expand_search_options()[source]
filters_changed_signal
rows_widget

alias of RowsWidget

search_widget

alias of SimpleSearchControl

setNumberOfRows(*args, **kwargs)[source]
class camelot.view.controls.tableview.RowsWidget(parent)[source]

Bases: PyQt4.QtGui.QLabel

Widget that is part of the header widget, displaying the number of rows in the table view

setNumberOfRows(rows)[source]
class camelot.view.controls.tableview.Splitter[source]

Bases: PyQt4.QtGui.QSplitter

Custom implementation of QSplitter to use the custom SplitterHandle

createHandle()[source]
class camelot.view.controls.tableview.SplitterHandle(orientation, splitter, widget_to_hide=None)[source]

Bases: PyQt4.QtGui.QSplitterHandle

Custom implementation of QSplitterHandle to provide more functions, such as hiding a widget by clicking the handle

mousePressEvent(event)[source]
class camelot.view.controls.tableview.TableView(admin, search_text=None, parent=None)[source]

Bases: camelot.view.controls.view.AbstractView

A generic tableview widget that puts together some other widgets. The behaviour of this class and the resulting interface can be tuned by specifying specific class attributes which define the underlying widgets used

class MovieRentalTableView(TableView):
  title_format = 'Grand overview of recent movie rentals'

The attributes that can be specified are :

header_widget

The widget class to be used as a header in the table view:

header_widget = HeaderWidget
table_widget

The widget class used to display a table within the table view

table_widget = TableWidget

title_format

A string used to format the title of the view

title_format = ‘%(verbose_name_plural)s’

table_model

A class implementing QAbstractTableModel that will be used as a model for the table view

table_model = QueryTableProxy
  • emits the row_selected signal when a row has been selected
class AdminTableWidget(admin, parent=None)

Bases: camelot.view.controls.tableview.TableWidget

A table widget that inspects the admin class and changes the behavior of the table as specified in the admin class

copy_selected_rows()
delete_selected_rows()
TableView.cancelSearch()[source]

resets search filtering to default

TableView.closeEvent(event)[source]

reimplements close event

TableView.copy_selected_rows()[source]

Copy the selected rows in this tableview

TableView.create_table_model(admin)[source]

Create a table model for the given admin interface

TableView.deleteSelectedRows()[source]

delete the selected rows in this tableview

TableView.focusTable()[source]
TableView.getColumns()[source]

return the columns to be displayed in the table view

TableView.getData()[source]

generator for data queried by table model

TableView.getTitle()[source]

return the name of the entity managed by the admin attribute

TableView.get_admin()[source]
TableView.get_collection_getter(*args, **kwargs)[source]
Returns:a list with all the objects corresponding to the rows in the table
TableView.get_model()[source]
TableView.get_selection_getter(*args, **kwargs)[source]
Returns:a function that when called return an iterable with all the

objects corresponding to the selected rows in the table.

TableView.get_title(*args, **kwargs)[source]
TableView.header_widget

alias of HeaderWidget

TableView.importFromFile()[source]

“import data : the data will be imported in the activeMdiChild

TableView.makeImport()[source]
TableView.newRow(*args, **kwargs)[source]

Create a new row in the tableview

TableView.on_keyboard_selection_signal()[source]
TableView.rebuild_query()[source]

resets the table model query

TableView.refresh()[source]

Refresh the whole view

TableView.row_selected_signal
TableView.sectionClicked(section)[source]

emits a row_selected signal

TableView.selectTableRow(row)[source]

selects the specified row

TableView.select_all_rows()[source]
TableView.selectedTableIndexes(*args, **kwargs)[source]

returns a list of selected rows indexes

TableView.setSubclassTree(*args, **kwargs)[source]
TableView.set_admin(*args, **kwargs)[source]

Switch to a different subclass, where admin is the admin object of the subclass

TableView.set_filters_and_actions(*args, **kwargs)[source]

sets filters for the tableview

TableView.startSearch(text)[source]

rebuilds query based on filtering text

TableView.tableLayoutChanged(*args, **kwargs)[source]
TableView.table_model

alias of QueryTableProxy

TableView.title_format = '%(verbose_name_plural)s'
TableView.to_html()[source]

generates html of the table

TableView.viewFirst()[source]

selects first row

TableView.viewLast()[source]

selects last row

TableView.viewNext()[source]

selects next row

TableView.viewPrevious()[source]

selects previous row

class camelot.view.controls.tableview.TableWidget(parent=None, columns_frozen=0, lines_per_row=1)[source]

Bases: PyQt4.QtGui.QTableView

A widget displaying a table, to be used within a TableView. This is a pumped up version of the QTableView widget providing extra functions such as frozen columns. But it does not rely on the model being Camelot specific, or a Collection Proxy.

margin

margin, specified as a number of pixels, used to calculate the height of a row in the table, the minimum row height will allow for this number of pixels below and above the text.

activated(selectedIndex, previousSelectedIndex)[source]
close_editor()[source]

Close the active editor, this method is used to prevent assertion failures in QT when an editor is still open in the view for a cell that no longer exists in the model

those assertion failures only exist in QT debug builds.

edit(index, trigger=None, event=None)[source]
horizontal_section_clicked(logical_index)[source]

Update the sorting of the model and the header

keyPressEvent(e)[source]
keyboard_selection_signal
margin = 5
moveCursor(cursorAction, modifiers)[source]
resizeEvent(event)[source]
scrollTo(index, hint)[source]
setItemDelegate(item_delegate)[source]
setModel(model)[source]

user_translatable_label Module

class camelot.view.controls.user_translatable_label.TranslateLabelAction(parent)[source]

Bases: PyQt4.QtGui.QAction

translate_icon = Icon('tango/16x16/apps/preferences-desktop-locale.png')
class camelot.view.controls.user_translatable_label.UserTranslatableLabel(text, parent=None)[source]

Bases: PyQt4.QtGui.QLabel

A QLabel that allows the user to translate the text contained within by right clicking on it and selecting the appropriate submenu.

change_translation()[source]
create_update_translation_table(source, language, value)[source]

view Module

Functionality common to TableViews and FormViews

class camelot.view.controls.view.AbstractView[source]

Bases: PyQt4.QtGui.QWidget

A string used to format the title of the view :: title_format = ‘Movie rental overview’

header_widget

The widget class to be used as a header in the table view:

header_widget = None

change_icon(new_icon)[source]
change_title(new_title)[source]

Will emit the title_changed_signal

export_to_excel(*args, **kwargs)[source]
export_to_mail(*args, **kwargs)[source]
export_to_word(*args, **kwargs)[source]
header_widget = None
icon_changed_signal
refresh()[source]

Refresh the data in the current view

title_changed_signal
title_format = ''
to_html(*args, **kwargs)[source]
class camelot.view.controls.view.TabView(parent, views=[], admin=None)[source]

Bases: camelot.view.controls.view.AbstractView

Class to combine multiple views in Tabs and let them behave as one view. This class can be used when defining custom create_table_view methods on an ObjectAdmin class to group multiple table views together in one view.

export_to_excel()[source]
export_to_mail()[source]
export_to_word()[source]
refresh()[source]

Refresh the data in the current view

set_views_and_titles(views_and_titles)[source]
to_html()[source]

Subpackages


Comments
blog comments powered by Disqus