pyspread package

Subpackages

Submodules

pyspread.actions module

Provides

class pyspread.actions.Action(parent, label, *callbacks, icon=None, shortcut=None, statustip=None, checkable=False, role=None)[source]

Bases: QAction

A convenience class for creating a QAction

Parameters:
  • parent (QWidget) – The parent object, normally pyspread.MainWindow

  • label (str) – The text to appear

  • callbacks (List[Callable]) – the callback functions

  • icon (QIcon) – the icons.Icon

  • shortcut (str) – The magic kestrokes if ant

  • statustip (str) – The popup message

  • checkable (bool) – Has a checkbox

  • role (MenuRole) – Menu role for action for macOS

class pyspread.actions.ChartDialogActions(parent)[source]

Bases: AttrDict

QActions for chart dialog

Reads out template files in share/templates/matplotlib and adds a QAction for each template.

Parameters:

parent (QWidget) – The parent object

class pyspread.actions.MainWindowActions(parent, shortcuts=True)[source]

Bases: AttrDict

Holds all QActions for the main window

Parameters:
  • parent (QWidget) – The parent object, normally pyspread.MainWindow

  • shortcuts (bool) – Enable shortcuts for actions

create_edit_actions()[source]

actions for Edit menu

create_file_actions()[source]

actions for File menu

create_format_actions()[source]

actions for Format menu

create_help_actions()[source]

actions for Help menu

create_macro_actions()[source]

Create actions for Macro menu

create_view_actions()[source]

actions for View menu

disable_unavailable()[source]

Disables unavailable menu items e.g. due to missing dependencies

class pyspread.actions.SpellTextEditActions(parent)[source]

Bases: AttrDict

Holds QActions for SpellTextEdit

Parameters:

parent (QWidget) – The parent object, normally pyspread.MainWindow

pyspread.cli module

Provides

class pyspread.cli.PyspreadArgumentParser[source]

Bases: ArgumentParser

Parser for the command line

pyspread.cli.check_mandatory_dependencies()[source]

Checks mandatory dependencies and exits if they are not met

pyspread.commands module

Pyspread undoable commands

Provides

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

Bases: 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 pyspread.commands.DeleteRows(grid, model, index, row, count, description)[source]

Bases: 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 pyspread.commands.DeleteSelectedCellData(grid, model, selection, description)[source]

Bases: QUndoCommand

Delete selected cells

Parameters:
  • grid (QTableView) – The main grid object

  • model (QAbstractTableModel) – Model of the grid object

  • selection (Selection) – Selected cells to be deleted

  • description (str) – Command description

redo()[source]

Redo cell data deletion, updates screen

undo()[source]

Undo row insertion, updates screen

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

Bases: 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 pyspread.commands.FreezeCell(model, cells, description)[source]

Bases: 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 pyspread.commands.InsertColumns(grid, model, index, column, count, description)[source]

Bases: 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 pyspread.commands.InsertRows(grid, model, index, row, count, description)[source]

Bases: 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 pyspread.commands.InsertTable(grid, model, table, description)[source]

Bases: 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 pyspread.commands.MakeButtonCell(grid, text, index, description)[source]

Bases: 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 pyspread.commands.PasteSelectedCellData(grid, model, selection, data, description)[source]

Bases: QUndoCommand

Paste selected cells

Parameters:
  • grid (QTableView) – The main grid object

  • model (QAbstractTableModel) – Model of the grid object

  • selection (Selection) – Selection into which cells are pasted

  • data (str) – Data to be pasted

  • description (str) – Command description

redo()[source]

Redo cell data deletion, updates screen

undo()[source]

Undo row insertion, updates screen

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

Bases: 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 pyspread.commands.SetCellCode(code, model, index, description)[source]

Bases: 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 pyspread.commands.SetCellFormat(attr, model, index, selected_idx, description)[source]

Bases: 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 pyspread.commands.SetCellMerge(attr, model, index, selected_idx, description)[source]

Bases: 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 pyspread.commands.SetCellRenderer(attr, model, entry_line, highlighter_document, index, selected_idx, description)[source]

Bases: 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 pyspread.commands.SetCellTextAlignment(attr, model, index, selected_idx, description)[source]

Bases: 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 pyspread.commands.SetColumnsWidth(grid, columns, table, old_width, new_width, description)[source]

Bases: 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 pyspread.commands.SetGridSize(grid, old_shape, new_shape, description)[source]

Bases: 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 pyspread.commands.SetRowsHeight(grid, rows, table, old_height, new_height, description)[source]

Bases: 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 pyspread.commands.ThawCell(model, cells, description)[source]

Bases: 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

pyspread.dialogs module

Modal dialogs

class pyspread.dialogs.ApproveWarningDialog(parent)[source]

Bases: object

Modal warning dialog for approving files to be evaled

The modal dialog is shown on accessing the property choice.

Parameters:

parent (QWidget) – Parent widget, e.g. main window

buttons

alias of StandardButton

property choice: bool

User choice

Returns True iif the user approves leaving safe_mode. Returns False iif the user chooses to stay in safe_mode Returns None if the user chooses to abort the operation

choices = 81920
default_choice = 65536
text = 'You are going to approve and trust a file that you have not created yourself. After proceeding, the file is executed.\n \nIt may harm your system as any program can. Please check all cells thoroughly before proceeding.\n \nProceed and sign this file as trusted?'
title = 'Security warning'
class pyspread.dialogs.CellKeyDialog(parent, shape)[source]

Bases: DataEntryDialog

Modal dialog for entering a cell key, i.e. row, column, table

Parameters:
  • parent (QWidget) – Parent widget, e.g. main window

  • shape (Tuple[int, int, int]) – Grid shape

property key: Tuple[int, int, int]

Executes the dialog and returns rows, columns, tables

Returns None if the dialog is canceled.

class pyspread.dialogs.ChartDialog(parent, key, size=(1000, 700))[source]

Bases: QDialog

The chart dialog

Parameters:
  • parent (QWidget) – Parent window

  • key (Tuple[int, int, int]) – Target cell for chart

  • size (Tuple[int, int]) – Initial dialog size

apply()[source]

Executes the code in the dialog and updates the canvas

create_buttonbox()[source]

Returns a QDialogButtonBox with Ok and Cancel

dialog_ui()[source]

Sets up dialog UI

on_template()[source]

Event handler for pressing a template toolbar button

class pyspread.dialogs.CsvExportAreaDialog(parent, grid, title)[source]

Bases: DataEntryDialog

Modal dialog for entering csv export area

Initially, this dialog is filled with the selection bounding box if present or with the visible area of <= 1 cell is selected.

Parameters:
  • parent (QWidget) – Parent widget, e.g. main window

  • grid (QTableView) – The main grid widget

  • title (str) – Dialog title

property area: SinglePageArea | MultiPageArea

Executes the dialog and returns top, left, bottom, right

Returns None if the dialog is canceled.

area_cls

alias of SinglePageArea

groupbox_title = 'Page area'
labels = ['Top', 'Left', 'Bottom', 'Right']
property validator_list: List[QIntValidator]

Returns list of validators for dialog

class pyspread.dialogs.CsvExportDialog(parent, csv_area)[source]

Bases: QDialog

Modal dialog for exporting csv files

Parameters:
  • parent (QWidget) – Parent window

  • csv_area (SinglePageArea) – Grid area to be exported

accept()[source]

Button event handler, starts csv import

apply()[source]

Button event handler, applies parameters to csv_preview

create_buttonbox()[source]

Returns button box with Reset, Apply, Ok, Cancel

Return type:

QDialogButtonBox

property default_dialect: Dialect

Default dialect for export based on excel-tab

maxrows = 10
reset()[source]

Button event handler, resets parameter_groupbox and csv_preview

title = 'CSV export'
class pyspread.dialogs.CsvFileImportDialog(main_window)[source]

Bases: FileDialogBase

Modal dialog for importing csv files

Parameters:

main_window (QMainWindow) – Application main window

filters_list = ['CSV file (*.*)']
show_dialog()[source]

Present dialog and update values

property suffix

Do not offer suffix for filepath

title = 'Import data'
class pyspread.dialogs.CsvImportDialog(parent, filepath, digest_types=None)[source]

Bases: QDialog

Modal dialog for importing csv files

Parameters:
  • parent (QWidget) – Parent window

  • filepath (Path) – Path to csv file

  • digest_types (List[str]) – Names of preprocessing functions for csv values

accept()[source]

Button event handler, starts csv import

apply()[source]

Button event handler, applies parameters to csv_table

create_buttonbox()[source]

Returns a QDialogButtonBox

reset()[source]

Button event handler, resets parameter_groupbox and csv_table

title = 'CSV import'
class pyspread.dialogs.CsvParameterGroupBox(parent)[source]

Bases: QGroupBox

QGroupBox that holds parameter widgets for the csv import dialog

Parameters:

parent (QWidget) – Parent window

adjust_csvdialect(dialect)[source]

Adjusts csv dialect from widget settings

Note that the dialect has two extra attributes encoding and hasheader

Parameters:

dialect (Dialect) – Attributes class for csv reading and writing

Return type:

Dialect

default_delimiter = ','
default_quotechar = '"'
default_quoting = 'QUOTE_MINIMAL'
delimiter_tooltip = 'A one-character string used to separate fields.'
doublequote_tooltip = 'Controls how instances of quotechar appearing inside a field should be themselves be quoted. When True, the character is doubled. When False, the escapechar is used as a prefix to the quotechar.'
encoding_widget_tooltip = 'CSV file encoding'
escapechar_tooltip = 'A one-character string used by the writer to escape the delimiter if quoting is set to QUOTE_NONE and the quotechar if doublequote is False. On reading, the escapechar removes any special meaning from the following character.'
hasheader_tooltip = 'Analyze the CSV file and treat the first row as strings if it appears to be a series of column headers.'
keepheader_tooltip = 'Import header labels as str in the first row'
on_hasheader_toggled(toggled)[source]

Disables keep_header if hasheader is not toggled

quotechar_tooltip = 'A one-character string used to quote fields containing special characters, such as the delimiter or quotechar, or which contain new-line characters.'
quoting_widget_tooltip = 'Controls when quotes should be generated by the writer and recognised by the reader.'
quotings = ('QUOTE_ALL', 'QUOTE_MINIMAL', 'QUOTE_NONNUMERIC', 'QUOTE_NONE')
set_csvdialect(dialect)[source]

Update widgets from given csv dialect

Parameters:

dialect (Dialect) – Attributes class for csv reading and writing

skipinitialspace_tooltip = 'When True, whitespace immediately following the delimiter is ignored.'
title = 'Parameters'
class pyspread.dialogs.CsvTable(parent)[source]

Bases: QTableView

Table for previewing csv file content

Parameters:

parent (QWidget) – Parent window

add_choice_row(length)[source]

Adds row with comboboxes for digest choice

Parameters:

length (int) – Number of columns in row

fill(filepath, dialect, digest_types=None)[source]

Fills the csv table with values from the csv file

Parameters:
  • filepath (Path) – Path to csv file

  • dialect (Dialect) – Attributes class for csv reading and writing

  • digest_types (List[str]) – Names of preprocessing functions for csv values

get_digest_types()[source]

Returns list of digest types from comboboxes

Return type:

List[str]

no_rows = 9
update_comboboxes(digest_types)[source]

Updates the cono boxes to show digest_types

Parameters:

digest_types (List[str]) – Names of preprocessing functions for csv values

class pyspread.dialogs.DataEntryDialog(parent, title, labels, initial_data=None, groupbox_title=None, validators=None)[source]

Bases: QDialog

Modal dialog for entering multiple values

Parameters:
  • parent (QWidget) – Parent widget, e.g. main window

  • title (str) – Dialog title

  • labels (Sequence[str]) – Labels for the values in the dialog

  • initial_data (Sequence[str]) – Initial values to be displayed in the dialog

  • validators (Sequence[Union[QValidator, bool, None]]) – Validators for the editors of the dialog

len(initial_data), len(validators) and len(labels) must be equal

create_buttonbox()[source]

Returns a QDialogButtonBox with Ok and Cancel

Return type:

QDialogButtonBox

create_form()[source]

Returns form inside a QGroupBox

Return type:

QGroupBox

property data: Tuple[str]

Executes the dialog and returns input as a tuple of strings

Returns None if the dialog is canceled.

class pyspread.dialogs.DiscardChangesDialog(main_window)[source]

Bases: object

Modal dialog that asks if the user wants to discard or save unsaved data

The modal dialog is shown on accessing the property choice.

Parameters:

main_window (QMainWindow) – Application main window

buttons

alias of StandardButton

property choice: bool

User choice

Returns True if the user confirms in a user dialog that unsaved changes will be discarded if conformed. Returns False if the user chooses to save the unsaved data Returns None if the user chooses to abort the operation

choices = 12584960
default_choice = 2048
text = 'There are unsaved changes.\nDo you want to save?'
title = 'Unsaved changes'
class pyspread.dialogs.DiscardDataDialog(main_window, text)[source]

Bases: DiscardChangesDialog

Modal dialog that asks if the user wants to discard data

Parameters:
  • main_window (QMainWindow) – Application main window

  • text (str) – Message text

buttons

alias of StandardButton

choices = 12582912
default_choice = 4194304
title = 'Data to be discarded'
class pyspread.dialogs.FileDialogBase(main_window)[source]

Bases: object

Base class for modal file dialogs

The chosen filename is stored in the file_path attribute The chosen name filter is stored in the chosen_filter attribute If the dialog is aborted then both filepath and chosen_filter are None

_get_filepath must be overloaded

Parameters:

main_window (QMainWindow) – Application main window

file_path = None
property filters: str

Formatted filters for qt

filters_list = ['Pyspread un-compressed (*.pysu)', 'Pyspread compressed (*.pys)']
selected_filter = None
show_dialog()[source]

Sublasses must overload this method

property suffix: str

Suffix for filepath

title = 'Choose file'
class pyspread.dialogs.FileExportDialog(main_window, filters_list)[source]

Bases: FileDialogBase

Modal dialog for exporting csv files

Parameters:
  • main_window (QMainWindow) – Application main window

  • filters_list (List[str]) – List of filter strings

show_dialog()[source]

Present dialog and update values

property suffix: str

Suffix for filepath

title = 'Export data'
class pyspread.dialogs.FileOpenDialog(main_window)[source]

Bases: FileDialogBase

Modal dialog for opening a pyspread file

Parameters:

main_window (QMainWindow) – Application main window

show_dialog()[source]

Present dialog and update values

title = 'Open'
class pyspread.dialogs.FileSaveDialog(main_window)[source]

Bases: FileDialogBase

Modal dialog for saving a pyspread file

Parameters:

main_window (QMainWindow) – Application main window

show_dialog()[source]

Present dialog and update values

title = 'Save'
class pyspread.dialogs.FindDialog(main_window)[source]

Bases: QDialog

Find dialog that is launched from the main menu

Parameters:

main_window (QMainWindow) – Application main window

closeEvent(event)[source]

Store state for next invocation and close

Parameters:

event (QEvent) – Close event

restore(state)[source]

Restores state from FindDialogState

class pyspread.dialogs.FindDialogState(pos, case, results, more, backward, word, regex, start)[source]

Bases: object

Dataclass for FindDialog state storage

backward: bool
case: bool
more: bool
pos: QPoint
regex: bool
results: bool
start: bool
word: bool
class pyspread.dialogs.GridShapeDialog(parent, shape, title='Create a new Grid')[source]

Bases: DataEntryDialog

Modal dialog for entering the number of rows, columns and tables

Parameters:
  • parent (QWidget) – Parent widget, e.g. main window

  • shape (Tuple[int, int, int]) – Initial shape to be displayed in the dialog

property shape: Tuple[int, int, int]

Executes the dialog and returns an rows, columns, tables

Returns None if the dialog is canceled.

class pyspread.dialogs.ImageFileOpenDialog(main_window)[source]

Bases: FileDialogBase

Modal dialog for inserting an image

Parameters:

main_window (QMainWindow) – Application main window

img_format_string = '*.bmp *.cur *.ico *.jpeg *.jpg *.pbm *.pgm *.png *.ppm *.xbm *.xpm'
img_format_strings = <generator object ImageFileOpenDialog.<genexpr>>
img_formats = [PyQt6.QtCore.QByteArray(b'bmp'), PyQt6.QtCore.QByteArray(b'cur'), PyQt6.QtCore.QByteArray(b'ico'), PyQt6.QtCore.QByteArray(b'jpeg'), PyQt6.QtCore.QByteArray(b'jpg'), PyQt6.QtCore.QByteArray(b'pbm'), PyQt6.QtCore.QByteArray(b'pgm'), PyQt6.QtCore.QByteArray(b'png'), PyQt6.QtCore.QByteArray(b'ppm'), PyQt6.QtCore.QByteArray(b'xbm'), PyQt6.QtCore.QByteArray(b'xpm')]
name_filter = 'Images (*.bmp *.cur *.ico *.jpeg *.jpg *.pbm *.pgm *.png *.ppm *.xbm *.xpm);;Scalable Vector Graphics (*.svg *.svgz)'
show_dialog()[source]

Present dialog and update values

title = 'Insert image'
class pyspread.dialogs.ManualDialog(parent)[source]

Bases: TutorialDialog

Dialog for browsing the pyspread manual

Parameters:

parent (QWidget) – Parent window

size_hint = (1000, 800)
title2path = {'Advanced topics': PosixPath('/builds/pyspread/pyspread/pyspread/share/doc/manual/advanced_topics.md'), 'Concepts': PosixPath('/builds/pyspread/pyspread/pyspread/share/doc/manual/basic_concepts.md'), 'Edit': PosixPath('/builds/pyspread/pyspread/pyspread/share/doc/manual/edit_menu.md'), 'File': PosixPath('/builds/pyspread/pyspread/pyspread/share/doc/manual/file_menu.md'), 'Format': PosixPath('/builds/pyspread/pyspread/pyspread/share/doc/manual/format_menu.md'), 'Macro': PosixPath('/builds/pyspread/pyspread/pyspread/share/doc/manual/macro_menu.md'), 'Overview': PosixPath('/builds/pyspread/pyspread/pyspread/share/doc/manual/overview.md'), 'View': PosixPath('/builds/pyspread/pyspread/pyspread/share/doc/manual/view_menu.md'), 'Workspace': PosixPath('/builds/pyspread/pyspread/pyspread/share/doc/manual/workspace.md')}
window_title = 'pyspread manual'
class pyspread.dialogs.MultiPageArea(top, left, bottom, right, first, last)[source]

Bases: SinglePageArea

Holds multi page area boundaries e.g. for printing

first: int
last: int
class pyspread.dialogs.PreferencesDialog(parent)[source]

Bases: DataEntryDialog

Modal dialog for entering pyspread preferences

Parameters:

parent (QWidget) – Parent widget, e.g. main window

property data: dict

Executes the dialog and returns a dict containing preferences data

Returns None if the dialog is canceled.

class pyspread.dialogs.PrintAreaDialog(parent, grid, title)[source]

Bases: CsvExportAreaDialog

Modal dialog for entering print area

Initially, this dialog is filled with the selection bounding box if present or with the visible area of <= 1 cell is selected. Initially, the current table is selected.

Parameters:
  • parent (QWidget) – Parent widget, e.g. main window

  • grid (QTableView) – The main grid widget

  • title (str) – Dialog title

area_cls

alias of MultiPageArea

labels = ['Top', 'Left', 'Bottom', 'Right', 'First table', 'Last table']
property validator_list: List[QIntValidator]

Returns list of validators for dialog

class pyspread.dialogs.PrintPreviewDialog(printer)[source]

Bases: QPrintPreviewDialog

Adds Mouse wheel functionality

Parameters:

printer (QPrinter) – Target printer

wheelEvent(event)[source]

Overrides mouse wheel event handler

Parameters:

event (QWheelEvent) – Mouse wheel event

class pyspread.dialogs.ReplaceDialog(main_window)[source]

Bases: FindDialog

Replace dialog that is launched from the main menu

Parameters:

main_window (QMainWindow) – Application main window

