interfaces.pys.*

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

class 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

_attr_convert_1to2(key, value)[source]

Converts key, value attribute pair from v1.0 to v2.0

Parameters:
  • key (str) – AttrDict key

  • value (Any) – AttrDict value for key

Return type:

Tuple[str, Any]

_code_convert_1_2(key, code)[source]

Converts chart and image code from v1.0 to v2.0

Parameters:
  • key (Tuple[int, int, int]) – Key of cell with code

  • code (str) – Code in cell to be converted

Return type:

str

_get_key(*keystrings)[source]

Returns int key tuple from key string list

Parameters:

keystrings (str) – Strings that contain integers that are key elements

Return type:

Tuple[int, ...]

_pys2attributes(*args, **kwargs)[source]
_pys2attributes_10(line)[source]

Updates attributes in code_array - for save file version 1.0

Parameters:

line (str) – Pys file line to be parsed

_pys2code(*args, **kwargs)[source]
_pys2code_10(line)[source]

Updates code in pys code_array - for save file version 1.0

Parameters:

line (str) – Pys file line to be parsed

_pys2col_widths(line)[source]

Updates col_widths in code_array

Parameters:

line (str) – Pys file line to be parsed

_pys2macros(line)[source]

Updates macros in code_array

Parameters:

line (str) – Pys file line to be parsed

_pys2row_heights(line)[source]

Updates row_heights in code_array

Parameters:

line (str) – Pys file line to be parsed

_pys2shape(line)[source]

Updates shape in code_array

Parameters:

line (str) – Pys file line to be parsed

_pys_version(line)[source]

pys file version including assertion

Parameters:

line (str) – Pys file line to be parsed

_split_tidy(string, maxsplit=None)[source]

Rstrips string for and splits string for

Return type:

str

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

_attributes2pys()[source]

Returns cell attributes information in pys format

Format: <selection[0]> […] <tab> <key> <value> […]

Return type:

Iterable[str]

_code2pys()[source]

Returns cell code information in pys format

Format: <row> <col> <tab> <code>

Return type:

Iterable[str]

_col_widths2pys()[source]

Returns column width information in pys format

Format: <col> <tab> <value>

Return type:

Iterable[str]

_macros2pys()[source]

Returns macros information in pys format

Format: <macro code line>

Return type:

Iterable[str]

_row_heights2pys()[source]

Returns row height information in pys format

Format: <row> <tab> <value>

Return type:

Iterable[str]

_shape2pys()[source]

Returns shape information in pys format

Format: <rows> <cols> <tabs>

Return type:

Iterable[str]

_version2pys()[source]

Returns pys file version information in pys format

Format: <version>

Return type:

Iterable[str]

interfaces.pys.qt52qt6_fontweights(qt5_weight)[source]

Approximates the mapping from Qt5 to Qt6 font weight

interfaces.pys.qt62qt5_fontweights(qt6_weight)[source]

Approximates the mapping from Qt6 to Qt5 font weight

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]