efl.evas.Textgrid
Class¶
- class efl.evas.Textgrid(Canvas canvas, **kwargs)¶
Bases:
efl.evas.Object
A textgrid object.
New in version 1.8.
- Parameters
canvas (
Canvas
) – Evas canvas for this object**kwargs – All the remaining keyword arguments are interpreted as properties of the instance
- cell_size¶
The width and height of a cell in pixels.
This read-only property has the width and height, in pixels, of a cell of the textgrid object. Their value depends on the monospace font used for the textgrid object, as well as the style. On error, they are set to 0.
- Type
(int width, int height)
See also
- cellrow_get(y)¶
Get the string at the given row.
- Parameters
y (int) – The row index of the grid.
- Returns
A list of
TextgridCell
- Return type
TextgridCellRow
This method returns a list of cells in the line y of the textgrid object. If y is not between 0 and the number of lines of the grid - 1, or on error, this function return
None
.See also
- cellrow_set(y, row)¶
Set the string at the given row.
- Parameters
y (int) – The row index of the grid.
row (
TextgridCellRow
) – The string as a sequence ofTextgridCell
.
This method allows returning cells to the textgrid, retrieved with
cellrow_get()
.See also
- 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 isNone
, 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
(string font_name, int font_size)
- See
- 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
string
See also
- palette_get(pal, idx)¶
Retrieve color from the given palette at the given index.
- Parameters
pal (Textgrid Palette) – The type of the palette to set the color.
idx (int) – The index of the palette to which the color is stored.
- Return type
(int r, int g, int b, int a)
This method retrieves the color for the palette of type pal at the index idx of the textgrid object. 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.
- See
- palette_set(pal, idx, r, g, b, a)¶
Set color to the given palette at the given index.
- Parameters
pal (Textgrid Palette) – The type of the palette to set the color.
idx (int) – The index of the paletter to which the color is stored.
r (int) – The red component of the color.
g (int) – The green component of the color.
b (int) – The blue component of the color.
a (int) – 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. 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
- 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(x, y, w, h)¶
Indicate for evas that part of a textgrid region (cells) has been updated.
- Parameters
x (int) – The rect region of cells top-left x (column)
y (int) – The rect region of cells top-left y (row)
w (int) – The rect region size in number of cells (columns)
h (int) – The rect region size in number of cells (rows)
This method 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)
See also
- 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