class pyspread.dialogs.SinglePageArea(top, left, bottom, right)[source]

Bases: object

Holds single page area boundaries e.g. for export

bottom: int
left: int
right: int
top: int
class pyspread.dialogs.SvgExportAreaDialog(parent, grid, title)[source]

Bases: CsvExportAreaDialog

Modal dialog for entering svg export area

Initially, this dialog is filled with the selection bounding box if present or with the visible area of <= 1 cell is selected.

Parameters:
  • parent (QWidget) – Parent widget, e.g. main window

  • grid (QTableView) – The main grid widget

  • title (str) – Dialog title

groupbox_title = 'SVG export area'
class pyspread.dialogs.TupleValidator(*acceptable_values)[source]

Bases: QValidator

Validator for a tuple of values, normally strings

validate(text, pos)[source]

Validator core function. Must be overloaded.

class pyspread.dialogs.TutorialDialog(parent)[source]

Bases: QDialog

Dialog for browsing the pyspread tutorial

Parameters:

parent (QWidget) – Parent window

path: Path = PosixPath('/builds/pyspread/pyspread/pyspread/share/doc/tutorial/tutorial.md')
sizeHint()[source]

QDialog.sizeHint override

Return type:

QSize

size_hint = (1000, 800)
window_title = 'pyspread tutorial'

pyspread.entryline module

Provides

class pyspread.entryline.Entryline(main_window)[source]

Bases: SpellTextEdit

The entry line for pyspread

Parameters:

main_window (QMainWindow) – Application main window

disable_updates()[source]

Disables updates and highlighter

eventFilter(source, event)[source]

Quotes editor content for <Ctrl>+<Enter> and <Ctrl>+<Return>

Overrides SpellTextEdit default shortcut. Counts as undoable action.

Parameters:
  • source (QWidget) – Source widget of event

  • event (QEvent) – Event to be filtered

keyPressEvent(event)[source]

Key press event filter

Parameters:

event (QKeyEvent) – Key event

on_toggle_spell_check(signal)[source]

Spell check toggle event handler

Parameters:

signal (bool) – Spell check is enabled if True

setPlainText(text)[source]

Overides setPlainText

Additionally shows busy cursor and disables highlighter on long texts, and omits identical replace.

Parameters:

text (str) – Text to be set

store_data()[source]

Stores current entry line data in grid model

pyspread.grid module

Pyspread’s main grid

Provides

class pyspread.grid.Grid(main_window, model=None)[source]

Bases: QTableView

The main grid of pyspread

Parameters:
  • main_window (QMainWindow) – Application main window

  • model – GridTableModel for grid

adjust_size()[source]

Adjusts size to header maxima

closeEditor(editor, hint)[source]

Overrides QTableView.closeEditor

Changes to overridden behavior:
  • Data is submitted when a cell is changed without pressing <Enter> e.g. by mouse click or arrow keys.

Parameters:
  • editor (QWidget) – Editor to be closed

  • hint (EndEditHint) – Hint to be overridden if == QAbstractItemDelegate.NoHint

property column: int

Current column

property column_widths: List[Tuple[int, float]]

Returns list of tuples (col_index, col_width) for current table

contextMenuEvent(event)[source]

Overrides contextMenuEvent to install GridContextMenu

Parameters:

event (QContextMenuEvent) – Context menu event

property current: Tuple[int, int, int]

Tuple of row, column, table of the current index

focusInEvent(event)[source]

Overrides focusInEvent storing last focused grid in main_window

gui_update()[source]

Emits gui update signal

has_selection()[source]

Returns True if more than one cell is selected, else False

This method handles spanned/merged cells. One single cell that is selected is considered as no cell being selected.

Return type:

bool

is_column_data_discarded(count)[source]

True if column data is to be discarded on column insertion

Parameters:

count (int) – Columns to be inserted

Return type:

bool

is_row_data_discarded(count)[source]

True if row data is to be discarded on row insertion

Parameters:

count (int) – Rows to be inserted

Return type:

bool

is_table_data_discarded(count)[source]

True if table data is to be discarded on table insertion

Parameters:

count (int) – Tables to be inserted

Return type:

bool

keyPressEvent(event)[source]

Overrides QTableView.keyPressEvent

Changes to overridden behavior:
  • If Shift is pressed, the cell in the next column is selected.

  • If Shift is not pressed, the cell in the next row is selected.

Parameters:

event (QKeyEvent) – Key event

on_align_bottom()[source]

Align bottom button pressed event handler

on_align_middle()[source]

Align centere button pressed event handler

on_align_top()[source]

Align top button pressed event handler

on_background_color()[source]

Background color change event handler

on_bold_pressed(toggled)[source]

Bold button pressed event handler

Parameters:

toggled (bool) – Toggle state

on_border_choice()[source]

Border choice style event handler

on_borderwidth()[source]

Border width change event handler

on_button_cell_pressed(toggled)[source]

Button cell event handler

Parameters:

toggled (bool) – Toggle state

on_column_resized(column, old_width, new_width)[source]

Column resized event handler

Parameters:
  • row – Column that is resized

  • old_width (float) – Column width before resizing

  • new_width (float) – Column width after resizing

on_current_changed(*_)[source]

Event handler for change of current cell

on_data_changed()[source]

Event handler for data changes

on_date()[source]

Make cell date object event handler

on_datetime()[source]

Make cell datetime object event handler

on_delete_columns()[source]

Delete columns event handler

on_delete_rows()[source]

Delete rows event handler

on_delete_table()[source]

Delete table event handler

on_font()[source]

Font change event handler

on_font_dialog()[source]

Font dialog event handler

on_font_size()[source]

Font size change event handler

on_freeze_pressed(toggled)[source]

Freeze cell event handler

Parameters:

toggled (bool) – Toggle state

on_image_renderer_pressed()[source]

Image renderer button pressed event handler

on_insert_columns()[source]

Insert columns event handler

on_insert_rows()[source]

Insert rows event handler

on_insert_table()[source]

Insert table event handler

on_italics_pressed(toggled)[source]

Italics button pressed event handler

Parameters:

toggled (bool) – Toggle state

on_justify_center()[source]

Justify center button pressed event handler

on_justify_fill()[source]

Justify fill button pressed event handler

on_justify_left()[source]

Justify left button pressed event handler

on_justify_right()[source]

Justify right button pressed event handler

on_line_color()[source]

Line color change event handler

on_lock_pressed(toggled)[source]

Lock button pressed event handler

Parameters:

toggled (bool) – Toggle state

on_markup_renderer_pressed()[source]

Markup renderer button pressed event handler

on_matplotlib_renderer_pressed()[source]

Matplotlib renderer button pressed event handler

on_merge_pressed()[source]

Merge cells button pressed event handler

on_money()[source]

Make cell money object event handler using default currency

on_quote()[source]

Quote cells event handler

on_rotate_0()[source]

Set cell rotation to 0° left button pressed event handler

on_rotate_180()[source]

Set cell rotation to 180° left button pressed event handler

on_rotate_270()[source]

Set cell rotation to 270° left button pressed event handler

on_rotate_90()[source]

Set cell rotation to 90° left button pressed event handler

on_row_resized(row, old_height, new_height)[source]

Row resized event handler

Parameters:
  • row (int) – Row that is resized

  • old_height (float) – Row height before resizing

  • new_height (float) – Row height after resizing

on_selection_changed()[source]

Selection changed event handler

on_show_frozen_pressed(toggled)[source]

Show frozen cells event handler

Parameters:

toggled (bool) – Toggle state

on_strikethrough_pressed(toggled)[source]

Strikethrough button pressed event handler

Parameters:

toggled (bool) – Toggle state

on_text_color()[source]

Text color change event handler

on_text_renderer_pressed()[source]

Text renderer button pressed event handler

on_time()[source]

Make cell time object event handler

on_underline_pressed(toggled)[source]

Underline button pressed event handler

Parameters:

toggled (bool) – Toggle state

on_zoom_1()[source]

Sets zoom level ot 1.0

on_zoom_in()[source]

Zoom in event handler

on_zoom_out()[source]

Zoom out event handler

refresh_frozen_cells()[source]

Refreshes all frozen cells

refresh_selected_frozen_cells()[source]

Refreshes selected frozen cells

reset_selection()[source]

Select upper left cell

property row: int

Current row

property row_heights: List[Tuple[int, float]]

Returns list of tuples (row_index, row height) for current table

property selected_idx: List[QModelIndex]

Currently selected indices

property selection: Selection

Pyspread selection based on self’s QSelectionModel

property selection_mode: bool

In selection mode, cells cannot be edited

set_selection_mode(value=True)[source]

Setter for selection mode for all grids

Parameters:

value – If True, selection mode is set, if False unset

property table: int

Current table

toggle_selection_mode()[source]

Toggle selection mode for all grids

This method is required for accessing selection mode from QActions.

undo_resizing_column()[source]

Sets self.__undo_resizing_column to True for context

undo_resizing_row()[source]

Sets self.__undo_resizing_row to True for context

update_cell_spans()[source]

Update cell spans from model data

update_index_widgets()[source]

Remove old index widgets from model data

update_zoom()[source]

Updates the zoom level visualization to the current zoom factor

wheelEvent(event)[source]

Overrides mouse wheel event handler

Parameters:

event (QWheelEvent) – Mouse wheel event

property zoom: float

Returns zoom level

class pyspread.grid.GridCellDelegate(main_window, grid, code_array)[source]

Bases: QStyledItemDelegate

QStyledItemDelegate for main grid QTableView

Parameters:
  • main_window (QMainWindow) – Application main window

  • grid (Grid) – Grid, i.e. QTableView instance

  • code_array (CodeArray) – Main backend model instance

createEditor(parent, option, index)[source]

Overloads QStyledItemDelegate

Disables editor in locked cells Switches to chart dialog in chart cells

Parameters:
  • parent (QWidget) – Parent widget for the cell editor to be returned

  • option (QStyleOptionViewItem) – Style option for the cell editor

  • index (QModelIndex) – Index of cell for which a cell editor is created

Return type:

QWidget

eventFilter(source, event)[source]

Overloads eventFilter. Overrides QLineEdit default shortcut.

