2015-01-02 11:03:53 -08:00
|
|
|
# Copyright (C) 2007-2015 various contributors (see AUTHORS)
|
2013-04-14 04:08:15 -07:00
|
|
|
#
|
|
|
|
# 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
|
2013-12-07 08:54:58 -08:00
|
|
|
# version 3 of the License, or (at your option) any later version.
|
2013-04-14 04:08:15 -07:00
|
|
|
#
|
|
|
|
# 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
|
2014-04-04 17:13:15 -07:00
|
|
|
cdef const char *name
|
2013-04-14 04:08:15 -07:00
|
|
|
|
2013-04-14 05:24:44 -07:00
|
|
|
def __init__(self, EdjeEdit e not None, name not None):
|
2013-04-14 04:08:15 -07:00
|
|
|
if isinstance(name, unicode): name = name.encode("UTF-8")
|
|
|
|
self.edje = e
|
2013-04-14 05:24:44 -07:00
|
|
|
self.name = eina_stringshare_add(name)
|
|
|
|
|
|
|
|
def __dealloc__(self):
|
|
|
|
eina_stringshare_del(self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property name:
|
|
|
|
def __get__(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return _ctouni(self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
def __set__(self, name):
|
|
|
|
self.rename(name)
|
|
|
|
|
2013-04-14 05:24:44 -07:00
|
|
|
def rename(self, newname not None):
|
2013-04-14 04:08:15 -07:00
|
|
|
cdef Eina_Bool ret
|
|
|
|
if isinstance(newname, unicode): newname = newname.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
ret = edje_edit_part_name_set(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>newname if newname is not None else NULL)
|
2013-04-14 04:08:15 -07:00
|
|
|
if ret == 0:
|
|
|
|
return False
|
2014-04-04 17:13:15 -07:00
|
|
|
eina_stringshare_replace(&self.name, <const char *>newname)
|
2013-04-14 04:08:15 -07:00
|
|
|
return True
|
|
|
|
|
|
|
|
def above_get(self):
|
|
|
|
cdef:
|
2014-04-04 17:13:15 -07:00
|
|
|
const char *part
|
2013-04-14 04:08:15 -07:00
|
|
|
object ret
|
2013-04-14 05:24:44 -07:00
|
|
|
part = edje_edit_part_above_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _ctouni(part)
|
|
|
|
edje_edit_string_free(part)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def below_get(self):
|
|
|
|
cdef:
|
2014-04-04 17:13:15 -07:00
|
|
|
const char *part
|
2013-04-14 04:08:15 -07:00
|
|
|
object ret
|
2013-04-14 05:24:44 -07:00
|
|
|
part = edje_edit_part_below_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _ctouni(part)
|
|
|
|
edje_edit_string_free(part)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def restack_below(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_part_restack_below(self.edje.obj, self.name))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def restack_above(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_part_restack_above(self.edje.obj, self.name))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property type:
|
|
|
|
def __get__(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return edje_edit_part_type_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
property states:
|
|
|
|
def __get__(self):
|
|
|
|
cdef Eina_List *lst
|
2013-04-14 05:24:44 -07:00
|
|
|
lst = edje_edit_part_states_list_get(self.edje.obj, self.name)
|
2013-09-30 18:56:28 -07:00
|
|
|
ret = eina_list_strings_to_python_list(lst)
|
2013-04-14 04:08:15 -07:00
|
|
|
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")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_state_add(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>sname if sname is not None else NULL,
|
2013-04-14 04:08:15 -07:00
|
|
|
value))
|
|
|
|
|
|
|
|
def state_del(self, sname, double value=0.0):
|
|
|
|
if isinstance(sname, unicode): sname = sname.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_state_del(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>sname if sname is not None else NULL,
|
2013-04-14 04:08:15 -07:00
|
|
|
value))
|
|
|
|
|
|
|
|
def state_exist(self, sname, double value=0.0):
|
|
|
|
if isinstance(sname, unicode): sname = sname.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_state_exist(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>sname if sname is not None else NULL,
|
2013-04-14 04:08:15 -07:00
|
|
|
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")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_state_copy(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>sfrom if sfrom is not None else NULL, vfrom,
|
|
|
|
<const char *>sto if sto is not None else NULL, vto))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def state_selected_get(self):
|
2014-04-04 17:13:15 -07:00
|
|
|
cdef const char *sel
|
2013-04-14 04:08:15 -07:00
|
|
|
cdef double val
|
2013-04-14 05:24:44 -07:00
|
|
|
sel = edje_edit_part_selected_state_get(self.edje.obj, self.name, &val)
|
2013-04-14 04:08:15 -07:00
|
|
|
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")
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_selected_state_set(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>state if state is not None else NULL,
|
2013-04-14 04:08:15 -07:00
|
|
|
value)
|
|
|
|
|
|
|
|
property clip_to:
|
|
|
|
def __get__(self):
|
2014-04-04 17:13:15 -07:00
|
|
|
cdef const char *clipper
|
2013-04-14 05:24:44 -07:00
|
|
|
clipper = edje_edit_part_clip_to_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _ctouni(clipper)
|
|
|
|
edje_edit_string_free(clipper)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def __set__(self, clipper):
|
|
|
|
if isinstance(clipper, unicode): clipper = clipper.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_clip_to_set(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>clipper if clipper is not None else NULL)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def __del__(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_clip_to_set(self.edje.obj, self.name, NULL)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property source:
|
|
|
|
def __get__(self):
|
2014-04-04 17:13:15 -07:00
|
|
|
cdef const char *source
|
2013-04-14 05:24:44 -07:00
|
|
|
source = edje_edit_part_source_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _ctouni(source)
|
|
|
|
edje_edit_string_free(source)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def __set__(self, source):
|
|
|
|
if isinstance(source, unicode): source = source.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_source_set(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>source if source is not None else NULL)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def __del__(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_source_set(self.edje.obj, self.name, NULL)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property mouse_events:
|
|
|
|
def __get__(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_part_mouse_events_get(self.edje.obj, self.name))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def __set__(self, me):
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_mouse_events_set(self.edje.obj, self.name,
|
|
|
|
1 if me else 0)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property repeat_events:
|
|
|
|
def __get__(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_part_repeat_events_get(self.edje.obj, self.name))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def __set__(self, re):
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_repeat_events_set(self.edje.obj, self.name,
|
|
|
|
1 if re else 0)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property effect:
|
|
|
|
def __get__(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return edje_edit_part_effect_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def __set__(self, effect):
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_effect_set(self.edje.obj, self.name, effect)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property ignore_flags:
|
|
|
|
def __get__(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return edje_edit_part_ignore_flags_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def __set__(self, flags):
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_ignore_flags_set(self.edje.obj, self.name, flags)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property scale:
|
|
|
|
def __get__(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_part_scale_get(self.edje.obj, self.name))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def __set__(self, scale):
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_scale_set(self.edje.obj, self.name,
|
|
|
|
1 if scale else 0)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property drag:
|
|
|
|
def __get__(self):
|
|
|
|
cdef int x, y
|
2013-04-14 05:24:44 -07:00
|
|
|
x = edje_edit_part_drag_x_get(self.edje.obj, self.name)
|
|
|
|
y = edje_edit_part_drag_y_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
return (x, y)
|
|
|
|
|
|
|
|
def __set__(self, val):
|
|
|
|
x, y = val
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_drag_x_set(self.edje.obj, self.name, x)
|
|
|
|
edje_edit_part_drag_y_set(self.edje.obj, self.name, y)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property drag_step:
|
|
|
|
def __get__(self):
|
|
|
|
cdef int x, y
|
2013-04-14 05:24:44 -07:00
|
|
|
x = edje_edit_part_drag_step_x_get(self.edje.obj, self.name)
|
|
|
|
y = edje_edit_part_drag_step_y_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
return (x, y)
|
|
|
|
|
|
|
|
def __set__(self, val):
|
|
|
|
x, y = val
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_drag_step_x_set(self.edje.obj, self.name, x)
|
|
|
|
edje_edit_part_drag_step_y_set(self.edje.obj, self.name, y)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property drag_count:
|
|
|
|
def __get__(self):
|
|
|
|
cdef int x, y
|
2013-04-14 05:24:44 -07:00
|
|
|
x = edje_edit_part_drag_count_x_get(self.edje.obj, self.name)
|
|
|
|
y = edje_edit_part_drag_count_y_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
return (x, y)
|
|
|
|
|
|
|
|
def __set__(self, val):
|
|
|
|
x, y = val
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_drag_count_x_set(self.edje.obj, self.name, x)
|
|
|
|
edje_edit_part_drag_count_y_set(self.edje.obj, self.name, y)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property drag_confine:
|
|
|
|
def __get__(self):
|
2014-04-04 17:13:15 -07:00
|
|
|
cdef const char *confine
|
2013-04-14 05:24:44 -07:00
|
|
|
confine = edje_edit_part_drag_confine_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _ctouni(confine)
|
|
|
|
edje_edit_string_free(confine)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def __set__(self, confine):
|
|
|
|
if isinstance(confine, unicode): confine = confine.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_drag_confine_set(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>confine if confine is not None else NULL)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property drag_event:
|
|
|
|
def __get__(self):
|
2014-04-04 17:13:15 -07:00
|
|
|
cdef const char *event
|
2013-04-14 05:24:44 -07:00
|
|
|
event = edje_edit_part_drag_event_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _ctouni(event)
|
|
|
|
edje_edit_string_free(event)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def __set__(self, event):
|
|
|
|
if isinstance(event, unicode): event = event.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_drag_event_set(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>event if event is not None else NULL)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property api:
|
|
|
|
def __get__(self):
|
|
|
|
cdef:
|
2014-04-04 17:13:15 -07:00
|
|
|
const char *name
|
|
|
|
const char *desc
|
2013-04-14 05:24:44 -07:00
|
|
|
name = edje_edit_part_api_name_get(self.edje.obj, self.name)
|
|
|
|
desc = edje_edit_part_api_description_get(self.edje.obj, self.name)
|
|
|
|
n, d = _ctouni(name), _ctouni(desc)
|
2013-04-14 04:08:15 -07:00
|
|
|
edje_edit_string_free(name)
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_string_free(desc)
|
2013-04-14 04:08:15 -07:00
|
|
|
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")
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_api_name_set(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>name if name is not None else NULL)
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_part_api_description_set(self.edje.obj, self.name,
|
2014-04-04 17:13:15 -07:00
|
|
|
<const char *>desc if desc is not None else NULL)
|