Python-EFL: Implemented EdjeEdit API, with full unit tests.
Some stuff is not working on the C side, the unit test is full of FIXME and TODO. The biggest problem is the PartState that do not work at all, I will give a short look at this, but I'm not so much intrested atm...If you want/need to help please let me know.
This commit is contained in:
parent
9c8405ee0c
commit
9d85805b13
4
TODO
4
TODO
|
@ -3,6 +3,7 @@ BUGS
|
|||
====
|
||||
|
||||
* Evas: smart object doesn't work
|
||||
* EdjeEdit: PartState API does not work
|
||||
* Docs: GenlistWidget is documented instead of Genlist
|
||||
(all the scrollable are affected)
|
||||
|
||||
|
@ -22,7 +23,6 @@ TODO
|
|||
* ecore.FileMonitor
|
||||
* alert on signal and subprocess module usage (was in python-ecore/ecore/__init__.py)
|
||||
* evas.SmartObject
|
||||
* edje.Edit
|
||||
* edje: complete the unit tests
|
||||
* elm.Web need a test
|
||||
* elm.GestureLayer need a test
|
||||
|
@ -39,6 +39,7 @@ TODO
|
|||
* Tests for evas.Textgrid
|
||||
* update links and text on: http://www.freedesktop.org/wiki/Software/DBusBindings
|
||||
|
||||
|
||||
IMAGES
|
||||
======
|
||||
|
||||
|
@ -67,6 +68,7 @@ CHANGES FROM 1.7 to 1.8
|
|||
|
||||
* added efl container package
|
||||
* ecore.file.Download => efl.ecore.FileDownload
|
||||
* edje.edit.EdjeEdit => efl.edje_edit.EdjeEdit
|
||||
* Emotion(module_filename="xxx") => Emotion(module_name="xxx")
|
||||
* elementary.need_e_dbus => elementary.need_edbus
|
||||
* elm.domain_translatable_text_part_set => elm.domain_translatable_part_text_set
|
||||
|
|
|
@ -0,0 +1,495 @@
|
|||
# Copyright (C) 2007-2013 various contributors (see AUTHORS)
|
||||
#
|
||||
# This file is part of Python-EFL.
|
||||
#
|
||||
# Python-EFL is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# Python-EFL is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from efl.eo cimport _touni, _ctouni, convert_eina_list_strings_to_python_list
|
||||
from efl.edje cimport Edje_Part_Type
|
||||
from efl.edje import EDJE_PART_TYPE_EXTERNAL
|
||||
|
||||
|
||||
# Edje_Edit_Image_Comp
|
||||
EDJE_EDIT_IMAGE_COMP_RAW = 0
|
||||
EDJE_EDIT_IMAGE_COMP_USER = 1
|
||||
EDJE_EDIT_IMAGE_COMP_COMP = 2
|
||||
EDJE_EDIT_IMAGE_COMP_LOSSY = 3
|
||||
|
||||
|
||||
cdef class EdjeEdit(Edje):
|
||||
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
self._set_obj(edje_edit_object_add(canvas.obj))
|
||||
self._set_common_params(**kargs)
|
||||
|
||||
# General
|
||||
def compiler_get(self):
|
||||
cdef const_char *s = edje_edit_compiler_get(self.obj)
|
||||
r = _ctouni(s)
|
||||
if s != NULL:
|
||||
edje_edit_string_free(s)
|
||||
return r
|
||||
|
||||
def save(self):
|
||||
return bool(edje_edit_save(self.obj))
|
||||
|
||||
def save_all(self):
|
||||
return bool(edje_edit_save_all(self.obj))
|
||||
|
||||
def print_internal_status(self):
|
||||
edje_edit_print_internal_status(self.obj)
|
||||
|
||||
# Group
|
||||
property current_group:
|
||||
def __get__(self):
|
||||
return Group(self)
|
||||
|
||||
def group_add(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_group_add(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
def group_del(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_group_del(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
def group_exist(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_group_exist(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
# Data
|
||||
property data:
|
||||
def __get__(self):
|
||||
cdef:
|
||||
Eina_List *lst
|
||||
list ret
|
||||
lst = edje_edit_data_list_get(self.obj)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def data_get(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
cdef const_char *val = edje_edit_data_value_get(self.obj,
|
||||
<const_char *>name if name is not None else NULL)
|
||||
r = _ctouni(val)
|
||||
edje_edit_string_free(val)
|
||||
return r
|
||||
|
||||
def data_set(self, name, value):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
if isinstance(value, unicode): value = value.encode("UTF-8")
|
||||
|
||||
return bool(edje_edit_data_value_set(self.obj,
|
||||
<const_char *>name if name is not None else NULL,
|
||||
<const_char *>value if value is not None else NULL))
|
||||
|
||||
def data_add(self, name, value):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
if isinstance(value, unicode): value = value.encode("UTF-8")
|
||||
return bool(edje_edit_data_add(self.obj,
|
||||
<const_char *>name if name is not None else NULL,
|
||||
<const_char *>value if value is not None else NULL))
|
||||
|
||||
def data_rename(self, old, new):
|
||||
if isinstance(old, unicode): old = old.encode("UTF-8")
|
||||
if isinstance(new, unicode): new = new.encode("UTF-8")
|
||||
return bool(edje_edit_data_name_set(self.obj,
|
||||
<const_char *>old if old is not None else NULL,
|
||||
<const_char *>new if new is not None else NULL))
|
||||
|
||||
def data_del(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_data_del(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
# Group Data
|
||||
property group_data:
|
||||
def __get__(self):
|
||||
cdef:
|
||||
Eina_List *lst
|
||||
list ret
|
||||
lst = edje_edit_group_data_list_get(self.obj)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def group_data_get(self, name):
|
||||
cdef const_char *val
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
val = edje_edit_group_data_value_get(self.obj,
|
||||
<const_char *>name if name is not None else NULL)
|
||||
r = _ctouni(val)
|
||||
edje_edit_string_free(val)
|
||||
return r
|
||||
|
||||
def group_data_set(self, name, value):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
if isinstance(value, unicode): value = value.encode("UTF-8")
|
||||
return bool(edje_edit_group_data_value_set(self.obj,
|
||||
<const_char *>name if name is not None else NULL,
|
||||
<const_char *>value if value is not None else NULL))
|
||||
|
||||
def group_data_add(self, name, value):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
if isinstance(value, unicode): value = value.encode("UTF-8")
|
||||
return bool(edje_edit_group_data_add(self.obj,
|
||||
<const_char *>name if name is not None else NULL,
|
||||
<const_char *>value if value is not None else NULL))
|
||||
|
||||
def group_data_rename(self, old, new):
|
||||
if isinstance(old, unicode): old = old.encode("UTF-8")
|
||||
if isinstance(new, unicode): new = new.encode("UTF-8")
|
||||
return bool(edje_edit_group_data_name_set(self.obj,
|
||||
<const_char *>old if old is not None else NULL,
|
||||
<const_char *>new if new is not None else NULL))
|
||||
|
||||
def group_data_del(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_group_data_del(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
# Text Style
|
||||
property text_styles:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_styles_list_get(self.obj)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def text_style_get(self, name):
|
||||
return Text_Style(self, name)
|
||||
|
||||
def text_style_add(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_style_add(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
def text_style_del(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
edje_edit_style_del(self.obj,
|
||||
<const_char *>name if name is not None else NULL)
|
||||
return True
|
||||
|
||||
# Color Classes
|
||||
property color_classes:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_color_classes_list_get(self.obj)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def color_class_get(self, name):
|
||||
return Color_Class(self, name)
|
||||
|
||||
def color_class_add(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_color_class_add(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
def color_class_del(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_color_class_del(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
# Externals
|
||||
property externals:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_externals_list_get(self.obj)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def external_add(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_external_add(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
def external_del(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_external_del(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
# Fonts
|
||||
property fonts:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_fonts_list_get(self.obj)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def font_add(self, font, alias=None):
|
||||
if isinstance(font, unicode): font = font.encode("UTF-8")
|
||||
if isinstance(alias, unicode): alias = alias.encode("UTF-8")
|
||||
return bool(edje_edit_font_add(self.obj,
|
||||
<const_char *>font if font is not None else NULL,
|
||||
<const_char *>alias if alias is not None else NULL))
|
||||
|
||||
def font_del(self, alias):
|
||||
if isinstance(alias, unicode): alias = alias.encode("UTF-8")
|
||||
return bool(edje_edit_font_del(self.obj,
|
||||
<const_char *>alias if alias is not None else NULL))
|
||||
|
||||
# Parts
|
||||
property parts:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_parts_list_get(self.obj)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def part_get(self, name):
|
||||
if self.part_exist(name):
|
||||
return Part(self, name)
|
||||
return None
|
||||
|
||||
def part_add(self, name, int type, char *source=""):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
if type != EDJE_PART_TYPE_EXTERNAL:
|
||||
return bool(edje_edit_part_add(self.obj,
|
||||
<const_char *>name if name is not None else NULL,
|
||||
<Edje_Part_Type>type))
|
||||
else:
|
||||
return bool(edje_edit_part_external_add(self.obj, name, source))
|
||||
|
||||
def part_del(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_part_del(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
def part_exist(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_part_exist(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
# Images
|
||||
property images:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_images_list_get(self.obj)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def image_id_get(self, image):
|
||||
if isinstance(image, unicode): image = image.encode("UTF-8")
|
||||
return edje_edit_image_id_get(self.obj,
|
||||
<const_char *>image if image is not None else NULL)
|
||||
|
||||
def image_add(self, path):
|
||||
if isinstance(path, unicode): path = path.encode("UTF-8")
|
||||
return bool(edje_edit_image_add(self.obj,
|
||||
<const_char *>path if path is not None else NULL))
|
||||
|
||||
def image_del(self, image):
|
||||
if isinstance(image, unicode): image = image.encode("UTF-8")
|
||||
return bool(edje_edit_image_del(self.obj,
|
||||
<const_char *>image if image is not None else NULL))
|
||||
|
||||
# Programs
|
||||
property programs:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_programs_list_get(self.obj)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def program_get(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
if self.program_exist(name):
|
||||
return Program(self, name)
|
||||
return None
|
||||
|
||||
def program_add(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_program_add(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
def program_del(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_program_del(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
def program_exist(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_program_exist(self.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
"""
|
||||
property error:
|
||||
def __get__(self):
|
||||
last_error = c_evas.eina_error_get()
|
||||
if last_error:
|
||||
return c_evas.eina_error_msg_get(last_error)
|
||||
|
||||
return None
|
||||
"""
|
||||
|
||||
# Scripts
|
||||
property script:
|
||||
def __get__(self):
|
||||
cdef char *code
|
||||
code = edje_edit_script_get(self.obj)
|
||||
ret = _touni(code)
|
||||
free(code)
|
||||
return ret
|
||||
|
||||
def __set__(self, code):
|
||||
if isinstance(code, unicode): code = code.encode("UTF-8")
|
||||
edje_edit_script_set(self.obj,
|
||||
<char *>code if code is not None else NULL)
|
||||
|
||||
def __del__(self):
|
||||
edje_edit_script_set(self.obj, NULL)
|
||||
|
||||
def script_compile(self):
|
||||
return bool(edje_edit_script_compile(self.obj))
|
||||
|
||||
property script_errors:
|
||||
def __get__(self):
|
||||
cdef const_Eina_List *lst
|
||||
cdef Edje_Edit_Script_Error *se
|
||||
ret = []
|
||||
lst = edje_edit_script_error_list_get(self.obj)
|
||||
while lst:
|
||||
se = <Edje_Edit_Script_Error*>lst.data
|
||||
if se.program_name != NULL:
|
||||
pr = se.program_name
|
||||
else:
|
||||
pr = ''
|
||||
err = (pr, _ctouni(se.error_str))
|
||||
ret.append(err)
|
||||
lst = lst.next
|
||||
return ret
|
||||
|
||||
|
||||
cdef class Text_Style(object):
|
||||
cdef EdjeEdit edje
|
||||
cdef object name
|
||||
|
||||
def __init__(self, EdjeEdit e, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
self.edje = e
|
||||
self.name = name
|
||||
|
||||
property tags:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_style_tags_list_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def tag_get(self, name):
|
||||
return Text_Style_Tag(self, name)
|
||||
|
||||
def tag_add(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_style_tag_add(self.edje.obj, self.name,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
||||
def tag_del(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
edje_edit_style_tag_del(self.edje.obj, self.name,
|
||||
<const_char *>name if name is not None else NULL)
|
||||
return True
|
||||
|
||||
|
||||
cdef class Text_Style_Tag(object):
|
||||
cdef Text_Style text_style
|
||||
cdef object name
|
||||
|
||||
def __init__(self, Text_Style text_style, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
self.text_style = text_style
|
||||
self.name = name
|
||||
|
||||
property value:
|
||||
def __get__(self):
|
||||
cdef const_char *val
|
||||
val = edje_edit_style_tag_value_get(self.text_style.edje.obj,
|
||||
self.text_style.name,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(val)
|
||||
edje_edit_string_free(val)
|
||||
return ret
|
||||
def __set__(self, value):
|
||||
if isinstance(value, unicode): value = value.encode("UTF-8")
|
||||
edje_edit_style_tag_value_set(self.text_style.edje.obj,
|
||||
self.text_style.name, self.name,
|
||||
<const_char *>value if value is not None else NULL)
|
||||
|
||||
def rename(self, newname):
|
||||
if isinstance(newname, unicode): newname = newname.encode("UTF-8")
|
||||
edje_edit_style_tag_name_set(self.text_style.edje.obj,
|
||||
self.text_style.name,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>newname if newname is not None else NULL)
|
||||
self.name = <const_char *>newname if newname is not None else NULL
|
||||
return True
|
||||
|
||||
|
||||
cdef class Color_Class(object):
|
||||
cdef EdjeEdit edje
|
||||
cdef object name
|
||||
|
||||
def __init__(self, EdjeEdit e, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
self.edje = e
|
||||
self.name = name
|
||||
|
||||
property name:
|
||||
def __get__(self):
|
||||
return self.name.decode('UTF-8', 'strict')
|
||||
|
||||
def __set__(self, newname):
|
||||
self.rename(newname)
|
||||
|
||||
def rename(self, newname):
|
||||
cdef Eina_Bool ret
|
||||
if isinstance(newname, unicode): newname = newname.encode("UTF-8")
|
||||
ret = edje_edit_color_class_name_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>newname if newname is not None else NULL)
|
||||
if ret == 0:
|
||||
return False
|
||||
self.name = newname
|
||||
return True
|
||||
|
||||
def colors_get(self):
|
||||
cdef int r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3
|
||||
edje_edit_color_class_colors_get(self.edje.obj, self.name,
|
||||
&r, &g, &b, &a, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3)
|
||||
return ((r, g, b, a), (r2, g2, b2, a2), (r3, g3, b3, a3))
|
||||
|
||||
def colors_set(self, int r, int g, int b, int a,
|
||||
int r2, int g2, int b2, int a2,
|
||||
int r3, int g3, int b3, int a3):
|
||||
edje_edit_color_class_colors_set(self.edje.obj, self.name,
|
||||
r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
|
||||
|
||||
|
||||
include "efl.edje_edit_group.pxi"
|
||||
include "efl.edje_edit_part.pxi"
|
||||
include "efl.edje_edit_part_state.pxi"
|
||||
include "efl.edje_edit_program.pxi"
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# Copyright (C) 2007-2013 various contributors (see AUTHORS)
|
||||
#
|
||||
# This file is part of Python-EFL.
|
||||
#
|
||||
# Python-EFL is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# Python-EFL is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
cdef class Group(object):
|
||||
cdef EdjeEdit edje
|
||||
|
||||
def __init__(self, EdjeEdit e):
|
||||
self.edje = e
|
||||
|
||||
def delete(self):
|
||||
return False
|
||||
|
||||
property w_min: # TODO rename to min_w !!
|
||||
def __get__(self):
|
||||
return edje_edit_group_min_w_get(self.edje.obj)
|
||||
def __set__(self, value):
|
||||
edje_edit_group_min_w_set(self.edje.obj, value)
|
||||
|
||||
property w_max: # TODO rename to max_w !!
|
||||
def __get__(self):
|
||||
return edje_edit_group_max_w_get(self.edje.obj)
|
||||
def __set__(self, value):
|
||||
edje_edit_group_max_w_set(self.edje.obj, value)
|
||||
|
||||
property h_min: # TODO rename to min_h !!
|
||||
def __get__(self):
|
||||
return edje_edit_group_min_h_get(self.edje.obj)
|
||||
def __set__(self, value):
|
||||
edje_edit_group_min_h_set(self.edje.obj, value)
|
||||
|
||||
property h_max: # TODO rename to max_h !!
|
||||
def __get__(self):
|
||||
return edje_edit_group_max_h_get(self.edje.obj)
|
||||
def __set__(self, value):
|
||||
edje_edit_group_max_h_set(self.edje.obj, value)
|
||||
|
||||
def rename(self, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
return bool(edje_edit_group_name_set(self.edje.obj,
|
||||
<const_char *>name if name is not None else NULL))
|
||||
|
|
@ -0,0 +1,331 @@
|
|||
# Copyright (C) 2007-2013 various contributors (see AUTHORS)
|
||||
#
|
||||
# This file is part of Python-EFL.
|
||||
#
|
||||
# Python-EFL is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# Python-EFL is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
cdef class Part(object):
|
||||
cdef EdjeEdit edje
|
||||
cdef object name
|
||||
|
||||
def __init__(self, EdjeEdit e, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
self.edje = e
|
||||
self.name = name
|
||||
|
||||
property name:
|
||||
def __get__(self):
|
||||
return self.name.decode('UTF-8', 'strict')
|
||||
def __set__(self, name):
|
||||
self.rename(name)
|
||||
|
||||
def rename(self, newname):
|
||||
cdef Eina_Bool ret
|
||||
if isinstance(newname, unicode): newname = newname.encode("UTF-8")
|
||||
ret = edje_edit_part_name_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>newname if newname is not None else NULL)
|
||||
if ret == 0:
|
||||
return False
|
||||
self.name = newname
|
||||
return True
|
||||
|
||||
def above_get(self):
|
||||
cdef:
|
||||
const_char *part
|
||||
object ret
|
||||
part = edje_edit_part_above_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(part)
|
||||
edje_edit_string_free(part)
|
||||
return ret
|
||||
|
||||
def below_get(self):
|
||||
cdef:
|
||||
const_char *part
|
||||
object ret
|
||||
part = edje_edit_part_below_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(part)
|
||||
edje_edit_string_free(part)
|
||||
return ret
|
||||
|
||||
def restack_below(self):
|
||||
return bool(edje_edit_part_restack_below(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL))
|
||||
|
||||
def restack_above(self):
|
||||
return bool(edje_edit_part_restack_above(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL))
|
||||
|
||||
property type:
|
||||
def __get__(self):
|
||||
return edje_edit_part_type_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
|
||||
|
||||
property states:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_part_states_list_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def state_get(self, sname, double value=0.0):
|
||||
if self.state_exist(sname, value):
|
||||
return State(self, sname, value)
|
||||
|
||||
def state_add(self, sname, double value=0.0):
|
||||
if isinstance(sname, unicode): sname = sname.encode("UTF-8")
|
||||
return bool(edje_edit_state_add(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>sname if sname is not None else NULL,
|
||||
value))
|
||||
|
||||
def state_del(self, sname, double value=0.0):
|
||||
if isinstance(sname, unicode): sname = sname.encode("UTF-8")
|
||||
return bool(edje_edit_state_del(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>sname if sname is not None else NULL,
|
||||
value))
|
||||
|
||||
def state_exist(self, sname, double value=0.0):
|
||||
if isinstance(sname, unicode): sname = sname.encode("UTF-8")
|
||||
return bool(edje_edit_state_exist(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>sname if sname is not None else NULL,
|
||||
value))
|
||||
|
||||
def state_copy(self, sfrom, double vfrom, sto, double vto):
|
||||
if isinstance(sfrom, unicode): sfrom = sfrom.encode("UTF-8")
|
||||
if isinstance(sto, unicode): sto = sto.encode("UTF-8")
|
||||
return bool(edje_edit_state_copy(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>sfrom if sfrom is not None else NULL, vfrom,
|
||||
<const_char *>sto if sto is not None else NULL, vto))
|
||||
|
||||
def state_selected_get(self):
|
||||
cdef const_char *sel
|
||||
cdef double val
|
||||
sel = edje_edit_part_selected_state_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, &val)
|
||||
if sel == NULL: return None
|
||||
r = _ctouni(sel)
|
||||
v = val
|
||||
edje_edit_string_free(sel)
|
||||
return (r, v)
|
||||
|
||||
def state_selected_set(self, state, double value=0.0):
|
||||
if isinstance(state, unicode): state = state.encode("UTF-8")
|
||||
edje_edit_part_selected_state_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>state if state is not None else NULL,
|
||||
value)
|
||||
|
||||
property clip_to:
|
||||
def __get__(self):
|
||||
cdef const_char *clipper
|
||||
clipper = edje_edit_part_clip_to_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(clipper)
|
||||
edje_edit_string_free(clipper)
|
||||
return ret
|
||||
|
||||
def __set__(self, clipper):
|
||||
if isinstance(clipper, unicode): clipper = clipper.encode("UTF-8")
|
||||
edje_edit_part_clip_to_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>clipper if clipper is not None else NULL)
|
||||
|
||||
def __del__(self):
|
||||
edje_edit_part_clip_to_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
NULL)
|
||||
|
||||
property source:
|
||||
def __get__(self):
|
||||
cdef const_char *source
|
||||
source = edje_edit_part_source_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(source)
|
||||
edje_edit_string_free(source)
|
||||
return ret
|
||||
|
||||
def __set__(self, source):
|
||||
if isinstance(source, unicode): source = source.encode("UTF-8")
|
||||
edje_edit_part_source_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>source if source is not None else NULL)
|
||||
|
||||
def __del__(self):
|
||||
edje_edit_part_source_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
NULL)
|
||||
|
||||
property mouse_events:
|
||||
def __get__(self):
|
||||
return bool(edje_edit_part_mouse_events_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL))
|
||||
|
||||
def __set__(self, me):
|
||||
edje_edit_part_mouse_events_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
1 if me else 0)
|
||||
|
||||
property repeat_events:
|
||||
def __get__(self):
|
||||
return bool(edje_edit_part_repeat_events_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL))
|
||||
|
||||
def __set__(self, re):
|
||||
edje_edit_part_repeat_events_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
1 if re else 0)
|
||||
|
||||
property effect:
|
||||
def __get__(self):
|
||||
return edje_edit_part_effect_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
|
||||
def __set__(self, effect):
|
||||
edje_edit_part_effect_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
effect)
|
||||
|
||||
property ignore_flags:
|
||||
def __get__(self):
|
||||
return edje_edit_part_ignore_flags_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
|
||||
def __set__(self, flags):
|
||||
edje_edit_part_ignore_flags_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
flags)
|
||||
|
||||
property scale:
|
||||
def __get__(self):
|
||||
return bool(edje_edit_part_scale_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL))
|
||||
|
||||
def __set__(self, scale):
|
||||
edje_edit_part_scale_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
1 if scale else 0)
|
||||
|
||||
property drag:
|
||||
def __get__(self):
|
||||
cdef int x, y
|
||||
x = edje_edit_part_drag_x_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
y = edje_edit_part_drag_y_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
return (x, y)
|
||||
|
||||
def __set__(self, val):
|
||||
x, y = val
|
||||
edje_edit_part_drag_x_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, x)
|
||||
edje_edit_part_drag_y_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, y)
|
||||
|
||||
property drag_step:
|
||||
def __get__(self):
|
||||
cdef int x, y
|
||||
x = edje_edit_part_drag_step_x_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
y = edje_edit_part_drag_step_y_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
return (x, y)
|
||||
|
||||
def __set__(self, val):
|
||||
x, y = val
|
||||
edje_edit_part_drag_step_x_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, x)
|
||||
edje_edit_part_drag_step_y_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, y)
|
||||
|
||||
property drag_count:
|
||||
def __get__(self):
|
||||
cdef int x, y
|
||||
x = edje_edit_part_drag_count_x_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
y = edje_edit_part_drag_count_y_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
return (x, y)
|
||||
|
||||
def __set__(self, val):
|
||||
x, y = val
|
||||
edje_edit_part_drag_count_x_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, x)
|
||||
edje_edit_part_drag_count_y_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, y)
|
||||
|
||||
property drag_confine:
|
||||
def __get__(self):
|
||||
cdef const_char *confine
|
||||
confine = edje_edit_part_drag_confine_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(confine)
|
||||
edje_edit_string_free(confine)
|
||||
return ret
|
||||
|
||||
def __set__(self, confine):
|
||||
if isinstance(confine, unicode): confine = confine.encode("UTF-8")
|
||||
edje_edit_part_drag_confine_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>confine if confine is not None else NULL)
|
||||
|
||||
property drag_event:
|
||||
def __get__(self):
|
||||
cdef const_char *event
|
||||
event = edje_edit_part_drag_event_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(event)
|
||||
edje_edit_string_free(event)
|
||||
return ret
|
||||
|
||||
def __set__(self, event):
|
||||
if isinstance(event, unicode): event = event.encode("UTF-8")
|
||||
edje_edit_part_drag_event_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>event if event is not None else NULL)
|
||||
|
||||
property api:
|
||||
def __get__(self):
|
||||
cdef:
|
||||
const_char *name
|
||||
const_char *description
|
||||
name = edje_edit_part_api_name_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
description = edje_edit_part_api_description_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
n, d = _ctouni(name), _ctouni(description)
|
||||
edje_edit_string_free(name)
|
||||
edje_edit_string_free(description)
|
||||
return (n, d)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef object name, desc
|
||||
name, desc = value
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
if isinstance(desc, unicode): desc = desc.encode("UTF-8")
|
||||
edje_edit_part_api_name_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>name if name is not None else NULL)
|
||||
edje_edit_part_api_description_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>desc if desc is not None else NULL)
|
|
@ -0,0 +1,851 @@
|
|||
# Copyright (C) 2007-2013 various contributors (see AUTHORS)
|
||||
#
|
||||
# This file is part of Python-EFL.
|
||||
#
|
||||
# Python-EFL is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# Python-EFL is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
cdef class State:
|
||||
cdef EdjeEdit edje
|
||||
cdef object part
|
||||
cdef object name
|
||||
cdef object part_obj
|
||||
cdef object value
|
||||
|
||||
def __init__(self, Part part, name, double value=0.0):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
self.part_obj = part
|
||||
self.edje = part.edje
|
||||
self.part = part.name
|
||||
self.name = name
|
||||
self.value = value
|
||||
|
||||
property name:
|
||||
def __get__(self):
|
||||
return self.name
|
||||
|
||||
property value:
|
||||
def __get__(self):
|
||||
return self.value
|
||||
|
||||
def part_get(self):
|
||||
return self.part_obj
|
||||
|
||||
def name_set(self, new_name, new_value=None):
|
||||
if new_value == None:
|
||||
new_value = self.value
|
||||
return bool(edje_edit_state_name_set(self.edje.obj, self.part,
|
||||
self.name, self.value, new_name,
|
||||
new_value))
|
||||
"""
|
||||
def copy_from(self, from_state, from_value=0.0):
|
||||
return bool(edje_edit_state_copy(self.edje.obj, self.part,
|
||||
from_state, from_value, self.name,
|
||||
self.value))
|
||||
"""
|
||||
def rel1_to_get(self):
|
||||
cdef const_char *tx, *ty
|
||||
tx = edje_edit_state_rel1_to_x_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
ty = edje_edit_state_rel1_to_y_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
if tx != NULL:
|
||||
x = tx
|
||||
edje_edit_string_free(tx)
|
||||
else:
|
||||
x = None
|
||||
|
||||
if ty != NULL:
|
||||
y = ty
|
||||
edje_edit_string_free(ty)
|
||||
else:
|
||||
y = None
|
||||
|
||||
return (x, y)
|
||||
"""
|
||||
def rel1_to_set(self, x, y):
|
||||
if x:
|
||||
edje_edit_state_rel1_to_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
else:
|
||||
edje_edit_state_rel1_to_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, NULL)
|
||||
if y:
|
||||
edje_edit_state_rel1_to_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
else:
|
||||
edje_edit_state_rel1_to_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, NULL)
|
||||
# remove when fixed in edje_edit
|
||||
edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
|
||||
property rel1_to:
|
||||
def __get__(self):
|
||||
return self.rel1_to_get()
|
||||
def __set__(self, rel1_to):
|
||||
self.rel1_to_set(*rel1_to)
|
||||
|
||||
def rel1_to_x_set(self, x):
|
||||
if x:
|
||||
edje_edit_state_rel1_to_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
else:
|
||||
edje_edit_state_rel1_to_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, NULL)
|
||||
# remove when fixed in edje_edit
|
||||
edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
|
||||
def rel1_to_y_set(self, y):
|
||||
if y:
|
||||
edje_edit_state_rel1_to_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
else:
|
||||
edje_edit_state_rel1_to_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, NULL)
|
||||
# remove when fixed in edje_edit
|
||||
edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
|
||||
def rel1_relative_get(self):
|
||||
cdef double x, y
|
||||
x = edje_edit_state_rel1_relative_x_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
y = edje_edit_state_rel1_relative_y_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
return (x, y)
|
||||
|
||||
def rel1_relative_set(self, double x, double y):
|
||||
edje_edit_state_rel1_relative_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
edje_edit_state_rel1_relative_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
|
||||
property rel1_relative:
|
||||
def __get__(self):
|
||||
return self.rel1_relative_get()
|
||||
def __set__(self, value):
|
||||
self.rel1_relative_set(*value)
|
||||
|
||||
def rel1_relative_x_set(self, double x):
|
||||
edje_edit_state_rel1_relative_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
|
||||
def rel1_relative_y_set(self, double y):
|
||||
edje_edit_state_rel1_relative_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
|
||||
def rel1_offset_get(self):
|
||||
cdef int x, y
|
||||
x = edje_edit_state_rel1_offset_x_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
y = edje_edit_state_rel1_offset_y_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
return (x, y)
|
||||
|
||||
def rel1_offset_set(self, int x, int y):
|
||||
edje_edit_state_rel1_offset_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
edje_edit_state_rel1_offset_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
|
||||
property rel1_offset:
|
||||
def __get__(self):
|
||||
return self.rel1_offset_get()
|
||||
def __set__(self, value):
|
||||
self.rel1_offset_set(*value)
|
||||
|
||||
def rel1_offset_x_set(self, int x):
|
||||
edje_edit_state_rel1_offset_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
|
||||
def rel1_offset_y_set(self, int y):
|
||||
edje_edit_state_rel1_offset_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
|
||||
def rel2_to_get(self):
|
||||
cdef const_char_ptr tx, ty
|
||||
tx = edje_edit_state_rel2_to_x_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
ty = edje_edit_state_rel2_to_y_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
if tx != NULL:
|
||||
x = tx
|
||||
edje_edit_string_free(tx)
|
||||
else:
|
||||
x = None
|
||||
|
||||
if ty != NULL:
|
||||
y = ty
|
||||
edje_edit_string_free(ty)
|
||||
else:
|
||||
y = None
|
||||
|
||||
return (x, y)
|
||||
|
||||
def rel2_to_set(self, x, y):
|
||||
if x:
|
||||
edje_edit_state_rel2_to_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
else:
|
||||
edje_edit_state_rel2_to_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, NULL)
|
||||
if y:
|
||||
edje_edit_state_rel2_to_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
else:
|
||||
edje_edit_state_rel2_to_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, NULL)
|
||||
# remove when fixed in edje_edit
|
||||
edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
|
||||
property rel2_to:
|
||||
def __get__(self):
|
||||
return self.rel2_to_get()
|
||||
def __set__(self, rel2_to):
|
||||
self.rel2_to_set(*rel2_to)
|
||||
|
||||
def rel2_to_x_set(self, x):
|
||||
if x:
|
||||
edje_edit_state_rel2_to_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
else:
|
||||
edje_edit_state_rel2_to_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, NULL)
|
||||
# remove when fixed in edje_edit
|
||||
edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
def rel2_to_y_set(self, y):
|
||||
if y:
|
||||
edje_edit_state_rel2_to_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
else:
|
||||
edje_edit_state_rel2_to_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, NULL)
|
||||
# remove when fixed in edje_edit
|
||||
edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
|
||||
def rel2_relative_get(self):
|
||||
cdef double x, y
|
||||
x = edje_edit_state_rel2_relative_x_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
y = edje_edit_state_rel2_relative_y_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
return (x, y)
|
||||
|
||||
def rel2_relative_set(self, double x, double y):
|
||||
edje_edit_state_rel2_relative_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
edje_edit_state_rel2_relative_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
|
||||
property rel2_relative:
|
||||
def __get__(self):
|
||||
return self.rel2_relative_get()
|
||||
def __set__(self, value):
|
||||
self.rel2_relative_set(*value)
|
||||
|
||||
def rel2_relative_x_set(self, double x):
|
||||
edje_edit_state_rel2_relative_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
def rel2_relative_y_set(self, double y):
|
||||
edje_edit_state_rel2_relative_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
|
||||
def rel2_offset_get(self):
|
||||
cdef int x, y
|
||||
x = edje_edit_state_rel2_offset_x_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
y = edje_edit_state_rel2_offset_y_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
return (x, y)
|
||||
|
||||
def rel2_offset_set(self, int x, int y):
|
||||
edje_edit_state_rel2_offset_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
edje_edit_state_rel2_offset_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
|
||||
property rel2_offset:
|
||||
def __get__(self):
|
||||
return self.rel2_offset_get()
|
||||
def __set__(self, value):
|
||||
self.rel2_offset_set(*value)
|
||||
|
||||
def rel2_offset_x_set(self, int x):
|
||||
edje_edit_state_rel2_offset_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
def rel2_offset_y_set(self, int y):
|
||||
edje_edit_state_rel2_offset_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
|
||||
def color_get(self):
|
||||
cdef int r, g, b, a
|
||||
edje_edit_state_color_get(self.edje.obj, self.part, self.name,
|
||||
self.value, &r, &g, &b, &a)
|
||||
return (r, g, b, a)
|
||||
|
||||
def color_set(self, int r, int g, int b, int a):
|
||||
edje_edit_state_color_set(self.edje.obj, self.part, self.name,
|
||||
self.value, r, g, b, a)
|
||||
|
||||
property color:
|
||||
def __get__(self):
|
||||
return self.color_get()
|
||||
def __set__(self, color):
|
||||
self.color_set(*color)
|
||||
|
||||
def color2_get(self):
|
||||
cdef int r, g, b, a
|
||||
edje_edit_state_color2_get(self.edje.obj, self.part, self.name,
|
||||
self.value, &r, &g, &b, &a)
|
||||
return (r, g, b, a)
|
||||
|
||||
def color2_set(self, int r, int g, int b, int a):
|
||||
edje_edit_state_color2_set(self.edje.obj, self.part, self.name,
|
||||
self.value, r, g, b, a)
|
||||
|
||||
property color2:
|
||||
def __get__(self):
|
||||
return self.color2_get()
|
||||
def __set__(self, color):
|
||||
self.color2_set(*color)
|
||||
|
||||
def color3_get(self):
|
||||
cdef int r, g, b, a
|
||||
edje_edit_state_color3_get(self.edje.obj, self.part, self.name,
|
||||
self.value, &r, &g, &b, &a)
|
||||
return (r, g, b, a)
|
||||
|
||||
def color3_set(self, int r, int g, int b, int a):
|
||||
edje_edit_state_color3_set(self.edje.obj, self.part, self.name,
|
||||
self.value, r, g, b, a)
|
||||
|
||||
property color3:
|
||||
def __get__(self):
|
||||
return self.color3_get()
|
||||
def __set__(self, color):
|
||||
self.color3_set(*color)
|
||||
|
||||
def align_get(self):
|
||||
cdef double x, y
|
||||
x = edje_edit_state_align_x_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
y = edje_edit_state_align_y_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
return (x, y)
|
||||
|
||||
def align_set(self, double x, double y):
|
||||
edje_edit_state_align_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
edje_edit_state_align_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
|
||||
property align:
|
||||
def __get__(self):
|
||||
return self.align_get()
|
||||
def __set__(self, align):
|
||||
self.align_set(*align)
|
||||
|
||||
def min_get(self):
|
||||
cdef int w, h
|
||||
w = edje_edit_state_min_w_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
h = edje_edit_state_min_h_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
return (w, h)
|
||||
|
||||
def min_set(self, int w, int h):
|
||||
edje_edit_state_min_w_set(self.edje.obj, self.part, self.name,
|
||||
self.value, w)
|
||||
edje_edit_state_min_h_set(self.edje.obj, self.part, self.name,
|
||||
self.value, h)
|
||||
|
||||
property min:
|
||||
def __get__(self):
|
||||
return self.min_get()
|
||||
def __set__(self, min):
|
||||
self.min_set(*min)
|
||||
|
||||
def max_get(self):
|
||||
cdef int w, h
|
||||
w = edje_edit_state_max_w_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
h = edje_edit_state_max_h_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
return (w, h)
|
||||
|
||||
def max_set(self, int w, int h):
|
||||
edje_edit_state_max_w_set(self.edje.obj, self.part, self.name,
|
||||
self.value, w)
|
||||
edje_edit_state_max_h_set(self.edje.obj, self.part, self.name,
|
||||
self.value, h)
|
||||
|
||||
property max:
|
||||
def __get__(self):
|
||||
return self.max_get()
|
||||
def __set__(self, max):
|
||||
self.max_set(*max)
|
||||
|
||||
def aspect_min_get(self):
|
||||
return edje_edit_state_aspect_min_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
|
||||
def aspect_min_set(self, double a):
|
||||
edje_edit_state_aspect_min_set(self.edje.obj, self.part, self.name,
|
||||
self.value, a)
|
||||
|
||||
def aspect_max_get(self):
|
||||
return edje_edit_state_aspect_max_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
|
||||
def aspect_max_set(self, double a):
|
||||
edje_edit_state_aspect_max_set(self.edje.obj, self.part, self.name,
|
||||
self.value, a)
|
||||
|
||||
def aspect_pref_get(self):
|
||||
return edje_edit_state_aspect_pref_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
|
||||
def aspect_pref_set(self, char a):
|
||||
edje_edit_state_aspect_pref_set(self.edje.obj, self.part, self.name,
|
||||
self.value, a)
|
||||
|
||||
def fill_origin_relative_get(self):
|
||||
cdef double x, y
|
||||
x = edje_edit_state_fill_origin_relative_x_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
y = edje_edit_state_fill_origin_relative_y_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
return (x, y)
|
||||
|
||||
def fill_origin_relative_set(self, double x, double y):
|
||||
edje_edit_state_fill_origin_relative_x_set(self.edje.obj, self.part,
|
||||
self.name, self.value, x)
|
||||
edje_edit_state_fill_origin_relative_y_set(self.edje.obj, self.part,
|
||||
self.name, self.value, y)
|
||||
|
||||
def fill_origin_offset_get(self):
|
||||
cdef int x, y
|
||||
x = edje_edit_state_fill_origin_offset_x_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
y = edje_edit_state_fill_origin_offset_y_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
return (x, y)
|
||||
|
||||
def fill_origin_offset_set(self, x, y):
|
||||
edje_edit_state_fill_origin_offset_x_set(self.edje.obj, self.part,
|
||||
self.name, self.value, x)
|
||||
edje_edit_state_fill_origin_offset_y_set(self.edje.obj, self.part,
|
||||
self.name, self.value, y)
|
||||
|
||||
def fill_size_relative_get(self):
|
||||
cdef double x, y
|
||||
x = edje_edit_state_fill_size_relative_x_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
y = edje_edit_state_fill_size_relative_y_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
return (x, y)
|
||||
|
||||
def fill_size_relative_set(self, double x, double y):
|
||||
edje_edit_state_fill_size_relative_x_set(self.edje.obj, self.part,
|
||||
self.name, self.value, x)
|
||||
edje_edit_state_fill_size_relative_y_set(self.edje.obj, self.part,
|
||||
self.name, self.value, y)
|
||||
|
||||
def fill_size_offset_get(self):
|
||||
cdef int x, y
|
||||
x = edje_edit_state_fill_size_offset_x_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
y = edje_edit_state_fill_size_offset_y_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
return (x, y)
|
||||
|
||||
def fill_size_offset_set(self, x, y):
|
||||
edje_edit_state_fill_size_offset_x_set(self.edje.obj, self.part,
|
||||
self.name, self.value, x)
|
||||
edje_edit_state_fill_size_offset_y_set(self.edje.obj, self.part,
|
||||
self.name, self.value, y)
|
||||
|
||||
property visible:
|
||||
def __get__(self):
|
||||
return bool(edje_edit_state_visible_get(self.edje.obj, self.part,
|
||||
self.name, self.value))
|
||||
def __set__(self, v):
|
||||
if v:
|
||||
edje_edit_state_visible_set(self.edje.obj, self.part, self.name,
|
||||
self.value, 1)
|
||||
else:
|
||||
edje_edit_state_visible_set(self.edje.obj, self.part, self.name, self.value, 0)
|
||||
|
||||
def color_class_get(self):
|
||||
cdef const_char_ptr cc
|
||||
cc = edje_edit_state_color_class_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
if cc == NULL:
|
||||
return None
|
||||
rcc = cc
|
||||
edje_edit_string_free(cc)
|
||||
return rcc
|
||||
|
||||
def color_class_set(self, cc):
|
||||
if not cc:
|
||||
edje_edit_state_color_class_set(self.edje.obj, self.part,
|
||||
self.name, self.value, NULL)
|
||||
else:
|
||||
edje_edit_state_color_class_set(self.edje.obj, self.part,
|
||||
self.name, self.value, cc)
|
||||
|
||||
def external_params_get(self):
|
||||
cdef evas.c_evas.const_Eina_List *lst
|
||||
ret = []
|
||||
lst = edje_edit_state_external_params_list_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
while lst:
|
||||
p = c_edje._ExternalParam_from_ptr(<long>lst.data)
|
||||
if p is not None:
|
||||
ret.append(p)
|
||||
lst = lst.next
|
||||
return ret
|
||||
|
||||
def external_param_get(self, param):
|
||||
cdef c_edje.Edje_External_Param_Type type
|
||||
cdef void *value
|
||||
cdef const_char_ptr s
|
||||
|
||||
if not edje_edit_state_external_param_get(self.edje.obj, self.part,
|
||||
self.name, self.value, param,
|
||||
&type, &value):
|
||||
return None
|
||||
if type == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
||||
b = (<evas.c_evas.Eina_Bool *>value)[0]
|
||||
return (type, bool(b))
|
||||
elif type == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_INT:
|
||||
i = (<int *>value)[0]
|
||||
return (type, i)
|
||||
elif type == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
||||
d = (<double *>value)[0]
|
||||
return (type, d)
|
||||
elif type == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
||||
s = <char *>value
|
||||
if s == NULL:
|
||||
return (type, None)
|
||||
else:
|
||||
return (type, s)
|
||||
elif type == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
||||
s = <char *>value
|
||||
if s == NULL:
|
||||
return (type, None)
|
||||
else:
|
||||
return (type, s)
|
||||
return None
|
||||
|
||||
def external_param_set(self, param, value):
|
||||
cdef const_char_ptr expected
|
||||
|
||||
if isinstance(value, bool):
|
||||
return self.external_param_bool_set(param, value)
|
||||
elif isinstance(value, (long, int)):
|
||||
return self.external_param_int_set(param, value)
|
||||
elif isinstance(value, float):
|
||||
return self.external_param_double_set(param, value)
|
||||
elif isinstance(value, str):
|
||||
t = edje_object_part_external_param_type_get(
|
||||
self.edje.obj, self.part, param)
|
||||
if t == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
||||
return self.external_param_string_set(param, value)
|
||||
elif t == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
||||
return self.external_param_choice_set(param, value)
|
||||
|
||||
t = edje_object_part_external_param_type_get(
|
||||
self.edje.obj, self.part, param)
|
||||
if t >= edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_MAX:
|
||||
raise TypeError("no external parameter %s" % (param,))
|
||||
else:
|
||||
expected = edje_external_param_type_str(t)
|
||||
raise TypeError(
|
||||
"invalid external parameter %s of (%s), expected %s" %
|
||||
(param, type(value).__name__, expected))
|
||||
|
||||
def external_param_int_get(self, param):
|
||||
cdef int value
|
||||
|
||||
if not edje_edit_state_external_param_int_get(self.edje.obj, self.part,
|
||||
self.name, self.value,
|
||||
param, &value):
|
||||
return None
|
||||
return value
|
||||
|
||||
def external_param_bool_get(self, param):
|
||||
cdef evas.c_evas.Eina_Bool value
|
||||
|
||||
if not edje_edit_state_external_param_bool_get(
|
||||
self.edje.obj, self.part, self.name, self.value, param, &value):
|
||||
return None
|
||||
return bool(value)
|
||||
|
||||
def external_param_double_get(self, param):
|
||||
cdef double value
|
||||
|
||||
if not edje_edit_state_external_param_double_get(self.edje.obj, self.part,
|
||||
self.name, self.value,
|
||||
param, &value):
|
||||
return None
|
||||
return value
|
||||
|
||||
def external_param_string_get(self, param):
|
||||
cdef const_char_ptr value
|
||||
|
||||
if not edje_edit_state_external_param_string_get(
|
||||
self.edje.obj, self.part, self.name, self.value, param, &value):
|
||||
return None
|
||||
if value != NULL:
|
||||
return value
|
||||
|
||||
def external_param_choice_get(self, param):
|
||||
cdef const_char_ptr value
|
||||
|
||||
if not edje_edit_state_external_param_choice_get(
|
||||
self.edje.obj, self.part, self.name, self.value, param, &value):
|
||||
return None
|
||||
if value != NULL:
|
||||
return value
|
||||
|
||||
def external_param_int_set(self, param, value):
|
||||
return bool(edje_edit_state_external_param_int_set(self.edje.obj,
|
||||
self.part, self.name,
|
||||
self.value, param,
|
||||
value))
|
||||
|
||||
def external_param_bool_set(self, param, value):
|
||||
return bool(edje_edit_state_external_param_bool_set(
|
||||
self.edje.obj, self.part, self.name, self.value, param, value))
|
||||
|
||||
def external_param_double_set(self, param, value):
|
||||
return bool(edje_edit_state_external_param_double_set(self.edje.obj,
|
||||
self.part, self.name,
|
||||
self.value,param,
|
||||
value))
|
||||
|
||||
def external_param_string_set(self, param, value):
|
||||
return bool(edje_edit_state_external_param_string_set(self.edje.obj,
|
||||
self.part, self.name,
|
||||
self.value, param,
|
||||
value))
|
||||
|
||||
def external_param_choice_set(self, param, value):
|
||||
return bool(edje_edit_state_external_param_choice_set(
|
||||
self.edje.obj, self.part, self.name, self.value, param, value))
|
||||
|
||||
def text_get(self):
|
||||
cdef const_char_ptr t
|
||||
t = edje_edit_state_text_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
if t == NULL:
|
||||
return None
|
||||
r = t
|
||||
edje_edit_string_free(t)
|
||||
return r
|
||||
|
||||
def text_set(self, t):
|
||||
edje_edit_state_text_set(self.edje.obj, self.part, self.name,
|
||||
self.value, t)
|
||||
|
||||
property text:
|
||||
def __get__(self):
|
||||
return self.text_get()
|
||||
def __set__(self, text):
|
||||
self.text_set(text)
|
||||
|
||||
def font_get(self):
|
||||
cdef const_char_ptr f
|
||||
f = edje_edit_state_font_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
if f == NULL:
|
||||
return None
|
||||
r = f
|
||||
edje_edit_string_free(f)
|
||||
return r
|
||||
|
||||
def font_set(self, char *f):
|
||||
edje_edit_state_font_set(self.edje.obj, self.part, self.name,
|
||||
self.value, f)
|
||||
|
||||
property font:
|
||||
def __get__(self):
|
||||
return self.font_get()
|
||||
def __set__(self, font):
|
||||
self.font_set(font)
|
||||
|
||||
def text_size_get(self):
|
||||
return edje_edit_state_text_size_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
|
||||
def text_size_set(self, int s):
|
||||
edje_edit_state_text_size_set(self.edje.obj, self.part, self.name,
|
||||
self.value, s)
|
||||
|
||||
property text_size:
|
||||
def __get__(self):
|
||||
return self.text_size_get()
|
||||
def __set__(self, value):
|
||||
self.text_size_set(value)
|
||||
|
||||
def text_align_get(self):
|
||||
cdef double x, y
|
||||
x = edje_edit_state_text_align_x_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
y = edje_edit_state_text_align_y_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
return (x, y)
|
||||
|
||||
def text_align_set(self, double x, double y):
|
||||
edje_edit_state_text_align_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, x)
|
||||
edje_edit_state_text_align_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, y)
|
||||
|
||||
property text_align:
|
||||
def __get__(self):
|
||||
return self.text_align_get()
|
||||
def __set__(self, align):
|
||||
self.text_align_set(*align)
|
||||
|
||||
def text_elipsis_get(self):
|
||||
return edje_edit_state_text_elipsis_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
|
||||
def text_elipsis_set(self, double e):
|
||||
edje_edit_state_text_elipsis_set(self.edje.obj, self.part, self.name,
|
||||
self.value, e)
|
||||
|
||||
property text_elipsis:
|
||||
def __get__(self):
|
||||
return self.text_elipsis_get()
|
||||
def __set__(self, value):
|
||||
self.text_elipsis_set(value)
|
||||
|
||||
def text_fit_get(self):
|
||||
x = bool(edje_edit_state_text_fit_x_get(self.edje.obj, self.part,
|
||||
self.name, self.value))
|
||||
y = bool(edje_edit_state_text_fit_y_get(self.edje.obj, self.part,
|
||||
self.name, self.value))
|
||||
return (x, y)
|
||||
|
||||
def text_fit_set(self, x, y):
|
||||
if x:
|
||||
edje_edit_state_text_fit_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, 1)
|
||||
else:
|
||||
edje_edit_state_text_fit_x_set(self.edje.obj, self.part, self.name,
|
||||
self.value, 0)
|
||||
if y:
|
||||
edje_edit_state_text_fit_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, 1)
|
||||
else:
|
||||
edje_edit_state_text_fit_y_set(self.edje.obj, self.part, self.name,
|
||||
self.value, 0)
|
||||
|
||||
property text_fit:
|
||||
def __get__(self):
|
||||
return self.text_fit_get()
|
||||
def __set__(self, value):
|
||||
self.text_fit_set(*value)
|
||||
|
||||
def image_get(self):
|
||||
cdef const_char_ptr img
|
||||
img = edje_edit_state_image_get(self.edje.obj, self.part, self.name,
|
||||
self.value)
|
||||
if img == NULL:
|
||||
return None
|
||||
r = img
|
||||
edje_edit_string_free(img)
|
||||
return r
|
||||
|
||||
def image_set(self, char *image):
|
||||
if not image:
|
||||
return
|
||||
|
||||
edje_edit_state_image_set(self.edje.obj, self.part, self.name,
|
||||
self.value, image)
|
||||
|
||||
property image:
|
||||
def __get__(self):
|
||||
return self.image_get()
|
||||
def __set__(self, image):
|
||||
self.image_set(image)
|
||||
|
||||
def image_border_get(self):
|
||||
cdef int l, r, t, b
|
||||
edje_edit_state_image_border_get(self.edje.obj, self.part, self.name,
|
||||
self.value, &l, &r, &t, &b)
|
||||
return (l, r, t, b)
|
||||
|
||||
def image_border_set(self, int l, int r, int t, int b):
|
||||
edje_edit_state_image_border_set(self.edje.obj, self.part, self.name,
|
||||
self.value, l, r, t, b)
|
||||
|
||||
property image_border:
|
||||
def __get__(self):
|
||||
return self.image_border_get()
|
||||
def __set__(self, value):
|
||||
self.image_border_set(*value)
|
||||
|
||||
def image_border_fill_get(self):
|
||||
cdef unsigned char r
|
||||
r = edje_edit_state_image_border_fill_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
if r == 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
def image_border_fill_set(self, fill):
|
||||
if fill:
|
||||
edje_edit_state_image_border_fill_set(self.edje.obj, self.part,
|
||||
self.name, self.value, 1)
|
||||
else:
|
||||
edje_edit_state_image_border_fill_set(self.edje.obj, self.part,
|
||||
self.name, self.value, 0)
|
||||
|
||||
property image_border_fill:
|
||||
def __get__(self):
|
||||
return self.image_border_fill_get()
|
||||
def __set__(self, value):
|
||||
self.image_border_fill_set(value)
|
||||
|
||||
property tweens:
|
||||
def __get__(self):
|
||||
"@rtype: list of str"
|
||||
cdef evas.c_evas.Eina_List *lst, *itr
|
||||
ret = []
|
||||
lst = edje_edit_state_tweens_list_get(self.edje.obj, self.part,
|
||||
self.name, self.value)
|
||||
itr = lst
|
||||
while itr:
|
||||
ret.append(<char*>itr.data)
|
||||
itr = itr.next
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def tween_add(self, char *img):
|
||||
return bool(edje_edit_state_tween_add(self.edje.obj, self.part,
|
||||
self.name, self.value, img))
|
||||
|
||||
def tween_del(self, char *img):
|
||||
return bool(edje_edit_state_tween_del(self.edje.obj, self.part,
|
||||
self.name, self.value, img))
|
||||
"""
|
|
@ -0,0 +1,260 @@
|
|||
# Copyright (C) 2007-2013 various contributors (see AUTHORS)
|
||||
#
|
||||
# This file is part of Python-EFL.
|
||||
#
|
||||
# Python-EFL is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# Python-EFL is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
cdef class Program(object):
|
||||
cdef EdjeEdit edje
|
||||
cdef object name
|
||||
|
||||
def __init__(self, EdjeEdit e, name):
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
self.edje = e
|
||||
self.name = name
|
||||
|
||||
property name:
|
||||
def __get__(self):
|
||||
return self.name.decode('UTF-8', 'strict')
|
||||
|
||||
def __set__(self, newname):
|
||||
self.rename(newname)
|
||||
|
||||
def rename(self, newname):
|
||||
cdef Eina_Bool ret
|
||||
if isinstance(newname, unicode): newname = newname.encode("UTF-8")
|
||||
ret = edje_edit_program_name_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>newname if newname is not None else NULL)
|
||||
if ret == 0:
|
||||
return False
|
||||
self.name = newname
|
||||
return True
|
||||
|
||||
def edje_get(self):
|
||||
return self.edje
|
||||
|
||||
def run(self):
|
||||
return bool(edje_edit_program_run(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL))
|
||||
|
||||
# XXX TODO: add (or better convert) all this to properties
|
||||
# like is done in Part()
|
||||
def source_get(self):
|
||||
cdef const_char *s
|
||||
s = edje_edit_program_source_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(s)
|
||||
edje_edit_string_free(s)
|
||||
return ret
|
||||
|
||||
def source_set(self, source):
|
||||
if isinstance(source, unicode): source = source.encode("UTF-8")
|
||||
return bool(edje_edit_program_source_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>source if source is not None else NULL))
|
||||
|
||||
def signal_get(self):
|
||||
cdef const_char *s
|
||||
s = edje_edit_program_signal_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(s)
|
||||
edje_edit_string_free(s)
|
||||
return ret
|
||||
|
||||
def signal_set(self, signal):
|
||||
if isinstance(signal, unicode): signal = signal.encode("UTF-8")
|
||||
return bool(edje_edit_program_signal_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>signal if signal is not None else NULL))
|
||||
|
||||
def in_from_get(self):
|
||||
return edje_edit_program_in_from_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
|
||||
def in_from_set(self, double f):
|
||||
return bool(edje_edit_program_in_from_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, f))
|
||||
|
||||
def in_range_get(self):
|
||||
return edje_edit_program_in_range_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
|
||||
def in_range_set(self, double r):
|
||||
return bool(edje_edit_program_in_range_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, r))
|
||||
|
||||
def action_get(self):
|
||||
return edje_edit_program_action_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
|
||||
def action_set(self, action):
|
||||
if isinstance(action, unicode): action = action.encode("UTF-8")
|
||||
return bool(edje_edit_program_action_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
action))
|
||||
|
||||
def targets_get(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_program_targets_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def target_add(self, target):
|
||||
if isinstance(target, unicode): target = target.encode("UTF-8")
|
||||
return bool(edje_edit_program_target_add(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>target if target is not None else NULL))
|
||||
|
||||
def target_del(self, target):
|
||||
if isinstance(target, unicode): target = target.encode("UTF-8")
|
||||
return bool(edje_edit_program_target_del(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>target if target is not None else NULL))
|
||||
|
||||
def targets_clear(self):
|
||||
return bool(edje_edit_program_targets_clear(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL))
|
||||
|
||||
def afters_get(self):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_edit_program_afters_get(self.edje.obj, self.name)
|
||||
ret = convert_eina_list_strings_to_python_list(lst)
|
||||
edje_edit_string_list_free(lst)
|
||||
return ret
|
||||
|
||||
def after_add(self, after):
|
||||
if isinstance(after, unicode): after = after.encode("UTF-8")
|
||||
return bool(edje_edit_program_after_add(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>after if after is not None else NULL))
|
||||
|
||||
def after_del(self, after):
|
||||
if isinstance(after, unicode): after = after.encode("UTF-8")
|
||||
return bool(edje_edit_program_after_del(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>after if after is not None else NULL))
|
||||
|
||||
def afters_clear(self):
|
||||
return bool(edje_edit_program_afters_clear(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL))
|
||||
|
||||
def state_get(self):
|
||||
cdef const_char *s
|
||||
s = edje_edit_program_state_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(s)
|
||||
edje_edit_string_free(s)
|
||||
return ret
|
||||
|
||||
def state_set(self, state):
|
||||
if isinstance(state, unicode): state = state.encode("UTF-8")
|
||||
return bool(edje_edit_program_state_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>state if state is not None else NULL))
|
||||
|
||||
def value_get(self):
|
||||
return edje_edit_program_value_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
|
||||
def value_set(self, double v):
|
||||
return bool(edje_edit_program_value_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, v))
|
||||
|
||||
def state2_get(self):
|
||||
cdef const_char *s
|
||||
s = edje_edit_program_state2_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _ctouni(s)
|
||||
edje_edit_string_free(s)
|
||||
return ret
|
||||
|
||||
def state2_set(self, state):
|
||||
if isinstance(state, unicode): state = state.encode("UTF-8")
|
||||
return bool(edje_edit_program_state2_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>state if state is not None else NULL))
|
||||
|
||||
def value2_get(self):
|
||||
return edje_edit_program_value2_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
|
||||
def value2_set(self, double v):
|
||||
return bool(edje_edit_program_value2_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, v))
|
||||
|
||||
def transition_get(self):
|
||||
return edje_edit_program_transition_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
|
||||
def transition_set(self, t):
|
||||
return bool(edje_edit_program_transition_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, t))
|
||||
|
||||
def transition_time_get(self):
|
||||
return edje_edit_program_transition_time_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
|
||||
def transition_time_set(self, double t):
|
||||
return bool(edje_edit_program_transition_time_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, t))
|
||||
|
||||
property api:
|
||||
def __get__(self):
|
||||
cdef:
|
||||
const_char *name
|
||||
const_char *desc
|
||||
name = edje_edit_program_api_name_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
desc = edje_edit_program_api_description_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
n, d = _ctouni(name), _ctouni(desc)
|
||||
edje_edit_string_free(name)
|
||||
edje_edit_string_free(desc)
|
||||
return (n, d)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef object name, desc
|
||||
name, desc = value
|
||||
if isinstance(name, unicode): name = name.encode("UTF-8")
|
||||
if isinstance(desc, unicode): desc = desc.encode("UTF-8")
|
||||
edje_edit_program_api_name_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>name if name is not None else NULL)
|
||||
edje_edit_program_api_description_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>desc if desc is not None else NULL)
|
||||
|
||||
property script:
|
||||
def __get__(self):
|
||||
cdef char *code
|
||||
code = edje_edit_script_program_get(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL)
|
||||
ret = _touni(code)
|
||||
free(code)
|
||||
return ret
|
||||
|
||||
def __set__(self, code):
|
||||
if isinstance(code, unicode): code = code.encode("UTF-8")
|
||||
edje_edit_script_program_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL,
|
||||
<const_char *>code if code is not None else NULL)
|
||||
|
||||
def __del__(self):
|
||||
edje_edit_script_program_set(self.edje.obj,
|
||||
<const_char *>self.name if self.name is not None else NULL, NULL)
|
||||
|
|
@ -0,0 +1,321 @@
|
|||
# Copyright (C) 2007-2013 various contributors (see AUTHORS)
|
||||
#
|
||||
# This file is part of Python-EFL.
|
||||
#
|
||||
# Python-EFL is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# Python-EFL is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from efl cimport *
|
||||
from efl.evas cimport Canvas, Evas_Event_Flags
|
||||
from efl.evas cimport Evas_Object, Evas
|
||||
from efl.edje cimport Edje, Edje_Part_Type, Edje_Text_Effect, Edje_Tween_Mode, \
|
||||
Edje_Action_Type
|
||||
|
||||
|
||||
cdef extern from "Edje_Edit.h":
|
||||
####################################################################
|
||||
# Enumerations
|
||||
#
|
||||
ctypedef enum Edje_Edit_Image_Comp:
|
||||
pass
|
||||
|
||||
####################################################################
|
||||
# Structures
|
||||
#
|
||||
ctypedef struct Edje_Edit_Script_Error:
|
||||
const_char *program_name
|
||||
int line
|
||||
const_char *error_str
|
||||
|
||||
####################################################################
|
||||
# Engine
|
||||
#
|
||||
|
||||
# general
|
||||
Evas_Object *edje_edit_object_add(Evas *e)
|
||||
void edje_edit_string_free(const_char *str)
|
||||
void edje_edit_string_list_free(Eina_List *lst)
|
||||
|
||||
const_char *edje_edit_compiler_get(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_save(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_save_all(Evas_Object *obj)
|
||||
void edje_edit_print_internal_status(Evas_Object *obj)
|
||||
|
||||
# group
|
||||
Eina_Bool edje_edit_group_add(Evas_Object *obj, char *name)
|
||||
Eina_Bool edje_edit_group_del(Evas_Object *obj, char *group_name)
|
||||
Eina_Bool edje_edit_group_exist(Evas_Object *obj, char *group)
|
||||
Eina_Bool edje_edit_group_name_set(Evas_Object *obj, char *new_name)
|
||||
int edje_edit_group_min_w_get(Evas_Object *obj)
|
||||
void edje_edit_group_min_w_set(Evas_Object *obj, int w)
|
||||
int edje_edit_group_min_h_get(Evas_Object *obj)
|
||||
void edje_edit_group_min_h_set(Evas_Object *obj, int h)
|
||||
int edje_edit_group_max_w_get(Evas_Object *obj)
|
||||
void edje_edit_group_max_w_set(Evas_Object *obj, int w)
|
||||
int edje_edit_group_max_h_get(Evas_Object *obj)
|
||||
void edje_edit_group_max_h_set(Evas_Object *obj, int h)
|
||||
|
||||
# data
|
||||
Eina_List *edje_edit_data_list_get(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_data_add(Evas_Object *obj, const_char *itemname, const_char *value)
|
||||
Eina_Bool edje_edit_data_del(Evas_Object *obj, const_char *itemname)
|
||||
const_char *edje_edit_data_value_get(Evas_Object * obj, const_char *itemname)
|
||||
Eina_Bool edje_edit_data_value_set(Evas_Object * obj, const_char *itemname, const_char *value)
|
||||
Eina_Bool edje_edit_data_name_set(Evas_Object *obj, const_char *itemname, const_char *newname)
|
||||
|
||||
Eina_List *edje_edit_group_data_list_get(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_group_data_add(Evas_Object *obj, const_char *itemname, const_char *value)
|
||||
Eina_Bool edje_edit_group_data_del(Evas_Object *obj, const_char *itemname)
|
||||
const_char *edje_edit_group_data_value_get(Evas_Object *obj, const_char *itemname)
|
||||
Eina_Bool edje_edit_group_data_value_set(Evas_Object *obj, const_char *itemname, const_char *value)
|
||||
Eina_Bool edje_edit_group_data_name_set(Evas_Object *obj, const_char *itemname, const_char *newname)
|
||||
|
||||
# text styles
|
||||
Eina_List *edje_edit_styles_list_get(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_style_add(Evas_Object *obj, const_char *style)
|
||||
void edje_edit_style_del(Evas_Object *obj, const_char *style)
|
||||
Eina_List *edje_edit_style_tags_list_get(Evas_Object *obj, const_char *style)
|
||||
const_char *edje_edit_style_tag_value_get(Evas_Object *obj, const_char *style, const_char *tag)
|
||||
void edje_edit_style_tag_value_set(Evas_Object *obj, const_char *style, const_char *tag, const_char *new_value)
|
||||
void edje_edit_style_tag_name_set(Evas_Object *obj, const_char *style, const_char *tag, const_char *new_name)
|
||||
Eina_Bool edje_edit_style_tag_add(Evas_Object *obj, const_char *style, const_char *tag_name)
|
||||
void edje_edit_style_tag_del(Evas_Object *obj, const_char *style, const_char *tag)
|
||||
|
||||
# fonts
|
||||
Eina_List *edje_edit_fonts_list_get(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_font_add(Evas_Object *obj, const_char *path, const_char *alias)
|
||||
Eina_Bool edje_edit_font_del(Evas_Object *obj, const_char *alias)
|
||||
|
||||
# color classes
|
||||
Eina_List *edje_edit_color_classes_list_get(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_color_class_add(Evas_Object *obj, const_char *name)
|
||||
Eina_Bool edje_edit_color_class_del(Evas_Object *obj, const_char *name)
|
||||
Eina_Bool edje_edit_color_class_colors_get(Evas_Object *obj, const_char *class_name, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3)
|
||||
Eina_Bool edje_edit_color_class_colors_set(Evas_Object *obj, const_char *class_name, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3)
|
||||
Eina_Bool edje_edit_color_class_name_set(Evas_Object *obj, const_char *name, const_char *newname)
|
||||
|
||||
# externals
|
||||
Eina_List *edje_edit_externals_list_get(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_external_add(Evas_Object *obj, const_char *name)
|
||||
Eina_Bool edje_edit_external_del(Evas_Object *obj, const_char *name)
|
||||
|
||||
# images
|
||||
Eina_List *edje_edit_images_list_get(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_image_add(Evas_Object *obj, const_char *path)
|
||||
Eina_Bool edje_edit_image_del(Evas_Object *obj, const_char *name)
|
||||
Eina_Bool edje_edit_image_data_add(Evas_Object *obj, const_char *name, int id)
|
||||
const_char *edje_edit_state_image_get(Evas_Object *obj, const_char *part, const_char *state, double value)
|
||||
void edje_edit_state_image_set(Evas_Object *obj, const_char *part, const_char *state, double value, const_char *image)
|
||||
int edje_edit_image_id_get(Evas_Object *obj, const_char *image_name)
|
||||
Edje_Edit_Image_Comp edje_edit_image_compression_type_get(Evas_Object *obj, const_char *image)
|
||||
int edje_edit_image_compression_rate_get(Evas_Object *obj, const_char *image)
|
||||
void edje_edit_state_image_border_get(Evas_Object *obj, const_char *part, const_char *state, double value, int *l, int *r, int *t, int *b)
|
||||
void edje_edit_state_image_border_set(Evas_Object *obj, const_char *part, const_char *state, double value, int l, int r, int t, int b)
|
||||
unsigned char edje_edit_state_image_border_fill_get(Evas_Object *obj, const_char *part, const_char *state, double value)
|
||||
void edje_edit_state_image_border_fill_set(Evas_Object *obj, const_char *part, const_char *state, double value, unsigned char fill)
|
||||
Eina_List *edje_edit_state_tweens_list_get(Evas_Object *obj, const_char *part, const_char *state, double value)
|
||||
Eina_Bool edje_edit_state_tween_add(Evas_Object *obj, const_char *part, const_char *state, double value, const_char *tween)
|
||||
Eina_Bool edje_edit_state_tween_del(Evas_Object *obj, const_char *part, const_char *state, double value, const_char *tween)
|
||||
|
||||
# part
|
||||
Eina_List *edje_edit_parts_list_get(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_part_add(Evas_Object *obj, const_char *name, Edje_Part_Type type)
|
||||
Eina_Bool edje_edit_part_external_add(Evas_Object *obj, const_char *name, const_char *source)
|
||||
Eina_Bool edje_edit_part_del(Evas_Object *obj, const_char *part)
|
||||
Eina_Bool edje_edit_part_exist(Evas_Object *obj, const_char *part)
|
||||
const_char *edje_edit_part_above_get(Evas_Object *obj, const_char *part)
|
||||
const_char *edje_edit_part_below_get(Evas_Object *obj, const_char *part)
|
||||
Eina_Bool edje_edit_part_restack_below(Evas_Object *obj, const_char *part)
|
||||
Eina_Bool edje_edit_part_restack_above(Evas_Object *obj, const_char *part)
|
||||
Eina_Bool edje_edit_part_name_set(Evas_Object *obj, const_char *part, const_char *new_name)
|
||||
Edje_Part_Type edje_edit_part_type_get(Evas_Object *obj, const_char *part)
|
||||
const_char *edje_edit_part_clip_to_get(Evas_Object *obj, const_char *part)
|
||||
Eina_Bool edje_edit_part_clip_to_set(Evas_Object *obj, const_char *part, const_char *clip_to)
|
||||
const_char *edje_edit_part_source_get(Evas_Object *obj, const_char *part)
|
||||
Eina_Bool edje_edit_part_source_set(Evas_Object *obj, const_char *part, const_char *source)
|
||||
Edje_Text_Effect edje_edit_part_effect_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_effect_set(Evas_Object *obj, const_char *part, Edje_Text_Effect effect)
|
||||
const_char *edje_edit_part_selected_state_get(Evas_Object *obj, const_char *part, double *value)
|
||||
Eina_Bool edje_edit_part_selected_state_set(Evas_Object *obj, const_char *part, const_char *state, double value)
|
||||
Eina_Bool edje_edit_part_mouse_events_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_mouse_events_set(Evas_Object *obj, const_char *part, Eina_Bool mouse_events)
|
||||
Eina_Bool edje_edit_part_repeat_events_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_repeat_events_set(Evas_Object *obj, const_char *part, Eina_Bool repeat_events)
|
||||
Evas_Event_Flags edje_edit_part_ignore_flags_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_ignore_flags_set(Evas_Object *obj, const_char *part, Evas_Event_Flags ignore_flags)
|
||||
void edje_edit_part_scale_set(Evas_Object *obj, const_char *part, Eina_Bool scale)
|
||||
Eina_Bool edje_edit_part_scale_get(Evas_Object *obju, const_char *part)
|
||||
int edje_edit_part_drag_x_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_drag_x_set(Evas_Object *obj, const_char *part, int drag)
|
||||
int edje_edit_part_drag_y_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_drag_y_set(Evas_Object *obj, const_char *part, int drag)
|
||||
int edje_edit_part_drag_step_x_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_drag_step_x_set(Evas_Object *obj, const_char *part, int step)
|
||||
int edje_edit_part_drag_step_y_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_drag_step_y_set(Evas_Object *obj, const_char *part, int step)
|
||||
int edje_edit_part_drag_count_x_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_drag_count_x_set(Evas_Object *obj, const_char *part, int count)
|
||||
int edje_edit_part_drag_count_y_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_drag_count_y_set(Evas_Object *obj, const_char *part, int count)
|
||||
const_char *edje_edit_part_drag_confine_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_drag_confine_set(Evas_Object *obj, const_char *part, const_char *confine)
|
||||
const_char *edje_edit_part_drag_event_get(Evas_Object *obj, const_char *part)
|
||||
void edje_edit_part_drag_event_set(Evas_Object *obj, const_char *part, const_char *event)
|
||||
const_char *edje_edit_part_api_name_get(Evas_Object *obj, const_char *part)
|
||||
const_char *edje_edit_part_api_description_get(Evas_Object *obj, const_char *part)
|
||||
Eina_Bool edje_edit_part_api_name_set(Evas_Object *obj, const_char *part, const_char *name)
|
||||
Eina_Bool edje_edit_part_api_description_set(Evas_Object *obj, const_char *part, const_char *description)
|
||||
const_char *edje_edit_program_api_name_get(Evas_Object *obj, const_char *part)
|
||||
const_char *edje_edit_program_api_description_get(Evas_Object *obj, const_char *part)
|
||||
Eina_Bool edje_edit_program_api_name_set(Evas_Object *obj, const_char *part, const_char *name)
|
||||
Eina_Bool edje_edit_program_api_description_set(Evas_Object *obj, const_char *part, const_char *description)
|
||||
|
||||
# State
|
||||
Eina_List *edje_edit_part_states_list_get(Evas_Object *obj, char *part)
|
||||
int edje_edit_state_name_set(Evas_Object *obj, char *part, char *state, double value, char *new_name, double new_value)
|
||||
Eina_Bool edje_edit_state_add(Evas_Object *obj, char *part, char *name, double value)
|
||||
Eina_Bool edje_edit_state_del(Evas_Object *obj, char *part, char *state, double value)
|
||||
Eina_Bool edje_edit_state_exist(Evas_Object *obj, char *part, char *state, double value)
|
||||
Eina_Bool edje_edit_state_copy(Evas_Object *obj, char *part, char *sfrom, double vfrom, char *sto, double vto)
|
||||
double edje_edit_state_rel1_relative_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
double edje_edit_state_rel1_relative_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
double edje_edit_state_rel2_relative_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
double edje_edit_state_rel2_relative_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_rel1_relative_x_set(Evas_Object *obj, char *part, char *state, double value, double x)
|
||||
void edje_edit_state_rel1_relative_y_set(Evas_Object *obj, char *part, char *state, double value, double y)
|
||||
void edje_edit_state_rel2_relative_x_set(Evas_Object *obj, char *part, char *state, double value, double x)
|
||||
void edje_edit_state_rel2_relative_y_set(Evas_Object *obj, char *part, char *state, double value, double y)
|
||||
int edje_edit_state_rel1_offset_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
int edje_edit_state_rel1_offset_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
int edje_edit_state_rel2_offset_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
int edje_edit_state_rel2_offset_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_rel1_offset_x_set(Evas_Object *obj, char *part, char *state, double value, double x)
|
||||
void edje_edit_state_rel1_offset_y_set(Evas_Object *obj, char *part, char *state, double value, double y)
|
||||
void edje_edit_state_rel2_offset_x_set(Evas_Object *obj, char *part, char *state, double value, double x)
|
||||
void edje_edit_state_rel2_offset_y_set(Evas_Object *obj, char *part, char *state, double value, double y)
|
||||
char *edje_edit_state_rel1_to_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
char *edje_edit_state_rel1_to_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
char *edje_edit_state_rel2_to_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
char *edje_edit_state_rel2_to_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_rel1_to_x_set(Evas_Object *obj, char *part, char *state, double value, char *rel_to)
|
||||
void edje_edit_state_rel1_to_y_set(Evas_Object *obj, char *part, char *state, double value, char *rel_to)
|
||||
void edje_edit_state_rel2_to_x_set(Evas_Object *obj, char *part, char *state, double value, char *rel_to)
|
||||
void edje_edit_state_rel2_to_y_set(Evas_Object *obj, char *part, char *state, double value, char *rel_to)
|
||||
void edje_edit_state_color_get(Evas_Object *obj, char *part, char *state, double value, int *r, int *g, int *b, int *a)
|
||||
void edje_edit_state_color2_get(Evas_Object *obj, char *part, char *state, double value, int *r, int *g, int *b, int *a)
|
||||
void edje_edit_state_color3_get(Evas_Object *obj, char *part, char *state, double value, int *r, int *g, int *b, int *a)
|
||||
void edje_edit_state_color_set(Evas_Object *obj, char *part, char *state, double value, int r, int g, int b, int a)
|
||||
void edje_edit_state_color2_set(Evas_Object *obj, char *part, char *state, double value, int r, int g, int b, int a)
|
||||
void edje_edit_state_color3_set(Evas_Object *obj, char *part, char *state, double value, int r, int g, int b, int a)
|
||||
double edje_edit_state_align_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
double edje_edit_state_align_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_align_x_set(Evas_Object *obj, char *part, char *state, double value, double align)
|
||||
void edje_edit_state_align_y_set(Evas_Object *obj, char *part, char *state, double value, double align)
|
||||
int edje_edit_state_min_w_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_min_w_set(Evas_Object *obj, char *part, char *state, double value, int min_w)
|
||||
int edje_edit_state_min_h_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_min_h_set(Evas_Object *obj, char *part, char *state, double value, int min_h)
|
||||
int edje_edit_state_max_w_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_max_w_set(Evas_Object *obj, char *part, char *state, double value, int max_w)
|
||||
int edje_edit_state_max_h_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_max_h_set(Evas_Object *obj, char *part, char *state, double value, int max_h)
|
||||
double edje_edit_state_aspect_min_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
double edje_edit_state_aspect_max_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_aspect_min_set(Evas_Object *obj, char *part, char *state, double value, double aspect)
|
||||
void edje_edit_state_aspect_max_set(Evas_Object *obj, char *part, char *state, double value, double aspect)
|
||||
unsigned char edje_edit_state_aspect_pref_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_aspect_pref_set(Evas_Object *obj, char *part, char *state, double value, unsigned char pref)
|
||||
double edje_edit_state_fill_origin_relative_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
double edje_edit_state_fill_origin_relative_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
int edje_edit_state_fill_origin_offset_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
int edje_edit_state_fill_origin_offset_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_fill_origin_relative_x_set(Evas_Object *obj, char *part, char *state, double value, double x)
|
||||
void edje_edit_state_fill_origin_relative_y_set(Evas_Object *obj, char *part, char *state, double value, double x)
|
||||
void edje_edit_state_fill_origin_offset_x_set(Evas_Object *obj, char *part, char *state, double value, double x)
|
||||
void edje_edit_state_fill_origin_offset_y_set(Evas_Object *obj, char *part, char *state, double value, double y)
|
||||
double edje_edit_state_fill_size_relative_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
double edje_edit_state_fill_size_relative_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
int edje_edit_state_fill_size_offset_x_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
int edje_edit_state_fill_size_offset_y_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_fill_size_relative_x_set(Evas_Object *obj, char *part, char *state, double value, double x)
|
||||
void edje_edit_state_fill_size_relative_y_set(Evas_Object *obj, char *part, char *state, double value, double x)
|
||||
void edje_edit_state_fill_size_offset_x_set(Evas_Object *obj, char *part, char *state, double value, double x)
|
||||
void edje_edit_state_fill_size_offset_y_set(Evas_Object *obj, char *part, char *state, double value, double y)
|
||||
Eina_Bool edje_edit_state_visible_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_visible_set(Evas_Object *obj, char *part, char *state, double value, Eina_Bool visible)
|
||||
char *edje_edit_state_color_class_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
void edje_edit_state_color_class_set(Evas_Object *obj, char *part, char *state, double value, char *color_class)
|
||||
|
||||
# Eina_List * edje_edit_state_external_params_list_get(Evas_Object *obj, char *part, char *state, double value)
|
||||
# Eina_Bool edje_edit_state_external_param_get(Evas_Object *obj, char *part, char *state, double value, char *param, edje.c_edje.Edje_External_Param_Type *type, void **val)
|
||||
# Eina_Bool edje_edit_state_external_param_int_get(Evas_Object *obj, char *part, char *state, double value, char *param, int *val)
|
||||
# Eina_Bool edje_edit_state_external_param_bool_get(Evas_Object *obj, char *part, char *state, double value, char *param, Eina_Bool *val)
|
||||
# Eina_Bool edje_edit_state_external_param_double_get(Evas_Object *obj, char *part, char *state, double value, char *param, double *val)
|
||||
# Eina_Bool edje_edit_state_external_param_string_get(Evas_Object *obj, char *part, char *state, double value, char *param, char **val)
|
||||
# Eina_Bool edje_edit_state_external_param_choice_get(Evas_Object *obj, char *part, char *state, double value, char *param, char **val)
|
||||
# edje.c_edje.Edje_External_Param_Type edje_object_part_external_param_type_get(Evas_Object *obj, char *part, char *param)
|
||||
# char *edje_external_param_type_str(edje.c_edje.Edje_External_Param_Type type)
|
||||
# Eina_Bool edje_edit_state_external_param_set(Evas_Object *obj, char *part, char *state, double value, char *param, edje.c_edje.Edje_External_Param_Type type, ...)
|
||||
# Eina_Bool edje_edit_state_external_param_int_set(Evas_Object *obj, char *part, char *state, double value, char *param, int val)
|
||||
# Eina_Bool edje_edit_state_external_param_bool_set(Evas_Object *obj, char *part, char *state, double value, char *param, Eina_Bool val)
|
||||
# Eina_Bool edje_edit_state_external_param_double_set(Evas_Object *obj, char *part, char *state, double value, char *param, double val)
|
||||
# Eina_Bool edje_edit_state_external_param_string_set(Evas_Object *obj, char *part, char *state, double value, char *param, char *val)
|
||||
# Eina_Bool edje_edit_state_external_param_choice_set(Evas_Object *obj, char *part, char *state, double value, char *param, char *val)
|
||||
|
||||
|
||||
# programs
|
||||
Eina_List *edje_edit_programs_list_get(Evas_Object *obj)
|
||||
Eina_Bool edje_edit_program_add(Evas_Object *obj, const_char *name)
|
||||
Eina_Bool edje_edit_program_del(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_exist(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_run(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_name_set(Evas_Object *obj, const_char *prog, const_char *new_name)
|
||||
const_char *edje_edit_program_source_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_source_set(Evas_Object *obj, const_char *prog, const_char *source)
|
||||
const_char *edje_edit_program_signal_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_signal_set(Evas_Object *obj, const_char *prog, const_char *signal)
|
||||
double edje_edit_program_in_from_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_in_from_set(Evas_Object *obj, const_char *prog, double seconds)
|
||||
double edje_edit_program_in_range_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_in_range_set(Evas_Object *obj, const_char *prog, double seconds)
|
||||
Edje_Action_Type edje_edit_program_action_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_action_set(Evas_Object *obj, const_char *prog, Edje_Action_Type action)
|
||||
Eina_List *edje_edit_program_targets_get(Evas_Object *, const_char *prog)
|
||||
Eina_Bool edje_edit_program_target_add(Evas_Object *obj, const_char *prog, const_char *target)
|
||||
Eina_Bool edje_edit_program_target_del(Evas_Object *obj, const_char *prog, const_char *target)
|
||||
Eina_Bool edje_edit_program_targets_clear(Evas_Object *obj, const_char *prog)
|
||||
Eina_List *edje_edit_program_afters_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_after_add(Evas_Object *obj, const_char *prog, const_char *after)
|
||||
Eina_Bool edje_edit_program_after_del(Evas_Object *obj, const_char *prog, const_char *after)
|
||||
Eina_Bool edje_edit_program_afters_clear(Evas_Object *obj, const_char *prog)
|
||||
const_char *edje_edit_program_state_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_state_set(Evas_Object *obj, const_char *prog, const_char *state)
|
||||
double edje_edit_program_value_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_value_set(Evas_Object *obj, const_char *prog, double value)
|
||||
const_char *edje_edit_program_state2_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_state2_set(Evas_Object *obj, const_char *prog, const_char *state2)
|
||||
double edje_edit_program_value2_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_value2_set(Evas_Object *obj, const_char *prog, double value)
|
||||
Edje_Tween_Mode edje_edit_program_transition_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_transition_set(Evas_Object *obj, const_char *prog, Edje_Tween_Mode transition)
|
||||
double edje_edit_program_transition_time_get(Evas_Object *obj, const_char *prog)
|
||||
Eina_Bool edje_edit_program_transition_time_set(Evas_Object *obj, const_char *prog, double seconds)
|
||||
|
||||
# scripts
|
||||
char* edje_edit_script_get(Evas_Object *obj)
|
||||
void edje_edit_script_set(Evas_Object *obj, const_char *code)
|
||||
char* edje_edit_script_program_get(Evas_Object *obj, const_char *prog)
|
||||
void edje_edit_script_program_set(Evas_Object *obj, const_char *prog, const_char *code)
|
||||
Eina_Bool edje_edit_script_compile(Evas_Object *obj)
|
||||
const_Eina_List *edje_edit_script_error_list_get(Evas_Object *obj)
|
||||
|
9
setup.py
9
setup.py
|
@ -65,6 +65,7 @@ else:
|
|||
# subprocess.call("rm -rfv efl/evas/*.c", shell=True)
|
||||
# subprocess.call("rm -rfv efl/ecore/*.c", shell=True)
|
||||
# subprocess.call("rm -rfv efl/edje/*.c", shell=True)
|
||||
# subprocess.call("rm -rfv efl/edje/edit/*.c", shell=True)
|
||||
# subprocess.call("rm -rfv efl/emotion/*.c", shell=True)
|
||||
# subprocess.call("rm -rfv efl/elementary/*.c", shell=True)
|
||||
# subprocess.call("rm -rfv efl/dbus_mainloop/dbus_mainloop.c", shell=True)
|
||||
|
@ -102,6 +103,14 @@ else:
|
|||
extra_compile_args = edje_cflags,
|
||||
extra_link_args = edje_libs + eina_libs + evas_libs)
|
||||
modules.append(edje_ext)
|
||||
|
||||
# Edje_Edit
|
||||
edje_edit_ext = Extension("efl.edje_edit", ["efl/edje/efl.edje_edit.pyx"],
|
||||
define_macros = [('EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT', None)],
|
||||
include_dirs = ['include/'],
|
||||
extra_compile_args = edje_cflags,
|
||||
extra_link_args = edje_libs + eina_libs + evas_libs)
|
||||
modules.append(edje_edit_ext)
|
||||
|
||||
# Emotion
|
||||
emotion_cflags, emotion_libs = pkg_config('Emotion', 'emotion', "1.7.99")
|
||||
|
|
|
@ -0,0 +1,477 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from efl import evas
|
||||
from efl import ecore
|
||||
from efl import edje
|
||||
from efl.edje import EDJE_PART_TYPE_RECTANGLE
|
||||
from efl.edje_edit import EdjeEdit, Text_Style, Text_Style_Tag, Color_Class, \
|
||||
Part, Program
|
||||
import os, unittest
|
||||
|
||||
|
||||
theme_file = os.path.join(os.path.dirname(__file__), "theme.edj")
|
||||
|
||||
|
||||
class TestEdjeEditBase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.canvas = evas.Canvas(method="buffer",
|
||||
size=(400, 500),
|
||||
viewport=(0, 0, 400, 500))
|
||||
self.canvas.engine_info_set(self.canvas.engine_info_get())
|
||||
|
||||
def tearDown(self):
|
||||
self.canvas.delete()
|
||||
|
||||
|
||||
def testConstructor(self):
|
||||
o = EdjeEdit(self.canvas, file=theme_file, group="main")
|
||||
self.assertIsInstance(o, EdjeEdit)
|
||||
o.delete()
|
||||
self.assertTrue(o.is_deleted())
|
||||
|
||||
|
||||
class TestEdjeEditGeneral(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.canvas = evas.Canvas(method="buffer",
|
||||
size=(400, 500),
|
||||
viewport=(0, 0, 400, 500))
|
||||
self.canvas.engine_info_set(self.canvas.engine_info_get())
|
||||
self.o = EdjeEdit(self.canvas, file=theme_file, group="main")
|
||||
|
||||
def tearDown(self):
|
||||
self.o.delete()
|
||||
self.canvas.delete()
|
||||
|
||||
def testGeneral(self):
|
||||
self.assertEqual(self.o.compiler_get(), "edje_cc")
|
||||
self.assertEqual(self.o.file_get(), (theme_file, "main"))
|
||||
# o.print_internal_status() # FIXME this crash badly
|
||||
|
||||
def testGroup(self):
|
||||
g = self.o.current_group
|
||||
|
||||
self.assertEqual((g.w_min, g.w_max), (200, 400))
|
||||
self.assertEqual((g.h_min, g.h_max), (200, 400))
|
||||
|
||||
g.w_min = g.h_min = 201
|
||||
g.w_max = g.h_max = 401
|
||||
|
||||
self.assertEqual((g.w_min, g.w_max), (201, 401))
|
||||
self.assertEqual((g.h_min, g.h_max), (201, 401))
|
||||
|
||||
# TODO test g.rename
|
||||
|
||||
def testGroupAdd(self):
|
||||
self.assertFalse(self.o.group_exist("test_new_group"))
|
||||
self.o.group_add("test_new_group")
|
||||
self.assertTrue(self.o.group_exist("test_new_group"))
|
||||
|
||||
@unittest.skip("crash badly") # TODO FIXME
|
||||
def testGroupDel(self):
|
||||
self.o.group_add("test_new_group2")
|
||||
self.o.group_del("test_new_group2")
|
||||
self.assertFalse(o.group_exist("test_new_group2"))
|
||||
|
||||
def testData(self):
|
||||
self.assertIn("key1", self.o.data)
|
||||
self.assertIn("key2", self.o.data)
|
||||
|
||||
self.assertEqual(self.o.data_get("key1"), "value1")
|
||||
self.assertEqual(self.o.data_get("key2"), "value2")
|
||||
|
||||
self.o.data_set("key1", "new_value1")
|
||||
self.o.data_set("key2", "new_value2")
|
||||
self.assertEqual(self.o.data_get("key1"), "new_value1")
|
||||
self.assertEqual(self.o.data_get("key2"), "new_value2")
|
||||
|
||||
self.o.data_add("key5", "value5")
|
||||
self.assertEqual(self.o.data_get("key5"), "value5")
|
||||
|
||||
self.o.data_rename("key5", "key55")
|
||||
self.assertEqual(self.o.data_get("key55"), "value5")
|
||||
|
||||
# self.o.data_del("key44") # FIXME this crash badly
|
||||
# self.assertNotIn("key44", self.o.data)
|
||||
|
||||
def testGroupData(self):
|
||||
self.assertIn("key3", self.o.group_data)
|
||||
self.assertIn("key4", self.o.group_data)
|
||||
|
||||
self.assertEqual(self.o.group_data_get("key3"), "value3")
|
||||
self.assertEqual(self.o.group_data_get("key4"), "value4")
|
||||
|
||||
self.o.group_data_set("key3", "new_value3")
|
||||
self.o.group_data_set("key4", "new_value4")
|
||||
self.assertEqual(self.o.group_data_get("key3"), "new_value3")
|
||||
self.assertEqual(self.o.group_data_get("key4"), "new_value4")
|
||||
|
||||
self.o.group_data_add("key6", "value6")
|
||||
self.assertEqual(self.o.group_data_get("key6"), "value6")
|
||||
|
||||
self.o.group_data_del("key6")
|
||||
self.assertNotIn("key6", self.o.group_data)
|
||||
|
||||
def testTextStyles(self):
|
||||
self.assertIn("style1", self.o.text_styles)
|
||||
self.assertIn("style2", self.o.text_styles)
|
||||
self.assertNotIn("styleNOTEXISTS", self.o.text_styles)
|
||||
|
||||
style = self.o.text_style_get("style1")
|
||||
self.assertIsInstance(style, Text_Style)
|
||||
self.assertIn("DEFAULT", style.tags)
|
||||
self.assertIn("br", style.tags)
|
||||
self.assertIn("tab", style.tags)
|
||||
self.assertNotIn("b", style.tags)
|
||||
|
||||
tag = style.tag_get("DEFAULT")
|
||||
self.assertIsInstance(tag, Text_Style_Tag)
|
||||
|
||||
# TODO more test for tags add/del
|
||||
|
||||
def testColorClasses(self):
|
||||
self.assertIn("colorclass1", self.o.color_classes)
|
||||
self.assertIn("colorclass2", self.o.color_classes)
|
||||
self.assertNotIn("colorclassNOTEXISTS", self.o.color_classes)
|
||||
|
||||
cc1 = self.o.color_class_get("colorclass1")
|
||||
cc2 = self.o.color_class_get("colorclass2")
|
||||
self.assertIsInstance(cc1, Color_Class)
|
||||
self.assertIsInstance(cc2, Color_Class)
|
||||
|
||||
self.assertEqual(cc1.name, "colorclass1")
|
||||
self.assertEqual(cc2.name, "colorclass2")
|
||||
|
||||
cc1.name = "colorclass1_new"
|
||||
self.assertEqual(cc1.name, "colorclass1_new")
|
||||
|
||||
self.assertEqual(cc1.colors_get(), ((1,2,3,4),(5,6,7,8),(9,10,11,12)))
|
||||
self.assertEqual(cc2.colors_get(), ((13,14,15,16),(17,18,19,20),(21,22,23,24)))
|
||||
|
||||
cc1.colors_set(50,51,52,53, 54,55,56,57, 58,59,60,61)
|
||||
cc2.colors_set(70,71,72,73, 74,75,76,77, 78,79,80,81)
|
||||
self.assertEqual(cc1.colors_get(), ((50,51,52,53),(54,55,56,57),(58,59,60,61)))
|
||||
self.assertEqual(cc2.colors_get(), ((70,71,72,73),(74,75,76,77),(78,79,80,81)))
|
||||
|
||||
self.o.color_class_add("colorclass3")
|
||||
self.assertIn("colorclass3", self.o.color_classes)
|
||||
cc3 = self.o.color_class_get("colorclass3")
|
||||
self.assertIsInstance(cc3, Color_Class)
|
||||
|
||||
cc3.colors_set(85,86,87,88, 89,90,91,92, 93,94,95,96)
|
||||
self.assertEqual(cc3.colors_get(), ((85,86,87,88),(89,90,91,92),(93,94,95,96)))
|
||||
|
||||
self.o.color_class_del("colorclass3")
|
||||
self.assertNotIn("colorclass3", self.o.color_classes)
|
||||
|
||||
@unittest.skip("need to fix external_del to not leave a NULL element") # TODO FIXME
|
||||
def testExternal(self):
|
||||
self.assertEqual(self.o.externals, ['elm'])
|
||||
self.o.external_add('emotion')
|
||||
self.assertEqual(self.o.externals, ['elm', 'emotion'])
|
||||
self.o.external_del('emotion')
|
||||
self.assertEqual(self.o.externals, ['elm'])
|
||||
|
||||
# TODO test for images, image_id_get, image_del
|
||||
|
||||
def testScript(self):
|
||||
self.assertEqual(len(self.o.script), 104)
|
||||
# TODO test setting .script, compile and .script_errors
|
||||
|
||||
|
||||
class TestEdjeEditParts(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.canvas = evas.Canvas(method="buffer",
|
||||
size=(400, 500),
|
||||
viewport=(0, 0, 400, 500))
|
||||
self.canvas.engine_info_set(self.canvas.engine_info_get())
|
||||
self.o = EdjeEdit(self.canvas, file=theme_file, group="main")
|
||||
|
||||
def tearDown(self):
|
||||
self.o.delete()
|
||||
self.canvas.delete()
|
||||
|
||||
def testPart(self):
|
||||
self.assertEqual(len(self.o.parts), 42)
|
||||
self.assertTrue(self.o.part_exist("bg"))
|
||||
self.assertTrue(self.o.part_exist("rect"))
|
||||
self.assertFalse(self.o.part_exist("NOTEXIST"))
|
||||
|
||||
p = self.o.part_get("rect")
|
||||
self.assertIsInstance(p, Part)
|
||||
self.assertEqual(p.type, EDJE_PART_TYPE_RECTANGLE)
|
||||
|
||||
def testPartRename(self):
|
||||
p = self.o.part_get("rect")
|
||||
self.assertEqual(p.name, "rect")
|
||||
p.name = "rect_new_name"
|
||||
self.assertEqual(p.name, "rect_new_name")
|
||||
p.rename("rect")
|
||||
self.assertEqual(p.name, "rect")
|
||||
|
||||
def testPartAdd(self):
|
||||
self.o.part_add("new_part", EDJE_PART_TYPE_RECTANGLE)
|
||||
self.assertTrue(self.o.part_exist("new_part"))
|
||||
self.assertEqual(len(self.o.parts), 43)
|
||||
|
||||
p = self.o.part_get("new_part")
|
||||
self.assertIsInstance(p, Part)
|
||||
|
||||
@unittest.skip("part_del() crash") # TODO FIXME
|
||||
def testPartDel(self):
|
||||
self.assertTrue(self.o.part_exist("rect"))
|
||||
self.o.part_del("rect")
|
||||
self.assertFalse(self.o.part_exist("rect"))
|
||||
|
||||
@unittest.skip("cause segfault") # TODO FIXME
|
||||
def testPartStacking(self):
|
||||
# print(self.o.parts)
|
||||
p = self.o.part_get("rect")
|
||||
self.assertEqual(p.below_get(), "bg")
|
||||
self.assertEqual(p.above_get(), "label")
|
||||
|
||||
p.restack_below()
|
||||
p.restack_above()
|
||||
self.assertEqual(p.below_get(), "bg")
|
||||
self.assertEqual(p.above_get(), "label")
|
||||
|
||||
@unittest.skip("cause segfault") # TODO FIXME
|
||||
def testPartClip(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.clip_to, "test_clip")
|
||||
p.clip_to = "bg"
|
||||
self.assertEqual(p.clip_to, "bg")
|
||||
|
||||
def testPartSource(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.source, None)
|
||||
|
||||
def testPartMouseEvents(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.mouse_events, False)
|
||||
p.mouse_events = True
|
||||
self.assertEqual(p.mouse_events, True)
|
||||
|
||||
def testPartRepeatEvents(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.repeat_events, False)
|
||||
p.repeat_events = True
|
||||
self.assertEqual(p.repeat_events, True)
|
||||
|
||||
def testPartEffect(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.effect, 18)
|
||||
p.effect = 2
|
||||
self.assertEqual(p.effect, 2)
|
||||
|
||||
def testPartIgnoreFlags(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.ignore_flags, 1)
|
||||
p.ignore_flags = 0
|
||||
self.assertEqual(p.ignore_flags, 0)
|
||||
|
||||
def testPartScale(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.scale, True)
|
||||
p.scale = False
|
||||
self.assertEqual(p.scale, False)
|
||||
|
||||
def testPartDrag(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.drag, (1,1))
|
||||
p.drag = (0,0)
|
||||
self.assertEqual(p.drag, (0,0))
|
||||
|
||||
def testPartDragStep(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.drag_step, (6,7))
|
||||
p.drag_step = (16,17)
|
||||
self.assertEqual(p.drag_step, (16,17))
|
||||
|
||||
def testPartDragCount(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.drag_count, (8,9))
|
||||
p.drag_count = (18,19)
|
||||
self.assertEqual(p.drag_count, (18,19))
|
||||
|
||||
def testPartDragConfine(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.drag_confine, "label")
|
||||
p.drag_confine = "bg"
|
||||
self.assertEqual(p.drag_confine, "bg")
|
||||
|
||||
def testPartDragEvent(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.drag_event, "edit_test_drag_event")
|
||||
p.drag_event = "edit_test_drag_event"
|
||||
self.assertEqual(p.drag_event, "edit_test_drag_event")
|
||||
|
||||
def testPartApi(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.api, ("api_name", "api_description"))
|
||||
p.api = ("new_api_name", "new_api_desc")
|
||||
self.assertEqual(p.api, ("new_api_name", "new_api_desc"))
|
||||
|
||||
|
||||
class TestEdjeEditPrograms(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.canvas = evas.Canvas(method="buffer",
|
||||
size=(400, 500),
|
||||
viewport=(0, 0, 400, 500))
|
||||
self.canvas.engine_info_set(self.canvas.engine_info_get())
|
||||
self.o = EdjeEdit(self.canvas, file=theme_file, group="main")
|
||||
|
||||
def tearDown(self):
|
||||
self.o.delete()
|
||||
self.canvas.delete()
|
||||
|
||||
def testProgram(self):
|
||||
o = self.o
|
||||
self.assertIn("prog1", o.programs)
|
||||
self.assertIn("prog2", o.programs)
|
||||
self.assertIn("prog3", o.programs)
|
||||
self.assertNotIn("progNOTIN", o.programs)
|
||||
|
||||
pr1 = o.program_get("prog1")
|
||||
self.assertIsInstance(pr1, Program)
|
||||
self.assertEqual(pr1.edje_get(), self.o)
|
||||
|
||||
o.program_add("prog5")
|
||||
pr5 = o.program_get("prog5")
|
||||
self.assertIsInstance(pr5, Program)
|
||||
self.assertTrue(o.program_exist("prog5"))
|
||||
|
||||
pr5.name = "prog10"
|
||||
self.assertTrue(o.program_exist("prog10"))
|
||||
self.assertFalse(o.program_exist("prog5"))
|
||||
|
||||
pr5.rename("prog5")
|
||||
o.program_del("prog5")
|
||||
self.assertFalse(o.program_exist("prog5"))
|
||||
self.assertNotIn("prog5", o.programs)
|
||||
|
||||
# TODO test Program.run()
|
||||
|
||||
def testProgramSource(self):
|
||||
p = self.o.program_get("prog1")
|
||||
self.assertEqual(p.source_get(), "edit_test")
|
||||
p.source_set("edit_*")
|
||||
self.assertEqual(p.source_get(), "edit_*")
|
||||
|
||||
def testProgramSignal(self):
|
||||
p = self.o.program_get("prog1")
|
||||
self.assertEqual(p.signal_get(), "mouse,down,1")
|
||||
p.signal_set("mouse,down,2")
|
||||
self.assertEqual(p.signal_get(), "mouse,down,2")
|
||||
|
||||
def testProgramIn(self):
|
||||
p = self.o.program_get("prog1")
|
||||
self.assertEqual(p.in_from_get(), 1.1)
|
||||
self.assertEqual(p.in_range_get(), 2.2)
|
||||
p.in_from_set(3.3)
|
||||
p.in_range_set(4.4)
|
||||
self.assertEqual(p.in_from_get(), 3.3)
|
||||
self.assertEqual(p.in_range_get(), 4.4)
|
||||
|
||||
def testProgramAction(self):
|
||||
p = self.o.program_get("prog1")
|
||||
self.assertEqual(p.action_get(), 1)
|
||||
p.action_set(2)
|
||||
self.assertEqual(p.action_get(), 2)
|
||||
# restore the original to not mess stuff
|
||||
p.action_set(1)
|
||||
|
||||
def testProgramTargets(self):
|
||||
p = self.o.program_get("prog1")
|
||||
self.assertEqual(p.targets_get(), ["edit_test", "test_clip"])
|
||||
p.target_del("test_clip")
|
||||
self.assertEqual(p.targets_get(), ["edit_test"])
|
||||
p.target_add("test_clip")
|
||||
self.assertEqual(p.targets_get(), ["edit_test", "test_clip"])
|
||||
p.targets_clear()
|
||||
self.assertEqual(p.targets_get(), [])
|
||||
|
||||
@unittest.skip("Program.after_add() does not work")
|
||||
def testProgramAfters(self):
|
||||
p = self.o.program_get("prog1")
|
||||
self.assertEqual(p.afters_get(), ["prog2", "prog3"])
|
||||
p.after_del("prog2")
|
||||
self.assertEqual(p.afters_get(), ["prog3"])
|
||||
p.after_add("prog4")
|
||||
self.assertEqual(p.afters_get(), ["prog3", "prog4"])
|
||||
p.afters_clear()
|
||||
self.assertEqual(p.afters_get(), [])
|
||||
|
||||
def testProgramState(self):
|
||||
p = self.o.program_get("prog1")
|
||||
self.assertEqual(p.state_get(), "state2")
|
||||
self.assertEqual(p.value_get(), 0.1)
|
||||
p.state_set("state1")
|
||||
p.value_set(0.0)
|
||||
self.assertEqual(p.state_get(), "state1")
|
||||
self.assertEqual(p.value_get(), 0.0)
|
||||
|
||||
def testProgramApi(self):
|
||||
p = self.o.program_get("prog1")
|
||||
self.assertEqual(p.api, ("p_api_name", "p_api_desc"))
|
||||
p.api = ("new_name", "new_desc")
|
||||
self.assertEqual(p.api, ("new_name", "new_desc"))
|
||||
|
||||
@unittest.skip("Program.script does not work")
|
||||
def testProgramScript(self):
|
||||
p = self.o.program_get("emit_back_message")
|
||||
print(p.script)
|
||||
|
||||
|
||||
class TestEdjeEditPartStates(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.canvas = evas.Canvas(method="buffer",
|
||||
size=(400, 500),
|
||||
viewport=(0, 0, 400, 500))
|
||||
self.canvas.engine_info_set(self.canvas.engine_info_get())
|
||||
self.o = EdjeEdit(self.canvas, file=theme_file, group="main")
|
||||
|
||||
def tearDown(self):
|
||||
self.o.delete()
|
||||
self.canvas.delete()
|
||||
|
||||
def testPartStates(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertEqual(p.states, ["default 0.00","state1 0.00","state2 0.00","state2 0.10"])
|
||||
|
||||
# state_add()
|
||||
p.state_add("state9", 0.1)
|
||||
self.assertEqual(p.states, ["default 0.00","state1 0.00","state2 0.00","state2 0.10","state9 0.10"])
|
||||
|
||||
# state_selected TODO FIXME state_selected_set does not work
|
||||
# self.assertEqual(p.state_selected_get(), ("default", 0.0))
|
||||
# p.state_selected_set("state2", 0.1)
|
||||
# self.assertEqual(p.state_selected_get(), ("state2", 0.1))
|
||||
|
||||
# state del() TODO FIXME state_del does not work
|
||||
# p.state_del("state9", 0.1)
|
||||
# self.assertEqual(p.states, ["default 0.00","state1 0.00","state2 0.00","state2 0.10"])
|
||||
|
||||
# TODO test state_copy
|
||||
|
||||
@unittest.skip("state_exist does not work") # TODO FIXME
|
||||
def testPartStateExist(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
self.assertFalse(p.state_exist("stateNOTEXISTS", 0.1))
|
||||
self.assertTrue(p.state_exist("state1", 0.0))
|
||||
self.assertTrue(p.state_exist("state2", 0.1))
|
||||
|
||||
@unittest.skip("PartState does not work") # TODO FIXME
|
||||
def testPartStateProps(self):
|
||||
p = self.o.part_get("edit_test")
|
||||
s = p.state_get("state1", 0.0)
|
||||
print(s)
|
||||
print(s.rel1_to_get())
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
||||
edje.shutdown()
|
||||
ecore.shutdown()
|
||||
evas.shutdown()
|
|
@ -8,6 +8,38 @@ data {
|
|||
item: "key2" "value2";
|
||||
}
|
||||
|
||||
styles {
|
||||
style {
|
||||
name: "style1";
|
||||
base: "font=Sans font_size=13 color=#fff wrap=word";
|
||||
tag: "br" "\n";
|
||||
tag: "tab" "\t";
|
||||
}
|
||||
style {
|
||||
name: "style2";
|
||||
base: "font=Sans font_size=9 color=#ccc";
|
||||
tag: "br" "\n";
|
||||
tag: "tab" "\t";
|
||||
tag: "b" "+ font=Sans:style=Bold";
|
||||
}
|
||||
}
|
||||
|
||||
color_classes {
|
||||
color_class {
|
||||
name: "colorclass1";
|
||||
color: 1 2 3 4;
|
||||
color2: 5 6 7 8;
|
||||
color3: 9 10 11 12;
|
||||
}
|
||||
color_class {
|
||||
name: "colorclass2";
|
||||
color: 13 14 15 16;
|
||||
color2: 17 18 19 20;
|
||||
color3: 21 22 23 24;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
collections {
|
||||
group {
|
||||
name: "main";
|
||||
|
@ -19,6 +51,12 @@ collections {
|
|||
item: "key4" "value4";
|
||||
}
|
||||
|
||||
script {
|
||||
public my_func(val) {
|
||||
set_text(PART:"label", "asd");
|
||||
}
|
||||
}
|
||||
|
||||
parts {
|
||||
part { name: "bg";
|
||||
type: RECT;
|
||||
|
@ -70,6 +108,52 @@ collections {
|
|||
}
|
||||
}
|
||||
}
|
||||
//// Used to test edje edit
|
||||
part { name: "test_clip";
|
||||
type: RECT;
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
}
|
||||
}
|
||||
part { name: "edit_test";
|
||||
type: RECT;
|
||||
mouse_events: 0;
|
||||
repeat_events: 0;
|
||||
scale: 1;
|
||||
effect: OUTLINE BOTTOM;
|
||||
ignore_flags: ON_HOLD;
|
||||
clip_to: "test_clip";
|
||||
api: "api_name" "api_description";
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "state1" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "state2" 0.0;
|
||||
}
|
||||
description {
|
||||
state: "state2" 0.1;
|
||||
}
|
||||
dragable {
|
||||
confine: "label";
|
||||
events: "edit_test_drag_event";
|
||||
x: 1 6 8;
|
||||
y: 1 7 9;
|
||||
}
|
||||
}
|
||||
part { name: "edit_test_drag_event";
|
||||
type: RECT;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
}
|
||||
dragable {
|
||||
x: 1 0 0;
|
||||
y: 1 0 0;
|
||||
}
|
||||
}
|
||||
//// Externals (hiddens, only used for the unittests)
|
||||
part { name: "ext_elm_actionslider";
|
||||
type: EXTERNAL;
|
||||
|
@ -447,13 +531,29 @@ collections {
|
|||
}
|
||||
}
|
||||
programs {
|
||||
program {
|
||||
name: "emit_back_message";
|
||||
program { name: "emit_back_message";
|
||||
signal: "emit,message";
|
||||
script {
|
||||
send_message(MSG_INT, 1, 1);
|
||||
}
|
||||
}
|
||||
program { name: "prog1";
|
||||
source: "edit_test";
|
||||
signal: "mouse,down,1";
|
||||
in: 1.1 2.2;
|
||||
action: STATE_SET "state2" 0.1;
|
||||
target: "edit_test";
|
||||
target: "test_clip";
|
||||
after: "prog2";
|
||||
after: "prog3";
|
||||
api: "p_api_name" "p_api_desc";
|
||||
}
|
||||
program { name: "prog2";
|
||||
}
|
||||
program { name: "prog3";
|
||||
}
|
||||
program { name: "prog4";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue