Evas: Fix documentation

This commit is contained in:
Kai Huuhko 2015-04-24 22:24:28 +03:00
parent bd88b8845e
commit 178be163fc
2 changed files with 77 additions and 118 deletions

View File

@ -914,42 +914,46 @@ Evas_Textblock_Cursor_Type
.. _Evas_Textgrid_Palette: .. _Evas_Textgrid_Palette:
_Evas_Textgrid_Palette Textgrid Palette
------------------------------------- ----------------
The palette to use for the foreground and background colors.
.. data:: EVAS_TEXTGRID_PALETTE_NONE .. data:: EVAS_TEXTGRID_PALETTE_NONE
None. No palette is used.
.. data:: EVAS_TEXTGRID_PALETTE_STANDARD .. data:: EVAS_TEXTGRID_PALETTE_STANDARD
Standard. Standard palette (around 16 colors).
.. data:: EVAS_TEXTGRID_PALETTE_EXTENDED .. data:: EVAS_TEXTGRID_PALETTE_EXTENDED
Extended. Extended palette (at max 256 colors).
.. data:: EVAS_TEXTGRID_PALETTE_LAST .. data:: EVAS_TEXTGRID_PALETTE_LAST
Last. Ignore it.
.. _Evas_Textgrid_Font_Style: .. _Evas_Textgrid_Font_Style:
Evas_Textgrid_Font_Style Textgrid Font Style
------------------------------------- -------------------
The style to give to each character of the grid.
.. data:: EVAS_TEXTGRID_FONT_STYLE_NORMAL .. data:: EVAS_TEXTGRID_FONT_STYLE_NORMAL
Normal. Normal style.
.. data:: EVAS_TEXTGRID_FONT_STYLE_BOLD .. data:: EVAS_TEXTGRID_FONT_STYLE_BOLD
Bold. Bold style.
.. data:: EVAS_TEXTGRID_FONT_STYLE_ITALIC .. data:: EVAS_TEXTGRID_FONT_STYLE_ITALIC
italic. Oblique style.
Module level functions Module level functions

View File