Quotes cell editor content for <Ctrl>+<Enter> and <Ctrl>+<Return>. Counts as undoable action.

Parameters:
  • source (QObject) – Source widget of event

  • event (QEvent) – Any QEvent

Return type:

bool

paint(painter, option, index)[source]

Overloads QStyledItemDelegate to add cell border painting

Parameters:
  • painter (QPainter) – Painter with which borders are drawn

  • option (QStyleOptionViewItem) – Style option for rendering

  • index (QModelIndex) – Index of cell to be rendered

paint_(painter, rect, option, index)[source]

Calls the overloaded paint function or creates html delegate

Parameters:
  • painter (QPainter) – Painter with which borders are drawn

  • rect (QRectF) – Cell rect of the cell to be painted

  • option (QStyleOptionViewItem) – Style option for rendering

  • index (QModelIndex) – Index of cell for which borders are drawn

setEditorData(editor, index)[source]

Overloads setEditorData to use code_array data

Parameters:
  • editor (QWidget) – Cell editor, in which data is set

  • index (QModelIndex) – Index of cell from which the cell editor data is set

setModelData(editor, model, index)[source]

Overloads setModelData to use code_array data

Parameters:
  • editor (QWidget) – Cell editor, from which data is retrieved

  • model (QAbstractItemModel) – GridTableModel

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

sizeHint(option, index)[source]

Overloads SizeHint

Parameters:
  • option (QStyleOptionViewItem) – Style option for rendering

  • index (QModelIndex) – Index of the cell for the size hint

Return type:

QSize

updateEditorGeometry(editor, option, _)[source]

Overloads updateEditorGeometry to update editor geometry to cell

Parameters:
  • editor (QWidget) – Cell editor, for which geometry is retrieved

  • option (QStyleOptionViewItem) – Style option of the editor

class pyspread.grid.GridHeaderView(orientation, grid)[source]

Bases: QHeaderView

QHeaderView with zoom support

Parameters:
  • orientation (Orientation) – Orientation of the QHeaderView

  • grid (Grid) – The main grid widget

contextMenuEvent(event)[source]

Overrides contextMenuEvent

Installs HorizontalHeaderContextMenu or VerticalHeaderContextMenu depending on self.orientation().

Parameters:

event (QContextMenuEvent) – The triggering event

paintSection(painter, rect, logicalIndex)[source]

Overrides paintSection, which supports zoom

Parameters:
  • painter (QPainter) – Painter with which the section is drawn

  • rect (QRect) – Outer rectangle of the section to be drawn

  • logicalIndex (int) – Index of the section to be drawn

sectionSizeHint(logicalIndex)[source]

Overrides sectionSizeHint, which supports zoom

Parameters:

logicalIndex (int) – Index of the section for the size hint

Return type:

int

sizeHint()[source]

Overrides sizeHint, which supports zoom

Return type:

QSize

update_zoom()[source]

Updates zoom for the section sizes

class pyspread.grid.GridTableModel(main_window, shape)[source]

Bases: QAbstractTableModel

QAbstractTableModel for Grid

Parameters:
  • main_window (QMainWindow) – Application main window

  • shape (Tuple[int, int, int]) – Grid shape (rows, columns, tables)

cell_to_update

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

code(index)[source]

Code in cell index

Parameters:

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

Return type:

str

columnCount(_=<PyQt6.QtCore.QModelIndex object>)[source]

Overloaded QAbstractItemModel.columnCount for code_array backend

Return type:

int

current(index)[source]

Tuple of row, column, table of given index

Parameters:

index (QModelIndex) – Index of the cell to be made the current cell

Return type:

Tuple[int, int, int]

data(index, role=ItemDataRole.DisplayRole)[source]

Overloaded data for code_array backend

Parameters:
  • index (QModelIndex) – Index of the cell, for which data is returned

  • role (ItemDataRole) – Role of data to be returned

Return type:

Any

flags(index)[source]

Overloaded, makes items editable

Parameters:

index (QModelIndex) – Index of cell for which flags are returned

Return type:

ItemFlag

font(key)[source]

Returns font for given key

Parameters:

key (Tuple[int, int, int]) – Key of cell, for which font is returned

Return type:

QFont

property grid: Grid

The main grid

headerData(idx, _, role)[source]

Overloaded for displaying numbers in header

Parameters:
  • idx (QModelIndex) – Index of header for which data is returned

  • role (ItemDataRole) – Role of data to be returned

Return type:

str

insertColumns(column, count)[source]

Overloaded QAbstractItemModel.insertColumns for code_array backend

Parameters:
  • column (int) – Column at which columns are inserted

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

Return type:

bool

insertRows(row, count)[source]

Overloaded QAbstractItemModel.insertRows for code_array backend

Parameters:
  • row (int) – Row at which rows are inserted

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

Return type:

bool

insertTable(table, count=1)[source]

Inserts tables

Parameters:
  • table (int) – Table at which tables are inserted

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

inserting_columns(index, first, last)[source]

Context manager for inserting columns

see QAbstractItemModel.beginInsertColumns

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

  • first (int) – Column number that first column will have after insertion

  • last (int) – Column number that last column will have after insertion

inserting_rows(index, first, last)[source]

Context manager for inserting rows

see QAbstractItemModel.beginInsertRows

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

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

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

model_reset()[source]

Context manager for handle changing/resetting model data

removeColumns(column, count)[source]

Overloaded QAbstractItemModel.removeColumns for code_array backend

Parameters:
  • column (int) – Column at which columns are removed

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

Return type:

bool

removeRows(row, count)[source]

Overloaded QAbstractItemModel.removeRows for code_array backend

Parameters:
  • row (int) – Row at which rows are removed

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

Return type:

bool

removeTable(table, count=1)[source]

Removes tables

Parameters:
  • table (int) – Table at which tables are removed

  • count (int) – Number of tables to be removed

removing_columns(index, first, last)[source]

Context manager for removing columns

see QAbstractItemModel.beginRemoveColumns

Parameters:
  • index (QModelIndex) – Parent from which columns are removed

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

  • last (int) – Column number of the last column to be removed

removing_rows(index, first, last)[source]

Context manager for removing rows

see QAbstractItemModel.beginRemoveRows

Parameters:
  • index (QModelIndex) – Parent from which rows are removed

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

  • last (int) – Row number of the last row to be removed

reset()[source]

Deletes all grid data including undo data

rowCount(_=<PyQt6.QtCore.QModelIndex object>)[source]

Overloaded QAbstractItemModel.rowCount for code_array backend

Return type:

int

setData(index, value, role, raw=False, table=None)[source]

Overloaded setData for code_array backend

Parameters:
  • index (QModelIndex) – Index of the cell, for which data is set

  • value (Any) – Value of data to be set

  • role (ItemDataRole) – Role of data to be set

  • raw (bool) – Sets raw data without string formatting in EditRole

  • table (int) – Table for which data shall is set

Return type:

bool

property shape: Tuple[int, int, int]

Returns 3-tuple of rows, columns and tables

class pyspread.grid.TableChoice(main_window, no_tables)[source]

Bases: QTabBar

The TabBar below the main grid

Parameters:
  • main_window (QMainWindow) – Application main window

  • no_tables (int) – Number of tables to be initially created

contextMenuEvent(event)[source]

Overrides contextMenuEvent to install GridContextMenu

Parameters:

event (QContextMenuEvent) – Triggering event

property no_tables: int

Returns the number of tables in the table_choice

on_table_changed(current)[source]

Event handler for table changes

Parameters:

current (int) – The current table to be displayed

property table: int

Returns current table from table_choice that is displayed

pyspread.grid_renderer module

Provides

  • func:

    painter_save: Context manager saving and restoring painter state

  • func:

    painter_zoom: Context manager scaling and restoring the painter

  • func:

    painter_rotate: Context manager rotating and restoring the painter

  • GridCellNavigator: Find neighbors of a cell

  • EdgeBorders: Dataclass for edge properties

  • CellEdgeRenderer: Paints cell edges

  • QColorCache: QColor cache

  • CellRenderer: Paints cells

class pyspread.grid_renderer.BorderColorBottomCache(grid, *args, **kwargs)[source]

Bases: BorderWidthBottomCache

BorderColorBottomCache cache

class pyspread.grid_renderer.BorderColorRightCache(grid, *args, **kwargs)[source]

Bases: BorderWidthBottomCache

BorderColorBottomCache cache

class pyspread.grid_renderer.BorderWidthBottomCache(grid, *args, **kwargs)[source]

Bases: dict

BorderWidthBottom cache

class pyspread.grid_renderer.BorderWidthRightCache(grid, *args, **kwargs)[source]

Bases: BorderWidthBottomCache

BorderWidthRight cache

class pyspread.grid_renderer.CellEdgeRenderer(painter, center, borders, rect, clip_path, zoom)[source]

Bases: object

Paints cell edges

Borders are provided by EdgeBorders in order: left, right, top, bottom

Parameters:
  • painter (QPainter) – Painter with which edge is drawn

  • center (QPointF) – Edge center

  • borders (EdgeBorders) – Border widths and colors

  • rect (QRectF) – Rect of the clip_path

  • clip_path (QPainterPath) – Clip rectangle that is required for QtSVG clipping

  • zoom (float) – Current zoom level

intersection_cache = {}
paint()[source]

Paints the edge

class pyspread.grid_renderer.CellRenderer(grid, painter, option, index)[source]

Bases: object

Paints cells

Cell rendering governs the area of a cell inside its borders. It is done in a vector oriented way. Therefore, the following conventions shall apply:

  • Cell borders of width 1 shall be painted so that they appear only in the bottom and right edge of the cell.

  • Cell borders of all widths have the same center line.

  • Cell borders that are thicker than 1 are painted on all borders.

  • At the edges, borders are painted in the following order:
    1. Thin borders are painted first

    2. If border width is equal, lighter colors are painted first

Parameters:
  • grid (QTableView) – The main grid widget

  • painter (QPainter) – Painter with which borders are drawn

  • option (QStyleOptionViewItem) – Style option for rendering

  • index (QModelIndex) – Index of cell to be rendered

inner_rect(rect)[source]

