2013-04-14 04:08:15 -07:00
|
|
|
# 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
|
2013-04-14 05:24:44 -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, newname):
|
|
|
|
self.rename(newname)
|
|
|
|
|
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_program_name_set(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>newname if newname is not None else NULL)
|
|
|
|
if ret == 0:
|
|
|
|
return False
|
2013-04-14 05:24:44 -07:00
|
|
|
eina_stringshare_replace(&self.name, <const_char *>newname)
|
2013-04-14 04:08:15 -07:00
|
|
|
return True
|
|
|
|
|
|
|
|
def edje_get(self):
|
|
|
|
return self.edje
|
|
|
|
|
|
|
|
def run(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_run(self.edje.obj, self.name))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
# XXX TODO: add (or better convert) all this to properties
|
|
|
|
# like is done in Part()
|
|
|
|
def source_get(self):
|
|
|
|
cdef const_char *s
|
2013-04-14 05:24:44 -07:00
|
|
|
s = edje_edit_program_source_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _ctouni(s)
|
|
|
|
edje_edit_string_free(s)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def source_set(self, source):
|
|
|
|
if isinstance(source, unicode): source = source.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_source_set(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>source if source is not None else NULL))
|
|
|
|
|
|
|
|
def signal_get(self):
|
|
|
|
cdef const_char *s
|
2013-04-14 05:24:44 -07:00
|
|
|
s = edje_edit_program_signal_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _ctouni(s)
|
|
|
|
edje_edit_string_free(s)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def signal_set(self, signal):
|
|
|
|
if isinstance(signal, unicode): signal = signal.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_signal_set(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>signal if signal is not None else NULL))
|
|
|
|
|
|
|
|
def in_from_get(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return edje_edit_program_in_from_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def in_from_set(self, double f):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_in_from_set(self.edje.obj, self.name, f))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def in_range_get(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return edje_edit_program_in_range_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def in_range_set(self, double r):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_in_range_set(self.edje.obj, self.name, r))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def action_get(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return edje_edit_program_action_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def action_set(self, action):
|
|
|
|
if isinstance(action, unicode): action = action.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_action_set(self.edje.obj, self.name,
|
|
|
|
action))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def targets_get(self):
|
|
|
|
cdef Eina_List *lst
|
2013-04-14 05:24:44 -07:00
|
|
|
lst = edje_edit_program_targets_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
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")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_target_add(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>target if target is not None else NULL))
|
|
|
|
|
|
|
|
def target_del(self, target):
|
|
|
|
if isinstance(target, unicode): target = target.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_target_del(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>target if target is not None else NULL))
|
|
|
|
|
|
|
|
def targets_clear(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_targets_clear(self.edje.obj, self.name))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
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")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_after_add(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>after if after is not None else NULL))
|
|
|
|
|
|
|
|
def after_del(self, after):
|
|
|
|
if isinstance(after, unicode): after = after.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_after_del(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>after if after is not None else NULL))
|
|
|
|
|
|
|
|
def afters_clear(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_afters_clear(self.edje.obj, self.name))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def state_get(self):
|
|
|
|
cdef const_char *s
|
2013-04-14 05:24:44 -07:00
|
|
|
s = edje_edit_program_state_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _ctouni(s)
|
|
|
|
edje_edit_string_free(s)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def state_set(self, state):
|
|
|
|
if isinstance(state, unicode): state = state.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_state_set(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>state if state is not None else NULL))
|
|
|
|
|
|
|
|
def value_get(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return edje_edit_program_value_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def value_set(self, double v):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_value_set(self.edje.obj, self.name, v))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def state2_get(self):
|
|
|
|
cdef const_char *s
|
2013-04-14 05:24:44 -07:00
|
|
|
s = edje_edit_program_state2_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _ctouni(s)
|
|
|
|
edje_edit_string_free(s)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def state2_set(self, state):
|
|
|
|
if isinstance(state, unicode): state = state.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_state2_set(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>state if state is not None else NULL))
|
|
|
|
|
|
|
|
def value2_get(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return edje_edit_program_value2_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def value2_set(self, double v):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_value2_set(self.edje.obj, self.name, v))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def transition_get(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return edje_edit_program_transition_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def transition_set(self, t):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_transition_set(self.edje.obj, self.name, t))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def transition_time_get(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
return edje_edit_program_transition_time_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
def transition_time_set(self, double t):
|
2013-04-14 05:24:44 -07:00
|
|
|
return bool(edje_edit_program_transition_time_set(self.edje.obj, self.name, t))
|
2013-04-14 04:08:15 -07:00
|
|
|
|
|
|
|
property api:
|
|
|
|
def __get__(self):
|
|
|
|
cdef:
|
|
|
|
const_char *name
|
|
|
|
const_char *desc
|
2013-04-14 05:24:44 -07:00
|
|
|
name = edje_edit_program_api_name_get(self.edje.obj, self.name)
|
|
|
|
desc = edje_edit_program_api_description_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
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")
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_program_api_name_set(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>name if name is not None else NULL)
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_program_api_description_set(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>desc if desc is not None else NULL)
|
|
|
|
|
|
|
|
property script:
|
|
|
|
def __get__(self):
|
|
|
|
cdef char *code
|
2013-04-14 05:24:44 -07:00
|
|
|
code = edje_edit_script_program_get(self.edje.obj, self.name)
|
2013-04-14 04:08:15 -07:00
|
|
|
ret = _touni(code)
|
|
|
|
free(code)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def __set__(self, code):
|
|
|
|
if isinstance(code, unicode): code = code.encode("UTF-8")
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_script_program_set(self.edje.obj, self.name,
|
2013-04-14 04:08:15 -07:00
|
|
|
<const_char *>code if code is not None else NULL)
|
|
|
|
|
|
|
|
def __del__(self):
|
2013-04-14 05:24:44 -07:00
|
|
|
edje_edit_script_program_set(self.edje.obj, self.name, NULL)
|
2013-04-14 04:08:15 -07:00
|
|
|
|