Previous topic

efl.evas.Table Class

Next topic

efl.evas.Map Class

efl.evas.Textgrid Class

class efl.evas.Textgrid

Bases: efl.evas.Object

New in version 1.8.

cell_size

The size of a cell of the given textgrid object in pixels.

This functions retrieves the width and height, in pixels, of a cell of the textgrid object obj and store them respectively in the buffers width and height. Their value depends on the monospace font used for the textgrid object, as well as the style. width and height can be None. On error, they are set to 0.

Type :(int width, int height)
cellrow_get(int y) → list

Get the string at the given row of the given textgrid object.

Parameters:y – The row index of the grid.
Returns:A pointer to the first cell of the given row.

This function returns a pointer to the first cell of the line y of the textgrid object obj. If y is not between 0 and the number of lines of the grid - 1, or on error, this function return None.

cellrow_set(int y, list row)

Set the string at the given row of the given textgrid object.

Parameters:
  • y (int) – The row index of the grid.
  • row (list) – The string as a sequence of #Evas_Textgrid_Cell.

This function returns cells to the textgrid taken by cellrow_get(). The row pointer row should be the same row pointer returned by cellrow_get() for the same row y.

font

The font family and size on a given textgrid object.

This property allows the font_name and font_size of the textgrid object to be set. The font_name string has to follow fontconfig’s convention on naming fonts, as it’s the underlying library used to query system fonts by Evas (see the fc-list command’s output, on your system, to get an idea). It also has to be a monospace font. If font_name is None, or if it is an empty string, or if font_size is less or equal than 0, or on error, this function does nothing.

Type :(unicode font_name, unicode font_size)
See :font_source
font_source

The font (source) file used on a given textgrid object.

This allows the font file to be explicitly set for the textgrid object, overriding system lookup, which will first occur in the given file’s contents. If None or an empty string is assigned, or the same font_source has already been set, or on error, this does nothing.

Type :unicode

See also

font

palette_get(Evas_Textgrid_Palette pal, int idx) -> (int r, int g, int b, int a)

The retrieve color to the given palette at the given index of the given textgrid object.

Parameters:
  • pal – The type of the palette to set the color.
  • idx – The index of the paletter to wich the color is stored.
Return type:

(int r, int g, int b, int a)

This function retrieves the color for the palette of type pal at the index idx of the textgrid object obj. The ARGB components are stored in the buffers r, g, b and a. If idx is not between 0 and the index of the latest set color, or if pal is EVAS_TEXTGRID_PALETTE_NONE or EVAS_TEXTGRID_PALETTE_LAST, the values of the components are 0. r, g, b and a can be None.

See :palette_set()
palette_set(Evas_Textgrid_Palette pal, int idx, int r, int g, int b, int a)

The set color to the given palette at the given index of the given textgrid object.

Parameters:
  • pal – The type of the palette to set the color.
  • idx – The index of the paletter to wich the color is stored.
  • r – The red component of the color.
  • g – The green component of the color.
  • b – The blue component of the color.
  • a – The alpha component of the color.

This function sets the color for the palette of type pal at the index idx of the textgrid object obj. The ARGB components are given by r, g, b and a. This color can be used when setting the TextgridCell object. The components must set a pre-multiplied color. If pal is EVAS_TEXTGRID_PALETTE_NONE or EVAS_TEXTGRID_PALETTE_LAST, or if idx is not between 0 and 255, or on error, this function does nothing. The color components are clamped between 0 and 255. If idx is greater than the latest set color, the colors between this last index and idx - 1 are set to black (0, 0, 0, 0).

See :palette_get()
size

The size of the textgrid object.

The number of lines h and the number of columns w of the textgrid object. Values less than or equal to 0 are ignored.

Type :(int w, int h)
supported_font_styles

TODO: document this

update_add(int x, int y, int w, int h)

Indicate for evas that part of a textgrid region (cells) has been updated.

Parameters:
  • x – The rect region of cells top-left x (column)
  • y – The rect region of cells top-left y (row)
  • w – The rect region size in number of cells (columns)
  • h – The rect region size in number of cells (rows)

This function declares to evas that a region of cells was updated by code and needs refreshing. An application should modify cells like this as an example:

cells = tg.cellrow_get(row)
for i in range(width):
    cells[i].codepoint = 'E'
tg.cellrow_set(row, cells)
tg.update_add(0, row, width, 1)
class efl.evas.TextgridCell

Bases: object

The values that describe each cell.

New in version 1.8.

bg

the index of the palette for the background color

Type :int
bg_extended

whether the extended palette is used for the background color

Type :bool
bold

whether the character is bold

Type :bool
codepoint

the UNICODE value of the character

Type :unicode
double_width

If the codepoint is merged with the following cell to the right visually (cells must be in pairs with 2nd cell being a duplicate in all ways except codepoint is 0)

Type :bool
fg

the index of the palette for the foreground color

Type :int
fg_extended

whether the extended palette is used for the foreground color

Type :bool
italic

whether the character is oblique

Type :bool
strikethrough

whether the character is strikethrough’ed

Type :bool
underline

whether the character is underlined

Type :bool