tableview

Tableview

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

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

class camelot.view.controls.tableview.ColumnGroupsWidget(table, table_widget, parent=None)[source]

A tabbar the user can use to select a group of columns within an item view.

Parameters:
  • table – a camelot.admin.table.Table object, describing the column groups.
  • table_widget – a QtWidgets.QTableView widget of which columns will be hidden and shown depending on the selected tab.
  • parent – a QtWidgets.QWidget
class camelot.view.controls.tableview.HeaderWidget(gui_context, parent)[source]

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

rows_widget

alias of RowsWidget

search_widget

alias of SimpleSearchControl

class camelot.view.controls.tableview.RowsWidget(gui_context, parent=None)[source]

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

class camelot.view.controls.tableview.TableView(gui_context, admin, search_text=None, proxy=<class 'camelot.view.proxy.queryproxy.QueryTableProxy'>, parent=None)[source]
Parameters:

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’

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

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

TableView.cancelSearch()[source]

resets search filtering to default

TableView.closeEvent(event)[source]

reimplements close event

TableView.header_widget

alias of HeaderWidget

TableView.rebuild_query()[source]

resets the table model query

TableView.refresh()[source]

Refresh the whole view

TableView.sectionClicked(section)[source]

emits a row_selected signal

TableView.set_admin(admin)[source]

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

TableView.set_list_actions(actions)[source]

sets filters for the tableview

TableView.startSearch(text)[source]

rebuilds query based on filtering text

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

A widget displaying a table, to be used within a TableView. 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.

Parameters:lines_per_row – the number of lines of text that should be viewable in a single row.
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.

horizontal_section_clicked(logical_index)[source]

Update the sorting of the model and the header

timerEvent(event)[source]

On timer event, save changed column widths to the model

update_headers()[source]

Updating the header size seems to be no default Qt function, so, it’s managed here