Returns inner rect that is shrunk by border widths

For merged cells, minimum top/left border widths are taken into account

Parameters:

rect (QRectF) – Cell rect to be shrunk

Return type:

QRectF

paint()[source]

Paints the cell

paint_above_borders(rect, clip_path)[source]

Paint lower borders of all above cells

Parameters:
  • rect (QRectF) – Cell rect of below cell, in which the borders are painted

  • clip_path (QPainterPath) – Clip rectangle that is requuired for QtSVG clipping

paint_borders(rect)[source]

Paint cell borders

paint_bottom_border(rect, clip_path)[source]

Paint bottom border of cell

Parameters:
  • rect (QRectF) – Cell rect of the cell to be painted

  • clip_path (QPainterPath) – Clip rectangle that is required for QtSVG clipping

paint_bottom_left_edge(rect, clip_path)[source]

Paints bottom left edge of the cell

Parameters:
  • rect (QRectF) – Cell rect of cell, for which the edge is painted

  • clip_path (QPainterPath) –

    Clip rectangle that is requuired for QtSVG clipping

    top

    L | C

left ———— right
BL | B

bottom

paint_bottom_right_edge(rect, clip_path)[source]

Paints bottom right edge of the cell

Parameters:
  • rect (QRectF) – Cell rect of cell, for which the edge is painted

  • clip_path (QPainterPath) –

    Clip rectangle that is requuired for QtSVG clipping

    top

    C | R

left ———– right
B | BR

bottom

paint_content(rect)[source]
Parameters:

rect (QRectF) – Cell rect of the cell to be painted

paint_left_borders(rect, clip_path)[source]

Paint right borders of all left cells

Parameters:
  • rect (QRectF) – Cell rect of right cell, in which the borders are painted

  • clip_path (QPainterPath) – Clip rectangle that is requuired for QtSVG clipping

paint_right_border(rect, clip_path)[source]

Paint right border of cell

Parameters:
  • rect (QRectF) – Cell rect of the cell to be painted

  • clip_path (QPainterPath) – Clip rectangle that is requuired for QtSVG clipping

paint_top_left_edge(rect, clip_path)[source]

Paints top left edge of the cell

Parameters:
  • rect (QRectF) – Cell rect of cell, for which the edge is painted

  • clip_path (QPainterPath) –

    Clip rectangle that is requuired for QtSVG clipping

    top

    TL | T

left ———— right
L | C

bottom

paint_top_right_edge(rect, clip_path)[source]

Paints top right edge of the cell

Parameters:
  • rect (QRectF) – Cell rect of cell, for which the edge is painted

  • clip_path (QPainterPath) –

    Clip rectangle that is requuired for QtSVG clipping

    top

    T | TR

left ———— right
C | R

bottom

class pyspread.grid_renderer.EdgeBorders(left_width, right_width, top_width, bottom_width, left_color, right_color, top_color, bottom_color, left_x, right_x, top_y, bottom_y)[source]

Bases: object

Holds border data for an edge and provides effective edge properties

bottom_color: QColor
bottom_width: float
bottom_y: float
property color: QColor

Edge color, i.e. darkest color of thickest edge border

property height: float

Edge height, i.e. thickest horizontal border

left_color: QColor
left_width: float
left_x: float
right_color: QColor
right_width: float
right_x: float
top_color: QColor
top_width: float
top_y: float
property width: float

Edge width, i.e. thickest vertical border

class pyspread.grid_renderer.EdgeBordersCache[source]

Bases: dict

Cache of all EdgeBorders objects

class pyspread.grid_renderer.GridCellNavigator(grid, key)[source]

Bases: object

Find neighbors of a cell

Parameters:
  • grid (QTableView) – The main grid widget

  • key (Tuple[int, int, int]) – Key of cell fow which neighbors are identified

above_keys()[source]

Key list of neighboring cells above the key cell

Return type:

List[Tuple[int, int, int]]

above_left_key()[source]

Key of neighboring cell above left of the key cell

Return type:

Tuple[int, int, int]

above_right_key()[source]

Key of neighboring cell above right of the key cell

Return type:

Tuple[int, int, int]

below_keys()[source]

Key list of neighboring cells below the key cell

Return type:

List[Tuple[int, int, int]]

below_left_key()[source]

Key of neighboring cell below left of the key cell

Return type:

Tuple[int, int, int]

below_right_key()[source]

Key of neighboring cell below right of the key cell

Return type:

Tuple[int, int, int]

property border_color_bottom: QColor

Color of bottom border line

property border_color_right: QColor

Color of right border line

property borderwidth_bottom: float

Width of bottom border line

property borderwidth_right: float

Width of right border line

left_keys()[source]

Key list of neighboring cells left of the key cell

Return type:

List[Tuple[int, int, int]]

property merge_area: Tuple[int, int, int, int]

Merge area of the key cell

merging_key(key)[source]

Merging cell if cell is merged else cell key

Parameters:

key (Tuple[int, int, int]) – Key of cell that is checked for being merged

Return type:

Tuple[int, int, int]

right_keys()[source]

Key list of neighboring cells right of the key cell

Return type:

List[Tuple[int, int, int]]

class pyspread.grid_renderer.QColor[source]

Bases: QColor

Hashable QColor

class pyspread.grid_renderer.QColorCache(grid, *args, **kwargs)[source]

Bases: dict

QColor cache that returns default color for None

pyspread.grid_renderer.painter_rotate(painter, rect, angle=0)[source]

Context manager rotating and restoring the painter

Parameters:
  • painter (QPainter) – Painter, which is rotated

  • rect (QRectF) – Rect to be painted in

  • angle (int) – Rotataion angle must be in (0, 90, 180, 270)

Return type:

QRectF

pyspread.grid_renderer.painter_save(painter)[source]

Context manager saving and restoring painter state

Parameters:

painter (QPainter) – Painter, for which the state is preserved

pyspread.grid_renderer.painter_zoom(painter, zoom, rect)[source]

Context manager scaling and restoring the painter

(rect.x(), rect.y()) is invariant

Parameters:
  • painter (QPainter) – Painter, for which the state is preserved

  • zoom (float) – Zoom factor

  • rect (QRectF) – Rect for setting zoom invariant point (rect.x(), rect.y())

Return type:

QRectF

pyspread.icons module

Provides

class pyspread.icons.Icon[source]

Bases: object

Provides QIcons as attributes for all attributes of IconPaths

class pyspread.icons.IconConverter[source]

Bases: type

Meta class that provides QIcons for IconPaths icons

class pyspread.icons.IconPath[source]

Bases: object

Holds icon paths as attributes

align_bottom = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-text-align-bottom.svg')
align_center = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-text-align-center.svg')
align_top = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-text-align-top.svg')
approve = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-approve.svg')
background_color = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-background-color.svg')
bold = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-text-bold.svg')
border_menu = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-all.svg')
button = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-button.svg')
chart_area_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_area_1_1.svg')
chart_bar_1_3 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_bar_1_3.svg')
chart_boxplot_2_2 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_boxplot_2_2.svg')
chart_bubble_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_bubble_1_1.svg')
chart_column_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_column_1_1.svg')
chart_column_1_2 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_column_1_2.svg')
chart_contour_1_2 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_contour_1_2.svg')
chart_histogram_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_histogram_1_1.svg')
chart_histogram_1_4 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_histogram_1_4.svg')
chart_line_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_line_1_1.svg')
chart_matrix_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_matrix_1_1.svg')
chart_pie_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_pie_1_1.svg')
chart_plotnine_geom_bar_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_plotnine_geom_bar_1_1.svg')
chart_polar_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_polar_1_1.svg')
chart_r_ggplot2_geom_boxplot_1_2 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_r_ggplot2_geom_boxplot_1_2.svg')
chart_r_ggplot2_geom_density2d_1_2 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_r_ggplot2_geom_density2d_1_2.svg')
chart_r_ggplot2_geom_point_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_r_ggplot2_geom_point_1_1.svg')
chart_r_graphics_barplot_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_r_graphics_barplot_1_1.svg')
chart_r_lattice_wireframe_2_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_r_lattice_wireframe_2_1.svg')
chart_r_lattice_xyplot_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_r_lattice_xyplot_1_1.svg')
chart_ring_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_ring_1_1.svg')
chart_scatter_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_scatter_1_1.svg')
chart_scatterhist_1_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_scatterhist_1_1.svg')
chart_surface_2_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/charts/chart_surface_2_1.svg')
check_spelling = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/view-check-spelling.svg')
clear_globals = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-clear.svg')
copy = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-copy.svg')
copy_format = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-copy.svg')
copy_results = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-copy-results.svg')
cut = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-cut.svg')
date = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/macro-date.svg')
datetime = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/macro-datetime.svg')
delete_column = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-delete-column.svg')
delete_row = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-delete-row.svg')
delete_table = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-delete-table.svg')
dependencies = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/help-dependencies.svg')
export = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-export.svg')
faq = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/help-faq.svg')
find = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-find.svg')
find_next = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-find-next.svg')
font_dialog = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-font.svg')
format_borders = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-4.svg')
format_borders_0 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-0.svg')
format_borders_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-1.svg')
format_borders_16 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-16.svg')
format_borders_2 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-2.svg')
format_borders_32 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-32.svg')
format_borders_4 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-4.svg')
format_borders_64 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-64.svg')
format_borders_8 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-8.svg')
format_borders_all = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-all.svg')
format_borders_bottom = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-bottom.svg')
format_borders_inner = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-inner.svg')
format_borders_left = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-left.svg')
format_borders_outer = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-outer.svg')
format_borders_right = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-right.svg')
format_borders_top = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-top.svg')
format_borders_top_bottom = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-borders-top-bottom.svg')
freeze = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-freeze.svg')
fullscreen = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/view-fullscreen.svg')
goto_cell = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/view-goto-cell.svg')
help = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/help-browser.svg')
image = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-cell-image.svg')
imprt = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-import.svg')
insert_chart = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/macro-insert-chart.svg')
insert_column = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-insert-column.svg')
insert_image = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/macro-insert-image.svg')
insert_row = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-insert-row.svg')
insert_sum = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/macro-insert-sum.svg')
insert_table = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-insert-table.svg')
italics = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-text-italic.svg')
justify_center = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-justify-center.svg')
justify_fill = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-justify-fill.svg')
justify_left = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-justify-left.svg')
justify_right = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-justify-right.svg')
line_color = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-line-color.svg')
lock = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-lock.svg')
markup = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-cell-markup.svg')
matplotlib = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-cell-chart.svg')
menu_manager = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/menu-manager.svg')
merge_cells = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-merge-cells.svg')
money = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/macro-money.svg')
new = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-new.svg')
new_gpg_key = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-new-gpg-key.svg')
open = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-open.svg')
page_setup = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-page-setup.svg')
paste = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-paste.svg')
paste_as = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-paste-as.svg')
paste_format = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-paste.svg')
preferences = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-properties.svg')
print = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-print.svg')
print_preview = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-print-preview.svg')
pyspread = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/hicolor/svg/pyspread.svg')
quit = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-log-out.svg')
quote = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/macro-quote.svg')
redo = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-redo.svg')
refresh = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/view-refresh.svg')
replace = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-find-replace.svg')
resize_grid = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-resize-grid.svg')
rotate_0 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-cell-rotate-0.svg')
rotate_180 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-cell-rotate-180.svg')
rotate_270 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-cell-rotate-270.svg')
rotate_90 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-cell-rotate-90.svg')
safe_mode = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/status/status-safe-mode.svg')
save = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-save.svg')
save_as = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/document-save-as.svg')
select_all = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-select-all.svg')
selection_mode = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/status/status-selection-mode.svg')
show_frozen = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/view-show-frozen.svg')
sort_ascending = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-sort-ascending.svg')
sort_descending = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-sort-descending.svg')
strikethrough = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-text-strikethrough.svg')
text = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-cell-text.svg')
text_color = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-text-color.svg')
time = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/macro-time.svg')
toggle_periodic_updates = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/view-timer.svg')
tutorial = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/help-tutorial.svg')
underline = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-text-underline.svg')
undo = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-undo.svg')
zoom_1 = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/view-zoom-original.svg')
zoom_in = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/view-zoom-in.svg')
zoom_out = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/view-zoom-out.svg')