@ -15,47 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. # along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
"""
.. _Evas_Textgrid_Palette:
.. rubric:: The palette to use for the foreground and background colors.
.. data:: EVAS_TEXTGRID_PALETTE_NONE
No palette is used
.. data:: EVAS_TEXTGRID_PALETTE_STANDARD
standard palette (around 16 colors)
.. data:: EVAS_TEXTGRID_PALETTE_EXTENDED
extended palette (at max 256 colors)
.. data:: EVAS_TEXTGRID_PALETTE_LAST
ignore it
.. _Evas_Textgrid_Font_Style:
.. rubric:: The style to give to each character of the grid.
.. data:: EVAS_TEXTGRID_FONT_STYLE_NORMAL
Normal style
.. data:: EVAS_TEXTGRID_FONT_STYLE_BOLD
Bold style
.. data:: EVAS_TEXTGRID_FONT_STYLE_ITALIC
Oblique style
"""
from libc.stdlib cimport malloc from libc.stdlib cimport malloc
@ -74,9 +33,9 @@ cdef class TextgridCell(object):
return "%s" % (self.codepoint,) return "%s" % (self.codepoint,)
def __repr__(self): def __repr__(self):
return "%s(codepoint = %s, fg = %s, bg = %s, bold = %s, \ return "<%s(codepoint = %s, fg = %s, bg = %s, bold = %s, \
italic = %s, underline = %s, strikethrough = %s, \ italic = %s, underline = %s, strikethrough = %s, \
fg_extended = %s, bg_extended = %s, double_width = %s)" % ( fg_extended = %s, bg_extended = %s, double_width = %s)>" % (
type(self).__name__, self.codepoint, type(self).__name__, self.codepoint,
self.fg, self.bg, self.bold, self.italic, self.fg, self.bg, self.bold, self.italic,
self.underline, self.strikethrough, self.underline, self.strikethrough,
@ -223,7 +182,7 @@ cdef class Textgrid(Object):
:type canvas: :py:class:`~efl.evas.Canvas` :type canvas: :py:class:`~efl.evas.Canvas`
:keyword \**kwargs: All the remaining keyword arguments are interpreted :keyword \**kwargs: All the remaining keyword arguments are interpreted
as properties of the instance as properties of the instance
""" """
self._set_obj(evas_object_textgrid_add(canvas.obj)) self._set_obj(evas_object_textgrid_add(canvas.obj))
self._set_properties_from_keyword_args(kwargs) self._set_properties_from_keyword_args(kwargs)
@ -231,9 +190,8 @@ cdef class Textgrid(Object):
property size: property size:
"""The size of the textgrid object. """The size of the textgrid object.
The number of lines **h** and the number The number of lines **h** and the number of columns **w** of the
of columns **w** of the textgrid object. Values textgrid object. Values less than or equal to 0 are ignored.
less than or equal to 0 are ignored.
:type: (int **w**, int **h**) :type: (int **w**, int **h**)
@ -251,13 +209,12 @@ cdef class Textgrid(Object):
property font_source: property font_source:
"""The font (source) file used on a given textgrid object. """The font (source) file used on a given textgrid object.
This allows the font file to be explicitly This allows the font file to be explicitly set for the textgrid object,
set for the textgrid object, overriding system lookup, which overriding system lookup, which will first occur in the given file's
will first occur in the given file's contents. If contents. If None or an empty string is assigned, or the same
None or an empty string is assigned, or the same font_source has already font_source has already been set, or on error, this does nothing.
been set, or on error, this does nothing.
:type: unicode :type: string
.. seealso:: :py:attr:`font` .. seealso:: :py:attr:`font`
@ -283,7 +240,7 @@ cdef class Textgrid(Object):
``None``, or if it is an empty string, or if **font_size** is less or ``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. equal than 0, or on error, this function does nothing.
:type: (unicode **font_name**, unicode **font_size**) :type: (string **font_name**, int **font_size**)
:see: :py:attr:`font_source` :see: :py:attr:`font_source`
@ -306,14 +263,12 @@ cdef class Textgrid(Object):
return (_ctouni(font_name), font_size) return (_ctouni(font_name), font_size)
property cell_size: property cell_size:
"""The size of a cell of the given textgrid object in pixels. """The width and height of a cell in pixels.
This functions retrieves the width and height, in pixels, of a cell This read-only property has the width and height, in pixels, of a cell
of the textgrid object **obj** and store them respectively in the of the textgrid object. Their value depends on the monospace font used
buffers **width** and **height**. Their value depends on the for the textgrid object, as well as the style. On error, they are set
monospace font used for the textgrid object, as well as the to 0.
style. **width** and **height** can be ``None``. On error, they are
set to 0.
:type: (int **width**, int **height**) :type: (int **width**, int **height**)
@ -330,25 +285,26 @@ cdef class Textgrid(Object):
return (w, h) return (w, h)
def palette_set(self, Evas_Textgrid_Palette pal, int idx, int r, int g, int b, int a): def palette_set(self, 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. """Set color to the given palette at the given index.
:param pal: The type of the palette to set the color. :param pal: The type of the palette to set the color.
:param idx: The index of the paletter to wich the color is stored. :type pal: :ref:`Evas_Textgrid_Palette`
:param r: The red component of the color. :param int idx: The index of the paletter to which the color is stored.
:param g: The green component of the color. :param int r: The red component of the color.
:param b: The blue component of the color. :param int g: The green component of the color.
:param a: The alpha component of the color. :param int b: The blue component of the color.
:param int a: The alpha component of the color.
This function sets the color for the palette of type **pal** at the This function sets the color for the palette of type **pal** at the
index **idx** of the textgrid object **obj**. The ARGB components are index **idx** of the textgrid object. The ARGB components are given by
given by **r**, **g**, **b** and **a**. This color can be used when **r**, **g**, **b** and **a**. This color can be used when setting the
setting the :py:class:`TextgridCell` object. The components must set :py:class:`TextgridCell` object. The components must set a pre-
a pre-multiplied color. If pal is EVAS_TEXTGRID_PALETTE_NONE or multiplied color. If pal is EVAS_TEXTGRID_PALETTE_NONE or
EVAS_TEXTGRID_PALETTE_LAST, or if **idx** is not between 0 and 255, EVAS_TEXTGRID_PALETTE_LAST, or if **idx** is not between 0 and 255, or
or on error, this function does nothing. The color components are on error, this function does nothing. The color components are clamped
clamped between 0 and 255. If **idx** is greater than the latest set between 0 and 255. If **idx** is greater than the latest set color, the
color, the colors between this last index and **idx** - 1 are set to colors between this last index and **idx** - 1 are set to black (0, 0,
black (0, 0, 0, 0). 0, 0).
:see: :py:func:`palette_get` :see: :py:func:`palette_get`
@ -356,21 +312,21 @@ cdef class Textgrid(Object):
evas_object_textgrid_palette_set(self.obj, pal, idx, r, g, b, a) evas_object_textgrid_palette_set(self.obj, pal, idx, r, g, b, a)
def palette_get(self, Evas_Textgrid_Palette pal, int idx): def palette_get(self, Evas_Textgrid_Palette pal, int idx):
"""The retrieve color to the given palette at the given index of the given textgrid object. """Retrieve color from the given palette at the given index.
:param pal: The type of the palette to set the color. :param pal: The type of the palette to set the color.
:param idx: The index of the palette to which the color is stored. :type pal: :ref:`Evas_Textgrid_Palette`
:param int idx: The index of the palette to which the color is stored.
:rtype: (int **r**, int **g**, int **b**, int **a**) :rtype: (int **r**, int **g**, int **b**, int **a**)
This function retrieves the color for the palette of type **pal** at the This method retrieves the color for the palette of type **pal** at
index **idx** of the textgrid object **obj**. The ARGB components are the index **idx** of the textgrid object. The ARGB components are
stored in the buffers **r**, **g**, **b** and **a**. If **idx** is not 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 between 0 and the index of the latest set color, or if **pal** is
EVAS_TEXTGRID_PALETTE_NONE or EVAS_TEXTGRID_PALETTE_LAST, the EVAS_TEXTGRID_PALETTE_NONE or EVAS_TEXTGRID_PALETTE_LAST, the values of
values of the components are 0. **r**, **g**, **b** and **a** can be the components are 0.
``None``.
:see: :py:func:`palette_set` :see: :py:meth:`palette_set`
""" """
cdef: cdef:
@ -388,23 +344,21 @@ cdef class Textgrid(Object):
return evas_object_textgrid_supported_font_styles_get(self.obj) return evas_object_textgrid_supported_font_styles_get(self.obj)
def cellrow_set(self, int y, list row not None): def cellrow_set(self, int y, list row not None):
"""Set the string at the given row of the given textgrid object. """Set the string at the given row.
:param y: The row index of the grid. :param y: The row index of the grid.
:type y: int :type y: int
:param row: The string as a sequence of #Evas_Textgrid_Cell. :param row: The string as a sequence of :class:`TextgridCell`.
:type row: list :type row: list
This function returns cells to the textgrid taken by This method allows returning cells to the textgrid, retrieved with
:py:func:`cellrow_get`. The row pointer **row** should be the :py:meth:`cellrow_get`.
same row pointer returned by :py:func:`cellrow_get` for the
same row **y**.
.. seealso:: .. seealso::
:py:func:`cellrow_get` :py:meth:`cellrow_get`
:py:attr:`size` :py:attr:`size`
:py:func:`update_add` :py:meth:`update_add`
""" """
cdef: cdef:
@ -422,20 +376,21 @@ cdef class Textgrid(Object):
evas_object_textgrid_cellrow_set(self.obj, y, crow[0]) evas_object_textgrid_cellrow_set(self.obj, y, crow[0])
def cellrow_get(self, int y): def cellrow_get(self, int y):
"""Get the string at the given row of the given textgrid object. """Get the string at the given row.
:param y: The row index of the grid. :param int y: The row index of the grid.
:return: A pointer to the first cell of the given row. :return: A list of :class:`TextgridCell`
:rtype: list
This function returns a pointer to the first cell of the line **y** This method returns a list of cells in the line **y** of
of the textgrid object **obj**. If **y** is not between 0 and the the textgrid object. If **y** is not between 0 and the number
number of lines of the grid - 1, or on error, this function return ``None``. of lines of the grid - 1, or on error, this function return ``None``.
.. seealso:: .. seealso::
:py:func:`cellrow_set` :py:meth:`cellrow_set`
:py:attr:`size` :py:attr:`size`
:py:func:`update_add` :py:meth:`update_add`
""" """
cdef: cdef:
@ -457,12 +412,12 @@ cdef class Textgrid(Object):
def update_add(self, int x, int y, int w, int h): def update_add(self, int x, int y, int w, int h):
"""Indicate for evas that part of a textgrid region (cells) has been updated. """Indicate for evas that part of a textgrid region (cells) has been updated.
:param x: The rect region of cells top-left x (column) :param int x: The rect region of cells top-left x (column)
:param y: The rect region of cells top-left y (row) :param int y: The rect region of cells top-left y (row)
:param w: The rect region size in number of cells (columns) :param int w: The rect region size in number of cells (columns)
:param h: The rect region size in number of cells (rows) :param int h: The rect region size in number of cells (rows)
This function declares to evas that a region of cells was updated by This method declares to evas that a region of cells was updated by
code and needs refreshing. An application should modify cells like this code and needs refreshing. An application should modify cells like this
as an example:: as an example::
@ -474,8 +429,8 @@ cdef class Textgrid(Object):
.. seealso:: .. seealso::
:py:func:`cellrow_set` :py:meth:`cellrow_set`
:py:func:`cellrow_get` :py:meth:`cellrow_get`
:py:attr:`size` :py:attr:`size`
""" """