commands.*

Pyspread undoable commands

Provides

class commands.DeleteColumns(grid, model, index, column, count, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Deletes grid columns

Parameters
  • grid (QTableView) – The main grid object

  • model (QAbstractTableModel) – Model of the grid object

  • index (QModelIndex) – Parent from which the new columns are deleted

  • column (int) – Column number of the first column to be deleted

  • count (int) – Number of columns to be deleted

  • description (str) – Command description

redo()[source]

Redo column deletion, updates screen

undo()[source]

Undo column deletion, updates screen

class commands.DeleteRows(grid, model, index, row, count, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Deletes grid rows

Parameters
  • grid (QTableView) – The main grid object

  • model (QAbstractTableModel) – Model of the grid object

  • index (QModelIndex) – Parent from which the new rows are deleted

  • row (int) – Row number of the first row to be deleted

  • count (int) – Number of rows to be deleted

  • description (str) – Command description

redo()[source]

Redo row deletion, updates screen

undo()[source]

Undo row deletion, updates screen

class commands.DeleteTable(grid, model, table, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Deletes table

Parameters
  • grid (QTableView) – The main grid object

  • model (QAbstractTableModel) – Model of the grid object

  • table (int) – Table number for deletion

  • description (str) – Command description

redo()[source]

Redo table deletion, updates row and column sizes and screen

undo()[source]

Undo table deletion, updates row and column sizes and screen

class commands.FreezeCell(model, cells, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Freezes cell in grid

Parameters
  • model (QAbstractTableModel) – Model of the grid object

  • cells (List[Tuple[int, int, int]]) – List of indices of cells to be frozen

  • description (str) – Command description

redo()[source]

Redo cell freezing

undo()[source]

Undo cell freezing

class commands.InsertColumns(grid, model, index, column, count, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Inserts grid columns

Parameters
  • grid (QTableView) – The main grid object

  • model (QAbstractTableModel) – Model of the grid object

  • index (QModelIndex) – Parent into which the new columns are inserted

  • column (int) – Column number of the first column after insertion

  • count (int) – Number of columns to be inserted

  • description (str) – Command description

redo()[source]

Redo column insertion, updates screen

undo()[source]

Undo column insertion, updates screen

class commands.InsertRows(grid, model, index, row, count, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Inserts grid rows

Parameters
  • grid (QTableView) – The main grid object

  • model (QAbstractTableModel) – Model of the grid object

  • index (QModelIndex) – Parent into which the new rows are inserted

  • row (int) – Row number that first row will have after insertion

  • count (int) – Number of rows to be inserted

  • description (str) – Command description

redo()[source]

Redo row insertion, updates screen

undo()[source]

Undo row insertion, updates screen

class commands.InsertTable(grid, model, table, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Inserts table

Parameters
  • grid (QTableView) – The main grid object

  • model (QAbstractTableModel) – Model of the grid object

  • table (int) – Table number for insertion

  • description (str) – Command description

redo()[source]

Redo table insertion, updates row and column sizes and screen

undo()[source]

Undo table insertion, updates row and column sizes and screen

class commands.MakeButtonCell(grid, text, index, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Makes a button cell

Parameters
  • grid (QTableView) – Main grid object

  • text (str) – Button cell text

  • index (QModelIndex) – Index of the cell which becomes a button cell

  • description (str) – Command description

redo()[source]

Redo button cell making

undo()[source]

Undo button cell making

class commands.RemoveButtonCell(grid, index, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Removes a button cell

Parameters
  • grid (QTableView) – Main grid object

  • index (QModelIndex) – Index of the cell where a button cell is removed

  • description (str) – Command description

redo()[source]

Redo button cell removal

undo()[source]

Undo button cell removal

class commands.SetCellCode(code, model, index, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Sets cell code in grid

Parameters
  • code (str) – The main grid object

  • model (QAbstractTableModel) – Model of the grid object

  • index (QModelIndex) – Index of the cell for which the code is set

  • description (str) – Command description

id(self) int[source]
mergeWith(other)[source]

Consecutive commands are merged if descriptions match

Parameters

other (QUndoCommand) – Command to be merged

Return type

bool

redo()[source]

Redo cell code setting

During update, cell highlighting is disabled.

undo()[source]

Undo cell code setting.

During update, cell highlighting is disabled.

class commands.SetCellFormat(attr, model, index, selected_idx, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Sets cell format in grid

Format is set for one given cell and a selection.

Parameters
  • attr (CellAttribute) – Cell format to be set

  • model (QAbstractTableModel) – Model of the grid object

  • index (QModelIndex) – Index of the cell for which the format is set

  • selected_idx (Iterable[QModelIndex]) – Indexes of cells for which the format is set

  • description (str) – Command description

redo()[source]

Redo cell formatting

undo()[source]

Undo cell formatting

class commands.SetCellMerge(attr, model, index, selected_idx, description)[source]

Bases: commands.SetCellFormat

Sets cell merges in grid

Parameters
  • attr (CellAttribute) – Cell format to be set

  • model (QAbstractTableModel) – Model of the grid object

  • index (QModelIndex) – Index of the cell for which the format is set

  • selected_idx (Iterable[QModelIndex]) – Indexes of cells for which the format is set

  • description (str) – Command description

redo()[source]

Redo cell merging

undo()[source]

Undo cell merging

class commands.SetCellRenderer(attr, model, entry_line, highlighter_document, index, selected_idx, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Sets cell renderer in grid

Adjusts syntax highlighting in entry line.

Parameters
  • attr (CellAttribute) – Cell format that cointains target renderer information

  • model (QAbstractTableModel) – Model of the grid object

  • entry_line (QPlainTextEdit) – Entry line in main window

  • highlighter_document (QTextDocument) – Document for entry line

  • index (QModelIndex) – Index of the cell for which the renderer is set

  • selected_idx (Iterable[QModelIndex]) – Indexes of cells for which the renderer is set

  • description (str) – Command description

redo()[source]

Redo cell renderer setting, adjusts syntax highlighting

undo()[source]

Undo cell renderer setting, adjusts syntax highlighting

class commands.SetCellTextAlignment(attr, model, index, selected_idx, description)[source]

Bases: commands.SetCellFormat

Sets cell text alignment in grid

Parameters
  • attr (CellAttribute) – Cell format to be set

  • model (QAbstractTableModel) – Model of the grid object

  • index (QModelIndex) – Index of the cell for which the format is set

  • selected_idx (Iterable[QModelIndex]) – Indexes of cells for which the format is set

  • description (str) – Command description

redo()[source]

Redo cell text alignment

class commands.SetColumnsWidth(grid, columns, table, old_width, new_width, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Sets column width in grid

Parameters
  • grid (QTableView) – The main grid object

  • columns (List[int]) – Columns for which widths are set

  • table (int) – Table for which column widths are set

  • old_width (float) – Column width before setting

  • new_width (float) – Target column width for setting

  • description (str) – Command description

id()[source]

Command id that enables command merging

Return type

int

mergeWith(other)[source]

Consecutive commands are merged if descriptions match

Parameters

other (QUndoCommand) – Command to be merged

Return type

bool

redo()[source]

Redo column width setting

undo()[source]

Undo column width setting

class commands.SetGridSize(grid, old_shape, new_shape, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Sets size of grid

Parameters
  • grid (QTableView) – The main grid object

  • old_shape (Tuple[int, int, int]) – Shape of the grid before command

  • new_shape (Tuple[int, int, int]) – Shape of the grid to be set

  • description (str) – Command description

redo()[source]

Redo grid size change and deletion of cell code outside new shape

Cell formats are not deleted.

undo()[source]

Undo grid size change and deletion of cell code outside new shape

Cell formats are not deleted.

class commands.SetRowsHeight(grid, rows, table, old_height, new_height, description)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

Sets rows height in grid

Parameters
  • grid (QTableView) – The main grid object

  • rows (List[int]) – Rows for which height are set

  • table (int) – Table for which row heights are set

  • old_height (float) – Row height before setting

  • new_height (float) – Target row height for setting

  • description (str) – Command description

id()[source]

Command id that enables command merging

Return type

int

mergeWith(other)[source]

Consecutive commands are merged if descriptions match

Parameters

other (QUndoCommand) – Command to be merged

Return type

bool

redo()[source]

Redo row height setting

undo()[source]

Undo row height setting

class commands.ThawCell(model, cells, description)[source]

Bases: commands.FreezeCell

Thaw (unfreezes) cell in grid

Parameters
  • model (QAbstractTableModel) – Model of the grid object

  • cells (List[Tuple[int, int, int]]) – List of indices of cells to be frozen

  • description (str) – Command description

redo()[source]

Redo cell thawing

undo()[source]

Undo cell thawing