pyspread.installer module

Provides

class pyspread.installer.DependenciesDialog(parent=None)[source]

Bases: QDialog

Dependencies dialog for python dependencies

Parameters:

parent (QWidget) – Parent widget

column = {'button': 0, 'description': 5, 'name': 2, 'required_version': 4, 'status': 1, 'version': 3}
column_headers = ('', 'Status', 'Package', 'Version', 'Required', 'Description')
on_butt_install(butt)[source]

One of install buttons pressed

Parameters:

butt (QPushButton) – The pressed button

sizeHint()[source]

Overloaded method

Return type:

QSize

update_load()[source]
class pyspread.installer.InstallPackageDialog(parent=None, module=None)[source]

Bases: QDialog

Shows a dialog to execute command

Parameters:
  • parent – Parent widget

  • module – Module to be installed

line_str = '--------------------------------------------------------'
on_butt_execute()[source]

Execute button event handler

on_finished()[source]

Execution finished event handler

on_read_error()[source]

Stderr read event handler

on_read_standard()[source]

Stdout read event handler

update_cmd_line(*unused)[source]

Update the commend line considering sudo button state

class pyspread.installer.Module(name, description, required_version)[source]

Bases: object

Module checker

description: str
is_installed()[source]

True if the module is installed

Return type:

bool

name: str
required_version: str
property version: <module 'packaging.version' from '/usr/lib/python3/dist-packages/packaging/version.py'>

Currently installed version number, False if not installed

pyspread.main_window module

pyspread

  • Main Python spreadsheet application

  • Run this script to start the application.

Provides

  • MainApplication: Initial command line operations and application launch

  • MainWindow: Main windows class

class pyspread.main_window.MainWindow(filepath=PosixPath('.'), default_settings=False)[source]

Bases: QMainWindow

Pyspread main window

Parameters:
  • filepath (Path) – File path for inital file to be opened

  • default_settings (bool) – Ignore stored QSettings and use defaults

closeEvent(event=None)[source]

Overloaded, allows saving changes or canceling close

Parameters:

event (QEvent) – Any QEvent

eventFilter(source, event)[source]

Overloaded event filter for handling QDockWidget close events

Updates the menu if the macro panel is closed.

Parameters:
  • source (QWidget) – Source widget of event

  • event (QEvent) – Any QEvent

Return type:

bool

property focused_grid

Returns grid with focus or self if none has focus

gui_update

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

on_about()[source]

Show about message box

on_approve()[source]

Approve event handler

on_clear_globals()[source]

Clear globals event handler

on_dependencies()[source]

Dependancies installer (installer.InstallerDialog)

on_focus_changed(old, now)[source]

Handles grid clicks from entry line

on_fullscreen()[source]

Fullscreen toggle event handler

on_gui_update(attributes)[source]

GUI update that shall be called on each cell change

Parameters:

attributes (CellAttributes) – Attributes of current cell

on_manual()[source]

Show manual browser

on_paint_request(printer)[source]

Paints to printer

Parameters:

printer (QPrinter) – Target printer

on_preferences()[source]

Preferences event handler (dialogs.PreferencesDialog)

on_preview()[source]

Print preview event handler

on_print()[source]

Print event handler

on_redo()[source]

Undo event handler

on_refresh_timer()[source]

Event handler for self.refresh_timer.timeout

Called for periodic updates of frozen cells. Does nothing if either the entry_line or a cell editor is active.

on_toggle_entry_line_dock(toggled)[source]

Entryline toggle event handler

Parameters:

toggled (bool) – Toggle state

on_toggle_find_toolbar(toggled)[source]

Find toolbar toggle event handler

Parameters:

toggled (bool) – Toggle state

on_toggle_format_toolbar(toggled)[source]

Format toolbar toggle event handler

Parameters:

toggled (bool) – Toggle state

on_toggle_macro_dock(toggled)[source]

Macro panel toggle event handler

Parameters:

toggled (bool) – Toggle state

on_toggle_macro_toolbar(toggled)[source]

Macro toolbar toggle event handler

Parameters:

toggled (bool) – Toggle state

on_toggle_main_toolbar(toggled)[source]

Main toolbar toggle event handler

Parameters:

toggled (bool) – Toggle state

on_toggle_refresh_timer(toggled)[source]

Toggles periodic timer for frozen cells

Parameters:

toggled (bool) – Toggle state

on_tutorial()[source]

Show tutorial browser

on_undo()[source]

Undo event handler

resizeEvent(event)[source]

Overloaded, aborts on self._loading

Parameters:

event (QEvent) – Resize event

property safe_mode: bool

Returns safe_mode state. In safe_mode cells are not evaluated.

update_action_toggles()[source]

Updates the toggle menu check states

pyspread.menus module

Provides

class pyspread.menus.BorderChoiceMenu(actions)[source]

Bases: QMenu

QMenu for choosing cell borders that shall be manipulated

Parameters:

actions (MainWindowActions) – Main window actions

on_selection(event)[source]

Event handler

class pyspread.menus.BorderWidthMenu(actions)[source]

Bases: QMenu

QMenu for choosing the cell border width

Parameters:

actions (MainWindowActions) – Main window actions

on_selection(event)[source]

Event handler

class pyspread.menus.EditMenu(parent, actions)[source]

Bases: QMenu

Edit menu for the main menubar

Parameters:
  • parent (QWidget) – Parent widget

  • actions (MainWindowActions) – Main window actions

class pyspread.menus.FileHistoryMenu(parent, actions)[source]

Bases: QMenu

Menu that displays the file history

Parameters:
  • parent (QWidget) – Parent widget

  • actions (MainWindowActions) – Main window actions

on_recent()[source]

Event handler for file history menu

update()[source]

Updates file history menu

class pyspread.menus.FileMenu(parent, actions)[source]

Bases: QMenu

File menu for the main menubar

Parameters:
  • parent (QWidget) – Parent widget

  • actions (MainWindowActions) – Main window actions

class pyspread.menus.FormatMenu(parent, actions)[source]

Bases: QMenu

Format menu for the main menubar

Parameters:
  • parent (QWidget) – Parent widget

  • actions (MainWindowActions) – Main window actions

class pyspread.menus.GridContextMenu(actions)[source]

Bases: QMenu

Context menu for grid

Parameters:

actions (MainWindowActions) – Main window actions

class pyspread.menus.HelpMenu(parent, actions)[source]

Bases: QMenu

Help menu for the main menubar

Parameters:
  • parent (QWidget) – Parent widget

  • actions (MainWindowActions) – Main window actions

class pyspread.menus.HorizontalHeaderContextMenu(actions)[source]

Bases: QMenu

Context menu for horizontal grid header

Parameters:

actions (MainWindowActions) – Main window actions

class pyspread.menus.MacroMenu(parent, actions)[source]

Bases: QMenu

Macro menu for the main menubar

Parameters:
  • parent (QWidget) – Parent widget

  • actions (MainWindowActions) – Main window actions

class pyspread.menus.MenuBar(main_window)[source]

Bases: QMenuBar

The main menubar

Parameters:

main_window (QMainWindow) – Application main window

class pyspread.menus.TableChoiceContextMenu(actions)[source]

Bases: QMenu

Context menu for table choice

Parameters:

actions (MainWindowActions) – Main window actions

class pyspread.menus.ToolbarManagerMenu(toolbar)[source]

Bases: QMenu

Menu with all actions of a toolbar that allows toggling visibility

Parameters:

toolbar (QToolBar) – Toolbar that the menu is managing

on_toggled(action, toggled)[source]

Action toggle event handler

Parameters:
  • action (QAction) – Toolbar action for which visibility is toggled

  • toggled (bool) – If False then action is set invisible and vice versa

update_checked_states()[source]

Updates checked states

class pyspread.menus.VerticalHeaderContextMenu(actions)[source]

Bases: QMenu

Context menu for vertical grid header

Parameters:

actions (MainWindowActions) – Main window actions

class pyspread.menus.ViewMenu(parent, actions)[source]

Bases: QMenu

View menu for the main menubar

