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.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

pyspread.grid module

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 placeholder text 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')
default_format = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/format-default.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')
shift_down = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-shift-down.svg')
shift_left = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-shift-left.svg')
shift_right = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-shift-right.svg')
shift_up = PosixPath('/builds/pyspread/pyspread/pyspread/share/icons/actions/edit-shift-up.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/local/lib/python3.11/dist-packages/packaging/version.py'>

Currently installed version number, False if not installed

pyspread.main_window module

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.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

Module contents