bec_widgets.widgets.editors.dict_backed_table#
Classes#
Widget which uses a DictBackedTableModel to display an editable table |
|
A model to go with DictBackedTable, which represents key-value pairs |
Module Contents#
- class DictBackedTable(parent: qtpy.QtWidgets.QWidget | None = None, initial_data: list[list[str]] = [], autoscale_to_data: bool = True)#
Bases:
qtpy.QtWidgets.QWidgetWidget which uses a DictBackedTableModel to display an editable table which can be extracted as a dict.
- Parameters:
initial_data (list[list[str]]) – list of key-value pairs to initialise with
- clear()#
- delete_selected_rows()#
Delete rows which are part of the selection model
- dump_dict()#
Get the current content of the table as a dict
- replace_data(data: dict | None)#
- scale_to_data(*_)#
- set_button_visibility(value: bool)#
- set_default(value: dict | None)#
- set_height_in_lines(lines: int)#
- update_disallowed_keys(keys: list[str])#
Set the list of keys which may not be used.
- Parameters:
keys (list[str]) – list of keys which are forbidden.
- autoscale = True#
- data_changed#
- delete_rows#
- class DictBackedTableModel(data)#
Bases:
qtpy.QtCore.QAbstractTableModelA model to go with DictBackedTable, which represents key-value pairs to be displayed in a TreeWidget.
- Parameters:
data (list[list[str]]) – list of key-value pairs to initialise with
- _other_keys(row: int)#
- add_row()#
- columnCount(index: qtpy.QtCore.QModelIndex = QModelIndex())#
- data(index, role=Qt.ItemDataRole)#
- delete_rows(rows: list[int])#
- dump_dict()#
- flags(_)#
- headerData(section: int, orientation: qtpy.QtCore.Qt.Orientation, role: int = Qt.ItemDataRole()) Any#
- insertRows(row, number, index)#
We only support adding one at a time for now
- length()#
- removeRows(row, number, index)#
This can only be consecutive, so instead of trying to be clever, only support removing one at a time
- replaceData(data: dict)#
- rowCount(index: qtpy.QtCore.QModelIndex = QModelIndex())#
- setData(index, value, role)#
- set_default(value: dict | None)#
- update_disallowed_keys(keys: list[str])#
Set the list of keys which may not be used.
- Parameters:
keys (list[str]) – list of keys which are forbidden.