Parameters:
  • parent (QWidget) – Parent widget

  • actions (MainWindowActions) – Main window actions

pyspread.panels module

Provides

class pyspread.panels.MacroPanel(parent, code_array)[source]

Bases: QDialog

The macro panel

on_apply()[source]

Event handler for Apply button

update()[source]

Update macro content

update_result_viewer(result='', err='')[source]

Update event result following execution by main window

Parameters:
  • result (str) – Text to be shown in the result viewer in default color

  • err (str) – Text to be shown in the result viewer in error text color

pyspread.pyspread module

pyspread

  • Main Python spreadsheet application

  • Run this script to start the application.

Provides

  • MainApplication: Initial command line operations and application launch

  • MainWindow: Main windows class

pyspread.pyspread.excepthook(exception_type, exception_value, exception_traceback)[source]

Exception hook that prevents pyspread from crashing on exceptions

pyspread.pyspread.main()[source]

Pyspread main

pyspread.settings module

Provides

class pyspread.settings.Settings(parent, reset_settings=False)[source]

Bases: object

Contains all global application states.

Parameters:
  • parent (QWidget) – Parent widget, normally main window

  • reset_settings (bool) – Do not restore saved settings

add_to_file_history(filename)[source]

Adds new file to history

Parameters:

value – File name to be added to history

border_choice = 'All borders'

The state of the border choice button

changed_since_save = False

If True then File actions trigger a dialog

currency_iso_code = ''

Default currency for Money shortcut

default_column_width = 100
default_encoding = 'utf-8'

Default encoding for exporting files (e.g. CSV)

default_row_height = 30
digest_types = None

List of default digest types for preprocessing values from CSV import

encodings = ('ascii', 'big5', 'big5hkscs', 'cp037', 'cp424', 'cp437', 'cp500', 'cp720', 'cp737', 'cp775', 'cp850', 'cp852', 'cp855', 'cp856', 'cp857', 'cp858', 'cp860', 'cp861', 'cp862', 'cp863', 'cp864', 'cp865', 'cp866', 'cp869', 'cp874', 'cp875', 'cp932', 'cp949', 'cp950', 'cp1006', 'cp1026', 'cp1140', 'cp1250', 'cp1251', 'cp1252', 'cp1253', 'cp1254', 'cp1255', 'cp1256', 'cp1257', 'cp1258', 'euc-jp', 'euc-jis-2004', 'euc-jisx0213', 'euc-kr', 'gb2312', 'gbk', 'gb18030', 'hz', 'iso2022-jp', 'iso2022-jp-1', 'iso2022-jp-2', 'iso2022-jp-2004', 'iso2022-jp-3', 'iso2022-jp-ext', 'iso2022-kr', 'latin-1', 'iso8859-2', 'iso8859-3', 'iso8859-4', 'iso8859-5', 'iso8859-6', 'iso8859-7', 'iso8859-8', 'iso8859-9', 'iso8859-10', 'iso8859-13', 'iso8859-14', 'iso8859-15', 'iso8859-16', 'johab', 'koi8-r', 'koi8-u', 'mac-cyrillic', 'mac-greek', 'mac-iceland', 'mac-latin2', 'mac-roman', 'mac-turkish', 'ptcp154', 'shift-jis', 'shift-jis-2004', 'shift-jisx0213', 'utf-32', 'utf-32-be', 'utf-32-le', 'utf-16', 'utf-16-be', 'utf-16-le', 'utf-7', 'utf-8', 'utf-8-sig')

Encodings for importing and exporting files (e.g. CSV or SVG)

entry_line_font_family = 'Monospace'

Font family for entry line widget

file_history = []

Files in file history

find_dialog_state = None

Find dialog state - needs to be stored when dialog is closed

font_sizes = (6, 8, 10, 12, 14, 16, 18, 20, 24, 28, 32)

Sizes

highlighter_limit = 1000000

Maximum length of code, for which the netry line enables highlighting

last_file_export_path = PosixPath('/root')

Initial Path for exporting files

last_file_import_path = PosixPath('/root')

Initial Path for importing files

last_file_input_path = PosixPath('/root')

Initial Path for opening files

last_file_output_path = PosixPath('/root')

Initial Path for saving files

macro_editor_font_family = 'Monospace'

Font family for macro editor widget

max_file_history = 5

Maximum number of files in file history

maxshape = (1000000, 100000, 100)

Maximum shape of the grid

print_zoom = None
refresh_timeout = 1000

Timeout for frozen cell updates in milliseconds

reset()[source]

Reset to defaults

restore()[source]

Restores application state from QSettings

save()[source]

Saves application state to QSettings

shape = (1000, 100, 3)

Default shape of initial grid (rows, columns, tables)

show_frozen = False

If True then frozen cell background is striped

show_statusbar_sum = True
signature_key = None

Key for signing save files

sniff_size = 65536

Number of bytes for csv sniffer sniff_size should be larger than 1st+2nd line

timeout = 1000

Timeout for cell calculations in milliseconds

widget_names = ['main_window', 'main_toolbar', 'find_toolbar', 'format_toolbar', 'macro_toolbar', 'entry_line', 'entry_line_dock']

Names of widgets with persistant states

zoom_levels = (0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 6.0, 8.0)

pyspread.toolbar module

Provides

class pyspread.toolbar.ChartTemplatesToolBar(parent)[source]

Bases: ToolBarBase

Toolbar for chart dialog for inserting template chart code

Parameters:

parent (QWidget) – Parent widget, e.g. chart dialog window

tooltip_tpl = 'Package {} required but not installed'
class pyspread.toolbar.FindToolbar(main_window)[source]

Bases: ToolBarBase

The find toolbar for pyspread

Parameters:

main_window (QMainWindow) – Application main window

class pyspread.toolbar.FormatToolbar(main_window)[source]

Bases: ToolBarBase

The format toolbar for pyspread

Parameters:

main_window (QMainWindow) – Application main window

class pyspread.toolbar.MacroToolbar(main_window)[source]

Bases: ToolBarBase

The macro toolbar for pyspread

Parameters:

main_window (QMainWindow) – Application main window

class pyspread.toolbar.MainToolBar(main_window)[source]

Bases: ToolBarBase

The main toolbar

Parameters:

main_window (QMainWindow) – Application main window

class pyspread.toolbar.RChartTemplatesToolBar(parent)[source]

Bases: ToolBarBase

Toolbar for chart dialog for inserting R template chart code

Requires rpy2 with ggplot, lattice and graphics packages

Parameters:

parent (QWidget) – Parent widget, e.g. chart dialog window

static is_r_package_installed(package_name)[source]

True if the R package is installed

Parameters:

package_name – Name of R package to checked

tooltip_tpl = 'R Package {} required but not installed'
class pyspread.toolbar.ToolBarBase[source]

Bases: QToolBar

Base toolbar class that provides toolbar manager button method

add_widget(widget)[source]

Adds widget with addWidget and assigns action text and icon

The widget must have a label attribute and an icon method.

Parameters:

widget (QWidget) – Widget to be added

get_manager_button()[source]

Returns QToolButton for managing the toolbar

Return type:

QToolButton

pyspread.toolbar.add_toolbutton_widget(button, widget, minsize=(300, 200), popup_mode=ToolButtonPopupMode.MenuButtonPopup)[source]

Adds a widget as menu to a tool_button

Parameters:
  • button (QWidget) – Tool button for menu

  • widget (QWidget) – Toolbar widget

  • minsize (Tuple[int, int]) – Minimum menu size

  • popup_mode (ToolButtonPopupMode) – Describes how the menu is popped up

pyspread.widgets module

Provides

class pyspread.widgets.AlignmentButton(main_window)[source]

Bases: MultiStateBitmapButton

Alignment button for the format toolbar

Parameters:

main_window (QMainWindow) – Application main window

action_names = ('align_top', 'align_center', 'align_bottom')
icon()[source]

Returns icon for button identification

Return type:

QIcon

label = 'Alignment'
class pyspread.widgets.BackgroundColorButton(color)[source]

Bases: ColorButton

Color button with text icon

Parameters:

color (QColor) – Color that is initially set

label = 'Background Color'
class pyspread.widgets.CellButton(text, grid, key)[source]

Bases: QPushButton

Button that is used for button cells in the grid

Parameters:
  • text (str) – button label text

  • grid (QTableView) – Main grid

  • key (Tuple[int, int, int]) – key of button’s cell (row, column, table)

on_clicked()[source]

Clicked event handler, executes cell code

class pyspread.widgets.ColorButton(color, icon=None, max_size=PyQt6.QtCore.QSize(28, 28))[source]

Bases: QToolButton

Color button widget

Parameters:
  • color (QColor) – Color that is initially set

  • icon (QIcon) – Button foreground image

  • max_size (QSize) – Maximum Size of the button

property color: QColor

Chosen color

colorChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

default_color = None
on_pressed()[source]

Button pressed event handler

Shows color dialog and sets the chosen color.

set_max_size(size)[source]

Set the maximum size of the widget

Parameters:

color – Maximum button size

title = 'Select Color'
class pyspread.widgets.FindEditor(parent)[source]

Bases: QLineEdit

The Find editor widget for the find toolbar

Parameters:

parent (QWidget) – Parent widget

case = False
on_context_menu(point)[source]

Context menu event handler

Parameters:

point (QPoint) – Context menu coordinates on screen

on_toggle_case(toggled)[source]

Find case sensitively toggle event handler

Parameters:

toggled (bool) – case sensitivity option toggle state

on_toggle_regexp(toggled)[source]

Find with regular expression toggle event handler

Parameters:

toggled (bool) – regular expression option toggle state

on_toggle_results(toggled)[source]

Find in results toggle event handler

Parameters:

toggled (bool) – results option toggle state

on_toggle_up(toggled)[source]

Find upwards toggle event handler

Parameters:

toggled (bool) – up option toggle state

on_toggle_word(toggled)[source]

Find whole word toggle event handler

Parameters:

toggled (bool) – whole word option toggle state

prepend_actions(menu)[source]

Prepends find specific actions to menu

Parameters:

menu (QMenu) – Find editor context menu

regexp = False
results = False
up = False
word = False
class pyspread.widgets.FontChoiceCombo(main_window)[source]

