Elementary: Change the rest of the widgets to use the new item handling
style, and make the documentation more structured.
This commit is contained in:
parent
3b40ac6997
commit
6c89e84620
|
@ -63,7 +63,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Actionslider_Pos:
|
||||
|
||||
.. rubric:: Actionslider positions
|
||||
Actionslider positions
|
||||
======================
|
||||
|
||||
.. data:: ELM_ACTIONSLIDER_NONE
|
||||
|
||||
|
@ -101,11 +102,7 @@ ELM_ACTIONSLIDER_ALL = enums.ELM_ACTIONSLIDER_ALL
|
|||
|
||||
cdef class Actionslider(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_actionslider_add(parent.obj))
|
||||
|
@ -125,7 +122,7 @@ cdef class Actionslider(LayoutClass):
|
|||
property indicator_pos:
|
||||
"""Indicator position.
|
||||
|
||||
:type: :ref:`Actionslider position <Elm_Actionslider_Pos>`
|
||||
:type: :ref:`Elm_Actionslider_Pos`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -143,7 +140,7 @@ cdef class Actionslider(LayoutClass):
|
|||
magnets ``or`` them together(e.g.: ``ELM_ACTIONSLIDER_LEFT |
|
||||
ELM_ACTIONSLIDER_RIGHT``)
|
||||
|
||||
:type: :ref:`Actionslider position <Elm_Actionslider_Pos>`
|
||||
:type: :ref:`Elm_Actionslider_Pos`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -163,7 +160,7 @@ cdef class Actionslider(LayoutClass):
|
|||
|
||||
.. note:: All positions are enabled by default.
|
||||
|
||||
:type: :ref:`Actionslider position <Elm_Actionslider_Pos>`
|
||||
:type: :ref:`Elm_Actionslider_Pos`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -43,7 +43,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Bg_Option:
|
||||
|
||||
.. rubric:: Background display modes
|
||||
Background display modes
|
||||
========================
|
||||
|
||||
.. data:: ELM_BG_OPTION_CENTER
|
||||
|
||||
|
@ -77,11 +78,7 @@ ELM_BG_OPTION_LAST = enums.ELM_BG_OPTION_LAST
|
|||
|
||||
cdef class Background(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_bg_add(parent.obj))
|
||||
|
@ -140,7 +137,7 @@ cdef class Background(LayoutClass):
|
|||
image file. The image can be displayed tiled, scaled, centered or
|
||||
stretched.
|
||||
|
||||
:type: :ref:`Background display mode <Elm_Bg_Option>`
|
||||
:type: :ref:`Elm_Bg_Option`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -164,7 +161,7 @@ cdef class Background(LayoutClass):
|
|||
previously set :py:attr:`file`, so that you just want a solid color
|
||||
background.
|
||||
|
||||
:type: (int r, int g, int b)
|
||||
:type: (int **r**, int **g**, int **b**)
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -201,7 +198,7 @@ cdef class Background(LayoutClass):
|
|||
.. warning:: This function just makes sense if an image file was set
|
||||
with :py:attr:`file`.
|
||||
|
||||
:type: (Evas_Coord w, Evas_Coord h)
|
||||
:type: (int **w**, int **h**)
|
||||
|
||||
"""
|
||||
def __set__(self, value):
|
||||
|
|
|
@ -82,7 +82,10 @@ children of the box.
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Box layout modes
|
||||
.. _Evas_Object_Box_Layout:
|
||||
|
||||
Box layout modes
|
||||
================
|
||||
|
||||
.. data:: ELM_BOX_LAYOUT_HORIZONTAL
|
||||
|
||||
|
@ -172,21 +175,15 @@ cdef Evas_Object_Box_Layout _py_elm_box_layout_resolv(int layout) with gil:
|
|||
|
||||
cdef class Box(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
"""Add a new box to the parent
|
||||
|
||||
By default, the box will be in vertical mode and non-homogeneous.
|
||||
"""By default, the box will be in vertical mode and non-homogeneous.
|
||||
|
||||
:param parent: The parent object
|
||||
:type parent: :py:class:`elementary.object.Object`
|
||||
:type parent: :py:class:`efl.elementary.object.Object`
|
||||
:return: The new object or None if it cannot be created
|
||||
:rtype: :py:class:`elementary.object.Object`
|
||||
:rtype: :py:class:`Box`
|
||||
|
||||
"""
|
||||
self._set_obj(elm_box_add(parent.obj))
|
||||
|
@ -247,15 +244,7 @@ cdef class Box(Object):
|
|||
respectively.
|
||||
|
||||
:param subobj: The object to add to the box
|
||||
:type subobj: :py:class:`evas.object.Object`
|
||||
|
||||
.. seealso::
|
||||
:py:func:`pack_end()`
|
||||
:py:func:`pack_before()`
|
||||
:py:func:`pack_after()`
|
||||
:py:func:`unpack()`
|
||||
:py:func:`unpack_all()`
|
||||
:py:func:`clear()`
|
||||
:type subobj: :py:class:`Object <efl.evas.Object>`
|
||||
|
||||
"""
|
||||
elm_box_pack_start(self.obj, obj.obj)
|
||||
|
@ -272,15 +261,7 @@ cdef class Box(Object):
|
|||
respectively.
|
||||
|
||||
:param subobj: The object to add to the box
|
||||
:type subobj: :py:class:`evas.object.Object`
|
||||
|
||||
.. seealso::
|
||||
:py:func:`pack_start()`
|
||||
:py:func:`pack_before()`
|
||||
:py:func:`pack_after()`
|
||||
:py:func:`unpack()`
|
||||
:py:func:`unpack_all()`
|
||||
:py:func:`clear()`
|
||||
:type subobj: :py:class:`Object <efl.evas.Object>`
|
||||
|
||||
"""
|
||||
elm_box_pack_end(self.obj, obj.obj)
|
||||
|
@ -296,17 +277,9 @@ cdef class Box(Object):
|
|||
above it depending on orientation.
|
||||
|
||||
:param subobj: The object to add to the box
|
||||
:type subobj: :py:class:`evas.object.Object`
|
||||
:type subobj: :py:class:`Object <efl.evas.Object>`
|
||||
:param before: The object before which to add it
|
||||
:type before: :py:class:`evas.object.Object`
|
||||
|
||||
.. seealso::
|
||||
:py:func:`pack_start()`
|
||||
:py:func:`pack_end()`
|
||||
:py:func:`pack_after()`
|
||||
:py:func:`unpack()`
|
||||
:py:func:`unpack_all()`
|
||||
:py:func:`clear()`
|
||||
:type before: :py:class:`Object <efl.evas.Object>`
|
||||
|
||||
"""
|
||||
elm_box_pack_before(self.obj, obj.obj, before.obj)
|
||||
|
@ -322,17 +295,9 @@ cdef class Box(Object):
|
|||
below it depending on orientation.
|
||||
|
||||
:param subobj: The object to add to the box
|
||||
:type subobj: :py:class:`evas.object.Object`
|
||||
:type subobj: :py:class:`Object <efl.evas.Object>`
|
||||
:param after: The object after which to add it
|
||||
:type after: :py:class:`evas.object.Object`
|
||||
|
||||
.. seealso::
|
||||
:py:func:`pack_start()`
|
||||
:py:func:`pack_end()`
|
||||
:py:func:`pack_before()`
|
||||
:py:func:`unpack()`
|
||||
:py:func:`unpack_all()`
|
||||
:py:func:`clear()`
|
||||
:type after: :py:class:`Object <efl.evas.Object>`
|
||||
|
||||
"""
|
||||
elm_box_pack_after(self.obj, obj.obj, after.obj)
|
||||
|
@ -345,8 +310,6 @@ cdef class Box(Object):
|
|||
Remove all the elements contained by the box, deleting the respective
|
||||
objects.
|
||||
|
||||
.. seealso:: :py:func:`unpack()`, :py:func:`unpack_all()`
|
||||
|
||||
"""
|
||||
elm_box_clear(self.obj)
|
||||
|
||||
|
@ -359,9 +322,7 @@ cdef class Box(Object):
|
|||
deleting it.
|
||||
|
||||
:param subobj: The object to unpack
|
||||
:type subobj: :py:class:`evas.object.Object`
|
||||
|
||||
.. seealso:: :py:func:`unpack_all()`, :py:func:`clear()`
|
||||
:type subobj: :py:class:`Object <efl.evas.Object>`
|
||||
|
||||
"""
|
||||
elm_box_unpack(self.obj, obj.obj)
|
||||
|
@ -377,18 +338,17 @@ cdef class Box(Object):
|
|||
when using this function that you hold a reference to all the objects
|
||||
in the box.
|
||||
|
||||
.. seealso:: :py:func:`clear()`, :py:func:`unpack()`
|
||||
|
||||
"""
|
||||
elm_box_unpack_all(self.obj)
|
||||
|
||||
property children:
|
||||
"""Retrieve a list of the objects packed into the box
|
||||
|
||||
Returns a ``tuple`` with the child :py:class:`evas.object.Object`.
|
||||
The order of the list corresponds to the packing order the box uses.
|
||||
Returns a ``list`` with the child :py:class:`Objects
|
||||
<efl.evas.Object>`. The order of the list corresponds to the
|
||||
packing order the box uses.
|
||||
|
||||
:type: tuple of :py:class:`evas.object.Object`
|
||||
:type: list of :py:class:`Objects <efl.evas.Object>`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -411,7 +371,7 @@ cdef class Box(Object):
|
|||
is set for all elements in the box, besides any possible padding that
|
||||
individual elements may have through their size hints.
|
||||
|
||||
:type: tuple of Evas_Coords (int)
|
||||
:type: (int **h**, int **v**)
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -438,7 +398,7 @@ cdef class Box(Object):
|
|||
their sizes and position has been calculated, will be aligned within
|
||||
the space given for the whole box widget.
|
||||
|
||||
:rtype: tuple of floats
|
||||
:rtype: (float **h**, float **v**)
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -476,22 +436,11 @@ cdef class Box(Object):
|
|||
"""Set the layout function for the box.
|
||||
|
||||
A box layout function affects how a box object displays child
|
||||
elements within its area. The list of pre-defined box layouts
|
||||
available in Evas is:
|
||||
|
||||
- elementary.ELM_BOX_LAYOUT_HORIZONTAL
|
||||
- elementary.ELM_BOX_LAYOUT_VERTICAL
|
||||
- elementary.ELM_BOX_LAYOUT_HOMOGENEOUS_VERTICAL
|
||||
- elementary.ELM_BOX_LAYOUT_HOMOGENEOUS_HORIZONTAL
|
||||
- elementary.ELM_BOX_LAYOUT_HOMOGENEOUS_MAX_SIZE_HORIZONTAL
|
||||
- elementary.ELM_BOX_LAYOUT_HOMOGENEOUS_MAX_SIZE_VERTICAL
|
||||
- elementary.ELM_BOX_LAYOUT_FLOW_HORIZONTAL
|
||||
- elementary.ELM_BOX_LAYOUT_FLOW_VERTICAL
|
||||
- elementary.ELM_BOX_LAYOUT_STACK
|
||||
elements within its area.
|
||||
|
||||
Note that you cannot set a custom layout function.
|
||||
|
||||
:type: Evas_Object_Box_Layout
|
||||
:type: :ref:`Evas_Object_Box_Layout`
|
||||
|
||||
"""
|
||||
def __set__(self, layout):
|
||||
|
@ -513,14 +462,12 @@ cdef class Box(Object):
|
|||
just need to call this function with the starting layout and
|
||||
the final one.
|
||||
|
||||
.. seealso:: :py:attr:`layout` for the list of available layouts.
|
||||
|
||||
:param duration: the animation duration in seconds
|
||||
:type duration: float
|
||||
:param from_layout: one of elementary.ELM_BOX_LAYOUT
|
||||
:type from_layout: Evas_Object_Box_Layout
|
||||
:type from_layout: :ref:`Evas_Object_Box_Layout`
|
||||
:param to_layout: one of elementary.ELM_BOX_LAYOUT
|
||||
:type to_layout: Evas_Object_Box_Layout
|
||||
:type to_layout: :ref:`Evas_Object_Box_Layout`
|
||||
|
||||
"""
|
||||
cdef Elm_Box_Transition *t
|
||||
|
|
|
@ -47,7 +47,7 @@ selected. The four available corners are:
|
|||
- **bottom_right**
|
||||
|
||||
This widget emits the following signals, besides the ones sent from
|
||||
:py:class:`elementary.layout.Layout`:
|
||||
:py:class:`efl.elementary.layout_class.LayoutClass`:
|
||||
|
||||
- ``clicked`` - This is called when a user has clicked the bubble.
|
||||
|
||||
|
@ -65,7 +65,10 @@ Default text parts of the button widget that you can use for are:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Bubble arrow positions
|
||||
.. _Elm_Bubble_Pos:
|
||||
|
||||
Bubble arrow positions
|
||||
======================
|
||||
|
||||
.. data:: ELM_BUBBLE_POS_TOP_LEFT
|
||||
|
||||
|
@ -98,11 +101,7 @@ ELM_BUBBLE_POS_BOTTOM_RIGHT = enums.ELM_BUBBLE_POS_BOTTOM_RIGHT
|
|||
|
||||
cdef class Bubble(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_bubble_add(parent.obj))
|
||||
|
@ -114,7 +113,7 @@ cdef class Bubble(LayoutClass):
|
|||
used to determine where the arrow in the frame points to and where
|
||||
label, icon and info are shown.
|
||||
|
||||
:type: Elm_Bubble_Pos
|
||||
:type: :ref:`Elm_Bubble_Pos`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -67,11 +67,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Button(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_button_add(parent.obj))
|
||||
|
|
|
@ -37,9 +37,11 @@ The API of this widget lets the applications perform other functions, like:
|
|||
- setting the year and month format.
|
||||
|
||||
This widget emits the following signals, besides the ones sent from
|
||||
:py:class:`elementary.layout.Layout`:
|
||||
:py:class:`efl.elementary.layout_class.LayoutClass`:
|
||||
|
||||
- ``changed`` - emitted when the date in the calendar is changed.
|
||||
- ``display,changed`` - emitted when the current month displayed in the
|
||||
calendar is changed.
|
||||
|
||||
|
||||
Enumerations
|
||||
|
@ -47,7 +49,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Calendar_Mark_Repeat_Type:
|
||||
|
||||
.. rubric:: Calendar mark repeat types
|
||||
Calendar mark repeat types
|
||||
==========================
|
||||
|
||||
.. data:: ELM_CALENDAR_UNIQUE
|
||||
|
||||
|
@ -85,7 +88,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Calendar_Select_Mode:
|
||||
|
||||
.. rubric:: Calendar selection modes
|
||||
Calendar selection modes
|
||||
========================
|
||||
|
||||
.. data:: ELM_CALENDAR_SELECT_MODE_DEFAULT
|
||||
|
||||
|
@ -106,7 +110,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Calendar_Selectable:
|
||||
|
||||
.. rubric:: Selectable
|
||||
Selectable
|
||||
==========
|
||||
|
||||
.. data:: ELM_CALENDAR_SELECTABLE_NONE
|
||||
|
||||
|
@ -127,7 +132,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Calendar_Weekday:
|
||||
|
||||
.. rubric:: Days
|
||||
Days
|
||||
====
|
||||
|
||||
.. data:: ELM_DAY_SUNDAY
|
||||
|
||||
|
@ -241,7 +247,7 @@ cdef class CalendarMark(object):
|
|||
:type mark_time: datetime.date
|
||||
:param repeat: Repeat the event following this periodicity. Can be a unique
|
||||
mark (that don't repeat), daily, weekly, monthly or annually.
|
||||
:type repeat: :ref:`Calendar repeat type <Elm_Calendar_Mark_Repeat_Type>`
|
||||
:type repeat: :ref:Elm_Calendar_Mark_Repeat_Type`
|
||||
|
||||
:return: The created mark or ``None`` upon failure.
|
||||
:rtype: :py:class:`CalendarMark`
|
||||
|
@ -323,7 +329,7 @@ cdef class Calendar(LayoutClass):
|
|||
If the maximum year is a negative value, it will be limited depending
|
||||
on the platform architecture (year 2037 for 32 bits)
|
||||
|
||||
:type: tuple of ints
|
||||
:type: (int **min**, int **max**)
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -338,7 +344,7 @@ cdef class Calendar(LayoutClass):
|
|||
property select_mode:
|
||||
"""The day selection mode used.
|
||||
|
||||
:type: :ref:`Calendar select mode <Elm_Calendar_Select_Mode>`
|
||||
:type: :ref:`Elm_Calendar_Select_Mode`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -430,7 +436,7 @@ cdef class Calendar(LayoutClass):
|
|||
property marks:
|
||||
"""Calendar marks.
|
||||
|
||||
:type: tuple of :py:class:`CalendarMark`
|
||||
:type: list of :py:class:`CalendarMark`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -514,7 +520,7 @@ cdef class Calendar(LayoutClass):
|
|||
property selectable:
|
||||
"""How selected_time manages a date
|
||||
|
||||
:type: :ref:`Calendar selectable <Elm_Calendar_Selectable>`
|
||||
:type: :ref:`Elm_Calendar_Selectable`
|
||||
|
||||
"""
|
||||
def __set__(self, Elm_Calendar_Selectable selectable):
|
||||
|
@ -544,5 +550,11 @@ cdef class Calendar(LayoutClass):
|
|||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
def callback_display_changed_add(self, func, *args, **kwargs):
|
||||
"""Emitted when the current month displayed in the calendar is changed."""
|
||||
self._callback_add("display,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("display,changed", func)
|
||||
|
||||
_object_mapping_register("elm_calendar", Calendar)
|
||||
|
|
|
@ -32,7 +32,7 @@ the value of a boolean between false and true. :py:attr:`state` sets the
|
|||
boolean state and :py:attr:`state` returns the current state.
|
||||
|
||||
This widget emits the following signals, besides the ones sent from
|
||||
:py:class:`elementary.layout.Layout`:
|
||||
:py:class:`efl.elementary.layout_class.LayoutClass`:
|
||||
|
||||
- ``changed`` - This is called whenever the user changes the state of
|
||||
the check objects.
|
||||
|
@ -55,11 +55,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Check(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_check_add(parent.obj))
|
||||
|
|
|
@ -58,7 +58,10 @@ This widget emits the following signals, besides the ones sent from
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Clock edit modes
|
||||
.. _Elm_Clock_Edit_Mode:
|
||||
|
||||
Clock edit modes
|
||||
================
|
||||
|
||||
.. data:: ELM_CLOCK_EDIT_DEFAULT
|
||||
|
||||
|
@ -111,11 +114,7 @@ ELM_CLOCK_EDIT_ALL = enums.ELM_CLOCK_EDIT_ALL
|
|||
|
||||
cdef class Clock(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_clock_add(parent.obj))
|
||||
|
@ -136,7 +135,7 @@ cdef class Clock(LayoutClass):
|
|||
.. warning:: The behavior for values set out of those ranges is
|
||||
**undefined**.
|
||||
|
||||
:type: (int h, int m, int s)
|
||||
:type: (int **h**, int **m**, int **s**)
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -186,7 +185,7 @@ cdef class Clock(LayoutClass):
|
|||
"""Which digits of the given clock widget should be editable when in
|
||||
edition mode.
|
||||
|
||||
:type: Elm_Clock_Edit_Mode
|
||||
:type: :ref:`Elm_Clock_Edit_Mode`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -23,7 +23,6 @@ Widget description
|
|||
|
||||
.. image:: /images/colorselector-preview.png
|
||||
|
||||
|
||||
A Colorselector is a color selection widget.
|
||||
|
||||
It allows application to set a series of colors. It also allows to
|
||||
|
@ -47,7 +46,10 @@ This widget emits the following signals, besides the ones sent from
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Colorselector modes
|
||||
.. _Elm_Colorselector_Mode:
|
||||
|
||||
Colorselector modes
|
||||
===================
|
||||
|
||||
.. data:: ELM_COLORSELECTOR_PALETTE
|
||||
|
||||
|
@ -77,11 +79,7 @@ ELM_COLORSELECTOR_BOTH = enums.ELM_COLORSELECTOR_BOTH
|
|||
|
||||
cdef class ColorselectorPaletteItem(ObjectItem):
|
||||
|
||||
"""
|
||||
|
||||
An item for the :py:class:`Colorselector` widget.
|
||||
|
||||
"""
|
||||
"""An item for the :py:class:`Colorselector` widget."""
|
||||
|
||||
def __init__(self, evasObject cs, r, g, b, a):
|
||||
cdef Elm_Object_Item *item = elm_colorselector_palette_color_add(cs.obj, r, g, b, a)
|
||||
|
@ -91,9 +89,9 @@ cdef class ColorselectorPaletteItem(ObjectItem):
|
|||
Py_DECREF(self)
|
||||
|
||||
property color:
|
||||
"""The palette item's color.
|
||||
"""The palette items color.
|
||||
|
||||
:type: tuple of ints
|
||||
:type: (int **r**, int **g**, int **b**, int **a**)
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -114,11 +112,7 @@ cdef class ColorselectorPaletteItem(ObjectItem):
|
|||
|
||||
cdef class Colorselector(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_colorselector_add(parent.obj))
|
||||
|
@ -126,7 +120,7 @@ cdef class Colorselector(LayoutClass):
|
|||
property color:
|
||||
"""The current color (r, g, b, a).
|
||||
|
||||
:type: tuple of ints
|
||||
:type: (int **r**, int **g**, int **b**, int **a**)
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -150,7 +144,7 @@ cdef class Colorselector(LayoutClass):
|
|||
|
||||
Colorselector supports three modes palette only, selector only and both.
|
||||
|
||||
:type: Elm_Colorselector_Mode
|
||||
:type: :ref:`Elm_Colorselector_Mode`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -18,12 +18,74 @@
|
|||
|
||||
"""
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
Elementary configuration is formed by a set options bounded to a
|
||||
given profile, like theme, "finger size", etc.
|
||||
|
||||
These are functions with which one synchronizes changes made to those
|
||||
values to the configuration storing files, de facto. You most probably
|
||||
don't want to use the functions in this group unless you're writing an
|
||||
elementary configuration manager.
|
||||
|
||||
Profiles
|
||||
========
|
||||
|
||||
Profiles are pre-set options that affect the whole look-and-feel of
|
||||
Elementary-based applications. There are, for example, profiles
|
||||
aimed at desktop computer applications and others aimed at mobile,
|
||||
touchscreen-based ones. You most probably don't want to use the
|
||||
functions in this group unless you're writing an elementary
|
||||
configuration manager.
|
||||
|
||||
Elementary Scrolling
|
||||
====================
|
||||
|
||||
These set how scrollable views in Elementary widgets should behave on
|
||||
user interaction.
|
||||
|
||||
Password show last
|
||||
==================
|
||||
|
||||
Show last feature of password mode enables user to view the last input
|
||||
entered for few seconds before masking it. These functions allow to set
|
||||
this feature in password mode of entry widget and also allow to
|
||||
manipulate the duration for which the input has to be visible.
|
||||
|
||||
Elementary Engine
|
||||
=================
|
||||
|
||||
These are functions setting and querying which rendering engine
|
||||
Elementary will use for drawing its windows' pixels.
|
||||
|
||||
The following are the available engines:
|
||||
|
||||
- "software_x11"
|
||||
- "fb"
|
||||
- "directfb"
|
||||
- "software_16_x11"
|
||||
- "software_8_x11"
|
||||
- "xrender_x11"
|
||||
- "opengl_x11"
|
||||
- "software_gdi"
|
||||
- "software_16_wince_gdi"
|
||||
- "sdl"
|
||||
- "software_16_sdl"
|
||||
- "opengl_sdl"
|
||||
- "buffer"
|
||||
- "ews"
|
||||
- "opengl_cocoa"
|
||||
- "psl1ght"
|
||||
|
||||
|
||||
Enumerations
|
||||
------------
|
||||
|
||||
.. _Elm_Softcursor_Mode:
|
||||
|
||||
.. rubric:: Elm_Softcursor_Mode
|
||||
Elm_Softcursor_Mode
|
||||
===================
|
||||
|
||||
.. data:: ELM_SOFTCURSOR_MODE_AUTO
|
||||
|
||||
|
@ -52,62 +114,7 @@ ELM_SOFTCURSOR_MODE_OFF = enums.ELM_SOFTCURSOR_MODE_OFF
|
|||
|
||||
cdef class Configuration(object):
|
||||
|
||||
"""
|
||||
|
||||
Elementary configuration is formed by a set options bounded to a
|
||||
given profile, like theme, "finger size", etc.
|
||||
|
||||
These are functions with which one synchronizes changes made to those
|
||||
values to the configuration storing files, de facto. You most probably
|
||||
don't want to use the functions in this group unless you're writing an
|
||||
elementary configuration manager.
|
||||
|
||||
.. rubric:: Profiles
|
||||
|
||||
Profiles are pre-set options that affect the whole look-and-feel of
|
||||
Elementary-based applications. There are, for example, profiles
|
||||
aimed at desktop computer applications and others aimed at mobile,
|
||||
touchscreen-based ones. You most probably don't want to use the
|
||||
functions in this group unless you're writing an elementary
|
||||
configuration manager.
|
||||
|
||||
.. rubric:: Elementary Scrolling
|
||||
|
||||
These set how scrollable views in Elementary widgets should behave on
|
||||
user interaction.
|
||||
|
||||
.. rubric:: Password show last
|
||||
|
||||
Show last feature of password mode enables user to view the last input
|
||||
entered for few seconds before masking it. These functions allow to set
|
||||
this feature in password mode of entry widget and also allow to
|
||||
manipulate the duration for which the input has to be visible.
|
||||
|
||||
.. rubric:: Elementary Engine
|
||||
|
||||
These are functions setting and querying which rendering engine
|
||||
Elementary will use for drawing its windows' pixels.
|
||||
|
||||
The following are the available engines:
|
||||
|
||||
- "software_x11"
|
||||
- "fb"
|
||||
- "directfb"
|
||||
- "software_16_x11"
|
||||
- "software_8_x11"
|
||||
- "xrender_x11"
|
||||
- "opengl_x11"
|
||||
- "software_gdi"
|
||||
- "software_16_wince_gdi"
|
||||
- "sdl"
|
||||
- "software_16_sdl"
|
||||
- "opengl_sdl"
|
||||
- "buffer"
|
||||
- "ews"
|
||||
- "opengl_cocoa"
|
||||
- "psl1ght"
|
||||
|
||||
"""
|
||||
"""The configuration class"""
|
||||
|
||||
def save(self):
|
||||
"""save()
|
||||
|
@ -371,7 +378,7 @@ cdef class Configuration(object):
|
|||
canvas windows in the event the native display system does not provide one
|
||||
or the native oneis not wanted.
|
||||
|
||||
:type: Elm_Softcursor_Mode
|
||||
:type: :ref:`Elm_Softcursor_Mode`
|
||||
|
||||
"""
|
||||
def __set__(self, mode):
|
||||
|
@ -485,7 +492,7 @@ cdef class Configuration(object):
|
|||
property text_classes_list:
|
||||
"""Get Elementary's list of supported text classes.
|
||||
|
||||
:type: Elm_Text_Class
|
||||
:type: :ref:`Elm_Text_Class`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -22,7 +22,6 @@ Widget description
|
|||
|
||||
.. image:: /images/conformant-preview.png
|
||||
|
||||
|
||||
The aim is to provide a widget that can be used in elementary apps to
|
||||
account for space taken up by the indicator, virtual keypad & softkey
|
||||
windows when running the illume2 module of E17.
|
||||
|
@ -31,8 +30,15 @@ So conformant content will be sized and positioned considering the
|
|||
space required for such stuff, and when they popup, as a keyboard
|
||||
shows when an entry is selected, conformant content won't change.
|
||||
|
||||
This widget emits the signals sent from
|
||||
:py:class:`elementary.layout.Layout`.
|
||||
This widget emits the following signals, besides the ones sent from
|
||||
:py:class:`efl.elementary.layout_class.LayoutClass`:
|
||||
|
||||
- "virtualkeypad,state,on": if virtualkeypad state is switched to "on".
|
||||
- "virtualkeypad,state,off": if virtualkeypad state is switched to "off".
|
||||
- "clipboard,state,on": if clipboard state is switched to "on".
|
||||
- "clipboard,state,off": if clipboard state is switched to "off".
|
||||
|
||||
In all cases, the ``event`` parameter of the callback will be None.
|
||||
|
||||
Available styles for it:
|
||||
- ``"default"``
|
||||
|
@ -48,15 +54,46 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Conformant(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_conformant_add(parent.obj))
|
||||
|
||||
def callback_virtualkeypad_state_on_add(self, func, *args, **kwargs):
|
||||
"""if virtualkeypad state is switched to "on".
|
||||
|
||||
:since: 1.8"""
|
||||
self._callback_add("virtualkeypad,state,on", func, *args, **kwargs)
|
||||
|
||||
def callback_virtualkeypad_state_on_del(self, func):
|
||||
self._callback_del("virtualkeypad,state,on", func)
|
||||
|
||||
def callback_virtualkeypad_state_off_add(self, func, *args, **kwargs):
|
||||
"""if virtualkeypad state is switched to "off".
|
||||
|
||||
:since: 1.8"""
|
||||
self._callback_add("virtualkeypad,state,off", func, *args, **kwargs)
|
||||
|
||||
def callback_virtualkeypad_state_off_del(self, func):
|
||||
self._callback_del("virtualkeypad,state,off", func)
|
||||
|
||||
def callback_clipboard_state_on_add(self, func, *args, **kwargs):
|
||||
"""if clipboard state is switched to "on".
|
||||
|
||||
:since: 1.8"""
|
||||
self._callback_add("clipboard,state,on", func, *args, **kwargs)
|
||||
|
||||
def callback_clipboard_state_on_del(self, func):
|
||||
self._callback_del("clipboard,state,on", func)
|
||||
|
||||
def callback_clipboard_state_off_add(self, func, *args, **kwargs):
|
||||
"""if clipboard state is switched to "off".
|
||||
|
||||
:since: 1.8"""
|
||||
self._callback_add("clipboard,state,off", func, *args, **kwargs)
|
||||
|
||||
def callback_clipboard_state_off_del(self, func):
|
||||
self._callback_del("clipboard,state,off", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_conformant", Conformant)
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ Widget description
|
|||
|
||||
.. image:: /images/ctxpopup-preview.png
|
||||
|
||||
|
||||
Context popup widget.
|
||||
|
||||
A ctxpopup is a widget that, when shown, pops up a list of items. It
|
||||
|
@ -55,7 +54,10 @@ Default text parts of the ctxpopup items that you can use for are:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Ctxpopup arrow directions
|
||||
.. _Elm_Ctxpopup_Direction:
|
||||
|
||||
Ctxpopup arrow directions
|
||||
=========================
|
||||
|
||||
.. data:: ELM_CTXPOPUP_DIRECTION_DOWN
|
||||
|
||||
|
@ -80,7 +82,7 @@ Enumerations
|
|||
"""
|
||||
|
||||
include "widget_header.pxi"
|
||||
from object cimport Object
|
||||
from layout_class cimport LayoutClass
|
||||
from object_item cimport ObjectItem, _object_item_callback
|
||||
|
||||
cimport enums
|
||||
|
@ -92,35 +94,75 @@ ELM_CTXPOPUP_DIRECTION_UP = enums.ELM_CTXPOPUP_DIRECTION_UP
|
|||
ELM_CTXPOPUP_DIRECTION_UNKNOWN = enums.ELM_CTXPOPUP_DIRECTION_UNKNOWN
|
||||
|
||||
cdef class CtxpopupItem(ObjectItem):
|
||||
def __init__(self, evasObject ctxpopup, label = None, evasObject icon = None, callback = None, *args, **kargs):
|
||||
|
||||
cdef:
|
||||
bytes label
|
||||
evasObject icon
|
||||
|
||||
def __init__(self, label = None, evasObject icon = None, callback = None, *args, **kargs):
|
||||
"""
|
||||
.. warning:: Ctxpopup can't hold both an item list and a content at the
|
||||
same time. When an item is added, any previous content will be
|
||||
removed.
|
||||
|
||||
:param icon: Icon to be set on new item
|
||||
:type icon: :py:class:`evas.object.Object`
|
||||
:param label: The Label of the new item
|
||||
:type label: string
|
||||
:param func: Convenience function called when item selected
|
||||
:type func: function
|
||||
:return: The item added or ``None``, on errors
|
||||
:rtype: :py:class:`CtxpopupItem`
|
||||
|
||||
"""
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
self.label = label
|
||||
self.icon = icon
|
||||
self.cb_func = callback
|
||||
self.args = args
|
||||
self.kwargs = kargs
|
||||
|
||||
def append_to(self, evasObject ctxpopup):
|
||||
"""item_append(unicode label, evas.Object icon, func, *args, **kwargs) -> CtxpopupItem
|
||||
|
||||
Add a new item to a ctxpopup object.
|
||||
|
||||
.. warning:: Ctxpopup can't hold both an item list and a content at the
|
||||
same time. When an item is added, any previous content will be
|
||||
removed.
|
||||
|
||||
.. seealso:: :py:attr:`elementary.object.Object.content`
|
||||
|
||||
:param ctxpopup: The Ctxpopup widget this item is to be appended on
|
||||
:type ctxpopup: :py:class:`Ctxpopup`
|
||||
:return: The item added or ``None``, on errors
|
||||
:rtype: :py:class:`CtxpopupItem`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if callback:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
item = elm_ctxpopup_item_append(ctxpopup.obj,
|
||||
<const_char *>label if label is not None else NULL,
|
||||
icon.obj if icon is not None else NULL,
|
||||
cb,
|
||||
<void*>self)
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
self.icon.obj if self.icon is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
cdef class Ctxpopup(Object):
|
||||
cdef class Ctxpopup(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_ctxpopup_add(parent.obj))
|
||||
|
@ -166,25 +208,12 @@ cdef class Ctxpopup(Object):
|
|||
def item_append(self, label, evasObject icon = None, func = None, *args, **kwargs):
|
||||
"""item_append(unicode label, evas.Object icon, func, *args, **kwargs) -> CtxpopupItem
|
||||
|
||||
Add a new item to a ctxpopup object.
|
||||
A constructor for a :py:class:`CtxpopupItem`.
|
||||
|
||||
.. warning:: Ctxpopup can't hold both an item list and a content at the
|
||||
same time. When an item is added, any previous content will be
|
||||
removed.
|
||||
|
||||
.. seealso:: :py:attr:`elementary.object.Object.content`
|
||||
|
||||
:param icon: Icon to be set on new item
|
||||
:type icon: :py:class:`evas.object.Object`
|
||||
:param label: The Label of the new item
|
||||
:type label: string
|
||||
:param func: Convenience function called when item selected
|
||||
:type func: function
|
||||
:return: The item added or ``None``, on errors
|
||||
:rtype: :py:class:`CtxpopupItem`
|
||||
:see: :py:func:`CtxpopupItem.append_to`
|
||||
|
||||
"""
|
||||
return CtxpopupItem(self, label, icon, func, *args, **kwargs)
|
||||
return CtxpopupItem(label, icon, func, *args, **kwargs).append_to(self)
|
||||
|
||||
property direction_priority:
|
||||
"""The direction priority order of a ctxpopup.
|
||||
|
@ -193,7 +222,7 @@ cdef class Ctxpopup(Object):
|
|||
showing direction. This doesn't guarantee the ctxpopup will appear
|
||||
in the requested direction.
|
||||
|
||||
:type: tuple of Elm_Ctxpopup_Direction
|
||||
:type: (first, second, third, fourth) :ref:`Elm_Ctxpopup_Direction`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -219,7 +248,7 @@ cdef class Ctxpopup(Object):
|
|||
.. warning:: Only once the ctxpopup is shown can the direction be
|
||||
determined
|
||||
|
||||
:type: Elm_Ctxpopup_Direction
|
||||
:type: :ref:`Elm_Ctxpopup_Direction`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -158,7 +158,8 @@ Datetime individual field selection is implemented in a modular style.
|
|||
Module can be implemented as a Ctxpopup based selection or an ISE based
|
||||
selection or even a spinner like selection etc.
|
||||
|
||||
**Datetime Module design:**
|
||||
Datetime Module design
|
||||
======================
|
||||
|
||||
The following functions are expected to be implemented in a Datetime module:
|
||||
|
||||
|
@ -215,7 +216,10 @@ This widget emits the following signals, besides the ones sent from
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Datetime fields
|
||||
.. _Elm_Datetime_Field_Type:
|
||||
|
||||
Datetime fields
|
||||
===============
|
||||
|
||||
.. data:: ELM_DATETIME_YEAR
|
||||
|
||||
|
@ -260,11 +264,8 @@ ELM_DATETIME_AMPM = enums.ELM_DATETIME_AMPM
|
|||
|
||||
cdef class Datetime(Object):
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_datetime_add(parent.obj))
|
||||
|
||||
|
@ -471,7 +472,7 @@ cdef class Datetime(Object):
|
|||
Reference to field's minimum value
|
||||
Reference to field's maximum value
|
||||
|
||||
type: (Elm_Datetime_Field_Type, int, int)
|
||||
type: (:ref:`Elm_Datetime_Field_Type`, int, int)
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -536,7 +537,7 @@ cdef class Datetime(Object):
|
|||
.. seealso:: :py:func:`field_visible_set()`
|
||||
|
||||
:param fieldtype: Type of the field. ELM_DATETIME_YEAR etc
|
||||
:type fieldtype: Elm_Datetime_Field_Type
|
||||
:type fieldtype: :ref:`Elm_Datetime_Field_Type`
|
||||
:return: ``True``, if field can be visible. ``False`` otherwise.
|
||||
:rtype: bool
|
||||
|
||||
|
@ -560,7 +561,7 @@ cdef class Datetime(Object):
|
|||
.. seealso:: :py:func:`field_visible_get()`
|
||||
|
||||
:param fieldtype: Type of the field. ELM_DATETIME_YEAR etc.
|
||||
:type fieldtype: Elm_Datetime_Field_Type
|
||||
:type fieldtype: :ref:`Elm_Datetime_Field_Type`
|
||||
:param visible: ``True`` field can be visible, ``False`` otherwise.
|
||||
:type visible: bool
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ Widget description
|
|||
|
||||
.. image:: /images/dayselector-preview.png
|
||||
|
||||
|
||||
Dayselector displays all seven days of the week and allows the user to
|
||||
select multiple days.
|
||||
|
||||
|
@ -75,7 +74,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Dayselector_Day:
|
||||
|
||||
.. rubric:: Dayselector days
|
||||
Dayselector days
|
||||
================
|
||||
|
||||
.. data:: ELM_DAYSELECTOR_SUN
|
||||
|
||||
|
@ -124,11 +124,8 @@ ELM_DAYSELECTOR_MAX = enums.ELM_DAYSELECTOR_MAX
|
|||
|
||||
cdef class Dayselector(LayoutClass):
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_dayselector_add(parent.obj))
|
||||
|
||||
|
@ -138,7 +135,7 @@ cdef class Dayselector(LayoutClass):
|
|||
Set the state of given Dayselector_Day.
|
||||
|
||||
:param day: The day that the user want to set state.
|
||||
:type day: :ref:`Day <Elm_Dayselector_Day>`
|
||||
:type day: :ref:`Elm_Dayselector_Day`
|
||||
:param selected: state of the day. ``True`` is selected.
|
||||
:type selected: bool
|
||||
|
||||
|
@ -151,7 +148,7 @@ cdef class Dayselector(LayoutClass):
|
|||
Get the state of given Dayselector_Day.
|
||||
|
||||
:param day: The day that the user want to know state.
|
||||
:type day: :ref:`Day <Elm_Dayselector_Day>`
|
||||
:type day: :ref:`Elm_Dayselector_Day`
|
||||
:return: ``True``, if the Day is selected
|
||||
:rtype: bool
|
||||
|
||||
|
@ -161,7 +158,7 @@ cdef class Dayselector(LayoutClass):
|
|||
property week_start:
|
||||
"""The starting day of Dayselector.
|
||||
|
||||
:type: :ref:`Day <Elm_Dayselector_Day>`
|
||||
:type: :ref:`Elm_Dayselector_Day`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -172,7 +169,7 @@ cdef class Dayselector(LayoutClass):
|
|||
property weekend_start:
|
||||
"""The weekend starting day of Dayselector.
|
||||
|
||||
:type: :ref:`Day <Elm_Dayselector_Day>`
|
||||
:type: :ref:`Elm_Dayselector_Day`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -32,6 +32,7 @@ reduced for a defined length for side items.
|
|||
Smart callbacks one can listen to:
|
||||
|
||||
- "selected" - when item is selected, i.e. scroller stops.
|
||||
- "clicked" - This is called when a user clicks an item
|
||||
- "scroll,anim,start" - scrolling animation has started
|
||||
- "scroll,anim,stop" - scrolling animation has stopped
|
||||
- "scroll,drag,start" - dragging the diskselector has started
|
||||
|
@ -65,33 +66,88 @@ from scroller cimport *
|
|||
|
||||
cdef class DiskselectorItem(ObjectItem):
|
||||
|
||||
"""
|
||||
"""An item for the Diskselector widget.
|
||||
|
||||
An item for the Diskselector widget.
|
||||
A new item will be created and appended to the diskselector, i.e.,
|
||||
will be set as last item. Also, if there is no selected item, it will
|
||||
be selected. This will always happens for the first appended item.
|
||||
|
||||
If no icon is set, label will be centered on item position, otherwise
|
||||
the icon will be placed at left of the label, that will be shifted
|
||||
to the right.
|
||||
|
||||
Items created with this method can be deleted with
|
||||
:py:func:`elementary.object_item.ObjectItem.delete()`.
|
||||
|
||||
If a function is passed as argument, it will be called every time
|
||||
this item is selected, i.e., the user stops the diskselector with
|
||||
this item on center position.
|
||||
|
||||
Simple example (with no function callback or data associated)::
|
||||
|
||||
disk = Diskselector(win)
|
||||
ic = Icon(win)
|
||||
ic.file_set("path/to/image")
|
||||
ic.resizable_set(EINA_TRUE, EINA_TRUE)
|
||||
disk.item_append("label", ic)
|
||||
|
||||
.. seealso::
|
||||
:py:func:`elementary.object_item.ObjectItem.delete()`
|
||||
:py:func:`clear()`
|
||||
:py:class:`elementary.image.Image`
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, evasObject diskselector, label, evasObject icon=None, callback=None, *args, **kargs):
|
||||
cdef Evas_Object* icon_obj = NULL
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
cdef:
|
||||
bytes label
|
||||
evasObject icon
|
||||
|
||||
if icon is not None:
|
||||
icon_obj = icon.obj
|
||||
def __init__(self, label, evasObject icon=None, callback=None, *args, **kargs):
|
||||
"""
|
||||
|
||||
:param label: The label of the diskselector item.
|
||||
:type label: string
|
||||
:param icon: The icon object to use at left side of the item. An
|
||||
icon can be any Evas object, but usually it is an
|
||||
:py:class:`elementary.icon.Icon`.
|
||||
:type icon: :py:class:`evas.object.Object`
|
||||
:param func: The function to call when the item is selected.
|
||||
:type func: function
|
||||
|
||||
"""
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
self.label = label
|
||||
self.icon = icon
|
||||
self.cb_func = callback
|
||||
self.args = args
|
||||
self.kwargs = kargs
|
||||
|
||||
def append_to(self, Diskselector diskselector):
|
||||
"""append_to(self, Diskselector diskselector) -> DiskselectorItem
|
||||
|
||||
Appends a new item to the diskselector object.
|
||||
|
||||
:return: The created item or ``None`` upon failure.
|
||||
:rtype: :py:class:`DiskselectorItem`
|
||||
|
||||
"""
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_diskselector_item_append(diskselector.obj,
|
||||
<const_char *>label if label is not None else NULL,
|
||||
icon_obj, cb, <void*>self)
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
self.icon.obj if self.icon is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
|
@ -165,11 +221,7 @@ cdef class DiskselectorItem(ObjectItem):
|
|||
|
||||
cdef class Diskselector(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_diskselector_add(parent.obj))
|
||||
|
@ -310,50 +362,12 @@ cdef class Diskselector(Object):
|
|||
def item_append(self, label, evasObject icon = None, callback = None, *args, **kwargs):
|
||||
"""item_append(self, unicode label, evas.Object icon = None, callback = None, *args, **kwargs) -> DiskselectorItem
|
||||
|
||||
Appends a new item to the diskselector object.
|
||||
A constructor for :py:class:`DiskselectorItem`
|
||||
|
||||
A new item will be created and appended to the diskselector, i.e.,
|
||||
will be set as last item. Also, if there is no selected item, it will
|
||||
be selected. This will always happens for the first appended item.
|
||||
|
||||
If no icon is set, label will be centered on item position, otherwise
|
||||
the icon will be placed at left of the label, that will be shifted
|
||||
to the right.
|
||||
|
||||
Items created with this method can be deleted with
|
||||
:py:func:`elementary.object_item.ObjectItem.delete()`.
|
||||
|
||||
If a function is passed as argument, it will be called every time
|
||||
this item is selected, i.e., the user stops the diskselector with
|
||||
this item on center position.
|
||||
|
||||
Simple example (with no function callback or data associated)::
|
||||
|
||||
disk = Diskselector(win)
|
||||
ic = Icon(win)
|
||||
ic.file_set("path/to/image")
|
||||
ic.resizable_set(EINA_TRUE, EINA_TRUE)
|
||||
disk.item_append("label", ic)
|
||||
|
||||
.. seealso::
|
||||
:py:func:`elementary.object_item.ObjectItem.delete()`
|
||||
:py:func:`clear()`
|
||||
:py:class:`elementary.image.Image`
|
||||
|
||||
:param label: The label of the diskselector item.
|
||||
:type label: string
|
||||
:param icon: The icon object to use at left side of the item. An
|
||||
icon can be any Evas object, but usually it is an
|
||||
:py:class:`elementary.icon.Icon`.
|
||||
:type icon: :py:class:`evas.object.Object`
|
||||
:param func: The function to call when the item is selected.
|
||||
:type func: function
|
||||
|
||||
:return: The created item or ``None`` upon failure.
|
||||
:rtype: :py:class:`DiskselectorItem`
|
||||
:see: :py:func`DiskselectorItem.append_to`
|
||||
|
||||
"""
|
||||
return DiskselectorItem(self, label, icon, callback, *args, **kwargs)
|
||||
return DiskselectorItem(label, icon, callback, *args, **kwargs).append_to(self)
|
||||
|
||||
property selected_item:
|
||||
"""Get the selected item.
|
||||
|
@ -408,6 +422,15 @@ cdef class Diskselector(Object):
|
|||
def callback_selected_del(self, func):
|
||||
self._callback_del_full("selected", _cb_object_item_conv, func)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
"""This is called when a user clicks an item
|
||||
|
||||
:since 1.8"""
|
||||
self._callback_add_full("clicked", _cb_object_item_conv, func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del_full("clicked", _cb_object_item_conv, func)
|
||||
|
||||
def callback_scroll_anim_start_add(self, func, *args, **kwargs):
|
||||
"""Scrolling animation has started."""
|
||||
self._callback_add("scroll,anim,start", func, *args, **kwargs)
|
||||
|
|
|
@ -39,7 +39,8 @@ Other features include password mode, filtering of inserted text with
|
|||
:py:func:`markup_filter_append()` and related functions, inline "items" and
|
||||
formatted markup text.
|
||||
|
||||
.. rubric:: Formatted text
|
||||
Formatted text
|
||||
==============
|
||||
|
||||
The markup tags supported by the Entry are defined by the theme, but
|
||||
even when writing new themes or extensions it's a good idea to stick to
|
||||
|
@ -56,13 +57,15 @@ Currently defined by the default theme are the following tags:
|
|||
- <link>...</link>: Underlines the enclosed text.
|
||||
- <hilight>...</hilight>: Highlights the enclosed text.
|
||||
|
||||
.. rubric:: Special markups
|
||||
Special markups
|
||||
===============
|
||||
|
||||
Besides those used to format text, entries support two special markup
|
||||
tags used to insert click-able portions of text or items inlined within
|
||||
the text.
|
||||
|
||||
.. rubric:: Anchors
|
||||
Anchors
|
||||
'''''''
|
||||
|
||||
Anchors are similar to HTML anchors. Text can be surrounded by <a> and
|
||||
</a> tags and an event will be generated when this text is clicked,
|
||||
|
@ -79,7 +82,8 @@ callback function. The same applies for "anchor,in" (mouse in),
|
|||
"anchor,out" (mouse out), "anchor,down" (mouse down), and "anchor,up"
|
||||
(mouse up) events on an anchor.
|
||||
|
||||
.. rubric:: Items
|
||||
Items
|
||||
'''''
|
||||
|
||||
Inlined in the text, any other :py:class:`elementary.object.Object` can
|
||||
be inserted by using <item> tags this way::
|
||||
|
@ -168,7 +172,8 @@ Alternatively, an item may reference an image by its path, using
|
|||
the URI form ``file:///path/to/an/image.png`` and the entry will then
|
||||
use that image for the item.
|
||||
|
||||
.. rubric:: Setting entry's style
|
||||
Setting entry's style
|
||||
=====================
|
||||
|
||||
There are 2 major ways to change the entry's style:
|
||||
|
||||
|
@ -181,7 +186,8 @@ aesthetic reasons. While the user style should be changed when you would
|
|||
like to change the style to something specific defined at run-time, e.g,
|
||||
setting font or font size in a text editor.
|
||||
|
||||
.. rubric:: Loading and saving files
|
||||
Loading and saving files
|
||||
========================
|
||||
|
||||
Entries have convenience functions to load text from a file and save
|
||||
changes back to it after a short delay. The automatic saving is enabled
|
||||
|
@ -189,7 +195,8 @@ by default, but can be disabled with :py:attr:`autosave` and files
|
|||
can be loaded directly as plain text or have any markup in them
|
||||
recognized. See :py:attr:`file` for more details.
|
||||
|
||||
.. rubric:: Emitted signals
|
||||
Emitted signals
|
||||
---------------
|
||||
|
||||
This widget emits the following signals:
|
||||
|
||||
|
@ -244,7 +251,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Autocapital_Type:
|
||||
|
||||
.. rubric:: Autocapitalization types
|
||||
Autocapitalization types
|
||||
========================
|
||||
|
||||
.. data:: ELM_AUTOCAPITAL_TYPE_NONE
|
||||
|
||||
|
@ -265,7 +273,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Cnp_Mode:
|
||||
|
||||
.. rubric:: Copy & paste modes
|
||||
Copy & paste modes
|
||||
==================
|
||||
|
||||
.. data:: ELM_CNP_MODE_MARKUP
|
||||
|
||||
|
@ -282,7 +291,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Input_Panel_Lang:
|
||||
|
||||
.. rubric:: Input panel language sort order
|
||||
Input panel language sort order
|
||||
===============================
|
||||
|
||||
.. data:: ELM_INPUT_PANEL_LANG_AUTOMATIC
|
||||
|
||||
|
@ -295,7 +305,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Input_Panel_Layout:
|
||||
|
||||
.. rubric:: Input panel layouts
|
||||
Input panel layouts
|
||||
===================
|
||||
|
||||
.. data:: ELM_INPUT_PANEL_LAYOUT_NORMAL
|
||||
|
||||
|
@ -348,7 +359,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Input_Panel_Return_Key_Type:
|
||||
|
||||
.. rubric:: Input panel return key modes
|
||||
Input panel return key modes
|
||||
============================
|
||||
|
||||
.. data:: ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT
|
||||
|
||||
|
@ -385,7 +397,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Scroller_Policy:
|
||||
|
||||
.. rubric:: Scrollbar visibility
|
||||
Scrollbar visibility
|
||||
====================
|
||||
|
||||
.. data:: ELM_SCROLLER_POLICY_AUTO
|
||||
|
||||
|
@ -402,7 +415,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Text_Format:
|
||||
|
||||
.. rubric:: Text format
|
||||
Text format
|
||||
===========
|
||||
|
||||
.. data:: ELM_TEXT_FORMAT_PLAIN_UTF8
|
||||
|
||||
|
@ -415,7 +429,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Wrap_Type:
|
||||
|
||||
.. rubric:: Wrap mode
|
||||
Wrap mode
|
||||
=========
|
||||
|
||||
.. data:: ELM_WRAP_NONE
|
||||
|
||||
|
@ -436,7 +451,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Icon_Type:
|
||||
|
||||
.. rubric:: Icon types
|
||||
Icon types
|
||||
==========
|
||||
|
||||
.. data:: ELM_ICON_NONE
|
||||
|
||||
|
@ -899,7 +915,7 @@ cdef class Entry(Object):
|
|||
Note that this only makes sense for multi-line entries. A widget set
|
||||
to be single line will never wrap.
|
||||
|
||||
:type: :ref:`Line wrapping mode <Elm_Wrap_Type>`
|
||||
:type: :ref:`Elm_Wrap_Type`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -1305,7 +1321,7 @@ cdef class Entry(Object):
|
|||
will be saved if the autosave feature is enabled, otherwise, the file
|
||||
will be silently discarded and any non-saved changes will be lost.
|
||||
|
||||
:type: tuple of strings (file, format)
|
||||
:type: (unicode **file_name**, :ref:`Elm_Text_Format` **file_format**)
|
||||
:raise RuntimeError: when setting the file fails
|
||||
|
||||
"""
|
||||
|
@ -1317,14 +1333,12 @@ cdef class Entry(Object):
|
|||
self.file_set(file, format)
|
||||
|
||||
cpdef file_set(self, file_name, file_format):
|
||||
# TODO: Check that Elm_Text_Format is being used correctly here
|
||||
a1 = file_name
|
||||
a2 = file_format
|
||||
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
|
||||
if isinstance(a2, unicode): a2 = PyUnicode_AsUTF8String(a2)
|
||||
if not elm_entry_file_set(self.obj,
|
||||
<const_char *>a1 if a1 is not None else NULL,
|
||||
<Elm_Text_Format>a2 if a2 is not None else ""):
|
||||
a2 if a2 is not None else enums.ELM_TEXT_FORMAT_PLAIN_UTF8):
|
||||
raise RuntimeError("Could not set file")
|
||||
cpdef file_get(self):
|
||||
cdef const_char *file
|
||||
|
@ -1411,7 +1425,7 @@ cdef class Entry(Object):
|
|||
will automatically disable the display of scrollbars when the entry
|
||||
moves inside its scroller.
|
||||
|
||||
:type: (:ref:`Scroll policy <Elm_Scroller_Policy>` **h**, :ref:`Scroll policy <Elm_Scroller_Policy>` **v**)
|
||||
:type: (:ref:`Elm_Scroller_Policy` **h**, :ref:`Elm_Scroller_Policy` **v**)
|
||||
|
||||
"""
|
||||
def __set__(self, value):
|
||||
|
@ -1449,7 +1463,7 @@ cdef class Entry(Object):
|
|||
property input_panel_layout:
|
||||
"""The input panel layout of the entry
|
||||
|
||||
:type: :ref:`Input panel layout <Elm_Input_Panel_Layout>`
|
||||
:type: :ref:`Elm_Input_Panel_Layout`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -1486,7 +1500,7 @@ cdef class Entry(Object):
|
|||
property autocapital_type:
|
||||
"""Autocapitalization type on the immodule.
|
||||
|
||||
:type: :ref:`Autocapitalization type <Elm_Autocapital_Type>`
|
||||
:type: :ref:`Elm_Autocapital_Type`
|
||||
|
||||
"""
|
||||
def __set__(self, value):
|
||||
|
@ -1550,7 +1564,7 @@ cdef class Entry(Object):
|
|||
|
||||
This API can be used if you want to show the alphabet keyboard mode.
|
||||
|
||||
:type: :ref:`Input panel language <Elm_Input_Panel_Lang>`
|
||||
:type: :ref:`Elm_Input_Panel_Lang`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -1596,7 +1610,7 @@ cdef class Entry(Object):
|
|||
|
||||
An input panel displays the string or icon associated with this type
|
||||
|
||||
:type: :ref:`Input panel return key type <Elm_Input_Panel_Return_Key_Type>`
|
||||
:type: :ref:`Elm_Input_Panel_Return_Key_Type`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -1751,7 +1765,7 @@ cdef class Entry(Object):
|
|||
|
||||
.. note:: This only changes the behaviour of text.
|
||||
|
||||
:type: :ref:`Copy and paste mode <Elm_Cnp_Mode>`
|
||||
:type: :ref:`Elm_Cnp_Mode`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -2039,41 +2053,3 @@ cdef class Entry(Object):
|
|||
|
||||
|
||||
_object_mapping_register("elm_entry", Entry)
|
||||
|
||||
|
||||
# TODO:
|
||||
# def context_menu_item_label_get(menu_item):
|
||||
# """Get the text of the contextual menu item.
|
||||
|
||||
# Gets the text of the contextual menu item of entry.
|
||||
|
||||
# :param item: The item to get the label
|
||||
# :return: The text of contextual menu item
|
||||
|
||||
# :see: :py:func:`Entry.context_menu_item_add`
|
||||
|
||||
# :since: 1.8
|
||||
|
||||
# """
|
||||
# return _ctouni(elm_entry_context_menu_item_label_get(const_Elm_Entry_Context_Menu_Item *item))
|
||||
|
||||
# TODO:
|
||||
# def context_menu_item_icon_get(menu_item):
|
||||
# """Get the icon object of the contextual menu item.
|
||||
|
||||
# Gets the icon object packed in the contextual menu item of entry.
|
||||
|
||||
# :param item: The item to get the icon from
|
||||
# :param icon_file: The image file path on disk used for the icon or standard
|
||||
# icon name
|
||||
# :param icon_group: The edje group used if @p icon_file is an edje file. NULL
|
||||
# if the icon is not an edje file
|
||||
# :param icon_type: The icon type
|
||||
|
||||
# :see: :py:func:`Entry.context_menu_item_add`
|
||||
|
||||
# :since: 1.8
|
||||
|
||||
# """
|
||||
# elm_entry_context_menu_item_icon_get(const_Elm_Entry_Context_Menu_Item *item, const_char **icon_file, const_char **icon_group, Elm_Icon_Type *icon_type);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ Widget description
|
|||
|
||||
.. image:: /images/fileselector-preview.png
|
||||
|
||||
|
||||
A file selector is a widget that allows a user to navigate through a
|
||||
file system, reporting file selections back via its API.
|
||||
|
||||
|
@ -63,7 +62,10 @@ This widget emits the following signals, besides the ones sent from
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Fileselector modes
|
||||
.. _Elm_Fileselector_Mode:
|
||||
|
||||
Fileselector modes
|
||||
==================
|
||||
|
||||
.. data:: ELM_FILESELECTOR_LIST
|
||||
|
||||
|
@ -87,11 +89,7 @@ ELM_FILESELECTOR_GRID = enums.ELM_FILESELECTOR_GRID
|
|||
|
||||
cdef class Fileselector(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
cdef object _cbs
|
||||
|
||||
|
@ -249,7 +247,7 @@ cdef class Fileselector(LayoutClass):
|
|||
|
||||
.. seealso:: :py:attr:`expandable`
|
||||
|
||||
:type: Elm_Fileselector_Mode
|
||||
:type: :ref:`Elm_Fileselector_Mode`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -62,7 +62,10 @@ for are:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Fileselector modes
|
||||
.. _Elm_Fileselector_Mode:
|
||||
|
||||
Fileselector modes
|
||||
==================
|
||||
|
||||
.. data:: ELM_FILESELECTOR_LIST
|
||||
|
||||
|
@ -84,18 +87,13 @@ ELM_FILESELECTOR_GRID = enums.ELM_FILESELECTOR_GRID
|
|||
|
||||
cdef class FileselectorButton(Button):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
cdef object _cbs
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_fileselector_button_add(parent.obj))
|
||||
|
||||
|
||||
# TODO: What's this for?
|
||||
self._cbs = {}
|
||||
|
||||
property window_title:
|
||||
|
|
|
@ -76,7 +76,10 @@ are:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Fileselector modes
|
||||
.. _Elm_Fileselector_Mode:
|
||||
|
||||
Fileselector modes
|
||||
==================
|
||||
|
||||
.. data:: ELM_FILESELECTOR_LIST
|
||||
|
||||
|
@ -100,18 +103,13 @@ ELM_FILESELECTOR_GRID = enums.ELM_FILESELECTOR_GRID
|
|||
|
||||
cdef class FileselectorEntry(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
cdef object _cbs
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_fileselector_entry_add(parent.obj))
|
||||
|
||||
|
||||
# TODO: What's this for?
|
||||
self._cbs = {}
|
||||
|
||||
property window_title:
|
||||
|
|
|
@ -65,7 +65,119 @@ from object_item cimport _object_item_to_python, _object_item_callback, _object_
|
|||
|
||||
cdef class FlipSelectorItem(ObjectItem):
|
||||
|
||||
"""An item for the :py:class:`FlipSelector` widget."""
|
||||
"""
|
||||
|
||||
An item for the :py:class:`FlipSelector` widget.
|
||||
|
||||
.. note:: The current selection *won't* be modified by appending an
|
||||
element to the list.
|
||||
|
||||
.. note:: The maximum length of the text label is going to be
|
||||
determined *by the widget's theme*. Strings larger than
|
||||
that value are going to be *truncated*.
|
||||
|
||||
"""
|
||||
|
||||
cdef:
|
||||
bytes label
|
||||
|
||||
def __init__(self, label = None, callback = None, *args, **kwargs):
|
||||
"""
|
||||
|
||||
The widget's list of labels to show will be appended with the
|
||||
given value. If the user wishes so, a callback function pointer
|
||||
can be passed, which will get called when this same item is
|
||||
selected.
|
||||
|
||||
:param label: The (text) label of the new item
|
||||
:type label: string
|
||||
:param func: Convenience callback function to take place when item
|
||||
is selected
|
||||
:type func: function
|
||||
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`FlipSelectorItem`
|
||||
|
||||
"""
|
||||
|
||||
if callback:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
self.label = label
|
||||
self.cb_func = callback
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def append_to(self, FlipSelector flipselector not None):
|
||||
"""append_to(FlipSelector flipselector) -> FlipSelectorItem
|
||||
|
||||
Append a (text) item to a flip selector widget
|
||||
|
||||
:param flipselector: The widget to append this item to
|
||||
:type flipselector: :py:class:`FlipSelector`
|
||||
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`FlipSelectorItem`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_flipselector_item_append(flipselector.obj,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
cb, <void *>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
return
|
||||
|
||||
def prepend_to(self, FlipSelector flipselector not None):
|
||||
"""prepend_to(FlipSelector flipselector) -> FlipSelectorItem
|
||||
|
||||
Append a (text) item to a flip selector widget
|
||||
|
||||
:param flipselector: The widget to prepend this item to
|
||||
:type flipselector: :py:class:`FlipSelector`
|
||||
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`FlipSelectorItem`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_flipselector_item_prepend(flipselector.obj,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
cb, <void *>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
return
|
||||
|
||||
property label:
|
||||
"""The label of this item
|
||||
|
||||
:type: string
|
||||
|
||||
"""
|
||||
def __set__(self, value):
|
||||
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
|
||||
self.label = value
|
||||
|
||||
def __get__(self):
|
||||
return self.label.decode("UTF-8")
|
||||
|
||||
property selected:
|
||||
"""Set whether a given flip selector widget's item should be the
|
||||
|
@ -112,11 +224,7 @@ cdef class FlipSelectorItem(ObjectItem):
|
|||
|
||||
cdef class FlipSelector(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_flipselector_add(parent.obj))
|
||||
|
@ -149,98 +257,22 @@ cdef class FlipSelector(Object):
|
|||
def item_append(self, label = None, callback = None, *args, **kwargs):
|
||||
"""item_append(unicode label = None, callback = None, *args, **kwargs) -> FlipSelectorItem
|
||||
|
||||
Append a (text) item to a flip selector widget
|
||||
A constructor for a :py:class:`FlipSelectorItem`
|
||||
|
||||
The widget's list of labels to show will be appended with the
|
||||
given value. If the user wishes so, a callback function pointer
|
||||
can be passed, which will get called when this same item is
|
||||
selected.
|
||||
|
||||
.. note:: The current selection *won't* be modified by appending an
|
||||
element to the list.
|
||||
|
||||
.. note:: The maximum length of the text label is going to be
|
||||
determined *by the widget's theme*. Strings larger than
|
||||
that value are going to be *truncated*.
|
||||
|
||||
:param label: The (text) label of the new item
|
||||
:type label: string
|
||||
:param func: Convenience callback function to take place when item
|
||||
is selected
|
||||
:type func: function
|
||||
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`FlipSelectorItem`
|
||||
:see: :py:func:`FlipSelectorItem.append_to`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
cdef FlipSelectorItem ret = FlipSelectorItem()
|
||||
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
ret.params = (callback, args, kwargs)
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
item = elm_flipselector_item_append(self.obj,
|
||||
<const_char *>label if label is not None else NULL,
|
||||
cb, <void *>self)
|
||||
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return
|
||||
return FlipSelectorItem(label, callback, *args, **kwargs).append_to(self)
|
||||
|
||||
def item_prepend(self, label = None, callback = None, *args, **kwargs):
|
||||
"""item_prepend(unicode label = None, callback = None, *args, **kwargs) -> FlipSelectorItem
|
||||
|
||||
Prepend a (text) item to a flip selector widget
|
||||
A constructor for a :py:class:`FlipSelectorItem`
|
||||
|
||||
The widget's list of labels to show will be prepended with the
|
||||
given value. If the user wishes so, a callback function pointer
|
||||
can be passed, which will get called when this same item is
|
||||
selected.
|
||||
|
||||
.. note:: The current selection *won't* be modified by prepending
|
||||
an element to the list.
|
||||
|
||||
.. note:: The maximum length of the text label is going to be
|
||||
determined *by the widget's theme*. Strings larger than
|
||||
that value are going to be *truncated*.
|
||||
|
||||
:param label: The (text) label of the new item
|
||||
:type label: string
|
||||
:param func: Convenience callback function to take place when item
|
||||
is selected
|
||||
:type func: function
|
||||
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`FlipSelectorItem`
|
||||
:see: :py:func:`FlipSelectorItem.prepend_to`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
cdef FlipSelectorItem ret = FlipSelectorItem()
|
||||
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
ret.params = (callback, args, kwargs)
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
item = elm_flipselector_item_prepend(self.obj,
|
||||
<const_char *>label if label is not None else NULL,
|
||||
cb, <void *>self)
|
||||
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return
|
||||
return FlipSelectorItem(label, callback, *args, **kwargs).prepend_to(self)
|
||||
|
||||
property items:
|
||||
"""Get the internal list of items in a given flip selector widget.
|
||||
|
|
|
@ -60,11 +60,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Frame(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_frame_add(parent.obj))
|
||||
|
|
|
@ -23,7 +23,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Policy:
|
||||
|
||||
.. rubric:: Policy types
|
||||
Policy types
|
||||
============
|
||||
|
||||
.. data:: ELM_POLICY_QUIT
|
||||
|
||||
|
@ -32,7 +33,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Policy_Quit:
|
||||
|
||||
.. rubric:: Quit policy types
|
||||
Quit policy types
|
||||
=================
|
||||
|
||||
.. data:: ELM_POLICY_QUIT_NONE
|
||||
|
||||
|
@ -144,11 +146,7 @@ ELM_CURSOR_XTERM = "xterm"
|
|||
|
||||
cdef class FontProperties(object):
|
||||
|
||||
"""
|
||||
|
||||
Elementary font properties
|
||||
|
||||
"""
|
||||
"""Elementary font properties"""
|
||||
|
||||
cdef Elm_Font_Properties *efp
|
||||
|
||||
|
@ -216,12 +214,12 @@ def policy_set(Elm_Policy policy, value):
|
|||
policy identifier, new and old values.
|
||||
|
||||
:param policy: policy identifier as in Elm_Policy.
|
||||
:type policy: :ref:`Policy type <Elm_Policy>`
|
||||
:type policy: :ref:`Elm_Policy`
|
||||
:param value: policy value, depends on identifiers, usually there is
|
||||
an enumeration with the same prefix as the policy name, for
|
||||
example: ELM_POLICY_QUIT and Elm_Policy_Quit
|
||||
(ELM_POLICY_QUIT_NONE, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED).
|
||||
:type value: :ref:`Quit policy <Elm_Policy_Quit>`
|
||||
:type value: :ref:`Elm_Policy_Quit`
|
||||
|
||||
:return: True on success or False on error (right
|
||||
now just invalid policy identifier, but in future policy
|
||||
|
@ -236,10 +234,10 @@ def policy_get(Elm_Policy policy):
|
|||
Gets the policy value set for given identifier.
|
||||
|
||||
:param policy: policy identifier as in Elm_Policy.
|
||||
:type policy: :ref:`Policy type <Elm_Policy>`
|
||||
:type policy: :ref:`Elm_Policy`
|
||||
|
||||
:return: policy value. Will be 0 if policy identifier is invalid.
|
||||
:rtype: :ref:`Quit policy <Elm_Policy_Quit>`
|
||||
:rtype: :ref:`Elm_Policy_Quit`
|
||||
|
||||
"""
|
||||
return elm_policy_get(policy)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
from efl.evas cimport Eina_Bool, Eina_List, Evas_Object, Evas_Smart_Cb, Evas_Coord
|
||||
from efl.evas cimport Eina_Bool, Eina_List, Evas_Object, Evas_Smart_Cb, \
|
||||
Evas_Coord, Eina_Compare_Cb
|
||||
from object_item cimport Elm_Object_Item
|
||||
from general cimport Elm_Tooltip_Item_Content_Cb
|
||||
from enums cimport Elm_Genlist_Item_Scrollto_Type, Elm_Scroller_Policy, \
|
||||
Elm_Object_Select_Mode
|
||||
from libc.string cimport const_char
|
||||
from libc.stdlib cimport const_void
|
||||
|
||||
cdef extern from "Elementary.h":
|
||||
|
||||
#gengrid
|
||||
ctypedef char *(*GengridItemLabelGetFunc) (void *data, Evas_Object *obj, const_char *part)
|
||||
ctypedef Evas_Object *(*GengridItemIconGetFunc) (void *data, Evas_Object *obj, const_char *part)
|
||||
ctypedef Eina_Bool (*GengridItemStateGetFunc) (void *data, Evas_Object *obj, const_char *part)
|
||||
|
@ -23,7 +23,6 @@ cdef extern from "Elementary.h":
|
|||
char *item_style
|
||||
Elm_Gengrid_Item_Class_Func func
|
||||
|
||||
# Generic Grid (api:TODO cb:TODO test:DONE doc:TODO py3:TODO)
|
||||
Evas_Object * elm_gengrid_add(Evas_Object *parent)
|
||||
void elm_gengrid_clear(Evas_Object *obj)
|
||||
void elm_gengrid_multi_select_set(Evas_Object *obj, Eina_Bool multi)
|
||||
|
@ -32,10 +31,11 @@ cdef extern from "Elementary.h":
|
|||
Eina_Bool elm_gengrid_horizontal_get(Evas_Object *obj)
|
||||
void elm_gengrid_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
|
||||
void elm_gengrid_bounce_get(Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
|
||||
Elm_Object_Item * elm_gengrid_item_append(Evas_Object *obj, Elm_Gengrid_Item_Class *itc, void *data, Evas_Smart_Cb func, void *func_data)
|
||||
Elm_Object_Item * elm_gengrid_item_prepend(Evas_Object *obj, Elm_Gengrid_Item_Class *itc, void *data, Evas_Smart_Cb func, void *func_data)
|
||||
Elm_Object_Item * elm_gengrid_item_insert_before(Evas_Object *obj, Elm_Gengrid_Item_Class *itc, void *data, Elm_Object_Item *before, Evas_Smart_Cb func, void *func_data)
|
||||
Elm_Object_Item * elm_gengrid_item_insert_after(Evas_Object *obj, Elm_Gengrid_Item_Class *itc, void *data, Elm_Object_Item *after, Evas_Smart_Cb func, void *func_data)
|
||||
Elm_Object_Item * elm_gengrid_item_append(Evas_Object *obj, Elm_Gengrid_Item_Class *itc, const_void *data, Evas_Smart_Cb func, const_void *func_data)
|
||||
Elm_Object_Item * elm_gengrid_item_prepend(Evas_Object *obj, Elm_Gengrid_Item_Class *itc, const_void *data, Evas_Smart_Cb func, const_void *func_data)
|
||||
Elm_Object_Item * elm_gengrid_item_insert_before(Evas_Object *obj, Elm_Gengrid_Item_Class *itc, const_void *data, Elm_Object_Item *before, Evas_Smart_Cb func, const_void *func_data)
|
||||
Elm_Object_Item * elm_gengrid_item_insert_after(Evas_Object *obj, Elm_Gengrid_Item_Class *itc, const_void *data, Elm_Object_Item *after, Evas_Smart_Cb func, const_void *func_data)
|
||||
Elm_Object_Item * elm_gengrid_item_sorted_insert(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const_void *data, Eina_Compare_Cb comp, Evas_Smart_Cb func, const_void *func_data)
|
||||
Elm_Object_Item * elm_gengrid_selected_item_get(Evas_Object *obj)
|
||||
Eina_List * elm_gengrid_selected_items_get(Evas_Object *obj)
|
||||
Eina_List * elm_gengrid_realized_items_get(Evas_Object *obj)
|
||||
|
|
|
@ -34,7 +34,8 @@ clicking on items to select them and clicking on the grid's viewport and
|
|||
swiping to pan the whole view) or via the keyboard, navigating through
|
||||
item with the arrow keys.
|
||||
|
||||
.. rubric:: Gengrid layouts
|
||||
Gengrid layouts
|
||||
===============
|
||||
|
||||
Gengrid may layout its items in one of two possible layouts:
|
||||
|
||||
|
@ -49,7 +50,8 @@ placed in **rows**, from left to right and, when the space for a row is
|
|||
filled, another one is started below, thus expanding the grid vertically
|
||||
(and making for vertical scrolling).
|
||||
|
||||
.. rubric:: Gengrid items
|
||||
Gengrid items
|
||||
=============
|
||||
|
||||
An item in a gengrid can have 0 or more texts (they can be regular text
|
||||
or textblock Evas objects - that's up to the style to determine), 0 or
|
||||
|
@ -70,7 +72,8 @@ by default - "default", but this can be extended by system or
|
|||
application custom themes/overlays/extensions (see
|
||||
:py:class:`elementary.theme.Theme` for more details).
|
||||
|
||||
.. rubric:: Gengrid item classes
|
||||
Gengrid item classes
|
||||
====================
|
||||
|
||||
In order to have the ability to add and delete items on the fly, gengrid
|
||||
implements a class (callback) system where the application provides a
|
||||
|
@ -119,7 +122,8 @@ following members:
|
|||
to the item (e.g. its data parameter on creation) can be deleted. See
|
||||
#Elm_Gengrid_Item_Del_Cb.
|
||||
|
||||
.. rubric:: Usage hints
|
||||
Usage hints
|
||||
===========
|
||||
|
||||
If the user wants to have multiple items selected at the same time,
|
||||
elm_gengrid_multi_select_set() will permit it. If the gengrid is
|
||||
|
@ -154,7 +158,8 @@ augmentation per application with elm_theme_extension_add(). If you
|
|||
absolutely must have a specific style that overrides any theme the user
|
||||
or system sets up you can use elm_theme_overlay_add() to add such a file.
|
||||
|
||||
.. rubric:: Gengrid smart events
|
||||
Gengrid smart events
|
||||
====================
|
||||
|
||||
Smart events that you can add callbacks for are:
|
||||
|
||||
|
@ -217,7 +222,10 @@ Smart events that you can add callbacks for are:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Items' scroll to types
|
||||
.. _Elm_Genlist_Item_Scrollto_Type:
|
||||
|
||||
Items' scroll to types
|
||||
======================
|
||||
|
||||
.. data:: ELM_GENLIST_ITEM_SCROLLTO_NONE
|
||||
|
||||
|
@ -242,11 +250,9 @@ include "callback_conversions.pxi"
|
|||
include "tooltips.pxi"
|
||||
|
||||
from object cimport Object
|
||||
from object_item cimport ObjectItem, \
|
||||
_object_item_to_python, \
|
||||
elm_object_item_widget_get, \
|
||||
_object_item_from_python, \
|
||||
_object_item_list_to_python
|
||||
from object_item cimport ObjectItem, _object_item_to_python, \
|
||||
elm_object_item_widget_get, _object_item_from_python, \
|
||||
_object_item_list_to_python, elm_object_item_data_get
|
||||
from general cimport strdup
|
||||
from scroller cimport *
|
||||
cimport enums
|
||||
|
@ -258,58 +264,61 @@ ELM_GENLIST_ITEM_SCROLLTO_IN = enums.ELM_GENLIST_ITEM_SCROLLTO_IN
|
|||
ELM_GENLIST_ITEM_SCROLLTO_TOP = enums.ELM_GENLIST_ITEM_SCROLLTO_TOP
|
||||
ELM_GENLIST_ITEM_SCROLLTO_MIDDLE = enums.ELM_GENLIST_ITEM_SCROLLTO_MIDDLE
|
||||
|
||||
cdef _py_elm_gengrid_item_call(func, Evas_Object *obj, const_char *part, data) with gil:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
return func(o, _ctouni(part), data)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return None
|
||||
|
||||
cdef char *_py_elm_gengrid_item_text_get(void *data, Evas_Object *obj, const_char *part) with gil:
|
||||
cdef GengridItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef GengridItemClass itc = params[0]
|
||||
cdef GengridItemClass itc = item.cls
|
||||
|
||||
func = itc._text_get_func
|
||||
if func is None:
|
||||
return NULL
|
||||
|
||||
ret = _py_elm_gengrid_item_call(func, obj, part, params[1])
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
ret = func(o, part, item.item_data)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return NULL
|
||||
|
||||
if isinstance(ret, unicode): ret = PyUnicode_AsUTF8String(ret)
|
||||
return strdup(ret) if ret is not None else NULL
|
||||
|
||||
cdef Evas_Object *_py_elm_gengrid_item_content_get(void *data, Evas_Object *obj, const_char *part) with gil:
|
||||
cdef GengridItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef evasObject icon
|
||||
cdef GengridItemClass itc = params[0]
|
||||
cdef GengridItemClass itc = item.cls
|
||||
|
||||
func = itc._content_get_func
|
||||
if func is None:
|
||||
return NULL
|
||||
|
||||
ret = _py_elm_gengrid_item_call(func, obj, part, params[1])
|
||||
if ret is not None:
|
||||
try:
|
||||
icon = ret
|
||||
return icon.obj
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return NULL
|
||||
else:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
ret = func(o, _ctouni(part), item.item_data)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return NULL
|
||||
|
||||
if ret is None:
|
||||
return NULL
|
||||
|
||||
icon = ret
|
||||
return icon.obj
|
||||
|
||||
cdef Eina_Bool _py_elm_gengrid_item_state_get(void *data, Evas_Object *obj, const_char *part) with gil:
|
||||
cdef GengridItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef GengridItemClass itc = params[0]
|
||||
cdef GengridItemClass itc = item.cls
|
||||
|
||||
func = itc._state_get_func
|
||||
if func is None:
|
||||
return False
|
||||
|
||||
ret = _py_elm_gengrid_item_call(func, obj, part, params[1])
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
ret = func(o, part, item.item_data)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
|
||||
if ret is not None:
|
||||
return bool(ret)
|
||||
else:
|
||||
|
@ -317,36 +326,56 @@ cdef Eina_Bool _py_elm_gengrid_item_state_get(void *data, Evas_Object *obj, cons
|
|||
|
||||
cdef void _py_elm_gengrid_object_item_del(void *data, Evas_Object *obj) with gil:
|
||||
cdef GengridItem item = <object>data
|
||||
cdef object params
|
||||
cdef GengridItemClass itc
|
||||
cdef GengridItemClass itc = item.cls
|
||||
|
||||
if item is None:
|
||||
return
|
||||
|
||||
params = item.params
|
||||
itc = params[0]
|
||||
|
||||
func = itc._del_func
|
||||
if func is not None:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
func(o, params[1])
|
||||
except Exception as e:
|
||||
func(o, item.item_data)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
item._unset_obj()
|
||||
Py_DECREF(item)
|
||||
|
||||
cdef void _py_elm_gengrid_item_func(void *data, Evas_Object *obj, void *event_info) with gil:
|
||||
cdef GengridItem item = <object>data
|
||||
cdef object func = item.params[2]
|
||||
|
||||
if func is not None:
|
||||
if item.cb_func is not None:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
func(item, o, item.params[1])
|
||||
except Exception as e:
|
||||
item.cb_func(item, o, item.func_data)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
cdef int _gengrid_compare_cb(const_void *data1, const_void *data2) with gil:
|
||||
cdef:
|
||||
Elm_Object_Item *citem1 = <Elm_Object_Item *>data1
|
||||
Elm_Object_Item *citem2 = <Elm_Object_Item *>data2
|
||||
GengridItem item1 = <GengridItem>elm_object_item_data_get(citem1)
|
||||
GengridItem item2 = <GengridItem>elm_object_item_data_get(citem2)
|
||||
object func
|
||||
|
||||
if item1.comparison_func is not None:
|
||||
func = item1.comparison_func
|
||||
elif item2.comparison_func is not None:
|
||||
func = item2.comparison_func
|
||||
else:
|
||||
return 0
|
||||
|
||||
ret = func(item1, item2)
|
||||
if ret is not None:
|
||||
try:
|
||||
return ret
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
else:
|
||||
return 0
|
||||
|
||||
cdef class GengridItemClass:
|
||||
"""
|
||||
|
||||
|
@ -521,14 +550,13 @@ cdef class GengridItemClass:
|
|||
"""
|
||||
return False
|
||||
|
||||
|
||||
cdef class GengridItem(ObjectItem):
|
||||
|
||||
"""
|
||||
"""An item for the :py:class:`Gengrid` widget."""
|
||||
|
||||
An item for the :py:class:`Gengrid` widget.
|
||||
|
||||
"""
|
||||
cdef:
|
||||
object item_data, func_data, compare_func
|
||||
GengridItemClass cls
|
||||
|
||||
cdef int _set_obj(self, Elm_Object_Item *item) except 0:
|
||||
assert self.item == NULL, "Object must be clean"
|
||||
|
@ -540,31 +568,182 @@ cdef class GengridItem(ObjectItem):
|
|||
assert self.item != NULL, "Object must wrap something"
|
||||
self.item = NULL
|
||||
|
||||
def __init__(self, GengridItemClass item_class not None, item_data = None, \
|
||||
func = None, func_data = None):
|
||||
"""
|
||||
|
||||
:param item_class: a valid instance that defines the
|
||||
behavior of this item. See :py:class:`GengridItemClass`.
|
||||
:param item_data: some data that defines the model of this
|
||||
item. This value will be given to methods of
|
||||
``item_class`` such as
|
||||
:py:func:`GengridItemClass.text_get()`. It will also be
|
||||
provided to ``func`` as its last parameter.
|
||||
:param func: if not None, this must be a callable to be
|
||||
called back when the item is selected. The function
|
||||
signature is::
|
||||
|
||||
func(item, obj, item_data)
|
||||
|
||||
Where ``item`` is the handle, ``obj`` is the Evas object
|
||||
that represents this item, and ``item_data`` is the
|
||||
value given as parameter to this function.
|
||||
|
||||
"""
|
||||
if func is not None:
|
||||
if not callable(func):
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
self.cls = item_class
|
||||
self.cb_func = func
|
||||
self.item_data = item_data
|
||||
self.func_data = func_data
|
||||
|
||||
def append_to(self, Gengrid gengrid not None):
|
||||
"""item_append(Gengrid gengrid) -> GengridItem
|
||||
|
||||
Append a new item (add as last item) to this gengrid.
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _py_elm_gengrid_item_func
|
||||
|
||||
item = elm_gengrid_item_append(gengrid.obj, &self.cls.obj, <void*>self,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def prepend_to(self, Gengrid gengrid not None):
|
||||
"""item_prepend(Gengrid gengrid) -> GengridItem
|
||||
|
||||
Prepend a new item (add as first item) to this gengrid.
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _py_elm_gengrid_item_func
|
||||
|
||||
item = elm_gengrid_item_prepend(gengrid.obj, &self.cls.obj, <void*>self,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def insert_before(self, GengridItem before not None):
|
||||
"""insert_before(GengridItem before not None) -> GengridItem
|
||||
|
||||
Insert a new item before another item in this gengrid.
|
||||
|
||||
:param before: a reference item to use, the new item
|
||||
will be inserted before it.
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
cdef Gengrid gengrid = before.widget
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _py_elm_gengrid_item_func
|
||||
|
||||
item = elm_gengrid_item_insert_before(gengrid.obj, &self.cls.obj,
|
||||
<void*>self, before.item, cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def insert_after(self, GengridItem after not None):
|
||||
"""insert_after(GengridItem after not None) -> GengridItem
|
||||
|
||||
Insert a new item after another item in this gengrid.
|
||||
|
||||
:param after: a reference item to use, the new item
|
||||
will be inserted after it.
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
cdef Gengrid gengrid = after.widget
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _py_elm_gengrid_item_func
|
||||
|
||||
item = elm_gengrid_item_insert_after(gengrid.obj, &self.cls.obj,
|
||||
<void*>self, after.item, cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def sorted_insert(self, Gengrid gengrid not None, compare_func not None):
|
||||
"""insert_after(GengridItem after not None) -> GengridItem
|
||||
|
||||
Insert a new item after another item in this gengrid.
|
||||
|
||||
:param after: a reference item to use, the new item
|
||||
will be inserted after it.
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
self.compare_func = compare_func
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _py_elm_gengrid_item_func
|
||||
|
||||
item = elm_gengrid_item_sorted_insert(gengrid.obj, &self.cls.obj,
|
||||
<void*>self, _gengrid_compare_cb, cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return "%s(item_class=%s, func=%s, item_data=%s)" % \
|
||||
(self.__class__.__name__,
|
||||
self.params[0].__class__.__name__,
|
||||
self.params[2],
|
||||
self.params[1])
|
||||
(type(self).__name__,
|
||||
type(self.cls).__name__,
|
||||
self.cb_func,
|
||||
self.item_data)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
"item_class=%s, func=%s, item_data=%r)") % \
|
||||
(self.__class__.__name__,
|
||||
(type(self).__name__,
|
||||
<unsigned long><void*>self,
|
||||
PY_REFCOUNT(self),
|
||||
<unsigned long>self.item,
|
||||
self.params[0].__class__.__name__,
|
||||
self.params[2],
|
||||
self.params[1])
|
||||
type(self.cls).__name__,
|
||||
self.cb_func,
|
||||
self.item_data)
|
||||
|
||||
property data:
|
||||
"""User data for the item."""
|
||||
def __get__(self):
|
||||
return self.params[1]
|
||||
return self.item_data
|
||||
|
||||
def data_get(self):
|
||||
return self.params[1]
|
||||
return self.item_data
|
||||
|
||||
property next:
|
||||
"""This returns the item placed after the item, on the container
|
||||
|
@ -830,11 +1009,7 @@ cdef class GengridItem(ObjectItem):
|
|||
|
||||
cdef class Gengrid(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_gengrid_add(parent.obj))
|
||||
|
@ -940,30 +1115,8 @@ cdef class Gengrid(Object):
|
|||
that represents this item, and ``item_data`` is the
|
||||
value given as parameter to this function.
|
||||
"""
|
||||
cdef GengridItem ret = GengridItem()
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_gengrid_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_gengrid_item_append( self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
cb,
|
||||
<void*>ret)
|
||||
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
return GengridItem(item_class, item_data, func, item_data)\
|
||||
.append_to(self)
|
||||
|
||||
def item_prepend(self, GengridItemClass item_class not None,
|
||||
item_data, func=None):
|
||||
|
@ -988,29 +1141,8 @@ cdef class Gengrid(Object):
|
|||
that represents this item, and ``item_data`` is the
|
||||
value given as parameter to this function.
|
||||
"""
|
||||
cdef GengridItem ret = GengridItem()
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_gengrid_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_gengrid_item_prepend(self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
cb,
|
||||
<void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
return GengridItem(item_class, item_data, func, item_data)\
|
||||
.prepend_to(self)
|
||||
|
||||
def item_insert_before(self, GengridItemClass item_class not None,
|
||||
item_data, GengridItem before_item=None,
|
||||
|
@ -1038,32 +1170,8 @@ cdef class Gengrid(Object):
|
|||
that represents this item, and ``item_data`` is the
|
||||
value given as parameter to this function.
|
||||
"""
|
||||
cdef GengridItem ret = GengridItem()
|
||||
cdef Elm_Object_Item *item, *before
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
before = _object_item_from_python(before_item)
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_gengrid_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
(item_class, item_data, func)
|
||||
item = elm_gengrid_item_insert_before( self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
before,
|
||||
cb,
|
||||
<void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
return GengridItem(item_class, item_data, func, item_data)\
|
||||
.insert_before(before_item)
|
||||
|
||||
def item_insert_after(self, GengridItemClass item_class not None,
|
||||
item_data, GengridItem after_item=None,
|
||||
|
@ -1091,32 +1199,8 @@ cdef class Gengrid(Object):
|
|||
that represents this item, and ``item_data`` is the
|
||||
value given as parameter to this function.
|
||||
"""
|
||||
cdef GengridItem ret = GengridItem()
|
||||
cdef Elm_Object_Item *item, *after
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
after = _object_item_from_python(after_item)
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_gengrid_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_gengrid_item_insert_after( self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
after,
|
||||
cb,
|
||||
<void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
return GengridItem(item_class, item_data, func, item_data)\
|
||||
.insert_before(after_item)
|
||||
|
||||
# XXX TODO elm_gengrid_item_sorted_insert()
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ Widget description
|
|||
|
||||
.. image:: /images/gesturelayer-preview.png
|
||||
|
||||
|
||||
Use the GestureLayer to detect gestures. The advantage is that you don't
|
||||
have to implement gesture detection, just set callbacks for gesture states.
|
||||
|
||||
|
@ -91,7 +90,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Gesture_State:
|
||||
|
||||
.. rubric:: Gesture states
|
||||
Gesture states
|
||||
==============
|
||||
|
||||
.. data:: ELM_GESTURE_STATE_UNDEFINED
|
||||
|
||||
|
@ -116,7 +116,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Gesture_Type:
|
||||
|
||||
.. rubric:: Gesture types
|
||||
Gesture types
|
||||
=============
|
||||
|
||||
.. data:: ELM_GESTURE_N_TAPS
|
||||
|
||||
|
@ -549,9 +550,9 @@ cdef class GestureLayer(Object):
|
|||
EVAS_EVENT_FLAG_ON_HOLD from this callback.
|
||||
|
||||
:param idx: The gesture you would like to track its state.
|
||||
:type idx: :ref:`Gesture type <Elm_Gesture_Type>`
|
||||
:type idx: :ref:`Elm_Gesture_Type`
|
||||
:param cb_type: what event this callback tracks: START, MOVE, END, ABORT.
|
||||
:type cb_type: :ref:`Gesture state <Elm_Gesture_State>`
|
||||
:type cb_type: :ref:`Elm_Gesture_State`
|
||||
:param callback: Callback function.
|
||||
:type callback: function
|
||||
|
||||
|
|
|
@ -85,6 +85,11 @@ deleted, and vice-versa.
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. _Elm_Hover_Axis:
|
||||
|
||||
Hover axis
|
||||
==========
|
||||
|
||||
.. data:: ELM_HOVER_AXIS_NONE
|
||||
|
||||
No preferred orientation
|
||||
|
@ -171,13 +176,6 @@ cdef class Hover(LayoutClass):
|
|||
Best is defined here as the location at which there is the most
|
||||
available space.
|
||||
|
||||
``pref_axis`` may be one of
|
||||
|
||||
- ``ELM_HOVER_AXIS_NONE`` -- no preferred orientation
|
||||
- ``ELM_HOVER_AXIS_HORIZONTAL`` -- horizontal
|
||||
- ``ELM_HOVER_AXIS_VERTICAL`` -- vertical
|
||||
- ``ELM_HOVER_AXIS_BOTH`` -- both
|
||||
|
||||
If ELM_HOVER_AXIS_HORIZONTAL is chosen the returned position will
|
||||
necessarily be along the horizontal axis("left" or "right"). If
|
||||
ELM_HOVER_AXIS_VERTICAL is chosen the returned position will
|
||||
|
@ -189,7 +187,7 @@ cdef class Hover(LayoutClass):
|
|||
|
||||
:param pref_axis: The preferred orientation axis for the hover
|
||||
object to use
|
||||
:type pref_axis: Elm_Hover_Axis
|
||||
:type pref_axis: :ref:`Elm_Hover_Axis`
|
||||
|
||||
:return: The edje location to place content into the hover or *None*,
|
||||
on errors.
|
||||
|
|
|
@ -55,7 +55,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Icon_Type:
|
||||
|
||||
.. rubric:: Icon types
|
||||
Icon types
|
||||
==========
|
||||
|
||||
.. data:: ELM_ICON_NONE
|
||||
|
||||
|
@ -92,10 +93,6 @@ cdef class HoverselItem(ObjectItem):
|
|||
cdef:
|
||||
object label, icon_file, icon_group
|
||||
Elm_Icon_Type icon_type
|
||||
Evas_Smart_Cb cb
|
||||
|
||||
def __cinit__(self):
|
||||
self.cb = NULL
|
||||
|
||||
def __init__(self, label = None, icon_file = None,
|
||||
icon_type = ELM_ICON_NONE, callback = None, *args, **kargs):
|
||||
|
@ -108,7 +105,7 @@ cdef class HoverselItem(ObjectItem):
|
|||
standard icon name (None if not desired)
|
||||
:type icon_file: string
|
||||
:param icon_type: The icon type if relevant
|
||||
:type icon_type: :ref:`Icon type <Elm_Icon_Type>`
|
||||
:type icon_type: :ref:`Elm_Icon_Type`
|
||||
:param callback: Convenience function to call when this item is
|
||||
selected
|
||||
:type callback: function
|
||||
|
@ -123,9 +120,10 @@ cdef class HoverselItem(ObjectItem):
|
|||
if callback:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
self.cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
self.cb_func = callback
|
||||
self.args = args
|
||||
self.kwargs = kargs
|
||||
|
||||
def add_to(self, Hoversel hoversel):
|
||||
"""add_to(Hoversel hoversel)
|
||||
|
@ -142,12 +140,15 @@ cdef class HoverselItem(ObjectItem):
|
|||
:rtype: Elm_Object_Item
|
||||
|
||||
"""
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_hoversel_item_add( hoversel.obj,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
<const_char *>self.icon_file if self.icon_file is not None else NULL,
|
||||
self.icon_type,
|
||||
self.cb,
|
||||
<void*>self)
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
|
@ -161,7 +162,7 @@ cdef class HoverselItem(ObjectItem):
|
|||
The icon can be loaded from the standard set, from an image file, or
|
||||
from an edje file.
|
||||
|
||||
:type: tuple(string file, string group, Elm_Icon_Type type)
|
||||
:type: (string file, string group, :ref:`Elm_Icon_Type` type)
|
||||
|
||||
"""
|
||||
def __set__(self, value):
|
||||
|
@ -198,11 +199,7 @@ cdef class HoverselItem(ObjectItem):
|
|||
|
||||
cdef class Hoversel(Button):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_hoversel_add(parent.obj))
|
||||
|
|
|
@ -101,7 +101,10 @@ This widget emits the following signals, besides the ones sent from
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Icon lookup modes
|
||||
.. _Elm_Icon_Lookup_Order:
|
||||
|
||||
Icon lookup modes
|
||||
=================
|
||||
|
||||
.. data:: ELM_ICON_LOOKUP_FDO_THEME
|
||||
|
||||
|
@ -120,7 +123,10 @@ Enumerations
|
|||
theme
|
||||
|
||||
|
||||
.. rubric:: Icon type
|
||||
.. _Elm_Icon_Type:
|
||||
|
||||
Icon type
|
||||
=========
|
||||
|
||||
.. data:: ELM_ICON_NONE
|
||||
|
||||
|
@ -151,11 +157,7 @@ ELM_ICON_STANDARD = enums.ELM_ICON_STANDARD
|
|||
|
||||
cdef class Icon(Image):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_icon_add(parent.obj))
|
||||
|
@ -227,7 +229,7 @@ cdef class Icon(Image):
|
|||
property order_lookup:
|
||||
"""The icon lookup order used by :py:attr:`standard`.
|
||||
|
||||
:type: Elm_Icon_Lookup_Order
|
||||
:type: :ref:`Elm_Icon_Lookup_Order`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -107,11 +107,7 @@ ELM_IMAGE_FLIP_TRANSVERSE = enums.ELM_IMAGE_FLIP_TRANSVERSE
|
|||
|
||||
cdef class Image(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_image_add(parent.obj))
|
||||
|
|
|
@ -56,6 +56,7 @@ This widget emits the following signals, besides the ones sent from
|
|||
level to the second level
|
||||
- ``"level,down"`` - when the user moves a finger from the second
|
||||
level to the first level
|
||||
- ``"language,changed"`` - the program's language changed
|
||||
|
||||
The ``"delay,changed"`` event is so that it'll wait a small time
|
||||
before actually reporting those events and, moreover, just the
|
||||
|
@ -68,56 +69,231 @@ include "widget_header.pxi"
|
|||
include "callback_conversions.pxi"
|
||||
|
||||
from layout_class cimport LayoutClass
|
||||
from object_item cimport _object_item_callback, _object_item_to_python, \
|
||||
elm_object_item_data_get
|
||||
|
||||
from object_item cimport _object_item_callback, _object_item_to_python
|
||||
import traceback
|
||||
|
||||
cdef enum Elm_Index_Item_Insert_Kind:
|
||||
ELM_INDEX_ITEM_INSERT_APPEND
|
||||
ELM_INDEX_ITEM_INSERT_PREPEND
|
||||
ELM_INDEX_ITEM_INSERT_BEFORE
|
||||
ELM_INDEX_ITEM_INSERT_AFTER
|
||||
ELM_INDEX_ITEM_INSERT_SORTED
|
||||
|
||||
cdef int _index_compare_func(const_void *data1, const_void *data2) with gil:
|
||||
"""Comparison by IndexItem objects"""
|
||||
cdef:
|
||||
Elm_Object_Item *citem1 = <Elm_Object_Item *>data1
|
||||
Elm_Object_Item *citem2 = <Elm_Object_Item *>data2
|
||||
IndexItem item1 = <IndexItem>elm_object_item_data_get(citem1)
|
||||
IndexItem item2 = <IndexItem>elm_object_item_data_get(citem2)
|
||||
object func
|
||||
|
||||
if item1.compare_func is not None:
|
||||
func = item1.compare_func
|
||||
elif item2.compare_func is not None:
|
||||
func = item2.compare_func
|
||||
else:
|
||||
return 0
|
||||
|
||||
ret = func(item1, item2)
|
||||
if ret is not None:
|
||||
try:
|
||||
return ret
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
else:
|
||||
return 0
|
||||
|
||||
cdef int _index_data_compare_func(const_void *data1, const_void *data2) with gil:
|
||||
"""Comparison by IndexItem data"""
|
||||
cdef:
|
||||
IndexItem item1 = <object>data1
|
||||
IndexItem item2 = <object>data2
|
||||
object func
|
||||
|
||||
if item1.data_compare_func is not None:
|
||||
func = item1.data_compare_func
|
||||
elif item2.data_compare_func is not None:
|
||||
func = item2.data_compare_func
|
||||
else:
|
||||
return 0
|
||||
|
||||
ret = func(item1.data, item2.data)
|
||||
if ret is not None:
|
||||
try:
|
||||
return ret
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
else:
|
||||
return 0
|
||||
|
||||
cdef class IndexItem(ObjectItem):
|
||||
def __init__(self, kind, evasObject index, letter, IndexItem before_after = None,
|
||||
callback = None, *args, **kargs):
|
||||
# TODO: Fix this horrible API
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
"""
|
||||
|
||||
An item on an :py:class:`Index` widget.
|
||||
|
||||
Despite the most common usage of the ``letter`` argument is for
|
||||
single char strings, one could use arbitrary strings as index
|
||||
entries.
|
||||
|
||||
``item`` will be the item returned back on ``"changed"``,
|
||||
``"delay,changed"`` and ``"selected"`` smart events.
|
||||
|
||||
:param letter: Letter under which the item should be indexed
|
||||
:type letter: string
|
||||
:param callback: The function to call when the item is selected.
|
||||
:type callback: function
|
||||
|
||||
"""
|
||||
cdef:
|
||||
bytes letter
|
||||
object compare_func, data_compare_func
|
||||
|
||||
def __init__(self, letter, callback = None, *args, **kwargs):
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
|
||||
if isinstance(letter, unicode): letter = PyUnicode_AsUTF8String(letter)
|
||||
self.letter = letter
|
||||
|
||||
if kind == ELM_INDEX_ITEM_INSERT_APPEND:
|
||||
item = elm_index_item_append(index.obj,
|
||||
<const_char *>letter if letter is not None else NULL,
|
||||
cb, <void*>self)
|
||||
elif kind == ELM_INDEX_ITEM_INSERT_PREPEND:
|
||||
item = elm_index_item_prepend(index.obj,
|
||||
<const_char *>letter if letter is not None else NULL,
|
||||
cb, <void*>self)
|
||||
#elif kind == ELM_INDEX_ITEM_INSERT_SORTED:
|
||||
# TODO: remove _cfruni when implementing this
|
||||
#item = elm_index_item_sorted_insert(index.obj, _cfruni(letter), cb, <void*>self, cmp_f, cmp_data_f)
|
||||
else:
|
||||
if before_after == None:
|
||||
raise ValueError("need a valid after object to add an item before/after another item")
|
||||
if kind == ELM_INDEX_ITEM_INSERT_BEFORE:
|
||||
item = elm_index_item_insert_before(index.obj, before_after.item,
|
||||
<const_char *>letter if letter is not None else NULL,
|
||||
cb, <void*>self)
|
||||
else:
|
||||
item = elm_index_item_insert_after(index.obj, before_after.item,
|
||||
<const_char *>letter if letter is not None else NULL,
|
||||
cb, <void*>self)
|
||||
self.cb_func = callback
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def append_to(self, Index index not None):
|
||||
"""
|
||||
|
||||
Append this item to the ``index``.
|
||||
|
||||
:param index: The index object to append to.
|
||||
:type index: :py:class:`Index`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_index_item_append(index.obj,
|
||||
<const_char *>self.letter if self.letter is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def prepend_to(self, Index index not None):
|
||||
"""
|
||||
|
||||
Prepend this item to the ``index``.
|
||||
|
||||
:param index: The index object to prepend to.
|
||||
:type index: :py:class:`Index`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_index_item_prepend(index.obj,
|
||||
<const_char *>self.letter if self.letter is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def insert_after(self, IndexItem after not None):
|
||||
"""
|
||||
|
||||
Insert this item after the item ``after``.
|
||||
|
||||
:param after: The index item to insert after.
|
||||
:type after: :py:class:`IndexItem`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Index index = after.widget
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_index_item_insert_after(index.obj, after.item,
|
||||
<const_char *>self.letter if self.letter is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def insert_before(self, IndexItem before not None):
|
||||
"""
|
||||
|
||||
Insert this item before the item ``before``.
|
||||
|
||||
:param before: The index item to insert before.
|
||||
:type before: :py:class:`IndexItem`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Index index = before.widget
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_index_item_insert_before(index.obj, before.item,
|
||||
<const_char *>self.letter if self.letter is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def insert_sorted(self, Index index not None, compare_func, data_compare_func = None):
|
||||
"""
|
||||
|
||||
:param cmp_func: The comparing function to be used to sort index
|
||||
items **by index item handles**
|
||||
:type cmp_func: function
|
||||
:param cmp_data_func: A **fallback** function to be called for the
|
||||
sorting of index items **by item data**). It will be used
|
||||
when ``cmp_func`` returns ``0`` (equality), which means an index
|
||||
item with provided item data already exists. To decide which
|
||||
data item should be pointed to by the index item in question,
|
||||
``cmp_data_func`` will be used. If ``cmp_data_func`` returns a
|
||||
non-negative value, the previous index item data will be
|
||||
replaced by the given ``item`` pointer. If the previous data need
|
||||
to be freed, it should be done by the ``cmp_data_func``
|
||||
function, because all references to it will be lost. If this
|
||||
function is not provided (``None`` is given), index items will
|
||||
be **duplicated**, if ``cmp_func`` returns ``0``.
|
||||
:type cmp_data_func: function
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
self.compare_func = compare_func
|
||||
self.data_compare_func = data_compare_func
|
||||
item = elm_index_item_sorted_insert(index.obj,
|
||||
<const_char *>self.letter if self.letter is not None else NULL,
|
||||
cb, <void*>self,
|
||||
_index_compare_func, _index_data_compare_func)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
|
@ -164,11 +340,7 @@ cdef Elm_Object_Item *_elm_index_item_from_python(IndexItem item):
|
|||
|
||||
cdef class Index(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_index_add(parent.obj))
|
||||
|
@ -225,140 +397,50 @@ cdef class Index(LayoutClass):
|
|||
def item_append(self, letter, callback = None, *args, **kargs):
|
||||
"""item_append(unicode letter, callback = None, *args, **kargs) -> IndexItem
|
||||
|
||||
Append a new item on a given index widget.
|
||||
A constructor for :py:class:`IndexItem`
|
||||
|
||||
Despite the most common usage of the ``letter`` argument is for
|
||||
single char strings, one could use arbitrary strings as index
|
||||
entries.
|
||||
|
||||
``item`` will be the item returned back on ``"changed"``,
|
||||
``"delay,changed"`` and ``"selected"`` smart events.
|
||||
|
||||
:param letter: Letter under which the item should be indexed
|
||||
:type letter: string
|
||||
:param callback: The function to call when the item is selected.
|
||||
:type callback: function
|
||||
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`IndexItem`
|
||||
:see: :py:func:`IndexItem.append_to`
|
||||
|
||||
"""
|
||||
return IndexItem(ELM_INDEX_ITEM_INSERT_APPEND, self, letter,
|
||||
None, callback, *args, **kargs)
|
||||
return IndexItem(letter, callback, *args, **kargs).append_to(self)
|
||||
|
||||
def item_prepend(self, letter, callback = None, *args, **kargs):
|
||||
"""item_prepend(unicode letter, callback = None, *args, **kargs) -> IndexItem
|
||||
|
||||
Prepend a new item on a given index widget.
|
||||
A constructor for :py:class:`IndexItem`
|
||||
|
||||
Despite the most common usage of the ``letter`` argument is for
|
||||
single char strings, one could use arbitrary strings as index
|
||||
entries.
|
||||
|
||||
``item`` will be the item returned back on ``"changed"``,
|
||||
``"delay,changed"`` and ``"selected"`` smart events.
|
||||
|
||||
:param letter: Letter under which the item should be indexed
|
||||
:type letter: string
|
||||
:param callback: The function to call when the item is selected.
|
||||
:type callback: function
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`IndexItem`
|
||||
:see: :py:func:`IndexItem.prepend_to`
|
||||
|
||||
"""
|
||||
return IndexItem(ELM_INDEX_ITEM_INSERT_PREPEND, self, letter,
|
||||
None, callback, *args, **kargs)
|
||||
return IndexItem(letter, callback, *args, **kargs).prepend_to(self)
|
||||
|
||||
def item_insert_after(self, IndexItem after, letter, callback = None, *args, **kargs):
|
||||
"""item_insert_after(IndexItem after, unicode letter, callback = None, *args, **kargs) -> IndexItem
|
||||
|
||||
Insert a new item into the index object after item ``after``.
|
||||
A constructor for :py:class:`IndexItem`
|
||||
|
||||
Despite the most common usage of the ``letter`` argument is for
|
||||
single char strings, one could use arbitrary strings as index
|
||||
entries.
|
||||
|
||||
``item`` will be the pointer returned back on ``"changed"``,
|
||||
``"delay,changed"`` and ``"selected"`` smart events.
|
||||
|
||||
.. note:: If ``relative`` is ``None`` this function will behave
|
||||
as :py:func:`item_append()`.
|
||||
|
||||
:param after: The index item to insert after.
|
||||
:type after: :py:class:`IndexItem`
|
||||
:param letter: Letter under which the item should be indexed
|
||||
:type letter: string
|
||||
:param callback: The function to call when the item is clicked.
|
||||
:type callback: function
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`IndexItem`
|
||||
:see: :py:func:`IndexItem.insert_after`
|
||||
|
||||
"""
|
||||
return IndexItem(ELM_INDEX_ITEM_INSERT_AFTER, self, letter,
|
||||
after, callback, *args, **kargs)
|
||||
return IndexItem(letter, callback, *args, **kargs).insert_after(after)
|
||||
|
||||
def item_insert_before(self, IndexItem before, letter, callback = None, *args, **kargs):
|
||||
"""item_insert_before(IndexItem before, unicode letter, callback = None, *args, **kargs) -> IndexItem
|
||||
|
||||
Insert a new item into the index object before item ``before``.
|
||||
A constructor for :py:class:`IndexItem`
|
||||
|
||||
Despite the most common usage of the ``letter`` argument is for
|
||||
single char strings, one could use arbitrary strings as index
|
||||
entries.
|
||||
|
||||
``item`` will be the pointer returned back on ``"changed"``,
|
||||
``"delay,changed"`` and ``"selected"`` smart events.
|
||||
|
||||
.. note:: If ``relative`` is ``None`` this function will behave
|
||||
as :py:func:`item_prepend()`.
|
||||
|
||||
:param before: The index item to insert before.
|
||||
:type before: :py:class:`IndexItem`
|
||||
:param letter: Letter under which the item should be indexed
|
||||
:type letter: string
|
||||
:param callback: The function to call when the item is clicked.
|
||||
:type callback: function
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`IndexItem`
|
||||
:see: :py:func:`IndexItem.insert_before`
|
||||
|
||||
"""
|
||||
return IndexItem(ELM_INDEX_ITEM_INSERT_BEFORE, self, letter,
|
||||
before, callback, *args, **kargs)
|
||||
return IndexItem(letter, callback, *args, **kargs).insert_before(before)
|
||||
|
||||
#def item_sorted_insert(self, letter, callback = None, *args, **kargs):
|
||||
"""Insert a new item into the given index widget, using ``cmp_func``
|
||||
function to sort items (by item handles).
|
||||
|
||||
Despite the most common usage of the ``letter`` argument is for
|
||||
single char strings, one could use arbitrary strings as index
|
||||
entries.
|
||||
A constructor for :py:class:`IndexItem`
|
||||
|
||||
``item`` will be the pointer returned back on ``"changed"``,
|
||||
``"delay,changed"`` and ``"selected"`` smart events.
|
||||
|
||||
:param letter: Letter under which the item should be indexed
|
||||
:type letter: string
|
||||
:param func: The function to call when the item is clicked.
|
||||
:type func: function
|
||||
:param cmp_func: The comparing function to be used to sort index
|
||||
items **by index item handles**
|
||||
:type cmp_func: function
|
||||
:param cmp_data_func: A **fallback** function to be called for the
|
||||
sorting of index items **by item data**). It will be used
|
||||
when ``cmp_func`` returns ``0`` (equality), which means an index
|
||||
item with provided item data already exists. To decide which
|
||||
data item should be pointed to by the index item in question,
|
||||
``cmp_data_func`` will be used. If ``cmp_data_func`` returns a
|
||||
non-negative value, the previous index item data will be
|
||||
replaced by the given ``item`` pointer. If the previous data need
|
||||
to be freed, it should be done by the ``cmp_data_func``
|
||||
function, because all references to it will be lost. If this
|
||||
function is not provided (``None`` is given), index items will
|
||||
be **duplicated**, if ``cmp_func`` returns ``0``.
|
||||
:type cmp_data_func: function
|
||||
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`IndexItem`
|
||||
:see: :py:func:`IndexItem.insert_sorted`
|
||||
|
||||
"""
|
||||
#return IndexItem(ELM_INDEX_ITEM_INSERT_SORTED, self, letter,
|
||||
|
@ -520,5 +602,12 @@ cdef class Index(LayoutClass):
|
|||
def callback_level_down_del(self, func):
|
||||
self._callback_del("level,down", func)
|
||||
|
||||
def callback_language_changed_add(self, func, *args, **kwargs):
|
||||
"""the program's language changed"""
|
||||
self._callback_add("language,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_language_changed_del(self, func):
|
||||
self._callback_del("language,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_index", Index)
|
||||
|
|
|
@ -50,11 +50,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class InnerWindow(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_win_inwin_add(parent.obj))
|
||||
|
@ -76,12 +72,8 @@ cdef class InnerWindow(LayoutClass):
|
|||
elm_win_inwin_activate(self.obj)
|
||||
|
||||
def content_set(self, evasObject content):
|
||||
cdef Evas_Object *o
|
||||
if content is not None:
|
||||
o = content.obj
|
||||
else:
|
||||
o = NULL
|
||||
elm_win_inwin_content_set(self.obj, o)
|
||||
elm_win_inwin_content_set(self.obj,
|
||||
content.obj if content is not None else NULL)
|
||||
|
||||
def content_get(self):
|
||||
return object_from_instance(elm_win_inwin_content_get(self.obj))
|
||||
|
@ -101,12 +93,8 @@ cdef class InnerWindow(LayoutClass):
|
|||
return object_from_instance(elm_win_inwin_content_get(self.obj))
|
||||
|
||||
def __set__(self, evasObject content):
|
||||
cdef Evas_Object *o
|
||||
if content is not None:
|
||||
o = content.obj
|
||||
else:
|
||||
o = NULL
|
||||
elm_win_inwin_content_set(self.obj, o)
|
||||
elm_win_inwin_content_set(self.obj,
|
||||
content.obj if content is not None else NULL)
|
||||
|
||||
def __del__(self):
|
||||
elm_win_inwin_content_unset(self.obj)
|
||||
|
|
|
@ -56,7 +56,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Wrap_Type:
|
||||
|
||||
.. rubric:: Wrap modes
|
||||
Wrap modes
|
||||
==========
|
||||
|
||||
.. data:: ELM_WRAP_NONE
|
||||
|
||||
|
@ -77,7 +78,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Label_Slide_Mode:
|
||||
|
||||
.. rubric:: Slide modes
|
||||
Slide modes
|
||||
===========
|
||||
|
||||
.. data:: ELM_LABEL_SLIDE_MODE_NONE
|
||||
|
||||
|
@ -112,11 +114,7 @@ ELM_LABEL_SLIDE_MODE_ALWAYS = enums.ELM_LABEL_SLIDE_MODE_ALWAYS
|
|||
|
||||
cdef class Label(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_label_add(parent.obj))
|
||||
|
@ -124,14 +122,9 @@ cdef class Label(LayoutClass):
|
|||
property line_wrap:
|
||||
"""The wrapping behavior of the label
|
||||
|
||||
By default no wrapping is done. Possible values for ``wrap`` are:
|
||||
By default no wrapping is done.
|
||||
|
||||
- ELM_WRAP_NONE - No wrapping
|
||||
- ELM_WRAP_CHAR - wrap between characters
|
||||
- ELM_WRAP_WORD - wrap between words
|
||||
- ELM_WRAP_MIXED - Word wrap, and if that fails, char wrap
|
||||
|
||||
:type: :ref:`Line wrapping mode <Elm_Wrap_Type>`
|
||||
:type: :ref:`Elm_Wrap_Type`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -255,14 +248,9 @@ cdef class Label(LayoutClass):
|
|||
property slide_mode:
|
||||
"""Change the slide mode of the label widget.
|
||||
|
||||
By default, slide mode is none. Possible values for ``mode`` are:
|
||||
By default, slide mode is none.
|
||||
|
||||
- ELM_LABEL_SLIDE_MODE_NONE - no slide effect
|
||||
- ELM_LABEL_SLIDE_MODE_AUTO - slide only if the label area is bigger than
|
||||
the text width length
|
||||
- ELM_LABEL_SLIDE_MODE_ALWAYS - slide always
|
||||
|
||||
:type: :ref:`Label slide mode <Elm_Label_Slide_Mode>`
|
||||
:type: :ref:`Elm_Label_Slide_Mode`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -142,11 +142,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Layout(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_layout_add(parent.obj))
|
||||
|
|
|
@ -67,7 +67,8 @@ Enumerations
|
|||
|
||||
.. _Elm_List_Mode:
|
||||
|
||||
.. rubric:: List sizing modes
|
||||
List sizing modes
|
||||
=================
|
||||
|
||||
.. data:: ELM_LIST_COMPRESS
|
||||
|
||||
|
@ -108,7 +109,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Object_Select_Mode:
|
||||
|
||||
.. rubric:: Selection modes
|
||||
Selection modes
|
||||
===============
|
||||
|
||||
.. data:: ELM_OBJECT_SELECT_MODE_DEFAULT
|
||||
|
||||
|
@ -134,7 +136,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Scroller_Policy:
|
||||
|
||||
.. rubric:: Scrollbar visibility
|
||||
Scrollbar visibility
|
||||
====================
|
||||
|
||||
.. data:: ELM_SCROLLER_POLICY_AUTO
|
||||
|
||||
|
@ -179,20 +182,10 @@ ELM_SCROLLER_POLICY_OFF = enums.ELM_SCROLLER_POLICY_OFF
|
|||
|
||||
cdef class ListItem(ObjectItem):
|
||||
|
||||
"""
|
||||
|
||||
An item for the list widget.
|
||||
|
||||
"""
|
||||
"""An item for the list widget."""
|
||||
cdef:
|
||||
object label
|
||||
Evas_Object *icon_obj, *end_obj
|
||||
Evas_Smart_Cb cb
|
||||
|
||||
def __cinit__(self):
|
||||
self.icon_obj = NULL
|
||||
self.end_obj = NULL
|
||||
self.cb = NULL
|
||||
|
||||
def __init__(self, label = None, evasObject icon = None,
|
||||
evasObject end = None, callback = None, *args, **kargs):
|
||||
|
@ -221,15 +214,16 @@ cdef class ListItem(ObjectItem):
|
|||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
self.cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
self.cb_func = callback
|
||||
self.args = args
|
||||
self.kwargs = kargs
|
||||
|
||||
def __str__(self):
|
||||
return ("%s(label=%r, icon=%s, end=%s, "
|
||||
"callback=%r, args=%r, kargs=%s)") % \
|
||||
(self.__class__.__name__, self.text_get(), bool(self.part_content_get("icon")),
|
||||
bool(self.part_content_get("end")), self.params[0], self.params[1], self.params[2])
|
||||
bool(self.part_content_get("end")), self.cb_func, self.args, self.kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
|
@ -238,7 +232,7 @@ cdef class ListItem(ObjectItem):
|
|||
(self.__class__.__name__, <unsigned long><void *>self,
|
||||
PY_REFCOUNT(self), <unsigned long><void *>self.item,
|
||||
self.text_get(), bool(self.part_content_get("icon")),
|
||||
bool(self.part_content_get("end")), self.params[0], self.params[1], self.params[2])
|
||||
bool(self.part_content_get("end")), self.cb_func, self.args, self.kwargs)
|
||||
|
||||
def append_to(self, List list):
|
||||
"""append_to(List list)
|
||||
|
@ -272,18 +266,19 @@ cdef class ListItem(ObjectItem):
|
|||
:py:func:`List.clear()`
|
||||
:py:class:`Icon <efl.elementary.icon.Icon>`
|
||||
|
||||
:return: The created item or ``None`` upon failure.
|
||||
:rtype: :py:class:`ListItem`
|
||||
:return: The created item or ``None`` upon failure.
|
||||
:rtype: :py:class:`ListItem`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_list_item_append(list.obj,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
self.icon_obj,
|
||||
self.end_obj,
|
||||
self.cb,
|
||||
<void*>self)
|
||||
self.icon_obj, self.end_obj,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
|
@ -311,13 +306,14 @@ cdef class ListItem(ObjectItem):
|
|||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_list_item_prepend( list.obj,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
self.icon_obj,
|
||||
self.end_obj,
|
||||
self.cb,
|
||||
<void*>self)
|
||||
self.icon_obj, self.end_obj,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
|
@ -345,15 +341,16 @@ cdef class ListItem(ObjectItem):
|
|||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
cdef List list = before.widget
|
||||
item = elm_list_item_insert_before( list.obj,
|
||||
before.item,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
self.icon_obj,
|
||||
self.end_obj,
|
||||
self.cb,
|
||||
<void*>self)
|
||||
self.icon_obj, self.end_obj,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
|
@ -381,15 +378,16 @@ cdef class ListItem(ObjectItem):
|
|||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
cdef List list = after.widget
|
||||
item = elm_list_item_insert_after( list.obj,
|
||||
after.item,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
self.icon_obj,
|
||||
self.end_obj,
|
||||
self.cb,
|
||||
<void*>self)
|
||||
self.icon_obj, self.end_obj,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
|
|
|
@ -40,7 +40,8 @@ It supports some basic but yet nice features:
|
|||
- names/coordinates conversion (and viceversa)
|
||||
|
||||
|
||||
.. rubric:: Signals you can listen to
|
||||
Signals you can listen to
|
||||
=========================
|
||||
|
||||
- "clicked" - Called when a user has clicked the map without dragging around.
|
||||
- "clicked,double" - Called when a user has double-clicked the map.
|
||||
|
@ -72,7 +73,10 @@ It supports some basic but yet nice features:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Map overlay types
|
||||
.. _Elm_Map_Overlay_Type:
|
||||
|
||||
Map overlay types
|
||||
=================
|
||||
|
||||
.. data:: ELM_MAP_OVERLAY_TYPE_NONE
|
||||
|
||||
|
@ -115,7 +119,10 @@ Enumerations
|
|||
This will draw a dinamic scale on the map.
|
||||
|
||||
|
||||
.. rubric:: Map route methods
|
||||
.. _Elm_Map_Route_Method:
|
||||
|
||||
Map route methods
|
||||
=================
|
||||
|
||||
.. data:: ELM_MAP_ROUTE_METHOD_FASTEST
|
||||
|
||||
|
@ -126,7 +133,10 @@ Enumerations
|
|||
Route should prioritize distance
|
||||
|
||||
|
||||
.. rubric:: Map route types
|
||||
.. _Elm_Map_Route_Type:
|
||||
|
||||
Map route types
|
||||
===============
|
||||
|
||||
.. data:: ELM_MAP_ROUTE_TYPE_MOTOCAR
|
||||
|
||||
|
@ -141,7 +151,10 @@ Enumerations
|
|||
Route should consider user will be walking.
|
||||
|
||||
|
||||
.. rubric:: Map source types
|
||||
.. _Elm_Map_Source_Type:
|
||||
|
||||
Map source types
|
||||
================
|
||||
|
||||
.. data:: ELM_MAP_SOURCE_TYPE_TILE
|
||||
|
||||
|
@ -156,7 +169,10 @@ Enumerations
|
|||
Name service provider
|
||||
|
||||
|
||||
.. rubric:: Map zoom modes
|
||||
.. _Elm_Map_Zoom_Mode:
|
||||
|
||||
Map zoom modes
|
||||
==============
|
||||
|
||||
.. data:: ELM_MAP_ZOOM_MODE_MANUAL
|
||||
|
||||
|
@ -432,11 +448,9 @@ cdef class MapOverlay(object):
|
|||
elm_map_overlay_del(self.overlay)
|
||||
|
||||
property type:
|
||||
""" Get the type of the overlay
|
||||
"""Get the type of the overlay
|
||||
|
||||
Can be one of: ELM_MAP_OVERLAY_TYPE_*
|
||||
|
||||
:type: int
|
||||
:type: :ref:`Elm_Map_Overlay_Type`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -514,7 +528,7 @@ cdef class MapOverlay(object):
|
|||
dynamically while zooming and panning.
|
||||
|
||||
:type: bool
|
||||
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
return bool(elm_map_overlay_visible_get(self.overlay))
|
||||
|
@ -536,7 +550,7 @@ cdef class MapOverlay(object):
|
|||
.. note:: Only `default` and `class` type overlay support this function.
|
||||
.. warning:: Do not modify this object (move, show, hide, del, etc.)
|
||||
after set.
|
||||
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
cdef Evas_Object *obj = <Evas_Object *>elm_map_overlay_content_get(self.overlay)
|
||||
|
@ -555,7 +569,7 @@ cdef class MapOverlay(object):
|
|||
""" The icon that is used to display the overlay.
|
||||
|
||||
:type: :py:class:`efl.evas.Object`
|
||||
|
||||
|
||||
.. note:: Only `default` and `class` type overlay support this function.
|
||||
.. warning:: Do not modify this object (move, show, hide, del, etc.)
|
||||
after set.
|
||||
|
@ -613,7 +627,7 @@ cdef class MapOverlay(object):
|
|||
By default is set to solid red (r = 255, g = 0, b = 0, a = 255).
|
||||
|
||||
For alpha channel, 0 represents completely transparent, and 255, opaque.
|
||||
|
||||
|
||||
:type: tuple of 4 int (red, green, blue, alpha)
|
||||
|
||||
.. note:: Only `default`, `class` and `route` type overlay support
|
||||
|
@ -645,7 +659,7 @@ cdef class MapOverlay(object):
|
|||
|
||||
.. seealso:: :py:func:`Map.overlays_show` if more than one overlay need
|
||||
to be displayed
|
||||
|
||||
|
||||
"""
|
||||
elm_map_overlay_show(self.overlay)
|
||||
|
||||
|
@ -701,7 +715,7 @@ cdef class MapOverlayClass(MapOverlay):
|
|||
|
||||
:param overlay: the overlay to be added as a member.
|
||||
:type overlay: :py:class:`MapOverlay`
|
||||
|
||||
|
||||
"""
|
||||
elm_map_overlay_class_append(self.overlay, overlay.overlay)
|
||||
|
||||
|
@ -745,7 +759,7 @@ cdef class MapOverlayClass(MapOverlay):
|
|||
|
||||
You can change the state (hidden, paused, etc.) or set the content
|
||||
or icon of the group overlays by chaning the state of the class overlay.
|
||||
|
||||
|
||||
:type: list of :py:class:`MapOverlay`
|
||||
|
||||
.. warning:: Do not modifty the group overlay itself.
|
||||
|
@ -856,7 +870,7 @@ cdef class MapOverlayPolygon(MapOverlay):
|
|||
:type lon: float
|
||||
:param lat: The latitude.
|
||||
:type lat: float
|
||||
|
||||
|
||||
"""
|
||||
elm_map_overlay_polygon_region_add(self.overlay, lon, lat)
|
||||
|
||||
|
@ -922,13 +936,13 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
This property will respect the limits defined by :py:attr:`zoom_min`
|
||||
and :py:attr:`zoom_max`. By default these values are 0 (world map)
|
||||
and 18 (maximum zoom).
|
||||
|
||||
|
||||
This property should be used when zoom mode is set to
|
||||
`ELM_MAP_ZOOM_MODE_MANUAL`. That is the default mode, and can be set
|
||||
with :py:attr:`zoom_mode`.
|
||||
|
||||
:type: int
|
||||
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
return elm_map_zoom_get(self.obj)
|
||||
|
@ -1006,7 +1020,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
|
||||
This gets the current center coordinates of the map object. It can be
|
||||
set by :py:func:`region_bring_in()` and :py:func:`region_show()`.
|
||||
|
||||
|
||||
:type: tuple of float (lon, lat)
|
||||
|
||||
"""
|
||||
|
@ -1090,7 +1104,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
:rtype: tuple of int
|
||||
|
||||
.. seealso:: :py:func:`canvas_to_region_convert`
|
||||
|
||||
|
||||
"""
|
||||
cdef Evas_Coord x, y
|
||||
elm_map_region_to_canvas_convert(self.obj, lon, lat, &x, &y)
|
||||
|
@ -1183,7 +1197,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
field *User-Agent*.
|
||||
|
||||
:type: string
|
||||
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
return _ctouni(elm_map_user_agent_get(self.obj))
|
||||
|
@ -1237,7 +1251,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
|
||||
:return: a list of all overlays
|
||||
:rtype: list of :py:class:`MapOverlay` objects
|
||||
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
|
@ -1290,7 +1304,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
|
||||
:return: a new bubble style overlay
|
||||
:rtype: :py:class:`MapOverlayBubble`
|
||||
|
||||
|
||||
.. seealso:: :py:func:`overlay_add`
|
||||
|
||||
"""
|
||||
|
@ -1309,10 +1323,10 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
:type tlon: float
|
||||
:param tlat: The end latitude.
|
||||
:type tlat: float
|
||||
|
||||
|
||||
:return: a new line style overlay
|
||||
:rtype: :py:class:`MapOverlayLine`
|
||||
|
||||
|
||||
.. seealso:: :py:func:`overlay_add`
|
||||
|
||||
"""
|
||||
|
@ -1326,7 +1340,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
|
||||
:return: a new polygon style overlay
|
||||
:rtype: :py:class:`MapOverlayPolygon`
|
||||
|
||||
|
||||
.. seealso:: :py:func:`overlay_add`
|
||||
|
||||
"""
|
||||
|
@ -1345,7 +1359,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
:type radius: int
|
||||
:return: a new circle style overlay
|
||||
:rtype: :py:class:`MapOverlayCircle`
|
||||
|
||||
|
||||
.. seealso:: :py:func:`overlay_add`
|
||||
|
||||
"""
|
||||
|
@ -1364,7 +1378,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
:type y: int
|
||||
:return: a new scale style overlay
|
||||
:rtype: :py:class:`MapOverlayScale`
|
||||
|
||||
|
||||
.. seealso:: :py:func:`overlay_add`
|
||||
|
||||
"""
|
||||
|
@ -1387,7 +1401,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
|
||||
:return: a new class style overlay
|
||||
:rtype: :py:class:`MapOverlayClass`
|
||||
|
||||
|
||||
.. seealso:: :py:func:`overlay_add`
|
||||
|
||||
"""
|
||||
|
@ -1398,13 +1412,13 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
|
||||
This overlay has a route type.
|
||||
This overlay has a route style layout and icon or content can not be set.
|
||||
|
||||
|
||||
|
||||
:param route: The route object to make an overlay from.
|
||||
:type route: :py:class:`efl.elementary.map.MapRoute`
|
||||
:return: a new route style overlay
|
||||
:rtype: :py:class:`MapOverlayRoute`
|
||||
|
||||
|
||||
.. seealso:: :py:func:`overlay_add`
|
||||
|
||||
"""
|
||||
|
@ -1452,10 +1466,10 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
|
||||
:param type: the type of the source. Must be one of: `ELM_MAP_SOURCE_TYPE_TILE`,
|
||||
`ELM_MAP_SOURCE_TYPE_ROUTE` or `ELM_MAP_SOURCE_TYPE_NAME`
|
||||
:type type: int
|
||||
:type type: :ref:`Elm_Map_Source_Type`
|
||||
|
||||
.. seealso:: :py:func:`source_set`, :py:func:`source_get`
|
||||
|
||||
|
||||
"""
|
||||
cdef const_char **lst
|
||||
|
||||
|
@ -1489,7 +1503,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
|
||||
:param source_type: the type of the source. Must be one of: `ELM_MAP_SOURCE_TYPE_TILE`,
|
||||
`ELM_MAP_SOURCE_TYPE_ROUTE` or `ELM_MAP_SOURCE_TYPE_NAME`
|
||||
:type source_type: int
|
||||
:type source_type: :ref:`Elm_Map_Source_Type`
|
||||
:param source_name: The source to be used. Need to match one of the names
|
||||
provided by :py:func:`sources_get`.
|
||||
:type source_name: string
|
||||
|
@ -1507,7 +1521,7 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
|
||||
:param source_type: the type of the source. Must be one of: `ELM_MAP_SOURCE_TYPE_TILE`,
|
||||
`ELM_MAP_SOURCE_TYPE_ROUTE` or `ELM_MAP_SOURCE_TYPE_NAME`
|
||||
:type source_type: int
|
||||
:type source_type: :ref:`Elm_Map_Source_Type`
|
||||
|
||||
.. seealso:: :py:func:`sources_get`, :py:func:`source_set`
|
||||
"""
|
||||
|
@ -1526,16 +1540,16 @@ cdef public class Map(Object)[object PyElementaryMap, type PyElementaryMap_Type]
|
|||
depending if the user will be walking or driving, the route may vary.
|
||||
One of `ELM_MAP_ROUTE_TYPE_MOTOCAR`, `ELM_MAP_ROUTE_TYPE_BICYCLE`,
|
||||
or `ELM_MAP_ROUTE_TYPE_FOOT` need to be used.
|
||||
|
||||
|
||||
Another parameter is what the route should prioritize, the minor distance
|
||||
or the less time to be spend on the route. So `method` should be one
|
||||
of `ELM_MAP_ROUTE_METHOD_SHORTEST` or `ELM_MAP_ROUTE_METHOD_FASTEST`.
|
||||
|
||||
:param type: one of `ELM_MAP_ROUTE_TYPE_MOTOCAR`, `ELM_MAP_ROUTE_TYPE_BICYCLE`
|
||||
or `ELM_MAP_ROUTE_TYPE_FOOT`
|
||||
:type type: int
|
||||
:type type: :ref:`Elm_Map_Route_Type`
|
||||
:param method: `ELM_MAP_ROUTE_METHOD_SHORTEST` or `ELM_MAP_ROUTE_METHOD_FASTEST`
|
||||
:type method: int
|
||||
:type method: :ref:`Elm_Map_Route_Method`
|
||||
:param flon: The start longitude.
|
||||
:type flon: float
|
||||
:param flat: The start latitude.
|
||||
|
|
|
@ -38,11 +38,7 @@ from object cimport Object
|
|||
|
||||
cdef class Mapbuf(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_mapbuf_add(parent.obj))
|
||||
|
|
|
@ -51,42 +51,44 @@ from object_item cimport _object_item_callback, \
|
|||
|
||||
cdef class MenuItem(ObjectItem):
|
||||
|
||||
"""
|
||||
"""An item for the :py:class:`Menu` widget."""
|
||||
|
||||
An item for the :py:class:`Menu` widget.
|
||||
cdef:
|
||||
MenuItem parent
|
||||
bytes label, icon
|
||||
|
||||
"""
|
||||
|
||||
def __init__( self,
|
||||
evasObject menu,
|
||||
MenuItem parent = None,
|
||||
label = None,
|
||||
icon = None,
|
||||
callback = None,
|
||||
*args, **kargs):
|
||||
|
||||
cdef Elm_Object_Item *item, *parent_obj = NULL
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
parent_obj = parent.item if parent is not None else NULL
|
||||
def __init__(self, MenuItem parent = None, label = None, icon = None,
|
||||
callback = None, *args, **kargs):
|
||||
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
if isinstance(icon, unicode): icon = PyUnicode_AsUTF8String(icon)
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
self.parent = parent
|
||||
self.label = label
|
||||
self.icon = icon
|
||||
self.cb_func = callback
|
||||
self.args = args
|
||||
self.kwargs = kargs
|
||||
|
||||
def add_to(self, Menu menu not None):
|
||||
cdef Elm_Object_Item *item, *parent_obj = NULL
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_menu_item_add(menu.obj,
|
||||
parent_obj,
|
||||
<const_char *>icon if icon is not None else NULL,
|
||||
<const_char *>label if label is not None else NULL,
|
||||
cb,
|
||||
<void*>self)
|
||||
self.parent.item if self.parent is not None else NULL,
|
||||
<const_char *>self.icon if self.icon is not None else NULL,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
|
@ -208,16 +210,25 @@ cdef class MenuItem(ObjectItem):
|
|||
return _object_item_to_python(elm_menu_item_prev_get(self.item))
|
||||
|
||||
cdef class MenuSeparatorItem(ObjectItem):
|
||||
def __init__(self, evasObject menu, MenuItem parent):
|
||||
cdef Elm_Object_Item *parent_obj = NULL
|
||||
|
||||
if parent:
|
||||
parent_obj = parent.item
|
||||
item = elm_menu_item_separator_add(menu.obj, parent_obj)
|
||||
if not item:
|
||||
raise RuntimeError("Error creating separator")
|
||||
cdef MenuItem parent
|
||||
def __init__(self, MenuItem parent):
|
||||
self.parent = parent
|
||||
|
||||
self._set_obj(item)
|
||||
def add_to(self, Menu menu not None):
|
||||
cdef Elm_Object_Item *item
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_menu_item_separator_add(menu.obj,
|
||||
self.parent.item if self.parent is not None else NULL)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
property is_separator:
|
||||
"""Returns whether the item is a separator.
|
||||
|
@ -233,8 +244,8 @@ cdef class MenuSeparatorItem(ObjectItem):
|
|||
def next_get(self):
|
||||
"""Get the next item in the menu.
|
||||
|
||||
@return: The item after it, or None
|
||||
@rtype: L{MenuItem}
|
||||
:return: The item after it, or None
|
||||
:rtype: :py:class:`MenuItem`
|
||||
|
||||
"""
|
||||
return _object_item_to_python(elm_menu_item_next_get(self.item))
|
||||
|
@ -242,7 +253,7 @@ cdef class MenuSeparatorItem(ObjectItem):
|
|||
property next:
|
||||
"""Get the next item in the menu.
|
||||
|
||||
@type: L{MenuItem}
|
||||
:type: :py:class:`MenuItem`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -251,8 +262,8 @@ cdef class MenuSeparatorItem(ObjectItem):
|
|||
def prev_get(self):
|
||||
"""Get the previous item in the menu.
|
||||
|
||||
@return: The item before it, or None
|
||||
@rtype: L{MenuItem}
|
||||
:return: The item before it, or None
|
||||
:rtype: :py:class:`MenuItem`
|
||||
|
||||
"""
|
||||
return _object_item_to_python(elm_menu_item_prev_get(self.item))
|
||||
|
@ -260,7 +271,7 @@ cdef class MenuSeparatorItem(ObjectItem):
|
|||
property prev:
|
||||
"""Get the previous item in the menu.
|
||||
|
||||
@type: L{MenuItem}
|
||||
:type: :py:class:`MenuItem`
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
@ -268,17 +279,10 @@ cdef class MenuSeparatorItem(ObjectItem):
|
|||
|
||||
cdef class Menu(Object):
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, evasObject parent, obj = None):
|
||||
if obj is None:
|
||||
self._set_obj(elm_menu_add(parent.obj))
|
||||
else:
|
||||
self._set_obj(<Evas_Object*>obj)
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_menu_add(parent.obj))
|
||||
|
||||
property parent:
|
||||
"""The parent for the given menu widget.
|
||||
|
@ -352,7 +356,7 @@ cdef class Menu(Object):
|
|||
:rtype: :py:class:`MenuItem`
|
||||
|
||||
"""
|
||||
return MenuItem(self, parent, label, icon, callback, *args, **kwargs)
|
||||
return MenuItem(parent, label, icon, callback, *args, **kwargs).add_to(self)
|
||||
|
||||
def item_separator_add(self, parent = None):
|
||||
"""item_separator_add(parent = None) -> MenuSeparatorItem
|
||||
|
@ -367,7 +371,7 @@ cdef class Menu(Object):
|
|||
:rtype: :py:class:`MenuSeparatorItem`
|
||||
|
||||
"""
|
||||
return MenuSeparatorItem(self, parent)
|
||||
return MenuSeparatorItem(parent).add_to(self)
|
||||
|
||||
property selected_item:
|
||||
"""The selected item in the menu
|
||||
|
|
|
@ -44,85 +44,144 @@ Default text parts of the multibuttonentry items that you can use for are:
|
|||
|
||||
include "widget_header.pxi"
|
||||
|
||||
from libc.stdlib cimport free
|
||||
from libc.string cimport strdup
|
||||
from efl cimport Eina_Stringshare, eina_stringshare_add, eina_stringshare_del, \
|
||||
eina_stringshare_replace
|
||||
from object cimport Object
|
||||
import traceback
|
||||
from object_item cimport _object_item_callback, \
|
||||
_object_item_to_python, \
|
||||
_object_item_list_to_python
|
||||
|
||||
cdef Eina_Bool _multibuttonentry_filter_callback(Evas_Object *obj, const_char *item_label, void *item_data, void *data) with gil:
|
||||
cdef Eina_Bool _multibuttonentry_filter_callback(Evas_Object *obj, \
|
||||
const_char *item_label, void *item_data, void *data) with gil:
|
||||
cdef:
|
||||
MultiButtonEntry mbe = object_from_instance(obj)
|
||||
bint ret
|
||||
|
||||
(callback, a, ka) = <object>data
|
||||
|
||||
try:
|
||||
(mbe, callback, a, ka) = <object>data
|
||||
ret = callback(mbe, _ctouni(item_label), *a, **ka)
|
||||
if isinstance(ret, str):
|
||||
# TODO this is BROKEN! the doc say should work, but it's a const char* :/
|
||||
# free(<void*>item_label)
|
||||
# item_label = strdup(ret)
|
||||
return 1
|
||||
elif ret:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
except Exception, e:
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
cdef enum Elm_MultiButtonEntry_Item_Insert_Kind:
|
||||
ELM_MULTIBUTTONENTRY_INSERT_APPEND
|
||||
ELM_MULTIBUTTONENTRY_INSERT_PREPEND
|
||||
ELM_MULTIBUTTONENTRY_INSERT_BEFORE
|
||||
ELM_MULTIBUTTONENTRY_INSERT_AFTER
|
||||
return ret
|
||||
|
||||
# XXX: MBE API is teh b0rg
|
||||
# if ret is None:
|
||||
# eina_stringshare_del(item_label)
|
||||
# item_label = NULL
|
||||
# return 1
|
||||
# elif isinstance(ret, (str, unicode)):
|
||||
# ret = PyUnicode_AsUTF8String(ret)
|
||||
# item_label = eina_stringshare_replace(&item_label, strdup(ret))
|
||||
# return 1
|
||||
# else:
|
||||
# return 0
|
||||
|
||||
cdef class MultiButtonEntryItem(ObjectItem):
|
||||
|
||||
"""An item for the MultiButtonEntry widget."""
|
||||
|
||||
def __init__(self, kind, evasObject mbe, label,
|
||||
MultiButtonEntryItem before_after = None,
|
||||
callback = None, *args, **kargs):
|
||||
# TODO: fix this horrible API
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
cdef:
|
||||
bytes label
|
||||
|
||||
def __init__(self, label = None, callback = None, *args, **kargs):
|
||||
|
||||
if callback:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
self.label = label
|
||||
self.cb_func = callback
|
||||
self.args = args
|
||||
self.kwargs = kargs
|
||||
|
||||
def append_to(self, MultiButtonEntry mbe not None):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
if kind == ELM_MULTIBUTTONENTRY_INSERT_PREPEND:
|
||||
item = elm_multibuttonentry_item_prepend(mbe.obj,
|
||||
<const_char *>label if label is not None else NULL,
|
||||
cb, <void*>self)
|
||||
elif kind == ELM_MULTIBUTTONENTRY_INSERT_APPEND:
|
||||
item = elm_multibuttonentry_item_append(mbe.obj,
|
||||
<const_char *>label if label is not None else NULL,
|
||||
cb, <void*>self)
|
||||
elif kind == ELM_MULTIBUTTONENTRY_INSERT_BEFORE:
|
||||
item = elm_multibuttonentry_item_insert_before(mbe.obj,
|
||||
before_after.item,
|
||||
<const_char *>label if label is not None else NULL,
|
||||
cb, <void*>self)
|
||||
elif kind == ELM_MULTIBUTTONENTRY_INSERT_AFTER:
|
||||
item = elm_multibuttonentry_item_insert_after(mbe.obj,
|
||||
before_after.item,
|
||||
<const_char *>label if label is not None else NULL,
|
||||
cb, <void*>self)
|
||||
item = elm_multibuttonentry_item_append(mbe.obj,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def prepend_to(self, MultiButtonEntry mbe not None):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_multibuttonentry_item_prepend(mbe.obj,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def insert_before(self, MultiButtonEntryItem before not None):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
cdef MultiButtonEntry mbe = before.widget
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_multibuttonentry_item_insert_before(mbe.obj,
|
||||
before.item,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def insert_after(self, MultiButtonEntryItem after not None):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
cdef MultiButtonEntry mbe = after.widget
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_multibuttonentry_item_insert_after(mbe.obj,
|
||||
after.item,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def __str__(self):
|
||||
return ("%s(label=%r, callback=%r, args=%r, kargs=%s)") % \
|
||||
(self.__class__.__name__, self.text_get(), self.params[0], self.params[1], self.params[2])
|
||||
(self.__class__.__name__, self.text_get(), self.cb_func, self.args, self.kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
"label=%r, callback=%r, args=%r, kargs=%s)") % \
|
||||
(self.__class__.__name__, <unsigned long><void *>self,
|
||||
PY_REFCOUNT(self), <unsigned long><void *>self.item,
|
||||
self.text_get(), self.params[0], self.params[1], self.params[2])
|
||||
self.text_get(), self.cb_func, self.args, self.kwargs)
|
||||
|
||||
property selected:
|
||||
def __get__(self):
|
||||
|
@ -152,11 +211,7 @@ cdef class MultiButtonEntryItem(ObjectItem):
|
|||
|
||||
cdef class MultiButtonEntry(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_multibuttonentry_add(parent.obj))
|
||||
|
@ -191,20 +246,16 @@ cdef class MultiButtonEntry(Object):
|
|||
return bool(elm_multibuttonentry_expanded_get(self.obj))
|
||||
|
||||
def item_prepend(self, label, func = None, *args, **kwargs):
|
||||
return MultiButtonEntryItem(ELM_MULTIBUTTONENTRY_INSERT_PREPEND,
|
||||
self, label, None, func, *args, **kwargs)
|
||||
return MultiButtonEntryItem(label, func, *args, **kwargs).prepend_to(self)
|
||||
|
||||
def item_append(self, label, func = None, *args, **kwargs):
|
||||
return MultiButtonEntryItem(ELM_MULTIBUTTONENTRY_INSERT_APPEND,
|
||||
self, label, None, func, *args, **kwargs)
|
||||
return MultiButtonEntryItem(label, func, *args, **kwargs).append_to(self)
|
||||
|
||||
def item_insert_before(self, MultiButtonEntryItem before, label, func = None, *args, **kwargs):
|
||||
return MultiButtonEntryItem(ELM_MULTIBUTTONENTRY_INSERT_BEFORE,
|
||||
self, label, before, func, *args, **kwargs)
|
||||
return MultiButtonEntryItem(label, func, *args, **kwargs).insert_before(before)
|
||||
|
||||
def item_insert_after(self, MultiButtonEntryItem after, label, func = None, *args, **kwargs):
|
||||
return MultiButtonEntryItem(ELM_MULTIBUTTONENTRY_INSERT_AFTER,
|
||||
self, label, after, func, *args, **kwargs)
|
||||
return MultiButtonEntryItem(label, func, *args, **kwargs).insert_after(after)
|
||||
|
||||
property items:
|
||||
def __get__(self):
|
||||
|
@ -238,15 +289,19 @@ cdef class MultiButtonEntry(Object):
|
|||
elm_multibuttonentry_clear(self.obj)
|
||||
|
||||
def filter_append(self, func, *args, **kwargs):
|
||||
cbdata = (self, func, args, kwargs)
|
||||
cbdata = (func, args, kwargs)
|
||||
|
||||
elm_multibuttonentry_item_filter_append(self.obj,
|
||||
_multibuttonentry_filter_callback, <void *>cbdata)
|
||||
_multibuttonentry_filter_callback, <void *>cbdata)
|
||||
|
||||
Py_INCREF(cbdata)
|
||||
|
||||
def filter_prepend(self, func, *args, **kwargs):
|
||||
cbdata = (self, func, args, kwargs)
|
||||
cbdata = (func, args, kwargs)
|
||||
|
||||
elm_multibuttonentry_item_filter_prepend(self.obj,
|
||||
_multibuttonentry_filter_callback, <void *>cbdata)
|
||||
_multibuttonentry_filter_callback, <void *>cbdata)
|
||||
|
||||
Py_INCREF(cbdata)
|
||||
|
||||
def filter_remove(self, func, *args, **kwargs):
|
||||
|
|
|
@ -104,11 +104,7 @@ from object_item cimport _object_item_to_python, \
|
|||
|
||||
cdef class NaviframeItem(ObjectItem):
|
||||
|
||||
"""
|
||||
|
||||
An item for the Naviframe widget.
|
||||
|
||||
"""
|
||||
"""An item for the Naviframe widget."""
|
||||
|
||||
cdef object label, item_style
|
||||
cdef Evas_Object *prev_btn, *next_btn, *item_content
|
||||
|
@ -336,11 +332,7 @@ cdef class NaviframeItem(ObjectItem):
|
|||
|
||||
cdef class Naviframe(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_naviframe_add(parent.obj))
|
||||
|
|
|
@ -44,7 +44,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Notify_Orient:
|
||||
|
||||
.. rubric:: Notify orientation types
|
||||
Notify orientation types
|
||||
========================
|
||||
|
||||
.. data:: ELM_NOTIFY_ORIENT_TOP
|
||||
|
||||
|
@ -85,7 +86,8 @@ Enumerations
|
|||
|
||||
.. _ELM_NOTIFY_ALIGN_FILL:
|
||||
|
||||
.. rubric:: ELM_NOTIFY_ALIGN_FILL
|
||||
ELM_NOTIFY_ALIGN_FILL
|
||||
=====================
|
||||
|
||||
.. data:: ELM_NOTIFY_ALIGN_FILL
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
"""
|
||||
|
||||
.. rubric:: Copy and Paste
|
||||
Copy and Paste
|
||||
--------------
|
||||
|
||||
Implements the following functionality
|
||||
a. select, copy/cut and paste
|
||||
|
@ -55,13 +56,13 @@ More information is on
|
|||
- X11R6 Inter-Client Communication Conventions Manual, section 2
|
||||
|
||||
|
||||
|
||||
Enumerations
|
||||
------------
|
||||
|
||||
.. _Elm_Focus_Direction:
|
||||
|
||||
.. rubric:: Focus direction
|
||||
Focus direction
|
||||
===============
|
||||
|
||||
.. data:: ELM_FOCUS_PREVIOUS
|
||||
|
||||
|
@ -74,7 +75,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Sel_Type:
|
||||
|
||||
.. rubric:: Selection type
|
||||
Selection type
|
||||
==============
|
||||
|
||||
Defines the types of selection property names.
|
||||
:see: `http://www.x.org/docs/X11/xlib.pdf`_ for more details.
|
||||
|
@ -96,10 +98,10 @@ Defines the types of selection property names.
|
|||
Clipboard selection (ctrl+C)
|
||||
|
||||
|
||||
|
||||
.. _Elm_Sel_Format:
|
||||
|
||||
.. rubric:: Selection format
|
||||
Selection format
|
||||
================
|
||||
|
||||
Defines the types of content.
|
||||
|
||||
|
@ -132,10 +134,10 @@ Defines the types of content.
|
|||
Raw HTML-like data (eg. webkit)
|
||||
|
||||
|
||||
|
||||
.. _Elm_Xdnd_Action:
|
||||
|
||||
.. rubric:: XDND action
|
||||
XDND action
|
||||
===========
|
||||
|
||||
Defines the kind of action associated with the drop data if for XDND
|
||||
:since: 1.8
|
||||
|
|
|
@ -63,9 +63,12 @@ cdef void _object_item_del_cb(void *data, Evas_Object *o, void *event_info) with
|
|||
cdef void _object_item_callback(void *data, Evas_Object *obj, void *event_info) with gil
|
||||
|
||||
cdef class ObjectItem(object):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef tuple params
|
||||
cdef int _set_obj(self, Elm_Object_Item *item) except 0
|
||||
cdef:
|
||||
Elm_Object_Item *item
|
||||
object cb_func
|
||||
tuple args
|
||||
dict kwargs
|
||||
int _set_obj(self, Elm_Object_Item *item) except 0
|
||||
|
||||
cpdef text_set(self, text)
|
||||
cpdef text_get(self)
|
||||
|
|
|
@ -69,20 +69,15 @@ cdef void _object_item_del_cb(void *data, Evas_Object *o, void *event_info) with
|
|||
|
||||
cdef void _object_item_callback(void *data, Evas_Object *obj, void *event_info) with gil:
|
||||
cdef ObjectItem item = <object>data
|
||||
(callback, a, ka) = item.params
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
callback(o, item, *a, **ka)
|
||||
except Exception as e:
|
||||
item.cb_func(o, item, *item.args, **item.kwargs)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
cdef class ObjectItem(object):
|
||||
|
||||
"""
|
||||
|
||||
A generic item for the widgets.
|
||||
|
||||
"""
|
||||
"""A generic item for the widgets."""
|
||||
|
||||
# Notes to bindings' developers:
|
||||
# ==============================
|
||||
|
@ -91,13 +86,6 @@ cdef class ObjectItem(object):
|
|||
# instance pointer, and the attribute "item", that you see below, contains
|
||||
# a pointer to Elm_Object_Item.
|
||||
#
|
||||
# The variable params holds callback data, usually the tuple
|
||||
# (callback, args, kwargs). Note that some of the generic object item
|
||||
# functions expect this tuple. Use custom functions if you assign the
|
||||
# params differently.
|
||||
#
|
||||
# Gen type widgets MUST set the params BEFORE adding the item as the
|
||||
# items need their data immediately when adding them.
|
||||
|
||||
def __dealloc__(self):
|
||||
if self.item != NULL:
|
||||
|
@ -338,18 +326,18 @@ cdef class ObjectItem(object):
|
|||
|
||||
property data:
|
||||
def __get__(self):
|
||||
return (self.params[1], self.params[2])
|
||||
return (self.args, self.kwargs)
|
||||
|
||||
def __set__(self, data):
|
||||
args, kwargs = data
|
||||
callback = self.params[0]
|
||||
self.params = tuple(callback, *args, **kwargs)
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def data_get(self):
|
||||
return (self.params[1], self.params[2])
|
||||
return (self.args, self.kwargs)
|
||||
def data_set(self, *args, **kwargs):
|
||||
callback = self.params[0]
|
||||
self.params = tuple(callback, *args, **kwargs)
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def signal_emit(self, emission, source):
|
||||
"""signal_emit(unicode emission, unicode source)
|
||||
|
|
|
@ -42,7 +42,10 @@ Default content parts of the panel widget that you can use for are:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Panel orientation types
|
||||
.. _Elm_Panel_Orient:
|
||||
|
||||
Panel orientation types
|
||||
=======================
|
||||
|
||||
.. data:: ELM_PANEL_ORIENT_TOP
|
||||
|
||||
|
@ -75,11 +78,7 @@ ELM_PANEL_ORIENT_RIGHT = enums.ELM_PANEL_ORIENT_RIGHT
|
|||
|
||||
cdef class Panel(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_panel_add(parent.obj))
|
||||
|
@ -91,7 +90,7 @@ cdef class Panel(Object):
|
|||
|
||||
This has value ELM_PANEL_ORIENT_LEFT on failure
|
||||
|
||||
:type: Elm_Panel_Orient
|
||||
:type: :ref:`Elm_Panel_Orient`
|
||||
|
||||
"""
|
||||
def __set__(self, orient):
|
||||
|
|
|
@ -56,11 +56,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Panes(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_panes_add(parent.obj))
|
||||
|
|
|
@ -48,11 +48,7 @@ from object cimport Object
|
|||
|
||||
cdef class Photo(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_photo_add(parent.obj))
|
||||
|
|
|
@ -56,7 +56,10 @@ Signals that you can add callbacks for are:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Photocam zoom modes
|
||||
.. _Elm_Photocam_Zoom_Mode:
|
||||
|
||||
Photocam zoom modes
|
||||
===================
|
||||
|
||||
.. data:: ELM_PHOTOCAM_ZOOM_MODE_MANUAL
|
||||
|
||||
|
@ -93,11 +96,7 @@ ELM_PHOTOCAM_ZOOM_MODE_LAST = enums.ELM_PHOTOCAM_ZOOM_MODE_LAST
|
|||
|
||||
cdef class Photocam(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_photocam_add(parent.obj))
|
||||
|
@ -156,7 +155,7 @@ cdef class Photocam(Object):
|
|||
ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL will be similar but ensure no
|
||||
pixels within the frame are left unfilled.
|
||||
|
||||
:type: Elm_Photocam_Zoom_Mode
|
||||
:type: :ref:`Elm_Photocam_Zoom_Mode`
|
||||
|
||||
"""
|
||||
def __set__(self, mode):
|
||||
|
|
|
@ -104,7 +104,10 @@ Default text parts of the popup widget that you can use for are:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Popup orientation types
|
||||
.. _Elm_Popup_Orient:
|
||||
|
||||
Popup orientation types
|
||||
=======================
|
||||
|
||||
.. data:: ELM_POPUP_ORIENT_TOP
|
||||
|
||||
|
@ -143,7 +146,10 @@ Enumerations
|
|||
Popup should appear in the bottom right of parent
|
||||
|
||||
|
||||
.. rubric:: Wrap modes
|
||||
.. Elm_Wrap_Type:
|
||||
|
||||
Wrap modes
|
||||
==========
|
||||
|
||||
.. data:: ELM_WRAP_NONE
|
||||
|
||||
|
@ -202,36 +208,46 @@ cdef class PopupItem(ObjectItem):
|
|||
- "default" - Item's label
|
||||
|
||||
"""
|
||||
# TODO: change API
|
||||
cdef:
|
||||
bytes label
|
||||
evasObject icon
|
||||
|
||||
def __init__(self, evasObject popup, label = None, evasObject icon = None, func = None, *args, **kwargs):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
if func is not None:
|
||||
if not callable(func):
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _object_item_callback
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
self.params = (func, args, kwargs)
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
item = elm_popup_item_append( popup.obj,
|
||||
<const_char *>label if not None else NULL,
|
||||
icon.obj if not None else NULL,
|
||||
cb if not None else NULL,
|
||||
<void *>self)
|
||||
self.label = label
|
||||
self.icon = icon
|
||||
self.cb_func = func
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def append_to(self, Popup popup not None):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_popup_item_append(popup.obj,
|
||||
<const_char *>self.label if not None else NULL,
|
||||
self.icon.obj if not None else NULL,
|
||||
cb, <void *>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return "%s(func=%s, item_data=%s)" % \
|
||||
(self.__class__.__name__,
|
||||
self.params[0],
|
||||
self.params[1])
|
||||
self.cb_func,
|
||||
self.args)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
|
@ -240,16 +256,12 @@ cdef class PopupItem(ObjectItem):
|
|||
<unsigned long><void*>self,
|
||||
PY_REFCOUNT(self),
|
||||
<unsigned long>self.item,
|
||||
self.params[0],
|
||||
self.params[1])
|
||||
self.cb_func,
|
||||
self.args)
|
||||
|
||||
cdef class Popup(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_popup_add(parent.obj))
|
||||
|
@ -297,7 +309,7 @@ cdef class Popup(Object):
|
|||
|
||||
Sets the position in which popup will appear in its parent
|
||||
|
||||
:type: Elm_Popup_Orient
|
||||
:type: :ref:`Elm_Popup_Orient`
|
||||
|
||||
"""
|
||||
def __set__(self, orient):
|
||||
|
|
|
@ -83,11 +83,7 @@ class ProgressbarPulseState(int):
|
|||
|
||||
cdef class Progressbar(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_progressbar_add(parent.obj))
|
||||
|
|
|
@ -70,11 +70,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Radio(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent, obj=None):
|
||||
if obj is None:
|
||||
|
|
|
@ -76,7 +76,10 @@ Default content parts of the scroller widget that you can use for are:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Scrollbar visibility
|
||||
.. _Elm_Scroller_Policy:
|
||||
|
||||
Scrollbar visibility
|
||||
====================
|
||||
|
||||
.. data:: ELM_SCROLLER_POLICY_AUTO
|
||||
|
||||
|
@ -185,7 +188,7 @@ cdef class ScrollableInterface(Object):
|
|||
ELM_SCROLLER_POLICY_OFF always keeps it off. This applies
|
||||
respectively for the horizontal and vertical scrollbars.
|
||||
|
||||
:type: tuple of Elm_Scroller_Policy
|
||||
:type: (:ref:`Elm_Scroller_Policy` **policy_h**, :ref:`Elm_Scroller_Policy` **policy_v**)
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
|
|
|
@ -63,11 +63,7 @@ from object_item cimport _object_item_to_python
|
|||
|
||||
cdef class SegmentControlItem(ObjectItem):
|
||||
|
||||
"""
|
||||
|
||||
An item for :py:class:`SegmentControl`.
|
||||
|
||||
"""
|
||||
"""An item for :py:class:`SegmentControl`."""
|
||||
|
||||
property index:
|
||||
"""Get the index of an item.
|
||||
|
@ -112,11 +108,7 @@ cdef class SegmentControlItem(ObjectItem):
|
|||
|
||||
cdef class SegmentControl(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_segment_control_add(parent.obj))
|
||||
|
|
|
@ -38,11 +38,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Separator(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_separator_add(parent.obj))
|
||||
|
|
|
@ -78,11 +78,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Slider(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_slider_add(parent.obj))
|
||||
|
|
|
@ -37,7 +37,8 @@ The transition animations are defined in the widget's theme,
|
|||
consequently new animations can be added without having to
|
||||
update the widget's code.
|
||||
|
||||
.. rubric:: Slideshow items
|
||||
Slideshow items
|
||||
===============
|
||||
|
||||
For slideshow items, just like for :py:class:`Genlist` "genlist" ones,
|
||||
the user defines a **classes**, specifying functions that will be
|
||||
|
@ -55,7 +56,8 @@ members:
|
|||
is called, where the user must delete any data associated to
|
||||
the item.
|
||||
|
||||
.. rubric:: Slideshow caching
|
||||
Slideshow caching
|
||||
=================
|
||||
|
||||
The slideshow provides facilities to have items adjacent to the
|
||||
one being displayed **already "realized"** (i.e. loaded) for
|
||||
|
@ -85,47 +87,38 @@ from layout_class cimport LayoutClass
|
|||
import traceback
|
||||
from object_item cimport _object_item_to_python, _object_item_list_to_python
|
||||
|
||||
cdef _py_elm_slideshow_item_call(func, Evas_Object *obj, data) with gil:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
(args, kwargs) = data
|
||||
return func(o, *args, **kwargs)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return None
|
||||
|
||||
cdef Evas_Object *_py_elm_slideshow_item_get(void *data, Evas_Object *obj) with gil:
|
||||
cdef SlideshowItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef evasObject icon
|
||||
cdef SlideshowItemClass itc = params[0]
|
||||
cdef SlideshowItemClass itc = item.cls
|
||||
|
||||
func = itc._get_func
|
||||
if func is None:
|
||||
return NULL
|
||||
|
||||
ret = _py_elm_slideshow_item_call(func, obj, params[1])
|
||||
if ret is not None:
|
||||
try:
|
||||
icon = ret
|
||||
return icon.obj
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return NULL
|
||||
else:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
ret = func(o, *item.args, **item.kwargs)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return NULL
|
||||
|
||||
if ret is None:
|
||||
return NULL
|
||||
|
||||
icon = ret
|
||||
return icon.obj
|
||||
|
||||
cdef void _py_elm_slideshow_item_del(void *data, Evas_Object *obj) with gil:
|
||||
cdef SlideshowItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef SlideshowItemClass itc = params[0]
|
||||
cdef SlideshowItemClass itc = item.cls
|
||||
|
||||
func = itc._del_func
|
||||
if func is not None:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
func(o, params[1])
|
||||
except Exception as e:
|
||||
func(o, *item.args, **item.kwargs)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
# XXX: SlideShow item handling is weird
|
||||
|
@ -135,8 +128,7 @@ cdef void _py_elm_slideshow_item_del(void *data, Evas_Object *obj) with gil:
|
|||
cdef int _py_elm_slideshow_compare_func(const_void *data1, const_void *data2) with gil:
|
||||
cdef SlideshowItem item1 = <object>data1
|
||||
cdef SlideshowItem item2 = <object>data2
|
||||
cdef object params = item1.params
|
||||
cdef object func = params[2]
|
||||
cdef object func = item1.compare_func
|
||||
|
||||
if func is None:
|
||||
return 0
|
||||
|
@ -145,7 +137,7 @@ cdef int _py_elm_slideshow_compare_func(const_void *data1, const_void *data2) wi
|
|||
if ret is not None:
|
||||
try:
|
||||
return ret
|
||||
except Exception as e:
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
else:
|
||||
|
@ -187,9 +179,6 @@ cdef class SlideshowItemClass (object):
|
|||
cdef readonly object _del_func
|
||||
|
||||
def __cinit__(self, *a, **ka):
|
||||
self._get_func = None
|
||||
self._del_func = None
|
||||
|
||||
self.obj.func.get = _py_elm_slideshow_item_get
|
||||
self.obj.func.del_ = _py_elm_slideshow_item_del
|
||||
|
||||
|
@ -240,13 +229,13 @@ cdef class SlideshowItemClass (object):
|
|||
|
||||
cdef class SlideshowItem(ObjectItem):
|
||||
|
||||
"""
|
||||
"""An item for Slideshow."""
|
||||
|
||||
An item for Slideshow.
|
||||
cdef:
|
||||
SlideshowItemClass cls
|
||||
object compare_func
|
||||
|
||||
"""
|
||||
|
||||
cdef int _set_obj(self, Elm_Object_Item *item, params=None) except 0:
|
||||
cdef int _set_obj(self, Elm_Object_Item *item) except 0:
|
||||
assert self.item == NULL, "Object must be clean"
|
||||
self.item = item
|
||||
Py_INCREF(self)
|
||||
|
@ -256,21 +245,105 @@ cdef class SlideshowItem(ObjectItem):
|
|||
assert self.item != NULL, "Object must wrap something"
|
||||
self.item = NULL
|
||||
|
||||
def __init__(self, SlideshowItemClass item_class not None, *args, **kwargs):
|
||||
self.cls = item_class
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def add_to(self, Slideshow slideshow not None):
|
||||
"""add_to(Slideshow slideshow) -> SlideshowItem
|
||||
|
||||
Add (append) a new item in a given slideshow widget.
|
||||
|
||||
Add a new item to ``obj's`` internal list of items, appending it.
|
||||
The item's class must contain the function really fetching the
|
||||
image object to show for this item, which could be an Evas image
|
||||
object or an Elementary photo, for example. The ``data``
|
||||
parameter is going to be passed to both class functions of the
|
||||
item.
|
||||
|
||||
.. seealso::
|
||||
:py:class:`SlideshowItemClass`
|
||||
:py:func:`item_sorted_insert()`
|
||||
:py:attr:`efl.elementary.object_item.ObjectItem.data`
|
||||
|
||||
:param item_class: The item class for the item
|
||||
:type item_class: :py:class:`SlideshowItemClass`
|
||||
|
||||
:return: A handle to the item added or ``None``, on errors
|
||||
:rtype: :py:class:`SlideshowItem`
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
|
||||
item = elm_slideshow_item_add(slideshow.obj, &self.cls.obj, <void*>self)
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def sorted_insert(self, Slideshow slideshow not None, func not None):
|
||||
"""sorted_insert(Slideshow slideshow, func) -> SlideshowItem
|
||||
|
||||
Insert a new item into the given slideshow widget, using the ``func``
|
||||
function to sort items (by item handles).
|
||||
|
||||
Add a new item to ``obj``'s internal list of items, in a position
|
||||
determined by the ``func`` comparing function. The item's class
|
||||
must contain the function really fetching the image object to
|
||||
show for this item, which could be an Evas image object or an
|
||||
Elementary photo, for example. The ``data`` parameter is going to
|
||||
be passed to both class functions of the item.
|
||||
|
||||
The compare function compares data1 and data2. If data1 is 'less'
|
||||
than data2, -1 must be returned, if it is 'greater', 1 must be
|
||||
returned, and if they are equal, 0 must be returned.
|
||||
|
||||
.. seealso::
|
||||
:py:class:`SlideshowItemClass`
|
||||
:py:func:`item_add()`
|
||||
|
||||
:param itc: The item class for the item
|
||||
:param func: The comparing function to be used to sort slideshow
|
||||
items **by SlideshowItemClass item handles**
|
||||
:return: Returns The slideshow item handle, on success, or
|
||||
``None``, on errors
|
||||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Eina_Compare_Cb compare
|
||||
|
||||
if not callable(func):
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
self.compare_func = func
|
||||
compare = _py_elm_slideshow_compare_func
|
||||
|
||||
item = elm_slideshow_item_sorted_insert(slideshow.obj, &self.cls.obj, \
|
||||
<void*>self, compare)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
return self
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def __str__(self):
|
||||
return "%s(item_class=%s, item_data=%s)" % \
|
||||
(self.__class__.__name__,
|
||||
self.params[0].__class__.__name__,
|
||||
self.params[1])
|
||||
(type(self).__name__,
|
||||
type(self.cls).__name__,
|
||||
self.args)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
"item_class=%s, item_data=%r)") % \
|
||||
(self.__class__.__name__,
|
||||
(type(self).__name__,
|
||||
<unsigned long><void*>self,
|
||||
PY_REFCOUNT(self),
|
||||
<unsigned long>self.obj,
|
||||
self.params[0].__class__.__name__,
|
||||
self.params[1])
|
||||
type(self.cls).__name__,
|
||||
self.args)
|
||||
|
||||
property object:
|
||||
"""Get the real Evas object created to implement the view of a given
|
||||
|
@ -305,15 +378,9 @@ cdef class SlideshowItem(ObjectItem):
|
|||
"""
|
||||
elm_slideshow_item_show(self.item)
|
||||
|
||||
|
||||
|
||||
cdef class Slideshow(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_slideshow_add(parent.obj))
|
||||
|
@ -342,17 +409,7 @@ cdef class Slideshow(LayoutClass):
|
|||
:rtype: :py:class:`SlideshowItem`
|
||||
|
||||
"""
|
||||
cdef SlideshowItem ret = SlideshowItem()
|
||||
cdef Elm_Object_Item *item
|
||||
|
||||
item_data = (args, kwargs)
|
||||
ret.params = (item_class, item_data)
|
||||
item = elm_slideshow_item_add(self.obj, &item_class.obj, <void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
return SlideshowItem(item_class, *args, **kwargs).add_to(self)
|
||||
|
||||
def item_sorted_insert(self, SlideshowItemClass item_class not None,
|
||||
func not None, *args, **kwargs):
|
||||
|
@ -383,23 +440,7 @@ cdef class Slideshow(LayoutClass):
|
|||
``None``, on errors
|
||||
|
||||
"""
|
||||
cdef SlideshowItem ret = SlideshowItem()
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Eina_Compare_Cb compare
|
||||
|
||||
if callable(func):
|
||||
compare = _py_elm_slideshow_compare_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
item_data = (args, kwargs)
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_slideshow_item_sorted_insert(self.obj, &item_class.obj, <void*>ret, compare)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
return SlideshowItem(item_class, *args, **kwargs).sorted_insert(self, func)
|
||||
|
||||
def next(self):
|
||||
"""next()
|
||||
|
|
|
@ -58,11 +58,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Spinner(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_spinner_add(parent.obj))
|
||||
|
|
|
@ -63,7 +63,10 @@ Available styles:
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Thumb animation modes
|
||||
.. _Elm_Thumb_Animation_Setting:
|
||||
|
||||
Thumb animation modes
|
||||
=====================
|
||||
|
||||
.. data:: ELM_THUMB_ANIMATION_START
|
||||
|
||||
|
@ -92,11 +95,7 @@ ELM_THUMB_ANIMATION_LAST = enums.ELM_THUMB_ANIMATION_LAST
|
|||
|
||||
cdef class Thumb(Object):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_thumb_add(parent.obj))
|
||||
|
@ -172,7 +171,7 @@ cdef class Thumb(Object):
|
|||
|
||||
.. seealso:: :py:attr:`file`
|
||||
|
||||
:type: Elm_Thumb_Animation_Setting
|
||||
:type: :ref:`Elm_Thumb_Animation_Setting`
|
||||
|
||||
"""
|
||||
def __set__(self, s):
|
||||
|
|
|
@ -53,7 +53,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Icon_Lookup_Order:
|
||||
|
||||
.. rubric:: Icon lookup modes
|
||||
Icon lookup modes
|
||||
=================
|
||||
|
||||
.. data:: ELM_ICON_LOOKUP_FDO_THEME
|
||||
|
||||
|
@ -74,7 +75,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Object_Select_Mode:
|
||||
|
||||
.. rubric:: Selection modes
|
||||
Selection modes
|
||||
===============
|
||||
|
||||
.. data:: ELM_OBJECT_SELECT_MODE_DEFAULT
|
||||
|
||||
|
@ -95,7 +97,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Toolbar_Shrink_Mode:
|
||||
|
||||
.. rubric:: Toolbar shrink modes
|
||||
Toolbar shrink modes
|
||||
====================
|
||||
|
||||
.. data:: ELM_TOOLBAR_SHRINK_NONE
|
||||
|
||||
|
@ -120,7 +123,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Toolbar_Item_Scrollto_Type:
|
||||
|
||||
.. rubric:: Toolbar item scrollto types
|
||||
Toolbar item scrollto types
|
||||
===========================
|
||||
|
||||
Where to position the item in the toolbar.
|
||||
|
||||
|
@ -258,17 +262,17 @@ cdef class ToolbarItem(ObjectItem):
|
|||
:type callback: function
|
||||
|
||||
"""
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
|
||||
if isinstance(icon, unicode): icon = PyUnicode_AsUTF8String(icon)
|
||||
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
|
||||
self.icon = icon
|
||||
self.label = label
|
||||
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
self.cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kwargs)
|
||||
self.cb_func = callback
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def append_to(self, Toolbar toolbar):
|
||||
"""append_to(Toolbar toolbar) -> ToolbarItem
|
||||
|
@ -290,11 +294,15 @@ cdef class ToolbarItem(ObjectItem):
|
|||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_toolbar_item_append(toolbar.obj,
|
||||
<const_char *>self.icon if self.icon is not None else NULL,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
self.cb, <void*>self)
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
|
@ -318,11 +326,15 @@ cdef class ToolbarItem(ObjectItem):
|
|||
|
||||
"""
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_toolbar_item_prepend(toolbar.obj,
|
||||
<const_char *>self.icon if self.icon is not None else NULL,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
self.cb, <void*>self)
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
|
@ -348,12 +360,16 @@ cdef class ToolbarItem(ObjectItem):
|
|||
cdef:
|
||||
Elm_Object_Item *item
|
||||
Evas_Object *toolbar = elm_object_item_widget_get(after.item)
|
||||
Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_toolbar_item_insert_after(toolbar,
|
||||
after.item,
|
||||
<const_char *>self.icon if self.icon is not None else NULL,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
self.cb, <void*>self)
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
|
@ -379,12 +395,16 @@ cdef class ToolbarItem(ObjectItem):
|
|||
cdef:
|
||||
Elm_Object_Item *item
|
||||
Evas_Object *toolbar = elm_object_item_widget_get(before.item)
|
||||
Evas_Smart_Cb cb = NULL
|
||||
|
||||
if self.cb_func is not None:
|
||||
cb = _object_item_callback
|
||||
|
||||
item = elm_toolbar_item_insert_before(toolbar,
|
||||
before.item,
|
||||
<const_char *>self.icon if self.icon is not None else NULL,
|
||||
<const_char *>self.label if self.label is not None else NULL,
|
||||
self.cb, <void*>self)
|
||||
cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#
|
||||
|
||||
from efl.eo cimport object_from_instance
|
||||
from object_item cimport ObjectItem, _object_item_to_python, Elm_Object_Item
|
||||
|
||||
cdef Evas_Object *_tooltip_content_create(void *data, Evas_Object *o, Evas_Object *t) with gil:
|
||||
cdef Object ret, obj, tooltip
|
||||
|
@ -33,15 +34,18 @@ cdef void _tooltip_data_del_cb(void *data, Evas_Object *o, void *event_info) wit
|
|||
Py_DECREF(<object>data)
|
||||
|
||||
cdef Evas_Object *_tooltip_item_content_create(void *data, Evas_Object *o, Evas_Object *t, void *it) with gil:
|
||||
cdef Object ret, obj, tooltip
|
||||
cdef:
|
||||
Object ret, obj, tooltip
|
||||
ObjectItem item
|
||||
|
||||
obj = object_from_instance(o)
|
||||
tooltip = object_from_instance(t)
|
||||
(func, item, args, kargs) = <object>data
|
||||
ret = func(obj, item, *args, **kargs)
|
||||
if not ret:
|
||||
obj = object_from_instance(o)
|
||||
tooltip = object_from_instance(t)
|
||||
item = _object_item_to_python(<Elm_Object_Item *>it)
|
||||
(func, args, kargs) = <object>data
|
||||
ret = func(obj, item, *args, **kargs)
|
||||
if not ret:
|
||||
return NULL
|
||||
return ret.obj
|
||||
return ret.obj
|
||||
|
||||
cdef void _tooltip_item_data_del_cb(void *data, Evas_Object *o, void *event_info) with gil:
|
||||
Py_DECREF(<object>data)
|
||||
|
|
|
@ -71,7 +71,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Transit_Effect_Flip_Axis:
|
||||
|
||||
.. rubric:: Flip effects
|
||||
Flip effects
|
||||
============
|
||||
|
||||
.. data:: ELM_TRANSIT_EFFECT_FLIP_AXIS_X
|
||||
|
||||
|
@ -84,7 +85,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Transit_Effect_Wipe_Dir:
|
||||
|
||||
.. rubric:: Wipe effects
|
||||
Wipe effects
|
||||
============
|
||||
|
||||
.. data:: ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT
|
||||
|
||||
|
@ -105,7 +107,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Transit_Effect_Wipe_Type:
|
||||
|
||||
.. rubric:: Wipe types
|
||||
Wipe types
|
||||
==========
|
||||
|
||||
.. data:: ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE
|
||||
|
||||
|
@ -118,7 +121,8 @@ Enumerations
|
|||
|
||||
.. _Elm_Transit_Tween_Mode:
|
||||
|
||||
.. rubric:: Tween modes
|
||||
Tween modes
|
||||
===========
|
||||
|
||||
.. data:: ELM_TRANSIT_TWEEN_MODE_LINEAR
|
||||
|
||||
|
|
|
@ -35,11 +35,7 @@ from layout_class cimport LayoutClass
|
|||
|
||||
cdef class Video(LayoutClass):
|
||||
|
||||
"""
|
||||
|
||||
This is the class that actually implement the widget.
|
||||
|
||||
"""
|
||||
"""This is the class that actually implements the widget."""
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_video_add(parent.obj))
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
Enumerations
|
||||
------------
|
||||
|
||||
.. rubric:: Web window features
|
||||
.. _Elm_Web_Window_Feature:
|
||||
|
||||
Web window features
|
||||
===================
|
||||
|
||||
.. data:: ELM_WEB_WINDOW_FEATURE_TOOLBAR
|
||||
|
||||
|
@ -48,7 +51,10 @@ Enumerations
|
|||
Fullscreen
|
||||
|
||||
|
||||
.. rubric:: Web zoom modes
|
||||
.. _Elm_Web_Zoom_Mode:
|
||||
|
||||
Web zoom modes
|
||||
==============
|
||||
|
||||
.. data:: ELM_WEB_ZOOM_MODE_MANUAL
|
||||
|
||||
|
|
|
@ -14,22 +14,21 @@ from efl.elementary.scroller import Scroller
|
|||
|
||||
counter = 0
|
||||
|
||||
def cb_item_selected(mbe, item):
|
||||
print("cb!!!!!!!!!!!") # TODO this is never called
|
||||
def cb_item_selected(mbe, *args, **kwargs):
|
||||
# XXX: This gets called twice
|
||||
print(mbe)
|
||||
print(item)
|
||||
|
||||
def cb_btn_item_prepend(btn, mbe):
|
||||
global counter
|
||||
|
||||
counter += 1
|
||||
item = mbe.item_prepend("item #%d" % (counter), cb_item_selected, "PippO")
|
||||
item = mbe.item_prepend("item #%d" % (counter), cb_item_selected)
|
||||
|
||||
def cb_btn_item_append(btn, mbe):
|
||||
global counter
|
||||
|
||||
counter += 1
|
||||
item = mbe.item_append("item #%d" % (counter), cb_item_selected, "PippO")
|
||||
item = mbe.item_append("item #%d" % (counter), cb_item_selected)
|
||||
|
||||
def cb_btn_item_insert_after(btn, mbe):
|
||||
global counter
|
||||
|
@ -50,6 +49,7 @@ def cb_btn_clear2(btn, mbe):
|
|||
item.delete()
|
||||
|
||||
def cb_filter1(mbe, text):
|
||||
print(text)
|
||||
return True
|
||||
|
||||
def multibuttonentry_clicked(obj, item=None):
|
||||
|
@ -78,6 +78,7 @@ def multibuttonentry_clicked(obj, item=None):
|
|||
sc.show()
|
||||
|
||||
mbe = MultiButtonEntry(win)
|
||||
mbe.callback_item_selected_add(cb_item_selected)
|
||||
mbe.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
|
||||
mbe.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
|
||||
mbe.text = "To: "
|
||||
|
|
Loading…
Reference in New Issue