pyspread.interfaces package

Submodules

pyspread.interfaces.pys module

This file contains interfaces to the native pys file format.

PysReader and PysWriter classed are structured into the following sections:

  • shape

  • code

  • attributes

  • row_heights

  • col_widths

  • macros

Provides

  • Function wxcolor2rgb

  • Function qt52qt6_fontweights

  • Function qt62qt5_fontweights

  • Dict wx2qt_fontweights

  • Dict wx2qt_fontstyles

  • Class PysReader

  • Class PysWriter

class pyspread.interfaces.pys.PysReader(pys_file, code_array)[source]

Bases: object

Reads pys v2.0 file into a code_array

Parameters:
  • pys_file (BinaryIO) – The pys or pysu file to be read

  • code_array (CodeArray) – Target code_array

version_handler()[source]

Chooses method`_10` of method if version < 2.0

Parameters:

method (Callable) – Method to be replaced in case of old pys file version

Return type:

Callable

class pyspread.interfaces.pys.PysWriter(code_array)[source]

Bases: object

Interface between code_array and pys file data

Iterating over it yields pys file lines

Parameters:

code_array (CodeArray) – The code_array object data structure

pyspread.interfaces.pys.qt52qt6_fontweights(qt5_weight)[source]

Approximates the mapping from Qt5 to Qt6 font weight

pyspread.interfaces.pys.qt62qt5_fontweights(qt6_weight)[source]

Approximates the mapping from Qt6 to Qt5 font weight

pyspread.interfaces.pys.wxcolor2rgb(wxcolor)[source]

Returns red, green, blue for given wxPython binary color value

Parameters:

wxcolor (int) – Color value from wx.Color

Return type:

Tuple[int, int, int]

pyspread.interfaces.xlsx module

This file contains interfaces to the xlsx file format.

Provides

  • XlsReader

XlsReader is structured into the following sections:
  • shape

  • code

  • attributes

  • row_heights

  • col_widths

  • macros

class pyspread.interfaces.xlsx.XlsxReader(xlsx_file, code_array)[source]

Bases: object

Reads xlsx file from OpenPyXL into a code_array

Parameters:
  • xlsx_file (BinaryIO) – The xlsx file to be read

  • code_array (CodeArray) – Target code_array

append_sheet_attributes(table, sheet_attrs)[source]

Creates selections from attributes in sheet_attrs and appends them

Parameters:
  • table (int) – Current table

  • sheet_attrs (dict) – Dict mapping (attr_name, attr values) to key list

static xlsx_rgba2rgb(rgb)[source]

Converts rgba string from xlsx to rgb tuple

Parameters:

rgb (str) – rgba string from xlsx

Return type:

(int, int, int)

pyspread.interfaces.xlsx.xls_column(column)[source]

Converts column number to Excel like column name in A, B, C notation

The Excel like notationis created for arbitrary numbers. Limitations of Excel implementations are not taken into account.

Parameters:

column (int) – Column number starting with 0

Return type:

str

Returns:

String with Excel like column

Module contents