Bases: QFontComboBox

Font choice combo box

Parameters:

main_window (QMainWindow) – Application main window

property font: str

Font family name

fontChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

icon()[source]

Returns QIcon for button identification

Return type:

QIcon

label = 'Font Family'
on_font()[source]

Font choice event handler

class pyspread.widgets.FontSizeCombo(main_window)[source]

Bases: QComboBox

Font choice combo box

Parameters:

main_window (QMainWindow) – Application main window

fontSizeChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

icon()[source]

Returns icon for button identification

Return type:

QIcon

label = 'Font Size'
on_text()[source]

Font size choice event handler

property size: int

Size of current text

class pyspread.widgets.HelpBrowser(parent, path)[source]

Bases: QTextBrowser

Help browser widget

Parameters:
  • parent (QWidget) – Parent window

  • path (Path) – Path to markdown file that is displayed

get_html(path)[source]

Returns html content for content of browser

Parameters:

path (Path) – Path to markdown file that is displayed

Return type:

str

update(path)[source]

Updates content

Parameters:

path (Path) – Path to markdown file that is displayed

class pyspread.widgets.JustificationButton(main_window)[source]

Bases: MultiStateBitmapButton

Justification button for the format toolbar

Parameters:

main_window (QMainWindow) – Application main window

action_names = ('justify_left', 'justify_center', 'justify_right', 'justify_fill')
icon()[source]

Returns icon for button identification

Return type:

QIcon

label = 'Justification'
class pyspread.widgets.LineColorButton(color)[source]

Bases: ColorButton

Color button with text icon

Parameters:

color (QColor) – Color that is initially set

label = 'Line Color'
class pyspread.widgets.MenuComboBox(items)[source]

Bases: QComboBox

ComboBox that uses a menu instead of a list

Parameters:

items (dict) – Menu items

The dict items needs to be given in the following format: {

“<label_1>”: None, # For leaf item “<label_2>”: {“<label_2.1>”: None}, # For submenu

}

hidePopup()[source]

Hide combo menu

on_menu_selected(action)[source]

Event handler for menu

showPopup()[source]

Show combo menu

text_tpl = '{} ({})'
class pyspread.widgets.MultiStateBitmapButton(main_window)[source]

Bases: QToolButton

QToolButton that cycles through arbitrary states

The states are defined by an iterable of QIcons

Parameters:

main_window (QMainWindow) – Application main window

property current_action_idx: int

Index of current action

get_action(index)[source]

Returns action from index in action_names

Parameters:

index (int) – Index of action to be returned

Return type:

QAction

next()[source]

Advances current_action_idx and returns current action

Return type:

QAction

on_clicked()[source]

Button clicked event handler. Chechs corresponding menu item

set_current_action(action_name)[source]

Sets current action

Parameters:

action_name (str) – Name of action as in MainWindowActions

set_menu_checked(action_name)[source]

Sets checked status of menu

Parameters:

action_name (str) – Name of action as in MainWindowActions

class pyspread.widgets.RendererButton(main_window)[source]

Bases: MultiStateBitmapButton

Cell render button for the format toolbar

Parameters:

main_window (QMainWindow) – Application main window

action_names = ('text', 'markup', 'image', 'matplotlib')
icon()[source]

Returns icon for button identification

Return type:

QIcon

label = 'Renderer'
class pyspread.widgets.RotationButton(main_window)[source]

Bases: MultiStateBitmapButton

Rotation button for the format toolbar

Parameters:

main_window (QMainWindow) – Application main window

action_names = ('rotate_0', 'rotate_90', 'rotate_180', 'rotate_270')
icon()[source]

Returns icon for button identification

Return type:

QIcon

label = 'Rotate'
class pyspread.widgets.TextColorButton(color)[source]

Bases: ColorButton

Color button with text icon

Parameters:

color (QColor) – Color that is initially set

label = 'Text Color'
class pyspread.widgets.TypeMenuComboBox[source]

Bases: MenuComboBox

MenuComboBox that comprises types and currencies for CSV import

Parameters:

items – Menu items

The dict items needs to be given in the following format: {

“<label_1>”: None, # For leaf item “<label_2>”: {“<label_2.1>”: None}, # For submenu

}

class pyspread.widgets.Widgets(main_window)[source]

Bases: object

Container class for widgets

Parameters:

main_window (QMainWindow) – Application main window

pyspread.workflows module

Workflows for pyspread

class pyspread.workflows.Workflows(main_window)[source]

Bases: object

Workflow container class

busy_cursor()[source]

contextmanager that displays a busy cursor

cell2dialog = {}
count_file_lines(filepath)[source]

Returns line count of file in filepath

Parameters:

filepath (Path) – Path of file to be analyzed

delete(description_tpl='Delete selection {}')[source]

Delete cells in selection

Parameters:

description_tpl (str) – Description template for QUndoCommand

edit_copy()[source]

Edit -> Copy workflow

Copies selected grid code to clipboard

edit_copy_results()[source]

Edit -> Copy results workflow

If a selection is present then repr of selected grid cells result objects are copied to the clipboard.

If no selection is present, the current cell results are copied to the clipboard. This can be plain text, html, a png image or an svg image.

edit_cut()[source]

Edit -> Cut workflow

edit_find()[source]

Edit -> Find workflow, opens FindDialog

edit_find_next()[source]

Edit -> Find next workflow

edit_paste()[source]

Edit -> Paste workflow

Pastes text clipboard data

If no selection is present, data is pasted starting with the current cell. If a selection is present, data is pasted fully if the selection is smaller. If the selection is larger then data is duplicated.

edit_paste_as()[source]

Pastes clipboard into one cell using a user specified mime type

edit_replace()[source]

Edit -> Replace workflow, opens ReplaceDialog

edit_resize()[source]

Edit -> Resize workflow

edit_sort_ascending()[source]

Edit -> Sort ascending

edit_sort_descending()[source]

Edit -> Sort descending

file_export()[source]

Export csv and svg files

file_import()[source]

Import csv files

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

Check changes and display and handle the dialog

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

Check changes and display and handle the dialog

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

Check changes and display and handle the dialog

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

Check changes and display and handle the dialog

file_save()[source]

File save workflow

file_save_as()[source]

File save as workflow

filepath_open(filepath)[source]

Workflow for opening a file if a filepath is known

Parameters:

filepath (Path) – Path of file to be opened

find_dialog_on_find(find_dialog)[source]

Edit -> Find workflow, after pressing find button in FindDialog

Parameters:

find_dialog (FindDialog) – Find dialog of origin

format_copy_format()[source]

Copies the format of the selected cells to the Clipboard

Cells are shifted so that the top left bbox corner is at 0,0

format_paste_format()[source]

Pastes cell formats

Pasting starts at cursor or at top left bbox corner

get_paint_columns(left, right)[source]

Iterator of columns to paint

Parameters:
  • left (int) – First column to paint

  • right (int) – Last column to paint

Return type:

Iterable[int]

get_paint_rows(top, bottom)[source]

Iterator of rows to paint

Parameters:
  • top (int) – First row to paint

  • bottom (int) – Last row to paint

Return type:

Iterable[int]

get_paint_tables(first, last)[source]

Iterator of tables to paint

Parameters:
  • first (int) – First table to paint

  • last (int) – Last table to paint

Return type:

Iterable[int]

get_total_height(top, bottom)[source]

Total height of paint_rows

Parameters:
  • top (int) – First row to evaluate

  • bottom (int) – Last row to evaluate

Return type:

float

get_total_width(left, right)[source]

Total height of paint_columns

Parameters:
  • left (int) – First column to evaluate

  • right (int) – Last column to evaluate

Return type:

float

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

Decorator to handle changes since last saving the document

If changes are present then a dialog is displayed that asks if the changes shall be discarded.

  • If the user selects Cancel then func is not executed.

  • If the user selects Save then the file is saved and func is executed.

  • If the user selects Discard then the file is not saved and func is executed.

If no changes are present then func is directly executed. After executing func, reset_changed_since_save() and update_main_window_title are called.

macro_insert_chart()[source]

Insert chart workflow

macro_insert_image()[source]

Insert image workflow

macro_insert_sum()[source]

Sum up selection area

The sum is inserted into the cell below the bottom right cell of the selection.

paint(painter, option, paint_rect, rows, columns)[source]

Grid paint workflow for printing and svg export

Parameters:
  • painter (QPainter) – Painter with which the grid is drawn

  • option (QStyleOptionViewItem) – Style option for rendering

  • paint_rect (QRectF) – Rectangle, which is drawn at the grid borders

  • rows (Iterable[int]) – Rows to be painted

  • columns (Iterable[int]) – Columns to be painted

prevent_updates()[source]

contextmanager sets the prevent_updates state

The prevent_updates state prevents updates in main_window.grid.setData

print_zoom(zoom=1.0)[source]

Decorator for tasks that have to take place in standard zoom

Parameters:

zoom (float) – Print zoom factor

replace_dialog_on_replace(replace_dialog, toggled=False, max_=1)[source]

Edit -> Replace workflow when pushing Replace in ReplaceDialog

Returns True if there is a match otherwise False

Parameters:
  • replace_dialog (ReplaceDialog) – Replace dialog of origin

  • toggled (bool) – Replace dialog toggle state

  • max – Maximum number of replace actions, -1 is unlimited

Return type:

bool

replace_dialog_on_replace_all(replace_dialog)[source]

Edit -> Replace workflow when pushing ReplaceAll in ReplaceDialog

Parameters:

replace_dialog (ReplaceDialog) – Replace dialog of origin

reset_changed_since_save()[source]

Sets changed_since_save to False and updates the window title

sign_file(filepath)[source]

Signs filepath if not in model.model.DataArray.safe_mode

Parameters:

filepath (Path) – Path of file to be signed

svg_export(filepath, svg_area=None)[source]

Export to svg file filepath

Parameters:
  • filepath (Path) – Path of file to be exported

  • svg_area (SinglePageArea) – Area of the grid to be exported

update_main_window_title()[source]

Change the main window title to reflect the current file name

view_goto_cell()[source]

View -> Go to cell workflow

Module contents