efl.edje.Edje Class

class efl.edje.Edje(Canvas canvas, file=None, group=None, size=None, geometry=None, **kwargs)

Bases: efl.evas.Object

This is a high level efl.evas.SmartObject that is defined as a group of parts, usually written in text files (.edc) and compiled as a package using EET to store resources (.edj).

Attention

messages are one way only! If you emit a message from Python you will just get it from your Embryo script, if you emit from Embryo you just get it in Python. If you want to emit events and capture them on the same side, use signals.

Parameters:
  • canvas (Canvas) – Evas canvas for this object
  • file (string) – File name
  • group (string) – Group name
  • size (tuple of ints) – Min size for the object
  • geometry (tuple of ints) – Geometry for the object
  • **kwargs – All the remaining keyword arguments are interpreted as properties of the instance
animation_get()
Return type:bool
animation_set(value)

Set animation state.

base_scale

The base scale factor set in the edc collection.

Type:float

New in version 1.12.

base_scale_get()
calc_force()

Force recalculation of parts state (geometry, position, ...)

color_class_del(color_class)

Delete a specific color class.

color_class_get(color_class)

Get a specific color class.

Parameters:color_class – the name of the color class to query
Returns:the tuple (r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
Return type:tuple of int
color_class_set(color_class, r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)

Set color class.

Parameters:
  • color_class – color class name
  • r
  • g
  • b
  • a
  • r2
  • g2
  • b2
  • a2
  • r3
  • g3
  • b3
  • a3
data_get(key)

Get data from Edje data collection (defined in .edj).

Data collection is defined inside an Edje file as:

collections {
   group {
      name: "a_group";
      data {
         item: "key1" "value1";
         item: "key2" "value2";
      }
   }
}

Attention

this differs from Edje.data! Edje.data is a Python specific utility provided as a dictionary. This function returns data stored on the Edje (.edj), stored inside a data section inside the group that defines this object.

Type:string
file_get()

Get the file and group used to load the object.

Returns:the tuple (file, group)
Return type:tuple of str
file_set(file, group)

Set the file (.edj) and the group to load the Edje object from.

Parameters:
  • file (string) – the name of the file to load
  • group (string) – the name of the group inside the edj to load
Raises EdjeLoadError:
 

if error occurred during load.

freeze()

This puts all changes on hold.

Successive freezes will nest, requiring an equal number of thaws.

Return type:int
load_error_get()
Return type:int
message_handler_set(func, *args, **kargs)

Set the handler of messages coming from Embryo.

Signature:

function(object, message, *args, **kargs)

Note

this just handle messages sent from Embryo.

Raises TypeError:
 if func is not callable or None.
message_send(id, data)

Send message with given id and data.

Data should be pure-python types that will be converted to the Message subclass that better fits it. Supported are: - long, int, float, str - list of long, int, float, str - str and one of long, int, float - str and a list of one of long, int, float

Messages sent will NOT be available at Python-side (ie: message_handler_set()), but just at Embryo-side.

Raises TypeError:
 if data has no supported EdjeMessage counterpart.
message_signal_process()

Manually iterate message signal system.

mirrored

The RTL orientation for this object.

Type:int

New in version 1.8.

mirrored_get()
mirrored_set(rtl)
part_box_append(part, obj)

Adds an item to a BOX part.

Appends an item to the BOX edje part, where some box’s properties inherited. Like the color properties has some nice effect on the box’s childrens.

Parameters:
  • part – the name of the BOX part
  • obj – the efl.evas.Object to append
Return type:

bool

part_box_insert_at(part, obj, pos)

Inserts an item at the given position in a BOX part.

Parameters:
  • part – the name of the BOX part
  • obj – the efl.evas.Object to append
  • pos – the position to append the object
Return type:

bool

part_box_insert_before(part, obj, reference)

Inserts an item in a BOX part before the reference object.

Parameters:
  • part – the name of the BOX part
  • obj – the efl.evas.Object to append
  • reference – the efl.evas.Object used as reference
Return type:

bool

part_box_prepend(part, obj)

Prepend an item to a BOX part.

Prepends an item to the BOX edje part, where some box’s properties inherited. Like the color properties has some nice effect on the box’s childrens.

Parameters:
  • part – the name of the BOX part
  • obj – the efl.evas.Object to append
Return type:

bool

part_box_remove(part, obj)

Removes the object given from a BOX part.

Returns the object removed, or None if it wasn’t found or is internal to Edje.

Parameters:
  • part – the name of the BOX part
  • obj – the efl.evas.Object to remove
Returns:

the removed object

Return type:

efl.evas.Object or None

part_box_remove_all(part, clear)

Removes all objects from a BOX part.

Parameters:
  • part – the name of the BOX part to remove from.
  • clear – if 1, it will delete the objects it removes.

Note: this function doesn’t remove items created from the theme.

Return type:bool
part_box_remove_at(part, pos)

Removes the object at the given position in a BOX part.

Returns the object removed, or None nothing was found at the given position, or if the object was internal to Edje.

Parameters:
  • part – the name of the BOX part
  • pos – the position to remove from
Returns:

the removed object

Return type:

efl.evas.Object or None

part_drag_dir_get(part)
Return type:int
part_drag_page(part, dx, dy)
part_drag_page_get(part)
Return type:tuple of float
part_drag_page_set(part, dx, dy)
part_drag_size_get(part)
Return type:tuple of float
part_drag_size_set(part, dw, dh)

Set the drag size of part :param dw: :param dh:

part_drag_step(part, dx, dy)
part_drag_step_get(part)
Return type:tuple of float
part_drag_step_set(part, dx, dy)

Set the drag step of part :param dx: :param dy:

part_drag_value_get(part)
Return type:tuple of float
part_drag_value_set(part, dx, dy)

Set the drag value of part :param dx: :param dy:

part_exists(part)
Return type:bool
part_external_object_get(part)
Return type:efl.evas.Object
part_external_param_get(part, param)

Get a parameter of the external part.

Parameters:
  • part – EXTERNAL part to set parameter.
  • param – EXTERNAL parameter name.
Returns:

None for errors, other values depending on the parameter type.

part_external_param_set(part, param, value)

Set a parameter of the external part.

Parameters:
  • part – EXTERNAL part to set parameter.
  • param – EXTERNAL parameter name.
  • value – value to set, type is guessed from it, so must be of types bool, int, float or str.
Return type:

bool

part_geometry_get(part)
Return type:tuple of int
part_object_get(part)

Get the efl.evas.Object that represents this part.

Warning

You should never modify the state of the returned object (with Edje.move() or Edje.hide() for example), but you can safely query info about its current state (with Edje.visible_get() or Edje.color_get() for example).

part_pos_get(part)
Return type:tuple of int
part_size_get(part)
Return type:tuple of int
part_state_get(part)
Return type:(name, value)
part_swallow(part, obj)

Swallows an object into the edje

Swallows the object into the edje part so that all geometry changes for the part affect the swallowed object. (e.g. resize, move, show, raise/lower, etc.).

If an object has already been swallowed into this part, then it will first be unswallowed before the new object is swallowed.

Parameters:
  • part (str) – the name of the SWALLOW part
  • obj (efl.evas.Object) – the efl.evas.Object to swallow inside part
part_swallow_get(part)
Return type:efl.evas.Object
part_table_child_get(part, row, column)

Retrieve a child from a table.

Parameters:
  • part – the name of the TABLE part to get child from.
  • row – row index of the child.
  • column – column index of the child.
Returns:

the object ath the given position

Return type:

efl.evas.Object

part_table_clear(part, clear)

Clears a TABLE part.

Parameters:
  • part – the name of the TABLE part to clear all its elements from.
  • clear – Delete objects when removed from the table.

Note

This function will not remove the elements defined by the theme.

Return type:bool
part_table_col_row_size_get(part)

Returns the size in columns/rows of the TABLE part.

Parameters:part – the anme of the TABLE part to get the size of.
Returns:the tuple (cols, rows)
Return type:tuple of int
part_table_pack(part, child, col, row, colspan, rowspan)

Pack an object inside a TABLE part.

Parameters:
  • part – name of the TABLE part to pack in.
  • child – efl.evas.Object to pack into the table.
  • col
  • row
  • colspan
  • rowspan
Return type:

bool

part_table_unpack(part, child)

Remove an object from a TABLE part.

Parameters:
  • part – the name of the TABLE part to remove from.
  • child – the efl.evas.Object to remove.
Return type:

bool

part_text_get(part)

Get the text of a given part.

Returns:the text of part
Return type:str
part_text_input_hint_get(part)

Gets the value of input hint.

Parameters:part (str) – the part name

New in version 1.12.

part_text_input_hint_set(part, input_hints)

Sets the input hint which allows input methods to fine-tune their behavior.

Parameters:
  • part (str) – the part name
  • input_hints (Edje_Input_Hints) – the hints to set

New in version 1.12.

part_text_select_all(part)

Select all the text of the given TEXT or TEXTBLOCK part

part_text_select_none(part)

Deselect all the text of the given TEXT or TEXTBLOCK part

part_text_set(part, text)

Set the text of a given part.

Parameters:
  • part – name of the text part to edit
  • text – the new text to set
part_text_unescaped_get(part)

Automatically removes escape from text if using TEXTBLOCK.

Similar to part_text_get(), but if it is a textblock contents will be unescaped automatically.

See:part_text_get()
See:part_text_unescaped_set()
part_text_unescaped_set(part, text_to_escape)

Automatically escapes text if using TEXTBLOCK.

Similar to part_text_set(), but if it is a textblock contents will be escaped automatically so it is displayed without any formatting.

See:part_text_set()
See:part_text_unescaped_get()
part_unswallow(obj)

Unswallow the given object from the edje

parts_extends_calc()

Calculate the geometry of the region, relative to a given Edje object’s area, occupied by all parts in the object

Returns:(x, y, w, h)
Return type:tuple of 4 ints
play_get()
Return type:bool
play_set(value)

Set the Edje to play or pause.

Parameters:value (int) – True to play or False to pause
preload(cancel)

Preload the images on the Edje Object in the background.

This function requests the preload of all data images in the background. The work is queued before being processed (because there might be other pending requests of this type). It emits the signal “preload,done” when finished.

Parameters:cancel (bool) – True will add it the preloading work queue, False will remove it (if it was issued before).
Return type:bool

New in version 1.8.

scale

The scaling factor for a given Edje object.

Type:float

New in version 1.8.

scale_get()
scale_set(scale)
signal_callback_add(emission, source, func, *args, **kargs)

Add callback to given signal (emission, source).

Signature:

function(object, emission, source, *args, **kargs)
Parameters:
  • emission – the emission to listen, may be or contain ‘*’ to match multiple.
  • source – the emission’s source to listen, may be or contain ‘*’ to match multiple.
  • func – the callable to use. Will get any further arguments you gave to signal_callback_add().
Raises TypeError:
 

if func is not callable.

signal_callback_del(emission, source, func)

Remove the callable associated with given emission and source.

signal_emit(emission, source)

Emit signal with emission and source

size_max_get()
Return type:tuple of int
size_min_calc()

Request object to calculate minimum size.

size_min_get()
Return type:tuple of int
size_min_restricted_calc(minw, minh)

This call will trigger an internal recalculation of all parts of the object, in order to return its minimum required dimensions for width and height. The user might choose to impose those minimum sizes, making the resulting calculation to get values equal or bigger than minw and minh, for width and height, respectively.

Note:At the end of this call, the object won’t be automatically resized to new dimensions, but just return the calculated sizes. The caller is the one up to change its geometry or not.
Warning:Be advised that invisible parts in the object obj will be taken into account in this calculation.

New in version 1.8.

text_change_cb_set(func, *args, **kargs)

Set function to callback on text changes.

Parameters:func

The function to call when text change Expected signature:

function(object, part, *args, **kargs)
text_class_get(text_class)

Gets font and font size from edje text class.

This function gets the font and the font size from the object text class.

Parameters:text_class (string) – The text class name to query
Returns:The font name and the font size
Return type:(font_name, font_size)

New in version 1.14.

text_class_set(text_class, font, size)

Set text class.

Parameters:
  • text_class – text class name
  • font – the font name
  • size – the font size
thaw()

Thaw (unfreeze) the object.

update_hints

Edje will automatically update the size hints on itself.

By default edje doesn’t set size hints on itself. With this property set to True it will do so. Be carefully, it cost a lot to trigger this feature as it will recalc the object every time it make sense to be sure that’s its minimal size hint is always accurate.

Type:bool

New in version 1.8.

update_hints_get()
update_hints_set(update)