Put in a first, still wip, version of the python bindings in a merged tree.
This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
This commit is contained in:
commit
8b86398860
|
@ -0,0 +1,10 @@
|
|||
Gustavo Sverzut Barbieri <barbieri@gmail.com>
|
||||
Ulisses Furquim <ulissesf@gmail.com>
|
||||
Davide 'DaveMDS' Andreoli <dave@gurumeditation.it>
|
||||
Fabiano Fidêncio <fidencio@profusion.mobi>
|
||||
Tiago Falcão <tiago@profusion.mobi>
|
||||
Simon Busch <morphis@gravedo.de>
|
||||
Boris 'billiob' Faure <billiob@gmail.com>
|
||||
Bruno Dilly <bdilly@profusion.mobi>
|
||||
Joost Albers <joost.albers@nomadrail.com>
|
||||
Kai Huuhko <kai.huuhko@gmail.com>
|
|
@ -0,0 +1,165 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
|
@ -0,0 +1,59 @@
|
|||
|
||||
1. REQUIREMENTS:
|
||||
|
||||
1. Python 2.7 or higher (http://www.python.org/)
|
||||
- Tested with Python 2.7 / 3.2
|
||||
2. Cython 0.17.3 or higher (http://cython.org/)
|
||||
- Tested with Cython 0.17.3
|
||||
3. EFL core library
|
||||
- eo, evas, ecore, edje, elementary and, optionally, emotion
|
||||
4. pkg-config (http://www.freedesktop.org/wiki/Software/pkg-config)
|
||||
- Windows executable (and GLib dependency) can be downloaded from
|
||||
http://www.gtk.org/download/win32.php
|
||||
|
||||
|
||||
|
||||
2. BUILDING EFL
|
||||
|
||||
Once EFL is built and installed in your desired destination, proceed with
|
||||
building the wrapper.
|
||||
|
||||
|
||||
|
||||
2a. BUILDING WITH GCC/G++ (Linux, OS X, etc.)
|
||||
|
||||
python setup.py build_ext
|
||||
|
||||
2b. BUILDING WITH Visual Studio (Windows)
|
||||
|
||||
python setup.py build_ext
|
||||
|
||||
2c. BUILDING WITH MINGW (Windows)
|
||||
|
||||
python setup.py build_ext -c mingw32
|
||||
|
||||
|
||||
|
||||
4. INSTALLATION
|
||||
|
||||
4a. For system-wide installation (needs administrator privileges):
|
||||
|
||||
python setup.py install
|
||||
|
||||
4b. For user installation:
|
||||
|
||||
python setup.py install --user
|
||||
|
||||
4c. To install for python3:
|
||||
|
||||
python3 setup.py install (also cython need to be installed with py3)
|
||||
|
||||
|
||||
|
||||
5. DEMOS and TESTS
|
||||
|
||||
You can run individual tests or use the 00_run_all_tests.py in each folder or
|
||||
even in the tests/ base dir to run all the tests at once.
|
||||
|
||||
The tests in elementary are not unittest and are meant to be run by the user
|
||||
as they usually require some sort of interaction.
|
|
@ -0,0 +1,62 @@
|
|||
|
||||
BUGS:
|
||||
|
||||
* Ecore/Evas: 00_run_all_test.py, lots of errors
|
||||
* Evas: smart object doesn't work
|
||||
* object_from_instance fail with EdjeExternals
|
||||
* test_map3.py is buggy
|
||||
* test_mapbuf.py line 14 should work
|
||||
* test_progressbar.py on exit cause an endless loop (Timer??)
|
||||
* test_video.py have problems
|
||||
* test_menu.py -> evas events cb
|
||||
* test_naviframe is broken (also in the python-elementary version)
|
||||
* test_core_evas_canvas_callbacks.py have 2 lines commented out
|
||||
* test_emotion.py loop on shutdown (parent issue)
|
||||
|
||||
* edje.color_class_list() is broken in C (disabled in edje/test_01_basics.py)
|
||||
* edje.text_class_list() is broken in C (disabled out in edje/test_01_basics.py)
|
||||
|
||||
|
||||
TODO:
|
||||
|
||||
* Fix all the compilation warnings!
|
||||
* ecore.Poller
|
||||
* ecore.FileMonitor
|
||||
* alert on signal and subprocess module usage (was in python-ecore/ecore/__init__.py)
|
||||
* Ecore test_08_exe.py : Use unittests
|
||||
* evas.SmartObject
|
||||
* edje.Edit
|
||||
* edje: complete the unit tests
|
||||
* elm.Web need a test
|
||||
* elm.GestureLayer need a test
|
||||
* elm.PhotoCam need a test
|
||||
* elm.Transit need a test
|
||||
* elm.Conformant need a test
|
||||
* include python-ethumb
|
||||
* include python-e_dbus (or make edbus2 ??)
|
||||
|
||||
|
||||
TODO FOR PYTHON 3:
|
||||
|
||||
* ecore.Exe (use new buffer interface)
|
||||
* ecore.FdHandler (use new buffer interface)
|
||||
* edje external
|
||||
|
||||
|
||||
STUFF LEAVED OUT:
|
||||
|
||||
* EcoreEvas
|
||||
* EcoreImf
|
||||
* EcoreX
|
||||
* EcoreWin32
|
||||
* python-evas/evas/utils.py
|
||||
* python-evas/evas/decorators.py
|
||||
* python-evas/evas/debug.py
|
||||
* python-evas old hack to rotate objects
|
||||
* edje decorators callbacks
|
||||
|
||||
|
||||
CHANGES FROM 1.7 to 1.8:
|
||||
|
||||
* added efl container package
|
||||
* ecore.file.Download => efl.ecore.FileDownload
|
|
@ -0,0 +1,141 @@
|
|||
######################################################################
|
||||
# Copyright (C) 2007-2013 Gustavo Sverzut Barbieri
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
######################################################################
|
||||
|
||||
import traceback
|
||||
from efl.eo cimport Eo
|
||||
from efl.eo cimport _fruni, _cfruni
|
||||
from efl.eo cimport PY_REFCOUNT
|
||||
from cpython cimport Py_INCREF, Py_DECREF
|
||||
|
||||
|
||||
ECORE_CALLBACK_CANCEL = 0
|
||||
ECORE_CALLBACK_RENEW = 1
|
||||
|
||||
# Ecore_Fd_Handler_Flags:
|
||||
ECORE_FD_READ = 1
|
||||
ECORE_FD_WRITE = 2
|
||||
ECORE_FD_ERROR = 4
|
||||
ECORE_FD_ALL = 7
|
||||
|
||||
|
||||
# Ecore_Exe_Flags:
|
||||
ECORE_EXE_PIPE_READ = 1
|
||||
ECORE_EXE_PIPE_WRITE = 2
|
||||
ECORE_EXE_PIPE_ERROR = 4
|
||||
ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8
|
||||
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16
|
||||
ECORE_EXE_PIPE_AUTO = 32
|
||||
ECORE_EXE_RESPAWN = 64
|
||||
ECORE_EXE_USE_SH = 128
|
||||
ECORE_EXE_NOT_LEADER = 256
|
||||
ECORE_EXE_TERM_WITH_PARENT = 512
|
||||
|
||||
ECORE_EXE_PRIORITY_INHERIT = 9999
|
||||
|
||||
|
||||
# Ecore_File_Progress_Return:
|
||||
ECORE_FILE_PROGRESS_CONTINUE = 0
|
||||
ECORE_FILE_PROGRESS_ABORT = 1
|
||||
|
||||
|
||||
cdef Eina_Bool _ecore_task_cb(void *data) with gil:
|
||||
cdef Eo obj = <Eo>data
|
||||
cdef Eina_Bool ret
|
||||
|
||||
try:
|
||||
ret = bool(obj._task_exec())
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
ret = 0
|
||||
|
||||
if not ret:
|
||||
obj.delete()
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
cdef int _ecore_events_registered = 0
|
||||
|
||||
|
||||
def init():
|
||||
global _ecore_events_registered
|
||||
|
||||
r = ecore_init()
|
||||
|
||||
if r > 0 and _ecore_events_registered == 0:
|
||||
_ecore_events_registered = 1
|
||||
|
||||
global _event_type_mapping
|
||||
_event_type_mapping = {
|
||||
ECORE_EVENT_SIGNAL_USER: EventSignalUser,
|
||||
ECORE_EVENT_SIGNAL_HUP: EventSignalHup,
|
||||
ECORE_EVENT_SIGNAL_EXIT: EventSignalExit,
|
||||
ECORE_EVENT_SIGNAL_POWER: EventSignalPower,
|
||||
ECORE_EVENT_SIGNAL_REALTIME: EventSignalRealtime,
|
||||
ECORE_EXE_EVENT_ADD: EventExeAdd,
|
||||
ECORE_EXE_EVENT_DEL: EventExeDel,
|
||||
ECORE_EXE_EVENT_DATA: EventExeData,
|
||||
ECORE_EXE_EVENT_ERROR: EventExeData,
|
||||
}
|
||||
|
||||
ecore_file_init()
|
||||
return r
|
||||
|
||||
|
||||
def shutdown():
|
||||
ecore_file_shutdown()
|
||||
return ecore_shutdown()
|
||||
|
||||
|
||||
def main_loop_quit():
|
||||
ecore_main_loop_quit()
|
||||
|
||||
|
||||
def main_loop_begin():
|
||||
with nogil:
|
||||
ecore_main_loop_begin()
|
||||
|
||||
|
||||
def main_loop_iterate():
|
||||
with nogil:
|
||||
ecore_main_loop_iterate()
|
||||
|
||||
|
||||
def main_loop_glib_integrate():
|
||||
if not ecore_main_loop_glib_integrate():
|
||||
raise SystemError("failed to integrate GLib main loop into ecore.")
|
||||
|
||||
|
||||
def time_get():
|
||||
return ecore_time_get()
|
||||
|
||||
|
||||
def loop_time_get():
|
||||
return ecore_loop_time_get()
|
||||
|
||||
|
||||
include "efl.ecore_animator.pxi"
|
||||
include "efl.ecore_timer.pxi"
|
||||
include "efl.ecore_idler.pxi"
|
||||
include "efl.ecore_fd_handler.pxi"
|
||||
include "efl.ecore_events.pxi"
|
||||
include "efl.ecore_exe.pxi"
|
||||
include "efl.ecore_file_download.pxi"
|
||||
|
||||
init()
|
|
@ -0,0 +1,57 @@
|
|||
# Copyright (C) 2007-2013 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by efl.ecore.pyx
|
||||
|
||||
|
||||
cdef class Animator(Eo):
|
||||
def __init__(self, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("Parameter 'func' must be callable")
|
||||
self.func = func
|
||||
self.args = args
|
||||
self.kargs = kargs
|
||||
self._set_obj(ecore_animator_add(_ecore_task_cb, <void *>self))
|
||||
|
||||
def __str__(self):
|
||||
return "%s Animator(func=%s, args=%s, kargs=%s)" % (Eo.__repr__(self),
|
||||
self.func, self.args, self.kargs)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s Animator(func=%s, args=%s, kargs=%s)" % (Eo.__repr__(self),
|
||||
self.func, self.args, self.kargs)
|
||||
|
||||
cpdef object _task_exec(self):
|
||||
return self.func(*self.args, **self.kargs)
|
||||
|
||||
def delete(self):
|
||||
ecore_animator_del(self.obj)
|
||||
|
||||
def stop(self):
|
||||
self.delete()
|
||||
|
||||
|
||||
def animator_add(func, *args, **kargs):
|
||||
return Animator(func, *args, **kargs)
|
||||
|
||||
|
||||
def animator_frametime_set(double frametime):
|
||||
ecore_animator_frametime_set(frametime)
|
||||
|
||||
|
||||
def animator_frametime_get():
|
||||
return ecore_animator_frametime_get()
|
|
@ -0,0 +1,354 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_ecore.pyx
|
||||
|
||||
|
||||
cdef object _event_type_mapping = dict()
|
||||
|
||||
def _event_mapping_register(int type, cls):
|
||||
if type in _event_type_mapping:
|
||||
raise ValueError("event type '%d' already registered." % type)
|
||||
if not issubclass(cls, Event):
|
||||
raise TypeError("cls (%s) must be subclass of Event" % cls)
|
||||
_event_type_mapping[type] = cls
|
||||
|
||||
|
||||
def _event_mapping_unregister(int type):
|
||||
_event_type_mapping.pop(type)
|
||||
|
||||
|
||||
cdef Eina_Bool event_handler_cb(void *data, int type, void *event) with gil:
|
||||
cdef EventHandler handler
|
||||
cdef Eina_Bool r
|
||||
|
||||
assert event != NULL
|
||||
assert data != NULL
|
||||
handler = <EventHandler>data
|
||||
assert type == handler.type
|
||||
|
||||
try:
|
||||
r = handler._exec(event)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
r = 0
|
||||
|
||||
if not r:
|
||||
handler.delete()
|
||||
return r
|
||||
|
||||
|
||||
cdef class Event(object):
|
||||
def __init__(self):
|
||||
if type(self) is Event:
|
||||
raise TypeError("Must not instantiate Event, but subclasses")
|
||||
|
||||
def __str__(self):
|
||||
attrs = []
|
||||
for attr in dir(self):
|
||||
if not attr.startswith("_"):
|
||||
attrs.append("%s=%r" % (attr, getattr(self, attr)))
|
||||
return "%s(%s)" % (self.__class__.__name__, ", ".join(attrs))
|
||||
|
||||
cdef int _set_obj(self, void *obj) except 0:
|
||||
raise NotImplementedError("Event._set_obj() not implemented.")
|
||||
|
||||
|
||||
cdef class EventHandler(object):
|
||||
def __init__(self, int type, func, *args, **kargs):
|
||||
"@parm: B{type} event type, as registered with ecore_event_type_new()."
|
||||
if not callable(func):
|
||||
raise TypeError("Parameter 'func' must be callable")
|
||||
event_cls = _event_type_mapping.get(type, None)
|
||||
if event_cls is None:
|
||||
raise ValueError("Unknow Ecore_Event type %d" % type)
|
||||
self.type = type
|
||||
self.event_cls = event_cls
|
||||
self.func = func
|
||||
self.args = args
|
||||
self.kargs = kargs
|
||||
self._set_obj(ecore_event_handler_add(type, event_handler_cb,
|
||||
<void *>self))
|
||||
|
||||
def __str__(self):
|
||||
return "%s(type=%d, func=%s, args=%s, kargs=%s, event_cls=%s)" % \
|
||||
(self.__class__.__name__, self.type,
|
||||
self.func, self.args, self.kargs, self.event_cls)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, type=%d, func=%s, args=%s, kargs=%s, event_cls=%s, "
|
||||
"Ecore_Event_Handler=%#x, refcount=%d)") % \
|
||||
(self.__class__.__name__, <unsigned long><void *>self,
|
||||
self.type, self.func, self.args, self.kargs, self.event_cls,
|
||||
<unsigned long>self.obj, PY_REFCOUNT(self))
|
||||
|
||||
def __dealloc__(self):
|
||||
if self.obj != NULL:
|
||||
ecore_event_handler_del(self.obj)
|
||||
|
||||
cdef int _set_obj(self, Ecore_Event_Handler *obj) except 0:
|
||||
assert self.obj == NULL, "Object must be clean"
|
||||
assert obj != NULL, "Cannot set NULL as object"
|
||||
self.obj = obj
|
||||
Py_INCREF(self)
|
||||
return 1
|
||||
|
||||
cdef int _unset_obj(self) except 0:
|
||||
if self.obj != NULL:
|
||||
ecore_event_handler_del(self.obj)
|
||||
self.obj = NULL
|
||||
self.event_cls = None
|
||||
self.func = None
|
||||
self.args = None
|
||||
self.kargs = None
|
||||
Py_DECREF(self)
|
||||
return 1
|
||||
|
||||
cdef Eina_Bool _exec(self, void *event) except 2:
|
||||
cdef Event e
|
||||
e = self.event_cls()
|
||||
e._set_obj(event)
|
||||
return bool(self.func(e, *self.args, **self.kargs))
|
||||
|
||||
def delete(self):
|
||||
if self.obj != NULL:
|
||||
self._unset_obj()
|
||||
|
||||
def stop(self):
|
||||
self.delete()
|
||||
|
||||
|
||||
def event_handler_add(int type, func, *args, **kargs):
|
||||
return EventHandler(type, func, *args, **kargs)
|
||||
|
||||
|
||||
cdef class EventSignalUser(Event):
|
||||
cdef int _set_obj(self, void *o) except 0:
|
||||
cdef Ecore_Event_Signal_User *obj
|
||||
obj = <Ecore_Event_Signal_User*>o
|
||||
self.number = obj.number
|
||||
return 1
|
||||
|
||||
def __str__(self):
|
||||
return "%s(number=%d)" % (self.__class__.__name__, self.number)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s(number=%d)" % (self.__class__.__name__, self.number)
|
||||
|
||||
|
||||
cdef class EventSignalUser1(EventSignalUser):
|
||||
def __str__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
|
||||
cdef class EventSignalUser2(EventSignalUser):
|
||||
def __str__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
|
||||
cdef class EventHandlerSignalUser(EventHandler):
|
||||
def __init__(self, func, *args, **kargs):
|
||||
EventHandler.__init__(self, ECORE_EVENT_SIGNAL_USER,
|
||||
func, *args, **kargs)
|
||||
|
||||
cdef Eina_Bool _exec(self, void *event) except 2:
|
||||
cdef Ecore_Event_Signal_User *obj = <Ecore_Event_Signal_User *>event
|
||||
cdef EventSignalUser e
|
||||
if obj.number == 1:
|
||||
e = EventSignalUser1()
|
||||
elif obj.number == 2:
|
||||
e = EventSignalUser2()
|
||||
else:
|
||||
e = EventSignalUser()
|
||||
e._set_obj(event)
|
||||
return bool(self.func(e, *self.args, **self.kargs))
|
||||
|
||||
|
||||
def on_signal_user(func, *args, **kargs):
|
||||
return EventHandlerSignalUser(func, *args, **kargs)
|
||||
|
||||
|
||||
cdef class EventSignalHup(Event):
|
||||
cdef int _set_obj(self, void *o) except 0:
|
||||
return 1
|
||||
|
||||
def __str__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
|
||||
def on_signal_hup(func, *args, **kargs):
|
||||
return EventHandler(ECORE_EVENT_SIGNAL_HUP, func, *args, **kargs)
|
||||
|
||||
|
||||
cdef class EventSignalExit(Event):
|
||||
cdef int _set_obj(self, void *o) except 0:
|
||||
cdef Ecore_Event_Signal_Exit *obj
|
||||
obj = <Ecore_Event_Signal_Exit*>o
|
||||
self.interrupt = bool(obj.interrupt)
|
||||
self.quit = bool(obj.quit)
|
||||
self.terminate = bool(obj.terminate)
|
||||
return 1
|
||||
|
||||
def __str__(self):
|
||||
return "%s(interrupt=%s, quit=%s, terminate=%s)" % \
|
||||
(self.__class__.__name__, self.interrupt, self.quit, self.terminate)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s(interrupt=%s, quit=%s, terminate=%s)" % \
|
||||
(self.__class__.__name__, self.interrupt, self.quit, self.terminate)
|
||||
|
||||
|
||||
cdef class EventSignalQuit(EventSignalExit):
|
||||
def __str__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
|
||||
cdef class EventSignalInterrupt(EventSignalExit):
|
||||
def __str__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
|
||||
cdef class EventSignalTerminate(EventSignalExit):
|
||||
def __str__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
|
||||
cdef class EventHandlerSignalExit(EventHandler):
|
||||
def __init__(self, func, *args, **kargs):
|
||||
EventHandler.__init__(self, ECORE_EVENT_SIGNAL_EXIT,
|
||||
func, *args, **kargs)
|
||||
|
||||
cdef Eina_Bool _exec(self, void *event) except 2:
|
||||
cdef Ecore_Event_Signal_Exit *obj = <Ecore_Event_Signal_Exit *>event
|
||||
cdef EventSignalExit e
|
||||
if obj.terminate:
|
||||
e = EventSignalTerminate()
|
||||
elif obj.interrupt:
|
||||
e = EventSignalInterrupt()
|
||||
elif obj.quit:
|
||||
e = EventSignalQuit()
|
||||
else:
|
||||
e = EventSignalExit()
|
||||
e._set_obj(event)
|
||||
return bool(self.func(e, *self.args, **self.kargs))
|
||||
|
||||
|
||||
def on_signal_exit(func, *args, **kargs):
|
||||
return EventHandlerSignalExit(func, *args, **kargs)
|
||||
|
||||
|
||||
cdef class EventSignalPower(Event):
|
||||
cdef int _set_obj(self, void *o) except 0:
|
||||
return 1
|
||||
|
||||
def __str__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s()" % (self.__class__.__name__,)
|
||||
|
||||
|
||||
def on_signal_power(func, *args, **kargs):
|
||||
return EventHandler(ECORE_EVENT_SIGNAL_POWER, func, *args, **kargs)
|
||||
|
||||
|
||||
cdef class EventSignalRealtime(Event):
|
||||
cdef int _set_obj(self, void *o) except 0:
|
||||
cdef Ecore_Event_Signal_Realtime *obj
|
||||
obj = <Ecore_Event_Signal_Realtime*>o
|
||||
self.num = obj.num
|
||||
return 1
|
||||
|
||||
def __str__(self):
|
||||
return "%s(num=%d)" % (self.__class__.__name__, self.num)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s(num=%d)" % (self.__class__.__name__, self.num)
|
||||
|
||||
|
||||
def on_signal_realtime(func, *args, **kargs):
|
||||
return EventHandler(ECORE_EVENT_SIGNAL_REALTIME, func, *args, **kargs)
|
||||
|
||||
|
||||
cdef class CustomEvent(Event):
|
||||
cdef int _set_obj(self, void *obj):
|
||||
self.obj = <object>obj
|
||||
return 1
|
||||
|
||||
def event_type_new(cls):
|
||||
cdef int type
|
||||
|
||||
type = ecore_event_type_new()
|
||||
|
||||
_event_mapping_register(type, cls)
|
||||
|
||||
return type
|
||||
|
||||
|
||||
cdef void _event_free_cb(void *data, void *event) with gil:
|
||||
cdef QueuedEvent ev
|
||||
|
||||
ev = <QueuedEvent>data
|
||||
ev._free()
|
||||
|
||||
|
||||
cdef class QueuedEvent(object):
|
||||
def __init__(self, int type, *args):
|
||||
self.args = args
|
||||
self._set_obj(ecore_event_add(type, <void *>self.args, _event_free_cb,
|
||||
<void*>self))
|
||||
|
||||
cdef int _set_obj(self, Ecore_Event *ev):
|
||||
assert self.obj == NULL, "Object must be clean"
|
||||
assert ev != NULL, "Cannot set NULL as object"
|
||||
self.obj = ev
|
||||
Py_INCREF(self)
|
||||
return 1
|
||||
|
||||
cdef int _unset_obj(self):
|
||||
if self.obj != NULL:
|
||||
self.obj = NULL
|
||||
self.args = None
|
||||
Py_DECREF(self)
|
||||
return 1
|
||||
|
||||
def _free(self):
|
||||
self._unset_obj()
|
||||
|
||||
def delete(self):
|
||||
ecore_event_del(self.obj)
|
||||
|
||||
def event_add(int type, *args):
|
||||
return QueuedEvent(type, args)
|
|
@ -0,0 +1,534 @@
|
|||
# Copyright (C) 2010 Gustavo Sverzut Barbieri
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_ecore.pyx
|
||||
|
||||
|
||||
# TODO: remove me after usage is update to new buffer api
|
||||
cdef extern from "Python.h":
|
||||
int PyObject_AsReadBuffer(obj, void **buffer, Py_ssize_t *buffer_len) except -1
|
||||
object PyUnicode_FromStringAndSize(char *s, Py_ssize_t len)
|
||||
|
||||
|
||||
cdef exe_flags2str(int value):
|
||||
flags = []
|
||||
if value & ECORE_EXE_PIPE_READ:
|
||||
flags.append("PIPE_READ")
|
||||
if value & ECORE_EXE_PIPE_WRITE:
|
||||
flags.append("PIPE_WRITE")
|
||||
if value & ECORE_EXE_PIPE_ERROR:
|
||||
flags.append("PIPE_ERROR")
|
||||
if value & ECORE_EXE_PIPE_READ_LINE_BUFFERED:
|
||||
flags.append("PIPE_READ_LINE_BUFFERED")
|
||||
if value & ECORE_EXE_PIPE_ERROR_LINE_BUFFERED:
|
||||
flags.append("PIPE_ERROR_LINE_BUFFERED")
|
||||
if value & ECORE_EXE_PIPE_AUTO:
|
||||
flags.append("PIPE_AUTO")
|
||||
if value & ECORE_EXE_RESPAWN:
|
||||
flags.append("RESPAWN")
|
||||
if value & ECORE_EXE_USE_SH:
|
||||
flags.append("USE_SH")
|
||||
if value & ECORE_EXE_NOT_LEADER:
|
||||
flags.append("NOT_LEADER")
|
||||
return ", ".join(flags)
|
||||
|
||||
|
||||
cdef Eina_Bool _exe_event_filter_cb(void *data, int type, void *event) with gil:
|
||||
cdef ExeEventFilter self = <ExeEventFilter>data
|
||||
cdef Ecore_Exe_Event_Add *e_add
|
||||
cdef Ecore_Exe_Event_Del *e_del
|
||||
cdef Ecore_Exe_Event_Data *e_data
|
||||
cdef Event e
|
||||
|
||||
try:
|
||||
assert self.event_type == type, "event is not what we asked? impossible"
|
||||
if type == ECORE_EXE_EVENT_ADD:
|
||||
e_add = <Ecore_Exe_Event_Add *>event
|
||||
if e_add.exe != self.exe:
|
||||
return 1
|
||||
e = EventExeAdd()
|
||||
elif type == ECORE_EXE_EVENT_DEL:
|
||||
e_del = <Ecore_Exe_Event_Del *>event
|
||||
if e_del.exe != self.exe:
|
||||
return 1
|
||||
e = EventExeDel()
|
||||
elif type == ECORE_EXE_EVENT_DATA or type == ECORE_EXE_EVENT_ERROR:
|
||||
e_data = <Ecore_Exe_Event_Data *>event
|
||||
if e_data.exe != self.exe:
|
||||
return 1
|
||||
e = EventExeData()
|
||||
else:
|
||||
raise SystemError("unknown event type=%d" % type)
|
||||
|
||||
r = e._set_obj(event)
|
||||
assert r != -1, "exe is not known?! impossible!"
|
||||
|
||||
cb = tuple(self.callbacks) # copy, so we can change self.callbacks
|
||||
for func, args, kargs in cb:
|
||||
try:
|
||||
func(self.owner, e, *args, **kargs)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
return 1 # always return true, no matter what
|
||||
|
||||
|
||||
cdef class ExeEventFilter:
|
||||
def __cinit__(self, *a, **ka):
|
||||
self.exe = NULL
|
||||
self.handler = NULL
|
||||
self.owner = None
|
||||
self.event_type = -1
|
||||
self.callbacks = []
|
||||
|
||||
def __dealloc__(self):
|
||||
if self.handler != NULL:
|
||||
ecore_event_handler_del(self.handler)
|
||||
self.handler = NULL
|
||||
|
||||
self.exe = NULL
|
||||
self.owner = None
|
||||
self.event_type = None
|
||||
self.callbacks = None
|
||||
|
||||
def __init__(self, Exe exe not None, int event_type):
|
||||
self.exe = exe.exe
|
||||
self.owner = exe
|
||||
self.event_type = event_type
|
||||
self.callbacks = []
|
||||
|
||||
def delete(self):
|
||||
if self.handler != NULL:
|
||||
ecore_event_handler_del(self.handler)
|
||||
self.handler = NULL
|
||||
self.callbacks = None
|
||||
|
||||
def callback_add(self, func, args, kargs):
|
||||
if self.handler == NULL:
|
||||
self.handler = ecore_event_handler_add(
|
||||
self.event_type, _exe_event_filter_cb, <void *>self)
|
||||
self.callbacks.append((func, args, kargs))
|
||||
|
||||
def callback_del(self, func, args, kargs):
|
||||
try:
|
||||
self.callbacks.remove((func, args, kargs))
|
||||
except ValueError, e:
|
||||
raise ValueError(
|
||||
"callback is not registered: %s, args=%s, kargs=%s" %
|
||||
(func, args, kargs))
|
||||
|
||||
if self.callbacks:
|
||||
return
|
||||
|
||||
if self.handler != NULL:
|
||||
ecore_event_handler_del(self.handler)
|
||||
self.handler = NULL
|
||||
|
||||
|
||||
def exe_run_priority_set(int pri):
|
||||
ecore_exe_run_priority_set(pri)
|
||||
|
||||
|
||||
def exe_run_priority_get():
|
||||
return ecore_exe_run_priority_get()
|
||||
|
||||
|
||||
cdef object _ecore_exe_event_mapping
|
||||
_ecore_exe_event_mapping = {}
|
||||
|
||||
|
||||
cdef void _ecore_exe_pre_free_cb(void *data, const_Ecore_Exe *exe) with gil:
|
||||
cdef Exe obj
|
||||
try:
|
||||
if data == NULL:
|
||||
raise ValueError("data parameter is NULL")
|
||||
else:
|
||||
obj = <Exe>data
|
||||
obj._unset_obj()
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef class Exe(object):
|
||||
def __cinit__(self, *a, **ka):
|
||||
self.exe = NULL
|
||||
self.__data = None
|
||||
self.__callbacks = {}
|
||||
|
||||
def __init__(self, exe_cmd, int flags=0, data=None):
|
||||
if not exe_cmd:
|
||||
raise ValueError("exe_cmd must not be empty!")
|
||||
|
||||
if flags is None:
|
||||
flags = 0
|
||||
|
||||
self._set_obj(_fruni(exe_cmd), flags)
|
||||
self.__data = data
|
||||
self.__callbacks = {}
|
||||
|
||||
cdef int _set_obj(self, char *exe_cmd, int flags) except 0:
|
||||
cdef Ecore_Exe *exe
|
||||
|
||||
assert self.exe == NULL, "Exe must be clean, not wrapping any Ecore_Exe"
|
||||
|
||||
exe = ecore_exe_pipe_run(exe_cmd, <Ecore_Exe_Flags>flags, <void *>self)
|
||||
if exe == NULL:
|
||||
raise SystemError("could not run subprocess %r, flags=%#x" %
|
||||
(exe_cmd, flags))
|
||||
|
||||
Py_INCREF(self)
|
||||
self.exe = exe
|
||||
ecore_exe_callback_pre_free_set(exe, _ecore_exe_pre_free_cb)
|
||||
_ecore_exe_event_mapping[<long><void *>exe] = self
|
||||
return 1
|
||||
|
||||
cdef int _unset_obj(self) except 0:
|
||||
assert self.exe != NULL, "Exe must wrap something"
|
||||
for t, filter in self.__callbacks.iteritems():
|
||||
filter.delete()
|
||||
self.__callbacks = None
|
||||
|
||||
_ecore_exe_event_mapping.pop(<long><void *>self.exe)
|
||||
self.exe = NULL
|
||||
Py_DECREF(self)
|
||||
return 1
|
||||
|
||||
def __str__(self):
|
||||
if self.exe == NULL:
|
||||
pid = None
|
||||
cmd = None
|
||||
flags = ""
|
||||
data = None
|
||||
else:
|
||||
pid = self.pid
|
||||
cmd = self.cmd
|
||||
flags = exe_flags2str(self.flags)
|
||||
data = None
|
||||
return "%s(pid=%s, cmd=%r, flags=[%s], data=%r)" % \
|
||||
(self.__class__.__name__, pid, cmd, flags, data)
|
||||
|
||||
def __repr__(self):
|
||||
if self.exe == NULL:
|
||||
pid = None
|
||||
cmd = None
|
||||
flags = ""
|
||||
data = None
|
||||
else:
|
||||
pid = self.pid
|
||||
cmd = self.cmd
|
||||
flags = exe_flags2str(self.flags)
|
||||
data = None
|
||||
return ("%s(%#x, Ecore_Exe=%#x, refcount=%d, pid=%s, cmd=%r, "
|
||||
"flags=[%s], data=%r)") % \
|
||||
(self.__class__.__name__, <unsigned long><void *>self,
|
||||
<unsigned long>self.exe, PY_REFCOUNT(self),
|
||||
pid, cmd, flags, data)
|
||||
|
||||
def delete(self):
|
||||
if self.exe == NULL:
|
||||
raise ValueError("%s already deleted" % self.__class__.__name__)
|
||||
ecore_exe_free(self.exe)
|
||||
|
||||
def free(self):
|
||||
self.delete()
|
||||
|
||||
def send(self, buffer, long size=0):
|
||||
cdef const_void *b_data
|
||||
cdef Py_ssize_t b_size
|
||||
|
||||
# TODO: update to new buffer api
|
||||
PyObject_AsReadBuffer(buffer, &b_data, &b_size)
|
||||
if size <= 0:
|
||||
size = b_size
|
||||
elif size > b_size:
|
||||
raise ValueError(
|
||||
"given size (%d) is larger than buffer size (%d)." %
|
||||
(size, b_size))
|
||||
|
||||
return bool(ecore_exe_send(self.exe, b_data, size))
|
||||
|
||||
def close_stdin(self):
|
||||
ecore_exe_close_stdin(self.exe)
|
||||
|
||||
def auto_limits_set(self, int start_bytes, int end_bytes,
|
||||
int start_lines, int end_lines):
|
||||
ecore_exe_auto_limits_set(self.exe, start_bytes, end_bytes,
|
||||
start_lines, end_lines)
|
||||
|
||||
def event_data_get(self, int flags):
|
||||
pass
|
||||
# TODO:
|
||||
#Ecore_Exe_Event_Data *ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags)
|
||||
#void ecore_exe_event_data_free(Ecore_Exe_Event_Data *data)
|
||||
|
||||
def cmd_get(self):
|
||||
cdef const_char_ptr cmd = ecore_exe_cmd_get(self.exe)
|
||||
if cmd != NULL:
|
||||
return cmd
|
||||
return None
|
||||
|
||||
property cmd:
|
||||
def __get__(self):
|
||||
return self.cmd_get()
|
||||
|
||||
def pid_get(self):
|
||||
return ecore_exe_pid_get(self.exe)
|
||||
|
||||
property pid:
|
||||
def __get__(self):
|
||||
return self.pid_get()
|
||||
|
||||
def tag_set(self, char *tag):
|
||||
cdef char *s
|
||||
if tag is None:
|
||||
s = NULL
|
||||
else:
|
||||
s = tag
|
||||
ecore_exe_tag_set(self.exe, s)
|
||||
|
||||
def tag_get(self):
|
||||
cdef const_char_ptr tag = ecore_exe_tag_get(self.exe)
|
||||
if tag != NULL:
|
||||
return tag
|
||||
return None
|
||||
|
||||
property tag:
|
||||
def __set__(self, char *tag):
|
||||
self.tag_set(tag)
|
||||
|
||||
def __get__(self):
|
||||
return self.tag_get()
|
||||
|
||||
def data_get(self):
|
||||
return self.__data
|
||||
|
||||
property data:
|
||||
def __get__(self):
|
||||
return self.data_get()
|
||||
|
||||
def flags_get(self):
|
||||
return ecore_exe_flags_get(self.exe)
|
||||
|
||||
property flags:
|
||||
def __get__(self):
|
||||
return self.flags_get()
|
||||
|
||||
def signal(self, int num):
|
||||
if num != 1 or num != 2:
|
||||
raise ValueError("num must be either 1 or 2. Got %d." % num)
|
||||
ecore_exe_signal(self.exe, num)
|
||||
|
||||
def pause(self):
|
||||
ecore_exe_pause(self.exe)
|
||||
|
||||
def stop(self):
|
||||
self.pause()
|
||||
|
||||
def continue_(self):
|
||||
ecore_exe_continue(self.exe)
|
||||
|
||||
def resume(self):
|
||||
self.continue_()
|
||||
|
||||
def interrupt(self):
|
||||
ecore_exe_interrupt(self.exe)
|
||||
|
||||
def quit(self):
|
||||
ecore_exe_quit(self.exe)
|
||||
|
||||
def terminate(self):
|
||||
ecore_exe_terminate(self.exe)
|
||||
|
||||
def kill(self):
|
||||
ecore_exe_kill(self.exe)
|
||||
|
||||
def hup(self):
|
||||
ecore_exe_hup(self.exe)
|
||||
|
||||
def on_add_event_add(self, func, *args, **kargs):
|
||||
filter = self.__callbacks.get(ECORE_EXE_EVENT_ADD)
|
||||
if filter is None:
|
||||
filter = ExeEventFilter(self, ECORE_EXE_EVENT_ADD)
|
||||
self.__callbacks[ECORE_EXE_EVENT_ADD] = filter
|
||||
filter.callback_add(func, args, kargs)
|
||||
|
||||
def on_add_event_del(self, func, *args, **kargs):
|
||||
filter = self.__callbacks.get(ECORE_EXE_EVENT_ADD)
|
||||
if filter is None:
|
||||
raise ValueError("callback not registered %s, args=%s, kargs=%s" %
|
||||
(func, args, kargs))
|
||||
filter.callback_del(func, args, kargs)
|
||||
|
||||
def on_del_event_add(self, func, *args, **kargs):
|
||||
filter = self.__callbacks.get(ECORE_EXE_EVENT_DEL)
|
||||
if filter is None:
|
||||
filter = ExeEventFilter(self, ECORE_EXE_EVENT_DEL)
|
||||
self.__callbacks[ECORE_EXE_EVENT_DEL] = filter
|
||||
filter.callback_add(func, args, kargs)
|
||||
|
||||
def on_del_event_del(self, func, *args, **kargs):
|
||||
filter = self.__callbacks.get(ECORE_EXE_EVENT_DEL)
|
||||
if filter is None:
|
||||
raise ValueError("callback not registered %s, args=%s, kargs=%s" %
|
||||
(func, args, kargs))
|
||||
filter.callback_del(func, args, kargs)
|
||||
|
||||
def on_data_event_add(self, func, *args, **kargs):
|
||||
filter = self.__callbacks.get(ECORE_EXE_EVENT_DATA)
|
||||
if filter is None:
|
||||
filter = ExeEventFilter(self, ECORE_EXE_EVENT_DATA)
|
||||
self.__callbacks[ECORE_EXE_EVENT_DATA] = filter
|
||||
filter.callback_add(func, args, kargs)
|
||||
|
||||
def on_data_event_del(self, func, *args, **kargs):
|
||||
filter = self.__callbacks.get(ECORE_EXE_EVENT_DATA)
|
||||
if filter is None:
|
||||
raise ValueError("callback not registered %s, args=%s, kargs=%s" %
|
||||
(func, args, kargs))
|
||||
filter.callback_del(func, args, kargs)
|
||||
|
||||
def on_error_event_add(self, func, *args, **kargs):
|
||||
filter = self.__callbacks.get(ECORE_EXE_EVENT_ERROR)
|
||||
if filter is None:
|
||||
filter = ExeEventFilter(self, ECORE_EXE_EVENT_ERROR)
|
||||
self.__callbacks[ECORE_EXE_EVENT_ERROR] = filter
|
||||
filter.callback_add(func, args, kargs)
|
||||
|
||||
def on_error_event_del(self, func, *args, **kargs):
|
||||
filter = self.__callbacks.get(ECORE_EXE_EVENT_ERROR)
|
||||
if filter is None:
|
||||
raise ValueError("callback not registered %s, args=%s, kargs=%s" %
|
||||
(func, args, kargs))
|
||||
filter.callback_del(func, args, kargs)
|
||||
|
||||
|
||||
def exe_run(char *exe_cmd, data=None):
|
||||
return Exe(exe_cmd, data=data)
|
||||
|
||||
|
||||
def exe_pipe_run(char *exe_cmd, int flags=0, data=None):
|
||||
return Exe(exe_cmd, flags, data)
|
||||
|
||||
|
||||
cdef class EventExeAdd(Event):
|
||||
cdef int _set_obj(self, void *o) except 0:
|
||||
cdef Ecore_Exe_Event_Add *obj
|
||||
obj = <Ecore_Exe_Event_Add*>o
|
||||
self.exe = _ecore_exe_event_mapping.get(<long>obj.exe)
|
||||
if self.exe is None:
|
||||
return -1
|
||||
return 1
|
||||
|
||||
def __str__(self):
|
||||
return "%s(exe=%s)" % (self.__class__.__name__, self.exe)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s(exe=%r)" % (self.__class__.__name__, self.exe)
|
||||
|
||||
|
||||
cdef class EventExeDel(Event):
|
||||
cdef int _set_obj(self, void *o) except 0:
|
||||
cdef Ecore_Exe_Event_Del *obj
|
||||
obj = <Ecore_Exe_Event_Del*>o
|
||||
self.exe = _ecore_exe_event_mapping.get(<long>obj.exe)
|
||||
if self.exe is None:
|
||||
return -1
|
||||
self.pid = obj.pid
|
||||
self.exit_code = obj.exit_code
|
||||
self.exit_signal = obj.exit_signal
|
||||
self.exited = bool(obj.exited)
|
||||
self.signalled = bool(obj.signalled)
|
||||
return 1
|
||||
|
||||
def __str__(self):
|
||||
return ("%s(pid=%s, exit_code=%s, exit_signal=%s, exited=%s, "
|
||||
"signalled=%s, exe=%s)") % \
|
||||
(self.__class__.__name__, self.pid, self.exit_code,
|
||||
self.exit_signal, self.exited, self.signalled, self.exe)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(pid=%s, exit_code=%s, exit_signal=%s, exited=%s, "
|
||||
"signalled=%s, exe=%r)") % \
|
||||
(self.__class__.__name__, self.pid, self.exit_code,
|
||||
self.exit_signal, self.exited, self.signalled, self.exe)
|
||||
|
||||
|
||||
cdef class EventExeData(Event):
|
||||
cdef int _set_obj(self, void *o) except 0:
|
||||
cdef Ecore_Exe_Event_Data *obj
|
||||
cdef int i
|
||||
obj = <Ecore_Exe_Event_Data*>o
|
||||
self.exe = _ecore_exe_event_mapping.get(<long>obj.exe)
|
||||
if self.exe is None:
|
||||
return -1
|
||||
self.data = PyUnicode_FromStringAndSize(<char*>obj.data, obj.size)
|
||||
self.size = obj.size
|
||||
self.lines = []
|
||||
|
||||
line_append = self.lines.append
|
||||
if obj.lines:
|
||||
i = 0
|
||||
while obj.lines[i].line != NULL:
|
||||
line_append(PyUnicode_FromStringAndSize(
|
||||
obj.lines[i].line, obj.lines[i].size))
|
||||
i += 1
|
||||
|
||||
return 1
|
||||
|
||||
def __str__(self):
|
||||
if self.lines is None:
|
||||
count = None
|
||||
else:
|
||||
count = len(self.lines)
|
||||
return "%s(size=%d, lines=#%d, exe=%s)" % \
|
||||
(self.__class__.__name__, self.size, count, self.exe)
|
||||
|
||||
def __repr__(self):
|
||||
if self.lines is None:
|
||||
count = None
|
||||
else:
|
||||
count = len(self.lines)
|
||||
return "%s(size=%d, lines=#%d, exe=%r)" % \
|
||||
(self.__class__.__name__, self.size, count, self.exe)
|
||||
|
||||
|
||||
cdef class EventHandlerExe(EventHandler):
|
||||
cdef Eina_Bool _exec(self, void *event) except 2:
|
||||
cdef Event e
|
||||
e = self.event_cls()
|
||||
if e._set_obj(event) == -1: # no exe
|
||||
return True
|
||||
return bool(self.func(e, *self.args, **self.kargs))
|
||||
|
||||
|
||||
def on_exe_add_event_add(func, *args, **kargs):
|
||||
return EventHandlerExe(ECORE_EXE_EVENT_ADD, func, *args, **kargs)
|
||||
|
||||
|
||||
def on_exe_del_event_add(func, *args, **kargs):
|
||||
return EventHandlerExe(ECORE_EXE_EVENT_DEL, func, *args, **kargs)
|
||||
|
||||
|
||||
def on_exe_data_event_add(func, *args, **kargs):
|
||||
return EventHandlerExe(ECORE_EXE_EVENT_DATA, func, *args, **kargs)
|
||||
|
||||
|
||||
def on_exe_error_event_add(func, *args, **kargs):
|
||||
return EventHandlerExe(ECORE_EXE_EVENT_ERROR, func, *args, **kargs)
|
|
@ -0,0 +1,164 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_ecore.pyx
|
||||
|
||||
|
||||
cdef void fd_handler_prepare_cb(void *data, Ecore_Fd_Handler *fdh) with gil:
|
||||
cdef FdHandler obj = <FdHandler>data
|
||||
cdef int r
|
||||
|
||||
if obj._prepare_callback is None:
|
||||
return
|
||||
func, args, kargs = obj._prepare_callback
|
||||
try:
|
||||
func(obj, *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef flags2str(int value):
|
||||
flags = []
|
||||
if value & <int>ECORE_FD_READ:
|
||||
flags.append("READ")
|
||||
if value & <int>ECORE_FD_WRITE:
|
||||
flags.append("WRITE")
|
||||
if value & <int>ECORE_FD_ERROR:
|
||||
flags.append("ERROR")
|
||||
return ", ".join(flags)
|
||||
|
||||
|
||||
cdef Eina_Bool fd_handler_cb(void *data, Ecore_Fd_Handler *fdh) with gil:
|
||||
cdef FdHandler obj = <FdHandler>data
|
||||
cdef Eina_Bool r
|
||||
|
||||
try:
|
||||
r = bool(obj._exec())
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
r = 0
|
||||
|
||||
if not r:
|
||||
obj.delete()
|
||||
return r
|
||||
|
||||
|
||||
cdef class FdHandler(object):
|
||||
def __init__(self, fd, int flags, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("Parameter 'func' must be callable")
|
||||
self.func = func
|
||||
self.args = args
|
||||
self.kargs = kargs
|
||||
self._prepare_callback = None
|
||||
if self.obj == NULL:
|
||||
if not isinstance(fd, (int, long)):
|
||||
try:
|
||||
fd = fd.fileno()
|
||||
except AttributeError, e:
|
||||
raise ValueError("fd must be integer or have fileno()")
|
||||
|
||||
self.obj = ecore_main_fd_handler_add(fd,
|
||||
<Ecore_Fd_Handler_Flags>flags,
|
||||
fd_handler_cb, <void *>self,
|
||||
NULL, NULL)
|
||||
if self.obj != NULL:
|
||||
Py_INCREF(self)
|
||||
|
||||
def __str__(self):
|
||||
if self.obj == NULL:
|
||||
fd = None
|
||||
flags = ""
|
||||
else:
|
||||
fd = self.fd_get()
|
||||
flags = flags2str(self.active_get(7))
|
||||
return "%s(func=%s, args=%s, kargs=%s, fd=%s, flags=[%s])" % \
|
||||
(self.__class__.__name__, self.func, self.args, self.kargs,
|
||||
fd, flags)
|
||||
|
||||
def __repr__(self):
|
||||
if self.obj == NULL:
|
||||
fd = None
|
||||
flags = ""
|
||||
else:
|
||||
fd = self.fd_get()
|
||||
flags = flags2str(self.active_get(7))
|
||||
return ("%s(%#x, func=%s, args=%s, kargs=%s, fd=%s, flags=[%s], "
|
||||
"Ecore_Fd_Handler=%#x, refcount=%d)") % \
|
||||
(self.__class__.__name__, <unsigned long><void *>self,
|
||||
self.func, self.args, self.kargs, fd, flags,
|
||||
<unsigned long>self.obj, PY_REFCOUNT(self))
|
||||
|
||||
def __dealloc__(self):
|
||||
if self.obj != NULL:
|
||||
ecore_main_fd_handler_del(self.obj)
|
||||
self.obj = NULL
|
||||
self.func = None
|
||||
self.args = None
|
||||
self.kargs = None
|
||||
|
||||
cdef object _exec(self):
|
||||
return self.func(self, *self.args, **self.kargs)
|
||||
|
||||
def delete(self):
|
||||
if self.obj != NULL:
|
||||
ecore_main_fd_handler_del(self.obj)
|
||||
self.obj = NULL
|
||||
Py_DECREF(self)
|
||||
|
||||
def stop(self):
|
||||
self.delete()
|
||||
|
||||
def fd_get(self):
|
||||
return ecore_main_fd_handler_fd_get(self.obj)
|
||||
|
||||
property fd:
|
||||
def __get__(self):
|
||||
return self.fd_get()
|
||||
|
||||
def active_get(self, int flags):
|
||||
cdef Ecore_Fd_Handler_Flags v = <Ecore_Fd_Handler_Flags>flags
|
||||
return bool(ecore_main_fd_handler_active_get(self.obj, v))
|
||||
|
||||
def active_set(self, int flags):
|
||||
cdef Ecore_Fd_Handler_Flags v = <Ecore_Fd_Handler_Flags>flags
|
||||
ecore_main_fd_handler_active_set(self.obj, v)
|
||||
|
||||
def can_read(self):
|
||||
return bool(ecore_main_fd_handler_active_get(self.obj, ECORE_FD_READ))
|
||||
|
||||
def can_write(self):
|
||||
return bool(ecore_main_fd_handler_active_get(self.obj, ECORE_FD_WRITE))
|
||||
|
||||
def has_error(self):
|
||||
return bool(ecore_main_fd_handler_active_get(self.obj, ECORE_FD_ERROR))
|
||||
|
||||
def prepare_callback_set(self, func, *args, **kargs):
|
||||
if func is None:
|
||||
self._prepare_callback = None
|
||||
ecore_main_fd_handler_prepare_callback_set(self.obj, NULL, NULL)
|
||||
elif callable(func):
|
||||
self._prepare_callback = (func, args, kargs)
|
||||
ecore_main_fd_handler_prepare_callback_set(self.obj,
|
||||
fd_handler_prepare_cb,
|
||||
<void *>self)
|
||||
else:
|
||||
raise TypeError("Parameter 'func' must be callable")
|
||||
|
||||
|
||||
def fd_handler_add(fd, int flags, func, *args, **kargs):
|
||||
return FdHandler(fd, flags, func, *args, **kargs)
|
|
@ -0,0 +1,109 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_ecore_file.pyx
|
||||
|
||||
|
||||
cdef void _completion_cb(void *data, const_char_ptr file, int status) with gil:
|
||||
obj = <FileDownload>data
|
||||
try:
|
||||
obj._exec_completion(file, status)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
cdef int _progress_cb(void *data, const_char_ptr file, long int dltotal,
|
||||
long int dlnow, long int ultotal, long int ulnow) with gil:
|
||||
obj = <FileDownload>data
|
||||
try:
|
||||
return obj._exec_progress(file, dltotal, dlnow, ultotal, ulnow)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef class FileDownload(object):
|
||||
def __init__(self, url, dst, completion_cb, progress_cb, *args, **kargs):
|
||||
cdef Ecore_File_Download_Job *job
|
||||
|
||||
if completion_cb is not None and not callable(completion_cb):
|
||||
raise TypeError("Parameter 'completion_cb' must be callable, or None")
|
||||
|
||||
if progress_cb is not None and not callable(progress_cb):
|
||||
raise TypeError("Parameter 'progress_cb' must be callable, or None")
|
||||
|
||||
self.completion_cb = completion_cb
|
||||
self.progress_cb = progress_cb
|
||||
self.args = args
|
||||
self.kargs = kargs
|
||||
|
||||
if not ecore_file_download(_cfruni(url), _cfruni(dst),
|
||||
_completion_cb, _progress_cb,
|
||||
<void *>self, &job):
|
||||
raise SystemError("could not download '%s' to %s" % (url, dst))
|
||||
|
||||
self.job = job
|
||||
Py_INCREF(self)
|
||||
|
||||
def __str__(self):
|
||||
return "%s(completion_cb=%s, progress_cb=%s args=%s, kargs=%s)" % \
|
||||
(self.__class__.__name__, self.completion_cb,
|
||||
self.progress_cb, self.args, self.kargs)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, completion_cb=%s, progress_cb=%s, args=%s, kargs=%s, "
|
||||
"Ecore_File_Download_Job=%#x, refcount=%d)") % \
|
||||
(self.__class__.__name__, <unsigned long><void *>self,
|
||||
self.completion_cb, self.progress_cb, self.args, self.kargs,
|
||||
<unsigned long>self.job, PY_REFCOUNT(self))
|
||||
|
||||
def __dealloc__(self):
|
||||
if self.job != NULL:
|
||||
ecore_file_download_abort(self.job)
|
||||
self.job = NULL
|
||||
self.completion_cb = None
|
||||
self.progress_cb = None
|
||||
self.args = None
|
||||
self.kargs = None
|
||||
|
||||
cdef object _exec_completion(self, const_char_ptr file, int status):
|
||||
if self.completion_cb:
|
||||
self.completion_cb(file, status, *self.args, **self.kargs)
|
||||
|
||||
cdef object _exec_progress(self, const_char_ptr file, long int dltotal,
|
||||
long int dlnow, long int ultotal, long int ulnow):
|
||||
if self.progress_cb:
|
||||
return self.progress_cb(file, dltotal, dlnow, ultotal, ulnow,
|
||||
*self.args, **self.kargs)
|
||||
return 0
|
||||
|
||||
def abort(self):
|
||||
if self.job != NULL:
|
||||
ecore_file_download_abort(self.job)
|
||||
self.job = NULL
|
||||
Py_DECREF(self)
|
||||
|
||||
|
||||
def file_download(url, dst, completion_cb, progress_cb, *args, **kargs):
|
||||
return FileDownload(url, dst, completion_cb, progress_cb, *args, **kargs)
|
||||
|
||||
def file_download_abort(instance):
|
||||
instance.abort()
|
||||
|
||||
def file_download_abort_all():
|
||||
ecore_file_download_abort_all()
|
||||
|
||||
def file_download_protocol_available(protocol):
|
||||
return bool(ecore_file_download_protocol_available(protocol))
|
|
@ -0,0 +1,83 @@
|
|||
# Copyright (C) 2007-2013 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by efl.ecore.pyx
|
||||
|
||||
|
||||
cdef class Idler(Eo):
|
||||
def __init__(self, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("Parameter 'func' must be callable")
|
||||
self.func = func
|
||||
self.args = args
|
||||
self.kargs = kargs
|
||||
self._set_obj(ecore_idler_add(_ecore_task_cb, <void *>self))
|
||||
|
||||
def __str__(self):
|
||||
return "%s Idler(func=%s, args=%s, kargs=%s)" % (Eo.__repr__(self),
|
||||
self.func, self.args, self.kargs)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s Idler(func=%s, args=%s, kargs=%s)" % (Eo.__repr__(self),
|
||||
self.func, self.args, self.kargs)
|
||||
|
||||
cpdef object _task_exec(self):
|
||||
return self.func(*self.args, **self.kargs)
|
||||
|
||||
def delete(self):
|
||||
ecore_idler_del(self.obj)
|
||||
|
||||
def stop(self):
|
||||
self.delete()
|
||||
|
||||
|
||||
cdef class IdleEnterer(Idler):
|
||||
def __init__(self, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("Parameter 'func' must be callable")
|
||||
self.func = func
|
||||
self.args = args
|
||||
self.kargs = kargs
|
||||
self._set_obj(ecore_idle_enterer_add(_ecore_task_cb, <void *>self))
|
||||
|
||||
def delete(self):
|
||||
ecore_idle_enterer_del(self.obj)
|
||||
|
||||
|
||||
cdef class IdleExiter(Idler):
|
||||
def __init__(self, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("Parameter 'func' must be callable")
|
||||
self.func = func
|
||||
self.args = args
|
||||
self.kargs = kargs
|
||||
self._set_obj(ecore_idle_exiter_add(_ecore_task_cb, <void *>self))
|
||||
|
||||
def delete(self):
|
||||
ecore_idle_exiter_del(self.obj)
|
||||
|
||||
|
||||
def idler_add(func, *args, **kargs):
|
||||
return Idler(func, *args, **kargs)
|
||||
|
||||
|
||||
def idle_enterer_add(func, *args, **kargs):
|
||||
return IdleEnterer(func, *args, **kargs)
|
||||
|
||||
|
||||
def idle_exiter_add(func, *args, **kargs):
|
||||
return IdleExiter(func, *args, **kargs)
|
|
@ -0,0 +1,91 @@
|
|||
# Copyright (C) 2007-2013 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by efl.ecore.pyx
|
||||
|
||||
|
||||
cdef class Timer(Eo):
|
||||
def __init__(self, double interval, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("Parameter 'func' must be callable")
|
||||
self.func = func
|
||||
self.args = args
|
||||
self.kargs = kargs
|
||||
self._set_obj(ecore_timer_add(interval, _ecore_task_cb, <void *>self))
|
||||
|
||||
def __str__(self):
|
||||
return "%s Timer(func=%s, args=%s, kargs=%s)" % (Eo.__str__(self),
|
||||
self.func, self.args, self.kargs)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s Timer(interval=%f, func=%s, args=%s, kargs=%s)" % (Eo.__repr__(self),
|
||||
self.interval if self.obj else -1.0,
|
||||
self.func, self.args, self.kargs)
|
||||
|
||||
cpdef object _task_exec(self):
|
||||
return self.func(*self.args, **self.kargs)
|
||||
|
||||
def delete(self):
|
||||
ecore_timer_del(self.obj)
|
||||
|
||||
def stop(self):
|
||||
self.delete()
|
||||
|
||||
def freeze(self):
|
||||
ecore_timer_freeze(self.obj)
|
||||
|
||||
def thaw(self):
|
||||
ecore_timer_thaw(self.obj)
|
||||
|
||||
def interval_set(self, double t):
|
||||
ecore_timer_interval_set(self.obj, t)
|
||||
|
||||
def interval_get(self):
|
||||
return ecore_timer_interval_get(self.obj)
|
||||
|
||||
property interval:
|
||||
def __get__(self):
|
||||
return ecore_timer_interval_get(self.obj)
|
||||
|
||||
def __set__(self, double t):
|
||||
ecore_timer_interval_set(self.obj, t)
|
||||
|
||||
def delay(self, double add):
|
||||
ecore_timer_delay(self.obj, add)
|
||||
|
||||
def reset(self):
|
||||
ecore_timer_reset(self.obj)
|
||||
|
||||
def ecore_timer_pending_get(self):
|
||||
ecore_timer_pending_get(self.obj)
|
||||
|
||||
property pending:
|
||||
def __get__(self):
|
||||
return ecore_timer_pending_get(self.obj)
|
||||
|
||||
|
||||
def timer_add(double t, func, *args, **kargs):
|
||||
return Timer(t, func, *args, **kargs)
|
||||
|
||||
|
||||
def timer_precision_get():
|
||||
return ecore_timer_precision_get()
|
||||
|
||||
|
||||
def timer_precision_set(double value):
|
||||
ecore_timer_precision_set(value)
|
||||
|
|
@ -0,0 +1,328 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Edje.
|
||||
#
|
||||
# Python-Edje 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-Edje 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-Edje. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import traceback
|
||||
import warnings
|
||||
|
||||
from cpython cimport PyMem_Malloc, PyMem_Free
|
||||
cimport libc.stdlib
|
||||
|
||||
from efl.eo cimport _object_mapping_register, object_from_instance
|
||||
from efl.eo cimport _ctouni, _cfruni, _touni, _fruni, _strings_to_python
|
||||
|
||||
|
||||
# Edje_Message_Type:
|
||||
EDJE_MESSAGE_NONE = 0
|
||||
EDJE_MESSAGE_SIGNAL = 1
|
||||
EDJE_MESSAGE_STRING = 2
|
||||
EDJE_MESSAGE_INT = 3
|
||||
EDJE_MESSAGE_FLOAT = 4
|
||||
EDJE_MESSAGE_STRING_SET = 5
|
||||
EDJE_MESSAGE_INT_SET = 6
|
||||
EDJE_MESSAGE_FLOAT_SET = 7
|
||||
EDJE_MESSAGE_STRING_INT = 8
|
||||
EDJE_MESSAGE_STRING_FLOAT = 9
|
||||
EDJE_MESSAGE_STRING_INT_SET = 10
|
||||
EDJE_MESSAGE_STRING_FLOAT_SET = 11
|
||||
|
||||
# Edje_Aspect_Control:
|
||||
EDJE_ASPECT_CONTROL_NONE = 0
|
||||
EDJE_ASPECT_CONTROL_NEITHER = 1
|
||||
EDJE_ASPECT_CONTROL_HORIZONTAL = 2
|
||||
EDJE_ASPECT_CONTROL_VERTICAL = 3
|
||||
EDJE_ASPECT_CONTROL_BOTH = 4
|
||||
|
||||
# Edje_Drag_Dir:
|
||||
EDJE_DRAG_DIR_NONE = 0
|
||||
EDJE_DRAG_DIR_X = 1
|
||||
EDJE_DRAG_DIR_Y = 2
|
||||
EDJE_DRAG_DIR_XY = 3
|
||||
|
||||
# Edje_Load_Error:
|
||||
EDJE_LOAD_ERROR_NONE = 0
|
||||
EDJE_LOAD_ERROR_GENERIC = 1
|
||||
EDJE_LOAD_ERROR_DOES_NOT_EXIST = 2
|
||||
EDJE_LOAD_ERROR_PERMISSION_DENIED = 3
|
||||
EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4
|
||||
EDJE_LOAD_ERROR_CORRUPT_FILE = 5
|
||||
EDJE_LOAD_ERROR_UNKNOWN_FORMAT = 6
|
||||
EDJE_LOAD_ERROR_INCOMPATIBLE_FILE = 7
|
||||
EDJE_LOAD_ERROR_UNKNOWN_COLLECTION = 8
|
||||
|
||||
# Edje_Part_Type:
|
||||
EDJE_PART_TYPE_NONE = 0
|
||||
EDJE_PART_TYPE_RECTANGLE = 1
|
||||
EDJE_PART_TYPE_TEXT = 2
|
||||
EDJE_PART_TYPE_IMAGE = 3
|
||||
EDJE_PART_TYPE_SWALLOW = 4
|
||||
EDJE_PART_TYPE_TEXTBLOCK = 5
|
||||
EDJE_PART_TYPE_GRADIENT = 6
|
||||
EDJE_PART_TYPE_GROUP = 7
|
||||
EDJE_PART_TYPE_BOX = 8
|
||||
EDJE_PART_TYPE_TABLE = 9
|
||||
EDJE_PART_TYPE_EXTERNAL = 10
|
||||
EDJE_PART_TYPE_LAST = 11
|
||||
|
||||
# Edje_Text_Effect:
|
||||
EDJE_TEXT_EFFECT_NONE = 0
|
||||
EDJE_TEXT_EFFECT_PLAIN = 1
|
||||
EDJE_TEXT_EFFECT_OUTLINE = 2
|
||||
EDJE_TEXT_EFFECT_SOFT_OUTLINE = 3
|
||||
EDJE_TEXT_EFFECT_SHADOW = 4
|
||||
EDJE_TEXT_EFFECT_SOFT_SHADOW = 5
|
||||
EDJE_TEXT_EFFECT_OUTLINE_SHADOW = 6
|
||||
EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW = 7
|
||||
EDJE_TEXT_EFFECT_FAR_SHADOW = 8
|
||||
EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW = 9
|
||||
EDJE_TEXT_EFFECT_GLOW = 10
|
||||
EDJE_TEXT_EFFECT_LAST = 11
|
||||
|
||||
# Edje_Action_Type:
|
||||
EDJE_ACTION_TYPE_NONE = 0
|
||||
EDJE_ACTION_TYPE_STATE_SET = 1
|
||||
EDJE_ACTION_TYPE_ACTION_STOP = 2
|
||||
EDJE_ACTION_TYPE_SIGNAL_EMIT = 3
|
||||
EDJE_ACTION_TYPE_DRAG_VAL_SET = 4
|
||||
EDJE_ACTION_TYPE_DRAG_VAL_STEP = 5
|
||||
EDJE_ACTION_TYPE_DRAG_VAL_PAGE = 6
|
||||
EDJE_ACTION_TYPE_SCRIPT = 7
|
||||
EDJE_ACTION_TYPE_FOCUS_SET = 8
|
||||
EDJE_ACTION_TYPE_LUA_SCRIPT = 9
|
||||
EDJE_ACTION_TYPE_LAST = 10
|
||||
|
||||
# Edje_Tween_Mode:
|
||||
EDJE_TWEEN_MODE_NONE = 0
|
||||
EDJE_TWEEN_MODE_LINEAR = 1
|
||||
EDJE_TWEEN_MODE_SINUSOIDAL = 2
|
||||
EDJE_TWEEN_MODE_ACCELERATE = 3
|
||||
EDJE_TWEEN_MODE_DECELERATE = 4
|
||||
EDJE_TWEEN_MODE_LAST = 5
|
||||
|
||||
# Edje_External_Param_Type:
|
||||
EDJE_EXTERNAL_PARAM_TYPE_INT = 0
|
||||
EDJE_EXTERNAL_PARAM_TYPE_DOUBLE = 1
|
||||
EDJE_EXTERNAL_PARAM_TYPE_STRING = 2
|
||||
EDJE_EXTERNAL_PARAM_TYPE_BOOL = 3
|
||||
EDJE_EXTERNAL_PARAM_TYPE_CHOICE = 4
|
||||
EDJE_EXTERNAL_PARAM_TYPE_MAX = 5
|
||||
|
||||
|
||||
|
||||
def init():
|
||||
cdef int r = edje_init()
|
||||
|
||||
if edje_external_type_abi_version_get() != EDJE_EXTERNAL_TYPE_ABI_VERSION:
|
||||
raise TypeError("python-edje Edje_External_Type abi_version differs "
|
||||
"from libedje.so. Recompile python-edje!")
|
||||
return r
|
||||
|
||||
|
||||
def shutdown():
|
||||
return edje_shutdown()
|
||||
|
||||
|
||||
def frametime_set(double t):
|
||||
edje_frametime_set(t)
|
||||
|
||||
|
||||
def frametime_get():
|
||||
return edje_frametime_get()
|
||||
|
||||
|
||||
def freeze():
|
||||
edje_freeze()
|
||||
|
||||
|
||||
def thaw():
|
||||
edje_thaw()
|
||||
|
||||
|
||||
def fontset_append_set(fonts):
|
||||
edje_fontset_append_set(_cfruni(fonts))
|
||||
|
||||
|
||||
def fontset_append_get():
|
||||
return _ctouni(edje_fontset_append_get())
|
||||
|
||||
|
||||
def file_collection_list(file):
|
||||
cdef Eina_List *lst
|
||||
lst = edje_file_collection_list(_cfruni(file))
|
||||
ret = _strings_to_python(lst)
|
||||
edje_file_collection_list_free(lst)
|
||||
return ret
|
||||
|
||||
|
||||
def file_group_exists(file, group):
|
||||
return bool(edje_file_group_exists(_cfruni(file), _cfruni(group)))
|
||||
|
||||
|
||||
def file_data_get(file, key):
|
||||
cdef char *s
|
||||
return _ctouni(edje_file_data_get(_cfruni(file), _cfruni(key)))
|
||||
|
||||
|
||||
def file_cache_set(int count):
|
||||
edje_file_cache_set(count)
|
||||
|
||||
|
||||
def file_cache_get():
|
||||
return edje_file_cache_get()
|
||||
|
||||
|
||||
def file_cache_flush():
|
||||
edje_file_cache_flush()
|
||||
|
||||
|
||||
def collection_cache_set(int count):
|
||||
edje_collection_cache_set(count)
|
||||
|
||||
|
||||
def collection_cache_get():
|
||||
return edje_collection_cache_get()
|
||||
|
||||
|
||||
def collection_cache_flush():
|
||||
edje_collection_cache_flush()
|
||||
|
||||
|
||||
def color_class_set(color_class,
|
||||
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_color_class_set(_cfruni(color_class),
|
||||
r, g, b, a,
|
||||
r2, g2, b2, a2,
|
||||
r3, g3, b3, a3)
|
||||
|
||||
|
||||
def color_class_get(color_class):
|
||||
cdef int r, g, b, a
|
||||
cdef int r2, g2, b2, a2
|
||||
cdef int r3, g3, b3, a3
|
||||
edje_color_class_get(_cfruni(color_class),
|
||||
&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 color_class_del(color_class):
|
||||
edje_color_class_del(_cfruni(color_class))
|
||||
|
||||
|
||||
def color_class_list():
|
||||
cdef Eina_List *lst, *itr
|
||||
ret = []
|
||||
lst = edje_color_class_list()
|
||||
itr = lst
|
||||
while itr:
|
||||
ret.append(<char*>itr.data)
|
||||
libc.stdlib.free(itr.data)
|
||||
itr = itr.next
|
||||
eina_list_free(lst)
|
||||
return ret
|
||||
|
||||
|
||||
def text_class_set(text_class, font, int size):
|
||||
edje_text_class_set(_cfruni(text_class), _cfruni(font), size)
|
||||
|
||||
|
||||
def text_class_del(text_class):
|
||||
edje_text_class_del(_cfruni(text_class))
|
||||
|
||||
|
||||
def text_class_list():
|
||||
cdef Eina_List *lst, *itr
|
||||
ret = []
|
||||
lst = edje_text_class_list()
|
||||
itr = lst
|
||||
while itr:
|
||||
ret.append(<char*>itr.data)
|
||||
libc.stdlib.free(itr.data)
|
||||
itr = itr.next
|
||||
eina_list_free(lst)
|
||||
return ret
|
||||
|
||||
|
||||
def message_signal_process():
|
||||
edje_message_signal_process()
|
||||
|
||||
|
||||
def extern_object_min_size_set(Object obj, int w, int h):
|
||||
edje_extern_object_min_size_set(obj.obj, w, h)
|
||||
|
||||
|
||||
def extern_object_max_size_set(Object obj, int w, int h):
|
||||
edje_extern_object_max_size_set(obj.obj, w, h)
|
||||
|
||||
|
||||
def extern_object_aspect_set(Object obj, int aspect, int w, int h):
|
||||
edje_extern_object_aspect_set(obj.obj, <Edje_Aspect_Control>aspect, w, h)
|
||||
|
||||
|
||||
def available_modules_get():
|
||||
cdef const_Eina_List *lst
|
||||
lst = edje_available_modules_get()
|
||||
ret = []
|
||||
while lst:
|
||||
ret.append(<char*>lst.data)
|
||||
lst = lst.next
|
||||
return ret
|
||||
|
||||
|
||||
def module_load(name):
|
||||
return bool(edje_module_load(_cfruni(name)))
|
||||
|
||||
# class EdjeObjectMeta(evas.c_evas.EvasObjectMeta):
|
||||
# def __init__(cls, name, bases, dict_):
|
||||
# evas.c_evas.EvasObjectMeta.__init__(cls, name, bases, dict_)
|
||||
# cls._fetch_callbacks()
|
||||
#
|
||||
# def _fetch_callbacks(cls):
|
||||
# if "__edje_signal_callbacks__" in cls.__dict__:
|
||||
# return
|
||||
#
|
||||
# cls.__edje_signal_callbacks__ = []
|
||||
# cls.__edje_message_callbacks__ = []
|
||||
# cls.__edje_text_callbacks__ = []
|
||||
#
|
||||
# sig_append = cls.__edje_signal_callbacks__.append
|
||||
# msg_append = cls.__edje_message_callbacks__.append
|
||||
# txt_append = cls.__edje_text_callbacks__.append
|
||||
#
|
||||
# for name in dir(cls):
|
||||
# val = getattr(cls, name)
|
||||
# if not callable(val):
|
||||
# continue
|
||||
#
|
||||
# if hasattr(val, "edje_signal_callback"):
|
||||
# sig_data = getattr(val, "edje_signal_callback")
|
||||
# sig_append((name, sig_data))
|
||||
# elif hasattr(val, "edje_message_handler"):
|
||||
# msg_append(name)
|
||||
# elif hasattr(val, "edje_text_change_callback"):
|
||||
# txt_append(name)
|
||||
|
||||
|
||||
include "efl.edje_message.pxi"
|
||||
include "efl.edje_external.pxi"
|
||||
include "efl.edje_object.pxi"
|
||||
|
||||
|
||||
init()
|
|
@ -0,0 +1,488 @@
|
|||
# Copyright (C) 2007-2009 Gustavo Sverzut Barbieri, Ulisses Furquim,
|
||||
# Ivan Briano
|
||||
#
|
||||
# This file is part of Python-Edje.
|
||||
#
|
||||
# Python-Edje 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-Edje 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-Edje. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
cdef class ExternalParam:
|
||||
property name:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.name
|
||||
|
||||
property type:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.type
|
||||
|
||||
property i:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.i
|
||||
|
||||
property d:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.d
|
||||
|
||||
property s:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if self.obj.s != NULL:
|
||||
return self.obj.s
|
||||
|
||||
property b:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return bool(self.obj.i)
|
||||
|
||||
property value:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if self.obj.type == EDJE_EXTERNAL_PARAM_TYPE_INT:
|
||||
return self.obj.i
|
||||
elif self.obj.type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
||||
return self.obj.d
|
||||
elif self.obj.type == EDJE_EXTERNAL_PARAM_TYPE_STRING or \
|
||||
self.obj.type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
||||
if self.obj.s != NULL:
|
||||
return self.obj.s
|
||||
elif self.obj.type == EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
||||
return bool(self.obj.i)
|
||||
|
||||
|
||||
cdef ExternalParam ExternalParam_from_ptr(Edje_External_Param *param):
|
||||
cdef ExternalParam p
|
||||
p = ExternalParam()
|
||||
p.obj = param
|
||||
return p
|
||||
|
||||
# XXX: this should be C-only, but it would require edje_edit
|
||||
# XXX: being able to use it.
|
||||
def _ExternalParam_from_ptr(long ptr):
|
||||
return ExternalParam_from_ptr(<Edje_External_Param *>ptr)
|
||||
|
||||
|
||||
cdef class ExternalParamInfo:
|
||||
property name:
|
||||
def __get__(self):
|
||||
if self.obj.name:
|
||||
return self.obj.name
|
||||
return "(unknown)"
|
||||
|
||||
property translated_name:
|
||||
def __get__(self):
|
||||
cdef const_char_ptr t
|
||||
if self._external_type_obj == NULL or \
|
||||
self._external_type_obj.translate == NULL:
|
||||
return self.name
|
||||
t = self._external_type_obj.translate(self._external_type_obj.data,
|
||||
self.obj.name)
|
||||
if t == NULL:
|
||||
return self.name
|
||||
return t
|
||||
|
||||
property type:
|
||||
def __get__(self):
|
||||
return self.obj.type
|
||||
|
||||
def validate(self, value):
|
||||
return True
|
||||
|
||||
cdef _set_external_type(self, t):
|
||||
cdef ExternalType ext_type
|
||||
self.external_type = t
|
||||
if isinstance(t, ExternalType):
|
||||
ext_type = t
|
||||
self._external_type_obj = ext_type._obj
|
||||
|
||||
|
||||
cdef class ExternalParamInfoInt(ExternalParamInfo):
|
||||
property default:
|
||||
def __get__(self):
|
||||
if self.obj.info.i.default == EDJE_EXTERNAL_INT_UNSET:
|
||||
return None
|
||||
return self.obj.info.i.default
|
||||
|
||||
property min:
|
||||
def __get__(self):
|
||||
if self.obj.info.i.min == EDJE_EXTERNAL_INT_UNSET:
|
||||
return None
|
||||
return self.obj.info.i.min
|
||||
|
||||
property max:
|
||||
def __get__(self):
|
||||
if self.obj.info.i.max == EDJE_EXTERNAL_INT_UNSET:
|
||||
return None
|
||||
return self.obj.info.i.max
|
||||
|
||||
property step:
|
||||
def __get__(self):
|
||||
if self.obj.info.i.step == EDJE_EXTERNAL_INT_UNSET:
|
||||
return None
|
||||
return self.obj.info.i.step
|
||||
|
||||
def validate(self, value):
|
||||
min = self.min
|
||||
max = self.max
|
||||
if min is not None and value < min:
|
||||
return False
|
||||
if max is not None and value > max:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
cdef class ExternalParamInfoDouble(ExternalParamInfo):
|
||||
property default:
|
||||
def __get__(self):
|
||||
if self.obj.info.d.default == EDJE_EXTERNAL_DOUBLE_UNSET:
|
||||
return None
|
||||
return self.obj.info.d.default
|
||||
|
||||
property min:
|
||||
def __get__(self):
|
||||
if self.obj.info.d.min == EDJE_EXTERNAL_DOUBLE_UNSET:
|
||||
return None
|
||||
return self.obj.info.d.min
|
||||
|
||||
property max:
|
||||
def __get__(self):
|
||||
if self.obj.info.d.max == EDJE_EXTERNAL_DOUBLE_UNSET:
|
||||
return None
|
||||
return self.obj.info.d.max
|
||||
|
||||
property step:
|
||||
def __get__(self):
|
||||
if self.obj.info.d.step == EDJE_EXTERNAL_DOUBLE_UNSET:
|
||||
return None
|
||||
return self.obj.info.d.step
|
||||
|
||||
def validate(self, value):
|
||||
min = self.min
|
||||
max = self.max
|
||||
if min is not None and value < min:
|
||||
return False
|
||||
if max is not None and value > max:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
cdef class ExternalParamInfoString(ExternalParamInfo):
|
||||
property default:
|
||||
def __get__(self):
|
||||
if self.obj.info.s.default == NULL:
|
||||
return None
|
||||
return self.obj.info.s.default
|
||||
|
||||
property translated_default:
|
||||
def __get__(self):
|
||||
cdef const_char_ptr t
|
||||
if self._external_type_obj == NULL or \
|
||||
self._external_type_obj.translate == NULL:
|
||||
return self.default
|
||||
t = self._external_type_obj.translate(self._external_type_obj.data,
|
||||
self.obj.info.s.default)
|
||||
if t == NULL:
|
||||
return self.default
|
||||
return t
|
||||
|
||||
property accept_format:
|
||||
def __get__(self):
|
||||
if self.obj.info.s.accept_fmt == NULL:
|
||||
return None
|
||||
return self.obj.info.s.accept_fmt
|
||||
|
||||
property deny_format:
|
||||
def __get__(self):
|
||||
if self.obj.info.s.deny_fmt == NULL:
|
||||
return None
|
||||
return self.obj.info.s.deny_fmt
|
||||
|
||||
|
||||
cdef class ExternalParamInfoBool(ExternalParamInfo):
|
||||
property default:
|
||||
def __get__(self):
|
||||
return bool(self.obj.info.b.default)
|
||||
|
||||
property false_string:
|
||||
def __get__(self):
|
||||
if self.obj.info.b.false_str == NULL:
|
||||
return None
|
||||
return self.obj.info.b.false_str
|
||||
|
||||
property translated_false_string:
|
||||
def __get__(self):
|
||||
cdef const_char_ptr t
|
||||
if self._external_type_obj == NULL or \
|
||||
self._external_type_obj.translate == NULL:
|
||||
return self.false_string
|
||||
t = self._external_type_obj.translate(self._external_type_obj.data,
|
||||
self.obj.info.b.false_str)
|
||||
if t == NULL:
|
||||
return self.false_string
|
||||
return t
|
||||
|
||||
property true_string:
|
||||
def __get__(self):
|
||||
if self.obj.info.b.true_str == NULL:
|
||||
return None
|
||||
return self.obj.info.b.true_str
|
||||
|
||||
property translated_true_string:
|
||||
def __get__(self):
|
||||
cdef const_char_ptr t
|
||||
if self._external_type_obj == NULL or \
|
||||
self._external_type_obj.translate == NULL:
|
||||
return self.true_string
|
||||
t = self._external_type_obj.translate(self._external_type_obj.data,
|
||||
self.obj.info.b.true_str)
|
||||
if t == NULL:
|
||||
return self.true_string
|
||||
return t
|
||||
|
||||
|
||||
cdef class ExternalParamInfoChoice(ExternalParamInfo):
|
||||
property default:
|
||||
def __get__(self):
|
||||
if self.obj.info.c.default == NULL:
|
||||
return None
|
||||
return self.obj.info.c.default
|
||||
|
||||
property translated_default:
|
||||
def __get__(self):
|
||||
cdef const_char_ptr t
|
||||
if self._external_type_obj == NULL or \
|
||||
self._external_type_obj.translate == NULL:
|
||||
return self.default
|
||||
t = self._external_type_obj.translate(self._external_type_obj.data,
|
||||
self.obj.info.c.default)
|
||||
if t == NULL:
|
||||
return self.default
|
||||
return t
|
||||
|
||||
property choices:
|
||||
def __get__(self):
|
||||
cdef int i
|
||||
|
||||
if self.obj.info.c.choices == NULL:
|
||||
return None
|
||||
|
||||
i = 0
|
||||
lst = []
|
||||
while self.obj.info.c.choices[i] != NULL:
|
||||
lst.append(self.obj.info.c.choices[i])
|
||||
i += 1
|
||||
return lst
|
||||
|
||||
property translated_choices:
|
||||
def __get__(self):
|
||||
cdef const_char_ptr t
|
||||
if self._external_type_obj == NULL or \
|
||||
self._external_type_obj.translate == NULL:
|
||||
return self.choices
|
||||
|
||||
orig = self.choices
|
||||
ret = []
|
||||
for choice in orig:
|
||||
ret.append(
|
||||
self._external_type_obj.translate(
|
||||
self._external_type_obj.data, choice) or choice)
|
||||
return ret
|
||||
|
||||
|
||||
cdef ExternalParamInfo ExternalParamInfo_from_ptr(type, Edje_External_Param_Info *ptr):
|
||||
cdef ExternalParamInfo p
|
||||
if ptr.type == EDJE_EXTERNAL_PARAM_TYPE_INT:
|
||||
p = ExternalParamInfoInt()
|
||||
elif ptr.type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
||||
p = ExternalParamInfoDouble()
|
||||
elif ptr.type == EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
||||
p = ExternalParamInfoString()
|
||||
elif ptr.type == EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
||||
p = ExternalParamInfoBool()
|
||||
elif ptr.type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
||||
p = ExternalParamInfoChoice()
|
||||
else:
|
||||
msg = "Don't know how to convert parameter %s of type %s" % \
|
||||
(ptr.name, edje_external_param_type_str(ptr.type))
|
||||
warnings.warn(msg, Warning)
|
||||
return None
|
||||
p.obj = ptr
|
||||
p._set_external_type(type)
|
||||
return p
|
||||
|
||||
def external_param_info_get(char *type_name):
|
||||
cdef const_Edje_External_Type *ext_type
|
||||
cdef ExternalType t
|
||||
|
||||
warnings.warn("Use ExternalType.parameters_info_get() instead!",
|
||||
DeprecationWarning)
|
||||
|
||||
ext_type = edje_external_type_get(type_name)
|
||||
if ext_type == NULL:
|
||||
return tuple()
|
||||
|
||||
t = ExternalType()
|
||||
t._name = type_name
|
||||
t._obj = ext_type
|
||||
return t.parameters_info_get()
|
||||
|
||||
|
||||
cdef class ExternalType:
|
||||
property name:
|
||||
def __get__(self):
|
||||
return self._name
|
||||
|
||||
property module:
|
||||
def __get__(self):
|
||||
if self._obj.module == NULL:
|
||||
return None
|
||||
return self._obj.module
|
||||
|
||||
property module_name:
|
||||
def __get__(self):
|
||||
if self._obj.module_name == NULL:
|
||||
return None
|
||||
return self._obj.module_name
|
||||
|
||||
def label_get(self):
|
||||
cdef const_char_ptr l
|
||||
if self._obj.label_get == NULL:
|
||||
return None
|
||||
l = self._obj.label_get(self._obj.data)
|
||||
if l == NULL:
|
||||
return None
|
||||
ret = l
|
||||
return ret
|
||||
|
||||
def description_get(self):
|
||||
cdef const_char_ptr l
|
||||
if self._obj.description_get == NULL:
|
||||
return None
|
||||
l = self._obj.description_get(self._obj.data)
|
||||
if l == NULL:
|
||||
return None
|
||||
ret = l
|
||||
return ret
|
||||
|
||||
def translate(self, char *text):
|
||||
"""Used to translate text originated from this module.
|
||||
|
||||
Usually this is only required for static text, like the
|
||||
parameters. label_get() and description_get() may not require
|
||||
it. Note that ExternalParamInfo provides translated_* versions
|
||||
of its worth translating strings!
|
||||
|
||||
It will always return a string, on errors the parameter text
|
||||
is returned untranslated.
|
||||
"""
|
||||
cdef const_char_ptr l
|
||||
if self._obj.translate == NULL:
|
||||
return text
|
||||
l = self._obj.translate(self._obj.data, text)
|
||||
if l == NULL:
|
||||
return text
|
||||
return l
|
||||
|
||||
def icon_add(self, Canvas canvas not None):
|
||||
cdef Evas_Object *icon
|
||||
if self._obj.icon_add == NULL:
|
||||
return None
|
||||
icon = self._obj.icon_add(self._obj.data, canvas.obj)
|
||||
if icon == NULL:
|
||||
return None
|
||||
return object_from_instance(icon)
|
||||
|
||||
def preview_add(self, Canvas canvas not None):
|
||||
cdef Evas_Object *preview
|
||||
if self._obj.preview_add == NULL:
|
||||
return None
|
||||
preview = self._obj.preview_add(self._obj.data, canvas.obj)
|
||||
if preview == NULL:
|
||||
return None
|
||||
return object_from_instance(preview)
|
||||
|
||||
def parameters_info_get(self):
|
||||
cdef Edje_External_Param_Info *params
|
||||
cdef int i
|
||||
|
||||
if self._parameters_info:
|
||||
return self._parameters_info
|
||||
|
||||
lst = []
|
||||
params = self._obj.parameters_info
|
||||
if params == NULL:
|
||||
self._parameters_info = tuple()
|
||||
|
||||
i = 0
|
||||
while params[i].name != NULL:
|
||||
lst.append(ExternalParamInfo_from_ptr(self, ¶ms[i]))
|
||||
i += 1
|
||||
self._parameters_info = tuple(lst)
|
||||
return self._parameters_info
|
||||
|
||||
property parameters_info:
|
||||
def __get__(self):
|
||||
return self.parameters_info_get()
|
||||
|
||||
|
||||
cdef class ExternalIterator:
|
||||
cdef Eina_Iterator *obj
|
||||
|
||||
def __init__(self):
|
||||
cdef Eina_Iterator *it
|
||||
it = edje_external_iterator_get()
|
||||
self._set_obj(it)
|
||||
|
||||
cdef _set_obj(self, Eina_Iterator *ptr):
|
||||
self.obj = ptr
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
cdef const_Eina_Hash_Tuple *tuple
|
||||
cdef ExternalType t
|
||||
if eina_iterator_next(self.obj, <void **>&tuple):
|
||||
t = ExternalType()
|
||||
t._name = <char*>tuple.key
|
||||
t._obj = <const_Edje_External_Type*>tuple.data
|
||||
return t
|
||||
else:
|
||||
raise StopIteration
|
||||
|
||||
def __del__(self):
|
||||
if self.obj:
|
||||
eina_iterator_free(self.obj)
|
||||
|
||||
def external_type_get(char *type_name):
|
||||
"Gets the instance that represents an ExternalType of the given name."
|
||||
cdef const_Edje_External_Type *obj = edje_external_type_get(type_name)
|
||||
cdef ExternalType ret
|
||||
if obj == NULL:
|
||||
return None
|
||||
ret = ExternalType()
|
||||
ret._name = type_name
|
||||
ret._obj = obj
|
||||
return ret
|
||||
|
|
@ -0,0 +1,375 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri
|
||||
#
|
||||
# This file is part of Python-Edje.
|
||||
#
|
||||
# Python-Edje 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-Edje 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-Edje. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
cdef class Message:
|
||||
"""Base class to represent Edje messages.
|
||||
|
||||
@ivar type: message type.
|
||||
@ivar id: message id.
|
||||
"""
|
||||
property type:
|
||||
def __get__(self):
|
||||
return self._type
|
||||
|
||||
property id:
|
||||
def __get__(self):
|
||||
return self._id
|
||||
|
||||
|
||||
cdef class MessageString(Message):
|
||||
"""String message.
|
||||
|
||||
@ivar str: message contents.
|
||||
@ivar val: same as str.
|
||||
"""
|
||||
property str:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if self.obj.str != NULL:
|
||||
return self.obj.str
|
||||
|
||||
property val: # copy from 'str', to make api consistent
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if self.obj.str != NULL:
|
||||
return self.obj.str
|
||||
|
||||
|
||||
cdef class MessageInt(Message):
|
||||
"""Integer message.
|
||||
|
||||
@ivar val: message contents.
|
||||
"""
|
||||
property val:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.val
|
||||
|
||||
|
||||
cdef class MessageFloat(Message):
|
||||
"""Float message.
|
||||
|
||||
@ivar val: message contents.
|
||||
"""
|
||||
property val:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.val
|
||||
|
||||
|
||||
cdef class MessageStringSet(Message):
|
||||
"""String set message.
|
||||
|
||||
@ivar val: message contents.
|
||||
"""
|
||||
property val:
|
||||
def __get__(self):
|
||||
cdef int i
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
lst = []
|
||||
for i from 0 <= i < self.obj.count:
|
||||
if self.obj.str[i] != NULL:
|
||||
lst.append(self.obj.str[i])
|
||||
return lst
|
||||
|
||||
def __len__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.count
|
||||
|
||||
def __getitem__(self, int index):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if index < 0 or index >= self.obj.count:
|
||||
raise IndexError("list index out of range")
|
||||
return self.obj.str[index]
|
||||
|
||||
|
||||
cdef class MessageIntSet(Message):
|
||||
"""Integer set message.
|
||||
|
||||
@ivar val: message contents.
|
||||
"""
|
||||
property val:
|
||||
def __get__(self):
|
||||
cdef int i
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
lst = []
|
||||
for i from 0 <= i < self.obj.count:
|
||||
lst.append(self.obj.val[i])
|
||||
return lst
|
||||
|
||||
def __len__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.count
|
||||
|
||||
def __getitem__(self, int index):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if index < 0 or index >= self.obj.count:
|
||||
raise IndexError("list index out of range")
|
||||
return self.obj.val[index]
|
||||
|
||||
|
||||
cdef class MessageFloatSet(Message):
|
||||
"""Float set message.
|
||||
|
||||
@ivar val: message contents.
|
||||
"""
|
||||
property val:
|
||||
def __get__(self):
|
||||
cdef int i
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
lst = []
|
||||
for i from 0 <= i < self.obj.count:
|
||||
lst.append(self.obj.val[i])
|
||||
return lst
|
||||
|
||||
def __len__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.count
|
||||
|
||||
def __getitem__(self, int index):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if index < 0 or index >= self.obj.count:
|
||||
raise IndexError("list index out of range")
|
||||
return self.obj.val[index]
|
||||
|
||||
|
||||
cdef class MessageStringInt(Message):
|
||||
"""String + Integer message.
|
||||
|
||||
@ivar str: string.
|
||||
@ivar val: integer.
|
||||
"""
|
||||
property str:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if self.obj.str != NULL:
|
||||
return self.obj.str
|
||||
|
||||
property val:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.val
|
||||
|
||||
|
||||
cdef class MessageStringFloat(Message):
|
||||
"""String + float message.
|
||||
|
||||
@ivar str: string.
|
||||
@ivar val: float.
|
||||
"""
|
||||
property str:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if self.obj.str != NULL:
|
||||
return self.obj.str
|
||||
|
||||
property val:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.val
|
||||
|
||||
|
||||
cdef class MessageStringIntSet(Message):
|
||||
"""String + Integer set message.
|
||||
|
||||
@ivar str: string.
|
||||
@ivar val: integer list.
|
||||
"""
|
||||
property str:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if self.obj.str != NULL:
|
||||
return self.obj.str
|
||||
|
||||
property val:
|
||||
def __get__(self):
|
||||
cdef int i
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
lst = []
|
||||
for i from 0 <= i < self.obj.count:
|
||||
lst.append(self.obj.val[i])
|
||||
return lst
|
||||
|
||||
def __len__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.count
|
||||
|
||||
def __getitem__(self, int index):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if index < 0 or index >= self.obj.count:
|
||||
raise IndexError("list index out of range")
|
||||
return self.obj.val[index]
|
||||
|
||||
|
||||
cdef class MessageStringFloatSet(Message):
|
||||
"""String + Float set message.
|
||||
|
||||
@ivar str: string.
|
||||
@ivar val: float list.
|
||||
"""
|
||||
property str:
|
||||
def __get__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if self.obj.str != NULL:
|
||||
return self.obj.str
|
||||
|
||||
property val:
|
||||
def __get__(self):
|
||||
cdef int i
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
lst = []
|
||||
for i from 0 <= i < self.obj.count:
|
||||
lst.append(self.obj.val[i])
|
||||
return lst
|
||||
|
||||
def __len__(self):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
return self.obj.count
|
||||
|
||||
def __getitem__(self, int index):
|
||||
if self.obj == NULL:
|
||||
raise ValueError("Object uninitialized")
|
||||
if index < 0 or index >= self.obj.count:
|
||||
raise IndexError("list index out of range")
|
||||
return self.obj.val[index]
|
||||
|
||||
|
||||
cdef Message MessageString_from_ptr(void *msg):
|
||||
cdef MessageString m
|
||||
m = MessageString()
|
||||
m.obj = <Edje_Message_String*>msg
|
||||
return m
|
||||
|
||||
|
||||
cdef Message MessageInt_from_ptr(void *msg):
|
||||
cdef MessageInt m
|
||||
m = MessageInt()
|
||||
m.obj = <Edje_Message_Int*>msg
|
||||
return m
|
||||
|
||||
|
||||
cdef Message MessageFloat_from_ptr(void *msg):
|
||||
cdef MessageFloat m
|
||||
m = MessageFloat()
|
||||
m.obj = <Edje_Message_Float*>msg
|
||||
return m
|
||||
|
||||
|
||||
cdef Message MessageStringSet_from_ptr(void *msg):
|
||||
cdef MessageStringSet m
|
||||
m = MessageStringSet()
|
||||
m.obj = <Edje_Message_String_Set*>msg
|
||||
return m
|
||||
|
||||
|
||||
cdef Message MessageIntSet_from_ptr(void *msg):
|
||||
cdef MessageIntSet m
|
||||
m = MessageIntSet()
|
||||
m.obj = <Edje_Message_Int_Set*>msg
|
||||
return m
|
||||
|
||||
|
||||
cdef Message MessageFloatSet_from_ptr(void *msg):
|
||||
cdef MessageFloatSet m
|
||||
m = MessageFloatSet()
|
||||
m.obj = <Edje_Message_Float_Set*>msg
|
||||
return m
|
||||
|
||||
|
||||
cdef Message MessageStringInt_from_ptr(void *msg):
|
||||
cdef MessageStringInt m
|
||||
m = MessageStringInt()
|
||||
m.obj = <Edje_Message_String_Int*>msg
|
||||
return m
|
||||
|
||||
|
||||
cdef Message MessageStringFloat_from_ptr(void *msg):
|
||||
cdef MessageStringFloat m
|
||||
m = MessageStringFloat()
|
||||
m.obj = <Edje_Message_String_Float*>msg
|
||||
return m
|
||||
|
||||
|
||||
cdef Message MessageStringIntSet_from_ptr(void *msg):
|
||||
cdef MessageStringIntSet m
|
||||
m = MessageStringIntSet()
|
||||
m.obj = <Edje_Message_String_Int_Set*>msg
|
||||
return m
|
||||
|
||||
|
||||
cdef Message MessageStringFloatSet_from_ptr(void *msg):
|
||||
cdef MessageStringFloatSet m
|
||||
m = MessageStringFloatSet()
|
||||
m.obj = <Edje_Message_String_Float_Set*>msg
|
||||
return m
|
||||
|
||||
|
||||
cdef Message Message_from_type(Edje_Message_Type type, int id, void *msg):
|
||||
cdef Message m
|
||||
if type == EDJE_MESSAGE_NONE:
|
||||
return None
|
||||
elif type == EDJE_MESSAGE_SIGNAL:
|
||||
m = MessageSignal()
|
||||
elif type == EDJE_MESSAGE_STRING:
|
||||
m = MessageString_from_ptr(msg)
|
||||
elif type == EDJE_MESSAGE_INT:
|
||||
m = MessageInt_from_ptr(msg)
|
||||
elif type == EDJE_MESSAGE_FLOAT:
|
||||
m = MessageFloat_from_ptr(msg)
|
||||
elif type == EDJE_MESSAGE_STRING_SET:
|
||||
m = MessageStringSet_from_ptr(msg)
|
||||
elif type == EDJE_MESSAGE_INT_SET:
|
||||
m = MessageIntSet_from_ptr(msg)
|
||||
elif type == EDJE_MESSAGE_FLOAT_SET:
|
||||
m = MessageFloatSet_from_ptr(msg)
|
||||
elif type == EDJE_MESSAGE_STRING_INT:
|
||||
m = MessageStringInt_from_ptr(msg)
|
||||
elif type == EDJE_MESSAGE_STRING_FLOAT:
|
||||
m = MessageStringFloat_from_ptr(msg)
|
||||
elif type == EDJE_MESSAGE_STRING_INT_SET :
|
||||
m = MessageStringIntSet_from_ptr(msg)
|
||||
elif type == EDJE_MESSAGE_STRING_FLOAT_SET :
|
||||
m = MessageStringFloatSet_from_ptr(msg)
|
||||
|
||||
m._type = type
|
||||
m._id = id
|
||||
return m
|
|
@ -0,0 +1,689 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Edje.
|
||||
#
|
||||
# Python-Edje 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-Edje 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-Edje. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
cdef void text_change_cb(void *data,
|
||||
Evas_Object *obj,
|
||||
const_char_ptr part) with gil:
|
||||
cdef Edje self
|
||||
self = <Edje>data
|
||||
if self._text_change_cb is None:
|
||||
return
|
||||
func, args, kargs = self._text_change_cb
|
||||
try:
|
||||
func(self, _ctouni(part), *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void message_handler_cb(void *data,
|
||||
Evas_Object *obj,
|
||||
Edje_Message_Type type,
|
||||
int id, void *msg) with gil:
|
||||
cdef Edje self
|
||||
self = <Edje>data
|
||||
if self._message_handler_cb is None:
|
||||
return
|
||||
func, args, kargs = self._message_handler_cb
|
||||
try:
|
||||
func(self, Message_from_type(type, id, msg), *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void signal_cb(void *data, Evas_Object *obj,
|
||||
const_char_ptr emission, const_char_ptr source) with gil:
|
||||
cdef Edje self
|
||||
self = object_from_instance(obj)
|
||||
lst = tuple(<object>data)
|
||||
for func, args, kargs in lst:
|
||||
try:
|
||||
func(self, _ctouni(emission), _ctouni(source), *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
class EdjeLoadError(Exception):
|
||||
def __init__(self, int code, char *file, char *group):
|
||||
if code == EDJE_LOAD_ERROR_NONE:
|
||||
msg = "No error"
|
||||
elif code == EDJE_LOAD_ERROR_GENERIC:
|
||||
msg = "Generic error"
|
||||
elif code == EDJE_LOAD_ERROR_DOES_NOT_EXIST:
|
||||
msg = "Does not exist"
|
||||
elif code == EDJE_LOAD_ERROR_PERMISSION_DENIED:
|
||||
msg = "Permission denied"
|
||||
elif code == EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
|
||||
msg = "Resource allocation failed"
|
||||
elif code == EDJE_LOAD_ERROR_CORRUPT_FILE:
|
||||
msg = "Corrupt file"
|
||||
elif code == EDJE_LOAD_ERROR_UNKNOWN_FORMAT:
|
||||
msg = "Unknown format"
|
||||
elif code == EDJE_LOAD_ERROR_INCOMPATIBLE_FILE:
|
||||
msg = "Incompatible file"
|
||||
elif code == EDJE_LOAD_ERROR_UNKNOWN_COLLECTION:
|
||||
msg = "Unknown collection"
|
||||
|
||||
self.code = code
|
||||
self.file = file
|
||||
self.group = group
|
||||
Exception.__init__(self, "%s (file=%r, group=%r)" % (msg, file, group))
|
||||
|
||||
|
||||
cdef class Edje(Object):
|
||||
def __cinit__(self, *a, **ka):
|
||||
self._signal_callbacks = {}
|
||||
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
self._set_obj(edje_object_add(canvas.obj))
|
||||
self._set_common_params(**kargs)
|
||||
|
||||
def __free_wrapper_resources(self, ed):
|
||||
self._signal_callbacks.clear()
|
||||
self._text_change_cb = None
|
||||
self._message_handler_cb = None
|
||||
|
||||
def _set_common_params(self, file=None, group=None, size=None, pos=None,
|
||||
geometry=None, color=None, name=None):
|
||||
if file:
|
||||
self.file_set(file, group)
|
||||
Object._set_common_params(self, size=size, pos=pos, geometry=geometry,
|
||||
color=color, name=name)
|
||||
if not size and not geometry:
|
||||
w, h = self.size_min_get()
|
||||
self.size_set(w, h)
|
||||
|
||||
def __str__(self):
|
||||
x, y, w, h = self.geometry_get()
|
||||
r, g, b, a = self.color_get()
|
||||
file, group = self.file_get()
|
||||
name = self.name_get()
|
||||
if name:
|
||||
name_str = "name=%r, "
|
||||
else:
|
||||
name_str = ""
|
||||
clip = bool(self.clip_get() is not None)
|
||||
return ("%s(%sfile=%r, group=%r, geometry=(%d, %d, %d, %d), "
|
||||
"color=(%d, %d, %d, %d), layer=%s, clip=%s, visible=%s)") % \
|
||||
(self.__class__.__name__, name_str, file, group, x, y, w, h,
|
||||
r, g, b, a, self.layer_get(), clip, self.visible_get())
|
||||
|
||||
def __repr__(self):
|
||||
x, y, w, h = self.geometry_get()
|
||||
r, g, b, a = self.color_get()
|
||||
file, group = self.file_get()
|
||||
clip = bool(self.clip_get() is not None)
|
||||
return ("%s(name=%r, file=%r, group=%r, geometry=(%d, %d, %d, %d), "
|
||||
"color=(%d, %d, %d, %d), layer=%s, clip=%r, visible=%s)") % \
|
||||
(self.__class__.__name__, self.name_get(), file, group,
|
||||
x, y, w, h, r, g, b, a,
|
||||
self.layer_get(), clip, self.visible_get())
|
||||
|
||||
def data_get(self, key):
|
||||
return _ctouni(edje_object_data_get(self.obj, _cfruni(key)))
|
||||
|
||||
def file_set(self, file, group):
|
||||
if edje_object_file_set(self.obj, _cfruni(file), _cfruni(group)) == 0:
|
||||
raise EdjeLoadError(edje_object_load_error_get(self.obj),
|
||||
_cfruni(file), _cfruni(group))
|
||||
|
||||
def file_get(self):
|
||||
cdef const_char_ptr file, group
|
||||
edje_object_file_get(self.obj, &file, &group)
|
||||
return (_ctouni(file), _ctouni(group))
|
||||
|
||||
def load_error_get(self):
|
||||
return edje_object_load_error_get(self.obj)
|
||||
|
||||
def play_get(self):
|
||||
return bool(edje_object_play_get(self.obj))
|
||||
|
||||
def play_set(self, int value):
|
||||
edje_object_play_set(self.obj, value)
|
||||
|
||||
property play:
|
||||
def __get__(self):
|
||||
return self.play_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.play_set(value)
|
||||
|
||||
def animation_get(self):
|
||||
return bool(edje_object_animation_get(self.obj))
|
||||
|
||||
def animation_set(self, int value):
|
||||
edje_object_animation_set(self.obj, value)
|
||||
|
||||
property animation:
|
||||
def __get__(self):
|
||||
return self.animation_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.animation_set(value)
|
||||
|
||||
def freeze(self):
|
||||
return edje_object_freeze(self.obj)
|
||||
|
||||
def thaw(self):
|
||||
return edje_object_thaw(self.obj)
|
||||
|
||||
def color_class_set(self, color_class,
|
||||
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_object_color_class_set(self.obj, _cfruni(color_class),
|
||||
r, g, b, a,
|
||||
r2, g2, b2, a2,
|
||||
r3, g3, b3, a3)
|
||||
|
||||
def color_class_get(self, color_class):
|
||||
cdef int r, g, b, a
|
||||
cdef int r2, g2, b2, a2
|
||||
cdef int r3, g3, b3, a3
|
||||
edje_object_color_class_get(self.obj, _cfruni(color_class),
|
||||
&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 color_class_del(self, color_class):
|
||||
edje_object_color_class_del(self.obj, _cfruni(color_class))
|
||||
|
||||
def text_class_set(self, text_class, font, int size):
|
||||
edje_object_text_class_set(self.obj, _cfruni(text_class),
|
||||
_cfruni(font), size)
|
||||
|
||||
def size_min_get(self):
|
||||
cdef int w, h
|
||||
edje_object_size_min_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property size_min:
|
||||
def __get__(self):
|
||||
return self.size_min_get()
|
||||
|
||||
def size_max_get(self):
|
||||
cdef int w, h
|
||||
edje_object_size_max_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property size_max:
|
||||
def __get__(self):
|
||||
return self.size_max_get()
|
||||
|
||||
def calc_force(self):
|
||||
edje_object_calc_force(self.obj)
|
||||
|
||||
def size_min_calc(self):
|
||||
cdef int w, h
|
||||
edje_object_size_min_calc(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
def parts_extends_calc(self):
|
||||
cdef int x, y, w, h
|
||||
edje_object_parts_extends_calc(self.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
def part_exists(self, part):
|
||||
return bool(edje_object_part_exists(self.obj, _cfruni(part)))
|
||||
|
||||
def part_object_get(self, part):
|
||||
return object_from_instance(edje_object_part_object_get(self.obj,
|
||||
_cfruni(part)))
|
||||
|
||||
def part_geometry_get(self, part):
|
||||
cdef int x, y, w, h
|
||||
edje_object_part_geometry_get(self.obj, _cfruni(part), &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
def part_size_get(self, part):
|
||||
cdef int w, h
|
||||
edje_object_part_geometry_get(self.obj, _cfruni(part), NULL, NULL, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
def part_pos_get(self, part):
|
||||
cdef int x, y
|
||||
edje_object_part_geometry_get(self.obj, _cfruni(part), &x, &y, NULL, NULL)
|
||||
return (x, y)
|
||||
|
||||
def text_change_cb_set(self, func, *args, **kargs):
|
||||
if func is None:
|
||||
self._text_change_cb = None
|
||||
edje_object_text_change_cb_set(self.obj, NULL, NULL)
|
||||
elif callable(func):
|
||||
self._text_change_cb = (func, args, kargs)
|
||||
edje_object_text_change_cb_set(self.obj, text_change_cb, <void*>self)
|
||||
else:
|
||||
raise TypeError("func must be callable or None")
|
||||
|
||||
def part_text_set(self, part, text):
|
||||
edje_object_part_text_set(self.obj, _cfruni(part), _cfruni(text))
|
||||
|
||||
def part_text_get(self, part):
|
||||
cdef const_char_ptr s
|
||||
return _ctouni(edje_object_part_text_get(self.obj, _cfruni(part)))
|
||||
|
||||
|
||||
def part_text_select_all(self, part):
|
||||
edje_object_part_text_select_all(self.obj, _cfruni(part))
|
||||
|
||||
def part_text_select_none(self, part):
|
||||
edje_object_part_text_select_none(self.obj, _cfruni(part))
|
||||
|
||||
def part_text_unescaped_set(self, part, text_to_escape):
|
||||
edje_object_part_text_unescaped_set(self.obj, _cfruni(part),
|
||||
_cfruni(text_to_escape))
|
||||
|
||||
def part_text_unescaped_get(self, part):
|
||||
cdef char *s
|
||||
s = edje_object_part_text_unescaped_get(self.obj, _cfruni(part))
|
||||
if s == NULL:
|
||||
return None
|
||||
else:
|
||||
str = _touni(s)
|
||||
libc.stdlib.free(s)
|
||||
return str
|
||||
|
||||
def part_swallow(self, part, Object obj):
|
||||
edje_object_part_swallow(self.obj, _cfruni(part), obj.obj)
|
||||
|
||||
def part_unswallow(self, Object obj):
|
||||
edje_object_part_unswallow(self.obj, obj.obj)
|
||||
|
||||
def part_swallow_get(self, part):
|
||||
return object_from_instance(edje_object_part_swallow_get(self.obj,
|
||||
_cfruni(part)))
|
||||
|
||||
def part_external_object_get(self, part):
|
||||
return object_from_instance(edje_object_part_external_object_get(self.obj,
|
||||
_cfruni(part)))
|
||||
|
||||
def part_external_param_set(self, char *part, char *param, value):
|
||||
cdef Edje_External_Param p
|
||||
cdef Edje_External_Param_Type t
|
||||
|
||||
p.name = param
|
||||
if isinstance(value, bool): # bool is int, so keep it before!
|
||||
p.type = EDJE_EXTERNAL_PARAM_TYPE_BOOL
|
||||
p.i = value
|
||||
elif isinstance(value, int):
|
||||
p.type = EDJE_EXTERNAL_PARAM_TYPE_INT
|
||||
p.i = value
|
||||
elif isinstance(value, float):
|
||||
p.type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE
|
||||
p.d = value
|
||||
elif isinstance(value, (str, unicode)):
|
||||
# may be STRING or CHOICE
|
||||
p.type = edje_object_part_external_param_type_get(
|
||||
self.obj, part, param)
|
||||
|
||||
if isinstance(value, unicode):
|
||||
value = value.encode("utf-8")
|
||||
p.s = value
|
||||
else:
|
||||
raise TypeError("unsupported type %s" % type(value).__name__)
|
||||
return bool(edje_object_part_external_param_set(self.obj, part, &p))
|
||||
|
||||
def part_external_param_get(self, char *part, char *param):
|
||||
cdef Edje_External_Param p
|
||||
cdef Edje_External_Param_Type t
|
||||
|
||||
t = edje_object_part_external_param_type_get(self.obj, part, param)
|
||||
if t == EDJE_EXTERNAL_PARAM_TYPE_MAX:
|
||||
return None
|
||||
|
||||
p.name = param
|
||||
p.type = t
|
||||
if not edje_object_part_external_param_get(self.obj, part, &p):
|
||||
return None
|
||||
if t == EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
||||
return bool(p.i)
|
||||
elif t == EDJE_EXTERNAL_PARAM_TYPE_INT:
|
||||
return p.i
|
||||
elif t == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
||||
return p.d
|
||||
elif t == EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
||||
if p.s == NULL:
|
||||
return ""
|
||||
return p.s
|
||||
elif t == EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
||||
if p.s == NULL:
|
||||
return ""
|
||||
return p.s
|
||||
|
||||
def part_box_append(self, part, Object obj):
|
||||
return bool(edje_object_part_box_append(self.obj, _cfruni(part), obj.obj))
|
||||
|
||||
def part_box_prepend(self, part, Object obj):
|
||||
return bool(edje_object_part_box_prepend(self.obj, _cfruni(part), obj.obj))
|
||||
|
||||
def part_box_insert_at(self, part, Object obj,
|
||||
unsigned int pos):
|
||||
return bool(edje_object_part_box_insert_at(self.obj, _cfruni(part),
|
||||
obj.obj, pos))
|
||||
|
||||
def part_box_insert_before(self, part, Object obj, Object reference):
|
||||
return bool(edje_object_part_box_insert_before(self.obj, _cfruni(part),
|
||||
obj.obj, reference.obj))
|
||||
|
||||
def part_box_remove(self, part, Object obj):
|
||||
return object_from_instance(edje_object_part_box_remove(self.obj,
|
||||
_cfruni(part), obj.obj))
|
||||
|
||||
def part_box_remove_at(self, part, unsigned int pos):
|
||||
return object_from_instance(edje_object_part_box_remove_at(self.obj,
|
||||
_cfruni(part), pos))
|
||||
|
||||
def part_box_remove_all(self, part, int clear):
|
||||
return bool(edje_object_part_box_remove_all(self.obj,
|
||||
_cfruni(part), clear))
|
||||
|
||||
def part_table_pack(self, part, Object child, short col, short row, short colspan, short rowspan):
|
||||
return bool(edje_object_part_table_pack(self.obj, _cfruni(part),
|
||||
child.obj, col, row, colspan, rowspan))
|
||||
|
||||
def part_table_unpack(self, part, Object child):
|
||||
return bool(edje_object_part_table_unpack(self.obj, _cfruni(part),
|
||||
child.obj))
|
||||
|
||||
def part_table_col_row_size_get(self, part):
|
||||
cdef int c, r
|
||||
edje_object_part_table_col_row_size_get(self.obj, _cfruni(part), &c, &r)
|
||||
return (c, r)
|
||||
|
||||
def part_table_clear(self, part, int clear):
|
||||
return bool(edje_object_part_table_clear(self.obj, _cfruni(part), clear))
|
||||
|
||||
def part_table_child_get(self, part, int row, int column):
|
||||
return object_from_instance(edje_object_part_table_child_get(self.obj,
|
||||
_cfruni(part), row, column))
|
||||
|
||||
def part_state_get(self, part):
|
||||
cdef double sv
|
||||
cdef const_char_ptr sn
|
||||
sn = edje_object_part_state_get(self.obj, _cfruni(part), &sv)
|
||||
return (_ctouni(sn), sv)
|
||||
|
||||
def part_drag_dir_get(self, part):
|
||||
return edje_object_part_drag_dir_get(self.obj, _cfruni(part))
|
||||
|
||||
def part_drag_value_set(self, part, double dx, double dy):
|
||||
edje_object_part_drag_value_set(self.obj, _cfruni(part), dx, dy)
|
||||
|
||||
def part_drag_value_get(self, part):
|
||||
cdef double dx, dy
|
||||
edje_object_part_drag_value_get(self.obj, _cfruni(part), &dx, &dy)
|
||||
return (dx, dy)
|
||||
|
||||
def part_drag_size_set(self, part, double dw, double dh):
|
||||
edje_object_part_drag_size_set(self.obj, _cfruni(part), dw, dh)
|
||||
|
||||
def part_drag_size_get(self, part):
|
||||
cdef double dw, dh
|
||||
edje_object_part_drag_size_get(self.obj, _cfruni(part), &dw, &dh)
|
||||
return (dw, dh)
|
||||
|
||||
def part_drag_step_set(self, part, double dx, double dy):
|
||||
edje_object_part_drag_step_set(self.obj, _cfruni(part), dx, dy)
|
||||
|
||||
def part_drag_step_get(self, part):
|
||||
cdef double dx, dy
|
||||
edje_object_part_drag_step_get(self.obj, _cfruni(part), &dx, &dy)
|
||||
return (dx, dy)
|
||||
|
||||
def part_drag_step(self, part, double dx, double dy):
|
||||
edje_object_part_drag_step(self.obj, _cfruni(part), dx, dy)
|
||||
|
||||
def part_drag_page_set(self, part, double dx, double dy):
|
||||
edje_object_part_drag_page_set(self.obj, _cfruni(part), dx, dy)
|
||||
|
||||
def part_drag_page_get(self, part):
|
||||
cdef double dx, dy
|
||||
edje_object_part_drag_page_get(self.obj, _cfruni(part), &dx, &dy)
|
||||
return (dx, dy)
|
||||
|
||||
def part_drag_page(self, part, double dx, double dy):
|
||||
edje_object_part_drag_page(self.obj, _cfruni(part), dx, dy)
|
||||
|
||||
cdef void message_send_int(self, int id, int data):
|
||||
cdef Edje_Message_Int m
|
||||
m.val = data
|
||||
edje_object_message_send(self.obj, EDJE_MESSAGE_INT, id, <void*>&m)
|
||||
|
||||
cdef void message_send_float(self, int id, float data):
|
||||
cdef Edje_Message_Float m
|
||||
m.val = data
|
||||
edje_object_message_send(self.obj, EDJE_MESSAGE_FLOAT, id, <void*>&m)
|
||||
|
||||
cdef void message_send_str(self, int id, data):
|
||||
cdef Edje_Message_String m
|
||||
m.str = _fruni(data)
|
||||
edje_object_message_send(self.obj, EDJE_MESSAGE_STRING, id, <void*>&m)
|
||||
|
||||
cdef void message_send_str_set(self, int id, data):
|
||||
cdef int count, i
|
||||
cdef Edje_Message_String_Set *m
|
||||
|
||||
count = len(data)
|
||||
m = <Edje_Message_String_Set*>PyMem_Malloc(
|
||||
sizeof(Edje_Message_String_Set) + (count - 1) * sizeof(char *))
|
||||
|
||||
m.count = count
|
||||
i = 0
|
||||
for s in data:
|
||||
m.str[i] = s
|
||||
i = i + 1
|
||||
|
||||
edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_SET, id,
|
||||
<void*>m)
|
||||
PyMem_Free(m)
|
||||
|
||||
cdef void message_send_str_int(self, int id, s, int i):
|
||||
cdef Edje_Message_String_Int m
|
||||
m.str = _fruni(s)
|
||||
m.val = i
|
||||
edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_INT, id,
|
||||
<void*>&m)
|
||||
|
||||
cdef void message_send_str_float(self, int id, s, float f):
|
||||
cdef Edje_Message_String_Float m
|
||||
m.str = _fruni(s)
|
||||
m.val = f
|
||||
edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_FLOAT, id,
|
||||
<void*>&m)
|
||||
|
||||
cdef void message_send_str_int_set(self, int id, s, data):
|
||||
cdef int count, i
|
||||
cdef Edje_Message_String_Int_Set *m
|
||||
|
||||
count = len(data)
|
||||
m = <Edje_Message_String_Int_Set*>PyMem_Malloc(
|
||||
sizeof(Edje_Message_String_Int_Set) + (count - 1) * sizeof(int))
|
||||
|
||||
m.str = _fruni(s)
|
||||
m.count = count
|
||||
i = 0
|
||||
for f in data:
|
||||
m.val[i] = f
|
||||
i = i + 1
|
||||
|
||||
edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_INT_SET, id,
|
||||
<void*>m)
|
||||
PyMem_Free(m)
|
||||
|
||||
cdef void message_send_str_float_set(self, int id, s, data):
|
||||
cdef int count, i
|
||||
cdef Edje_Message_String_Float_Set *m
|
||||
|
||||
count = len(data)
|
||||
m = <Edje_Message_String_Float_Set*>PyMem_Malloc(
|
||||
sizeof(Edje_Message_String_Float_Set) +
|
||||
(count - 1) * sizeof(double))
|
||||
|
||||
m.str = _fruni(s)
|
||||
m.count = count
|
||||
i = 0
|
||||
for f in data:
|
||||
m.val[i] = f
|
||||
i = i + 1
|
||||
|
||||
edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_FLOAT_SET, id,
|
||||
<void*>m)
|
||||
PyMem_Free(m)
|
||||
|
||||
cdef void message_send_int_set(self, int id, data):
|
||||
cdef int count, i
|
||||
cdef Edje_Message_Int_Set *m
|
||||
|
||||
count = len(data)
|
||||
m = <Edje_Message_Int_Set*>PyMem_Malloc(
|
||||
sizeof(Edje_Message_Int_Set) + (count - 1) * sizeof(int))
|
||||
|
||||
m.count = count
|
||||
i = 0
|
||||
for f in data:
|
||||
m.val[i] = f
|
||||
i = i + 1
|
||||
|
||||
edje_object_message_send(self.obj, EDJE_MESSAGE_INT_SET, id,
|
||||
<void*>m)
|
||||
PyMem_Free(m)
|
||||
|
||||
cdef void message_send_float_set(self, int id, data):
|
||||
cdef int count, i
|
||||
cdef Edje_Message_Float_Set *m
|
||||
|
||||
count = len(data)
|
||||
m = <Edje_Message_Float_Set*>PyMem_Malloc(
|
||||
sizeof(Edje_Message_Float_Set) + (count - 1) * sizeof(double))
|
||||
|
||||
m.count = count
|
||||
i = 0
|
||||
for f in data:
|
||||
m.val[i] = f
|
||||
i = i + 1
|
||||
|
||||
edje_object_message_send(self.obj, EDJE_MESSAGE_FLOAT_SET, id,
|
||||
<void*>m)
|
||||
PyMem_Free(m)
|
||||
|
||||
cdef message_send_set(self, int id, data):
|
||||
second_item = data[1]
|
||||
item_type = type(second_item)
|
||||
for e in data[2:]:
|
||||
if type(e) != item_type:
|
||||
raise TypeError("every element of data should be the "
|
||||
"same type '%s'" % item_type.__name__)
|
||||
head = data[0]
|
||||
if isinstance(head, (int, long)):
|
||||
self.message_send_int_set(id, data)
|
||||
elif isinstance(head, float):
|
||||
self.message_send_float_set(id, data)
|
||||
elif isinstance(head, str):
|
||||
if issubclass(item_type, str):
|
||||
self.message_send_str_set(id, data)
|
||||
elif item_type == int or item_type == long:
|
||||
if len(data) == 2:
|
||||
self.message_send_str_int(id, head, second_item)
|
||||
else:
|
||||
self.message_send_str_int_set(id, head, data[2:])
|
||||
elif item_type == float:
|
||||
if len(data) == 2:
|
||||
self.message_send_str_float(id, head, second_item)
|
||||
else:
|
||||
self.message_send_str_float_set(id, head, data[2:])
|
||||
|
||||
def message_send(self, int id, data):
|
||||
if isinstance(data, (long, int)):
|
||||
self.message_send_int(id, data)
|
||||
elif isinstance(data, float):
|
||||
self.message_send_float(id, data)
|
||||
elif isinstance(data, str):
|
||||
self.message_send_str(id, data)
|
||||
elif isinstance(data, (tuple, list)):
|
||||
if len(data) < 1:
|
||||
return
|
||||
if len(data) < 2:
|
||||
self.message_send(id, data[0])
|
||||
return
|
||||
|
||||
if not isinstance(data[0], (long, int, float, str)):
|
||||
raise TypeError("invalid message list type '%s'" %
|
||||
type(data[0]).__name__)
|
||||
|
||||
self.message_send_set(id, data)
|
||||
else:
|
||||
raise TypeError("invalid message type '%s'" % type(data).__name__)
|
||||
|
||||
def message_handler_set(self, func, *args, **kargs):
|
||||
if func is None:
|
||||
self._message_handler_cb = None
|
||||
edje_object_message_handler_set(self.obj, NULL, NULL)
|
||||
elif callable(func):
|
||||
self._message_handler_cb = (func, args, kargs)
|
||||
edje_object_message_handler_set(self.obj, message_handler_cb,
|
||||
<void*>self)
|
||||
else:
|
||||
raise TypeError("func must be callable or None")
|
||||
|
||||
def message_signal_process(self):
|
||||
edje_object_message_signal_process(self.obj)
|
||||
|
||||
def signal_callback_add(self, emission, source, func,
|
||||
*args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
|
||||
d = self._signal_callbacks.setdefault(emission, {})
|
||||
lst = d.setdefault(source, [])
|
||||
if not lst:
|
||||
edje_object_signal_callback_add(self.obj, _cfruni(emission),
|
||||
_cfruni(source), signal_cb, <void*>lst)
|
||||
lst.append((func, args, kargs))
|
||||
|
||||
def signal_callback_del(self, emission, source, func):
|
||||
try:
|
||||
d = self._signal_callbacks[emission]
|
||||
lst = d[source]
|
||||
except KeyError:
|
||||
raise ValueError(("function %s not associated with "
|
||||
"emission %r, source %r") %
|
||||
(func, emission, source))
|
||||
|
||||
i = -1
|
||||
for i, (f, a, k) in enumerate(lst):
|
||||
if func == f:
|
||||
break
|
||||
else:
|
||||
raise ValueError(("function %s not associated with "
|
||||
"emission %r, source %r") %
|
||||
(func, emission, source))
|
||||
|
||||
lst.pop(i)
|
||||
if lst:
|
||||
return
|
||||
d.pop(source)
|
||||
if not d:
|
||||
self._signal_callbacks.pop(emission)
|
||||
edje_object_signal_callback_del(self.obj, _cfruni(emission),
|
||||
_cfruni(source), signal_cb)
|
||||
|
||||
def signal_emit(self, emission, source):
|
||||
edje_object_signal_emit(self.obj, _cfruni(emission), _cfruni(source))
|
||||
|
||||
|
||||
_object_mapping_register("edje", Edje)
|
|
@ -0,0 +1,610 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
from cpython cimport PyObject, Py_INCREF, Py_DECREF
|
||||
from cpython cimport PyMem_Malloc, PyMem_Free
|
||||
from cpython cimport bool
|
||||
|
||||
from efl.eo cimport _touni, _fruni, _ctouni, _cfruni, PY_REFCOUNT
|
||||
from efl.eo cimport object_from_instance, _object_mapping_register
|
||||
from efl.eo cimport _strings_to_python, _strings_from_python
|
||||
from efl.eo cimport _object_list_to_python
|
||||
# from efl.evas cimport Evas_Coord
|
||||
|
||||
|
||||
#import evas.c_evas
|
||||
# from evas.c_evas import _object_mapping_register
|
||||
# from evas.c_evas import _object_mapping_unregister
|
||||
import sys
|
||||
import traceback
|
||||
import logging
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
log = logging.getLogger("elementary")
|
||||
|
||||
|
||||
cdef _METHOD_DEPRECATED(self, replacement=None, message=None):
|
||||
stack = traceback.extract_stack()
|
||||
caller = stack[-1]
|
||||
caller_module, caller_line, caller_name, caller_code = caller
|
||||
if caller_code:
|
||||
msg = "%s:%s %s (class %s) is deprecated." % \
|
||||
(caller_module, caller_line, caller_code,
|
||||
self.__class__.__name__ if self else 'None')
|
||||
else:
|
||||
msg = "%s:%s %s.%s() is deprecated." % \
|
||||
(caller_module, caller_line,
|
||||
self.__class__.__name__ if self else 'None', caller_name)
|
||||
if replacement:
|
||||
msg += " Use %s() instead." % (replacement,)
|
||||
if message:
|
||||
msg += " " + message
|
||||
log.warn(msg)
|
||||
|
||||
|
||||
|
||||
ELM_ACTIONSLIDER_NONE = 0
|
||||
ELM_ACTIONSLIDER_LEFT = 1 << 0
|
||||
ELM_ACTIONSLIDER_CENTER = 1 << 1
|
||||
ELM_ACTIONSLIDER_RIGHT = 1 << 2
|
||||
ELM_ACTIONSLIDER_ALL = (1 << 3) - 1
|
||||
|
||||
ELM_BG_OPTION_CENTER = 0
|
||||
ELM_BG_OPTION_SCALE = 1
|
||||
ELM_BG_OPTION_STRETCH = 2
|
||||
ELM_BG_OPTION_TILE = 3
|
||||
ELM_BG_OPTION_LAST = 4
|
||||
|
||||
ELM_BOX_LAYOUT_HORIZONTAL = 0
|
||||
ELM_BOX_LAYOUT_VERTICAL = 1
|
||||
ELM_BOX_LAYOUT_HOMOGENEOUS_VERTICAL = 2
|
||||
ELM_BOX_LAYOUT_HOMOGENEOUS_HORIZONTAL = 3
|
||||
ELM_BOX_LAYOUT_HOMOGENEOUS_MAX_SIZE_HORIZONTAL = 4
|
||||
ELM_BOX_LAYOUT_HOMOGENEOUS_MAX_SIZE_VERTICAL = 5
|
||||
ELM_BOX_LAYOUT_FLOW_HORIZONTAL = 6
|
||||
ELM_BOX_LAYOUT_FLOW_VERTICAL = 7
|
||||
ELM_BOX_LAYOUT_STACK = 8
|
||||
|
||||
ELM_BUBBLE_POS_TOP_LEFT = 0
|
||||
ELM_BUBBLE_POS_TOP_RIGHT = 1
|
||||
ELM_BUBBLE_POS_BOTTOM_LEFT = 2
|
||||
ELM_BUBBLE_POS_BOTTOM_RIGHT = 3
|
||||
|
||||
ELM_CALENDAR_UNIQUE = 0
|
||||
ELM_CALENDAR_DAILY = 1
|
||||
ELM_CALENDAR_WEEKLY = 2
|
||||
ELM_CALENDAR_MONTHLY = 3
|
||||
ELM_CALENDAR_ANNUALLY = 4
|
||||
ELM_CALENDAR_LAST_DAY_OF_MONTH = 5
|
||||
|
||||
ELM_CALENDAR_SELECT_MODE_DEFAULT = 0
|
||||
ELM_CALENDAR_SELECT_MODE_ALWAYS = 1
|
||||
ELM_CALENDAR_SELECT_MODE_NONE = 2
|
||||
ELM_CALENDAR_SELECT_MODE_ONDEMAND = 3
|
||||
|
||||
ELM_CLOCK_EDIT_DEFAULT = 0
|
||||
ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 << 0
|
||||
ELM_CLOCK_EDIT_HOUR_UNIT = 1 << 1
|
||||
ELM_CLOCK_EDIT_MIN_DECIMAL = 1 << 2
|
||||
ELM_CLOCK_EDIT_MIN_UNIT = 1 << 3
|
||||
ELM_CLOCK_EDIT_SEC_DECIMAL = 1 << 4
|
||||
ELM_CLOCK_EDIT_SEC_UNIT = 1 << 5
|
||||
ELM_CLOCK_EDIT_ALL = (1 << 6) - 1
|
||||
|
||||
ELM_CNP_MODE_MARKUP = 0
|
||||
ELM_CNP_MODE_NO_IMAGE = 1
|
||||
ELM_CNP_MODE_PLAINTEXT = 2
|
||||
|
||||
ELM_COLORSELECTOR_PALETTE = 0
|
||||
ELM_COLORSELECTOR_COMPONENTS = 1
|
||||
ELM_COLORSELECTOR_BOTH = 2
|
||||
|
||||
ELM_CTXPOPUP_DIRECTION_DOWN = 0
|
||||
ELM_CTXPOPUP_DIRECTION_RIGHT = 1
|
||||
ELM_CTXPOPUP_DIRECTION_LEFT = 2
|
||||
ELM_CTXPOPUP_DIRECTION_UP = 3
|
||||
ELM_CTXPOPUP_DIRECTION_UNKNOWN = 4
|
||||
|
||||
ELM_DATETIME_YEAR = 0
|
||||
ELM_DATETIME_MONTH = 1
|
||||
ELM_DATETIME_DATE = 2
|
||||
ELM_DATETIME_HOUR = 3
|
||||
ELM_DATETIME_MINUTE = 4
|
||||
ELM_DATETIME_AMPM = 5
|
||||
|
||||
ELM_DAY_SUNDAY = 0
|
||||
ELM_DAY_MONDAY = 1
|
||||
ELM_DAY_TUESDAY = 2
|
||||
ELM_DAY_WEDNESDAY = 3
|
||||
ELM_DAY_THURSDAY = 4
|
||||
ELM_DAY_FRIDAY = 5
|
||||
ELM_DAY_SATURDAY = 6
|
||||
ELM_DAY_LAST = 7
|
||||
|
||||
ELM_DAYSELECTOR_SUN = 0
|
||||
ELM_DAYSELECTOR_MON = 1
|
||||
ELM_DAYSELECTOR_TUE = 2
|
||||
ELM_DAYSELECTOR_WED = 3
|
||||
ELM_DAYSELECTOR_THU = 4
|
||||
ELM_DAYSELECTOR_FRI = 5
|
||||
ELM_DAYSELECTOR_SAT = 6
|
||||
|
||||
ELM_FILESELECTOR_LIST = 0
|
||||
ELM_FILESELECTOR_GRID = 1
|
||||
|
||||
ELM_FLIP_DIRECTION_UP = 0
|
||||
ELM_FLIP_DIRECTION_DOWN = 1
|
||||
ELM_FLIP_DIRECTION_LEFT = 2
|
||||
ELM_FLIP_DIRECTION_RIGHT = 3
|
||||
|
||||
ELM_FLIP_INTERACTION_NONE = 0
|
||||
ELM_FLIP_INTERACTION_ROTATE = 1
|
||||
ELM_FLIP_INTERACTION_CUBE = 2
|
||||
ELM_FLIP_INTERACTION_PAGE = 3
|
||||
|
||||
ELM_FLIP_ROTATE_Y_CENTER_AXIS = 0
|
||||
ELM_FLIP_ROTATE_X_CENTER_AXIS = 1
|
||||
ELM_FLIP_ROTATE_XZ_CENTER_AXIS = 2
|
||||
ELM_FLIP_ROTATE_YZ_CENTER_AXIS = 3
|
||||
ELM_FLIP_CUBE_LEFT = 4
|
||||
ELM_FLIP_CUBE_RIGHT = 5
|
||||
ELM_FLIP_CUBE_UP = 6
|
||||
ELM_FLIP_CUBE_DOWN = 7
|
||||
ELM_FLIP_PAGE_LEFT = 8
|
||||
ELM_FLIP_PAGE_RIGHT = 9
|
||||
ELM_FLIP_PAGE_UP = 10
|
||||
ELM_FLIP_PAGE_DOWN = 11
|
||||
|
||||
ELM_FOCUS_PREVIOUS = 0
|
||||
ELM_FOCUS_NEXT = 1
|
||||
|
||||
ELM_GENLIST_ITEM_NONE = 0
|
||||
ELM_GENLIST_ITEM_TREE = 1
|
||||
ELM_GENLIST_ITEM_GROUP = 2
|
||||
ELM_GENLIST_ITEM_MAX = 3
|
||||
|
||||
ELM_GENLIST_ITEM_FIELD_ALL = 0
|
||||
ELM_GENLIST_ITEM_FIELD_TEXT = 1
|
||||
ELM_GENLIST_ITEM_FIELD_CONTENT = 2
|
||||
ELM_GENLIST_ITEM_FIELD_STATE = 3
|
||||
|
||||
ELM_GENLIST_ITEM_SCROLLTO_NONE = 0
|
||||
ELM_GENLIST_ITEM_SCROLLTO_IN = 1
|
||||
ELM_GENLIST_ITEM_SCROLLTO_TOP = 2
|
||||
ELM_GENLIST_ITEM_SCROLLTO_MIDDLE = 3
|
||||
|
||||
ELM_GESTURE_STATE_UNDEFINED = -1
|
||||
ELM_GESTURE_STATE_START = 0
|
||||
ELM_GESTURE_STATE_MOVE = 1
|
||||
ELM_GESTURE_STATE_END = 2
|
||||
ELM_GESTURE_STATE_ABORT = 3
|
||||
|
||||
ELM_GESTURE_FIRST = 0
|
||||
ELM_GESTURE_N_TAPS = 1
|
||||
ELM_GESTURE_N_LONG_TAPS = 2
|
||||
ELM_GESTURE_N_DOUBLE_TAPS = 3
|
||||
ELM_GESTURE_N_TRIPLE_TAPS = 4
|
||||
ELM_GESTURE_MOMENTUM = 5
|
||||
ELM_GESTURE_N_LINES = 6
|
||||
ELM_GESTURE_N_FLICKS = 7
|
||||
ELM_GESTURE_ZOOM = 8
|
||||
ELM_GESTURE_ROTATE = 9
|
||||
|
||||
ELM_HOVER_AXIS_NONE = 0
|
||||
ELM_HOVER_AXIS_HORIZONTAL = 1
|
||||
ELM_HOVER_AXIS_VERTICAL = 2
|
||||
ELM_HOVER_AXIS_BOTH = 3
|
||||
|
||||
ELM_ICON_NONE = 0
|
||||
ELM_ICON_FILE = 1
|
||||
ELM_ICON_STANDARD = 2
|
||||
|
||||
ELM_ILLUME_COMMAND_FOCUS_BACK = 0
|
||||
ELM_ILLUME_COMMAND_FOCUS_FORWARD = 1
|
||||
ELM_ILLUME_COMMAND_FOCUS_HOME = 2
|
||||
ELM_ILLUME_COMMAND_CLOSE = 3
|
||||
|
||||
ELM_IMAGE_ORIENT_NONE = 0
|
||||
ELM_IMAGE_ORIENT_0 = 0
|
||||
ELM_IMAGE_ROTATE_90 = 1
|
||||
ELM_IMAGE_ROTATE_180 = 2
|
||||
ELM_IMAGE_ROTATE_270 = 3
|
||||
ELM_IMAGE_FLIP_HORIZONTAL = 4
|
||||
ELM_IMAGE_FLIP_VERTICAL = 5
|
||||
ELM_IMAGE_FLIP_TRANSPOSE = 6
|
||||
ELM_IMAGE_FLIP_TRANSVERSE = 7
|
||||
|
||||
ELM_INPUT_PANEL_LANG_AUTOMATIC = 0
|
||||
ELM_INPUT_PANEL_LANG_ALPHABET = 1
|
||||
|
||||
ELM_INPUT_PANEL_LAYOUT_NORMAL = 0
|
||||
ELM_INPUT_PANEL_LAYOUT_NUMBER = 1
|
||||
ELM_INPUT_PANEL_LAYOUT_EMAIL = 2
|
||||
ELM_INPUT_PANEL_LAYOUT_URL = 3
|
||||
ELM_INPUT_PANEL_LAYOUT_PHONENUMBER = 4
|
||||
ELM_INPUT_PANEL_LAYOUT_IP = 5
|
||||
ELM_INPUT_PANEL_LAYOUT_MONTH = 6
|
||||
ELM_INPUT_PANEL_LAYOUT_NUMBERONLY = 7
|
||||
ELM_INPUT_PANEL_LAYOUT_INVALID = 8
|
||||
ELM_INPUT_PANEL_LAYOUT_HEX = 9
|
||||
ELM_INPUT_PANEL_LAYOUT_TERMINAL = 10
|
||||
ELM_INPUT_PANEL_LAYOUT_PASSWORD = 11
|
||||
|
||||
ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT = 0
|
||||
ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE = 1
|
||||
ELM_INPUT_PANEL_RETURN_KEY_TYPE_GO = 2
|
||||
ELM_INPUT_PANEL_RETURN_KEY_TYPE_JOIN = 3
|
||||
ELM_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN = 4
|
||||
ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT = 5
|
||||
ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH = 6
|
||||
ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEND = 7
|
||||
|
||||
ELM_LIST_COMPRESS = 0
|
||||
ELM_LIST_SCROLL = 1
|
||||
ELM_LIST_LIMIT = 2
|
||||
|
||||
ELM_MAP_OVERLAY_TYPE_NONE = 0
|
||||
ELM_MAP_OVERLAY_TYPE_DEFAULT = 1
|
||||
ELM_MAP_OVERLAY_TYPE_CLASS = 2
|
||||
ELM_MAP_OVERLAY_TYPE_GROUP = 3
|
||||
ELM_MAP_OVERLAY_TYPE_BUBBLE = 4
|
||||
ELM_MAP_OVERLAY_TYPE_ROUTE = 5
|
||||
ELM_MAP_OVERLAY_TYPE_LINE = 6
|
||||
ELM_MAP_OVERLAY_TYPE_POLYGON = 7
|
||||
ELM_MAP_OVERLAY_TYPE_CIRCLE = 8
|
||||
ELM_MAP_OVERLAY_TYPE_SCALE = 9
|
||||
|
||||
ELM_MAP_ROUTE_METHOD_FASTEST = 0
|
||||
ELM_MAP_ROUTE_METHOD_SHORTEST = 1
|
||||
ELM_MAP_ROUTE_METHOD_LAST = 2
|
||||
|
||||
ELM_MAP_ROUTE_TYPE_MOTOCAR = 0
|
||||
ELM_MAP_ROUTE_TYPE_BICYCLE = 1
|
||||
ELM_MAP_ROUTE_TYPE_FOOT = 2
|
||||
ELM_MAP_ROUTE_TYPE_LAST = 3
|
||||
|
||||
ELM_MAP_SOURCE_TYPE_TILE = 0
|
||||
ELM_MAP_SOURCE_TYPE_ROUTE = 1
|
||||
ELM_MAP_SOURCE_TYPE_NAME = 2
|
||||
ELM_MAP_SOURCE_TYPE_LAST = 3
|
||||
|
||||
ELM_MAP_ZOOM_MODE_MANUAL = 0
|
||||
ELM_MAP_ZOOM_MODE_AUTO_FIT = 1
|
||||
ELM_MAP_ZOOM_MODE_AUTO_FILL = 2
|
||||
ELM_MAP_ZOOM_MODE_LAST = 3
|
||||
|
||||
ELM_NOTIFY_ORIENT_TOP = 0
|
||||
ELM_NOTIFY_ORIENT_CENTER = 1
|
||||
ELM_NOTIFY_ORIENT_BOTTOM = 2
|
||||
ELM_NOTIFY_ORIENT_LEFT = 3
|
||||
ELM_NOTIFY_ORIENT_RIGHT = 4
|
||||
ELM_NOTIFY_ORIENT_TOP_LEFT = 5
|
||||
ELM_NOTIFY_ORIENT_TOP_RIGHT = 6
|
||||
ELM_NOTIFY_ORIENT_BOTTOM_LEFT = 7
|
||||
ELM_NOTIFY_ORIENT_BOTTOM_RIGHT = 8
|
||||
|
||||
ELM_OBJECT_SELECT_MODE_DEFAULT = 0
|
||||
ELM_OBJECT_SELECT_MODE_ALWAYS = 1
|
||||
ELM_OBJECT_SELECT_MODE_NONE = 2
|
||||
ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY = 3
|
||||
ELM_OBJECT_SELECT_MODE_MAX = 4
|
||||
|
||||
ELM_PANEL_ORIENT_TOP = 0
|
||||
ELM_PANEL_ORIENT_BOTTOM = 1
|
||||
ELM_PANEL_ORIENT_LEFT = 2
|
||||
ELM_PANEL_ORIENT_RIGHT = 3
|
||||
|
||||
ELM_PHOTOCAM_ZOOM_MODE_MANUAL = 0
|
||||
ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT = 1
|
||||
ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL = 2
|
||||
ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT_IN = 3
|
||||
|
||||
ELM_POLICY_QUIT = 0
|
||||
ELM_POLICY_LAST = 1
|
||||
|
||||
ELM_POLICY_QUIT_NONE = 0
|
||||
ELM_POLICY_QUIT_LAST_WINDOW_CLOSED = 1
|
||||
|
||||
ELM_POPUP_ORIENT_TOP = 0
|
||||
ELM_POPUP_ORIENT_CENTER = 1
|
||||
ELM_POPUP_ORIENT_BOTTOM = 2
|
||||
ELM_POPUP_ORIENT_LEFT = 3
|
||||
ELM_POPUP_ORIENT_RIGHT = 4
|
||||
ELM_POPUP_ORIENT_TOP_LEFT = 5
|
||||
ELM_POPUP_ORIENT_TOP_RIGHT = 6
|
||||
ELM_POPUP_ORIENT_BOTTOM_LEFT = 7
|
||||
ELM_POPUP_ORIENT_BOTTOM_RIGHT = 8
|
||||
|
||||
ELM_SCROLLER_POLICY_AUTO = 0
|
||||
ELM_SCROLLER_POLICY_ON = 1
|
||||
ELM_SCROLLER_POLICY_OFF = 2
|
||||
|
||||
ELM_TEXT_FORMAT_PLAIN_UTF8 = 0
|
||||
ELM_TEXT_FORMAT_MARKUP_UTF8 = 1
|
||||
|
||||
ELM_TOOLBAR_SHRINK_NONE = 0
|
||||
ELM_TOOLBAR_SHRINK_HIDE = 1
|
||||
ELM_TOOLBAR_SHRINK_SCROLL = 2
|
||||
ELM_TOOLBAR_SHRINK_MENU = 3
|
||||
ELM_TOOLBAR_SHRINK_EXPAND = 4
|
||||
ELM_TOOLBAR_SHRINK_LAST = 5
|
||||
|
||||
ELM_WEB_WINDOW_FEATURE_TOOLBAR = 0
|
||||
ELM_WEB_WINDOW_FEATURE_STATUSBAR = 1
|
||||
ELM_WEB_WINDOW_FEATURE_SCROLLBARS = 2
|
||||
ELM_WEB_WINDOW_FEATURE_MENUBAR = 3
|
||||
ELM_WEB_WINDOW_FEATURE_LOCATIONBAR = 4
|
||||
ELM_WEB_WINDOW_FEATURE_FULLSCREEN = 5
|
||||
|
||||
ELM_WEB_ZOOM_MODE_MANUAL = 0
|
||||
ELM_WEB_ZOOM_MODE_AUTO_FIT = 1
|
||||
ELM_WEB_ZOOM_MODE_AUTO_FILL = 2
|
||||
|
||||
ELM_WIN_BASIC = 0
|
||||
ELM_WIN_DIALOG_BASIC = 1
|
||||
ELM_WIN_DESKTOP = 2
|
||||
ELM_WIN_DOCK = 3
|
||||
ELM_WIN_TOOLBAR = 4
|
||||
ELM_WIN_MENU = 5
|
||||
ELM_WIN_UTILITY = 6
|
||||
ELM_WIN_SPLASH = 7
|
||||
ELM_WIN_DROPDOWN_MENU = 8
|
||||
ELM_WIN_POPUP_MENU = 9
|
||||
ELM_WIN_TOOLTIP = 10
|
||||
ELM_WIN_NOTIFICATION = 11
|
||||
ELM_WIN_COMBO = 12
|
||||
ELM_WIN_DND = 13
|
||||
ELM_WIN_INLINED_IMAGE = 14
|
||||
ELM_WIN_SOCKET_IMAGE = 15
|
||||
|
||||
ELM_WIN_INDICATOR_UNKNOWN = 0
|
||||
ELM_WIN_INDICATOR_HIDE = 1
|
||||
ELM_WIN_INDICATOR_SHOW = 2
|
||||
|
||||
ELM_WIN_INDICATOR_OPACITY_UNKNOWN = 0
|
||||
ELM_WIN_INDICATOR_OPAQUE = 1
|
||||
ELM_WIN_INDICATOR_TRANSLUCENT = 2
|
||||
ELM_WIN_INDICATOR_TRANSPARENT = 3
|
||||
|
||||
ELM_WIN_KEYBOARD_UNKNOWN = 0
|
||||
ELM_WIN_KEYBOARD_OFF = 1
|
||||
ELM_WIN_KEYBOARD_ON = 2
|
||||
ELM_WIN_KEYBOARD_ALPHA = 3
|
||||
ELM_WIN_KEYBOARD_NUMERIC = 4
|
||||
ELM_WIN_KEYBOARD_PIN = 5
|
||||
ELM_WIN_KEYBOARD_PHONE_NUMBER = 6
|
||||
ELM_WIN_KEYBOARD_HEX = 7
|
||||
ELM_WIN_KEYBOARD_TERMINAL = 8
|
||||
ELM_WIN_KEYBOARD_PASSWORD = 9
|
||||
ELM_WIN_KEYBOARD_IP = 10
|
||||
ELM_WIN_KEYBOARD_HOST = 11
|
||||
ELM_WIN_KEYBOARD_FILE = 12
|
||||
ELM_WIN_KEYBOARD_URL = 13
|
||||
ELM_WIN_KEYBOARD_KEYPAD = 14
|
||||
ELM_WIN_KEYBOARD_J2ME = 15
|
||||
|
||||
ELM_WRAP_NONE = 0
|
||||
ELM_WRAP_CHAR = 1
|
||||
ELM_WRAP_WORD = 2
|
||||
ELM_WRAP_MIXED = 3
|
||||
|
||||
###
|
||||
|
||||
ELM_CURSOR_X = "x"
|
||||
ELM_CURSOR_ARROW = "arrow"
|
||||
ELM_CURSOR_BASED_ARROW_DOWN = "based_arrow_down"
|
||||
ELM_CURSOR_BASED_ARROW_UP = "based_arrow_up"
|
||||
ELM_CURSOR_BOAT = "boat"
|
||||
ELM_CURSOR_BOGOSITY = "bogosity"
|
||||
ELM_CURSOR_BOTTOM_LEFT_CORNER = "bottom_left_corner"
|
||||
ELM_CURSOR_BOTTOM_RIGHT_CORNER = "bottom_right_corner"
|
||||
ELM_CURSOR_BOTTOM_SIDE = "bottom_side"
|
||||
ELM_CURSOR_BOTTOM_TEE = "bottom_tee"
|
||||
ELM_CURSOR_BOX_SPIRAL = "box_spiral"
|
||||
ELM_CURSOR_CENTER_PTR = "center_ptr"
|
||||
ELM_CURSOR_CIRCLE = "circle"
|
||||
ELM_CURSOR_CLOCK = "clock"
|
||||
ELM_CURSOR_COFFEE_MUG = "coffee_mug"
|
||||
ELM_CURSOR_CROSS = "cross"
|
||||
ELM_CURSOR_CROSS_REVERSE = "cross_reverse"
|
||||
ELM_CURSOR_CROSSHAIR = "crosshair"
|
||||
ELM_CURSOR_DIAMOND_CROSS = "diamond_cross"
|
||||
ELM_CURSOR_DOT = "dot"
|
||||
ELM_CURSOR_DOT_BOX_MASK = "dot_box_mask"
|
||||
ELM_CURSOR_DOUBLE_ARROW = "double_arrow"
|
||||
ELM_CURSOR_DRAFT_LARGE = "draft_large"
|
||||
ELM_CURSOR_DRAFT_SMALL = "draft_small"
|
||||
ELM_CURSOR_DRAPED_BOX = "draped_box"
|
||||
ELM_CURSOR_EXCHANGE = "exchange"
|
||||
ELM_CURSOR_FLEUR = "fleur"
|
||||
ELM_CURSOR_GOBBLER = "gobbler"
|
||||
ELM_CURSOR_GUMBY = "gumby"
|
||||
ELM_CURSOR_HAND1 = "hand1"
|
||||
ELM_CURSOR_HAND2 = "hand2"
|
||||
ELM_CURSOR_HEART = "heart"
|
||||
ELM_CURSOR_ICON = "icon"
|
||||
ELM_CURSOR_IRON_CROSS = "iron_cross"
|
||||
ELM_CURSOR_LEFT_PTR = "left_ptr"
|
||||
ELM_CURSOR_LEFT_SIDE = "left_side"
|
||||
ELM_CURSOR_LEFT_TEE = "left_tee"
|
||||
ELM_CURSOR_LEFTBUTTON = "leftbutton"
|
||||
ELM_CURSOR_LL_ANGLE = "ll_angle"
|
||||
ELM_CURSOR_LR_ANGLE = "lr_angle"
|
||||
ELM_CURSOR_MAN = "man"
|
||||
ELM_CURSOR_MIDDLEBUTTON = "middlebutton"
|
||||
ELM_CURSOR_MOUSE = "mouse"
|
||||
ELM_CURSOR_PENCIL = "pencil"
|
||||
ELM_CURSOR_PIRATE = "pirate"
|
||||
ELM_CURSOR_PLUS = "plus"
|
||||
ELM_CURSOR_QUESTION_ARROW = "question_arrow"
|
||||
ELM_CURSOR_RIGHT_PTR = "right_ptr"
|
||||
ELM_CURSOR_RIGHT_SIDE = "right_side"
|
||||
ELM_CURSOR_RIGHT_TEE = "right_tee"
|
||||
ELM_CURSOR_RIGHTBUTTON = "rightbutton"
|
||||
ELM_CURSOR_RTL_LOGO = "rtl_logo"
|
||||
ELM_CURSOR_SAILBOAT = "sailboat"
|
||||
ELM_CURSOR_SB_DOWN_ARROW = "sb_down_arrow"
|
||||
ELM_CURSOR_SB_H_DOUBLE_ARROW = "sb_h_double_arrow"
|
||||
ELM_CURSOR_SB_LEFT_ARROW = "sb_left_arrow"
|
||||
ELM_CURSOR_SB_RIGHT_ARROW = "sb_right_arrow"
|
||||
ELM_CURSOR_SB_UP_ARROW = "sb_up_arrow"
|
||||
ELM_CURSOR_SB_V_DOUBLE_ARROW = "sb_v_double_arrow"
|
||||
ELM_CURSOR_SHUTTLE = "shuttle"
|
||||
ELM_CURSOR_SIZING = "sizing"
|
||||
ELM_CURSOR_SPIDER = "spider"
|
||||
ELM_CURSOR_SPRAYCAN = "spraycan"
|
||||
ELM_CURSOR_STAR = "star"
|
||||
ELM_CURSOR_TARGET = "target"
|
||||
ELM_CURSOR_TCROSS = "tcross"
|
||||
ELM_CURSOR_TOP_LEFT_ARROW = "top_left_arrow"
|
||||
ELM_CURSOR_TOP_LEFT_CORNER = "top_left_corner"
|
||||
ELM_CURSOR_TOP_RIGHT_CORNER = "top_right_corner"
|
||||
ELM_CURSOR_TOP_SIDE = "top_side"
|
||||
ELM_CURSOR_TOP_TEE = "top_tee"
|
||||
ELM_CURSOR_TREK = "trek"
|
||||
ELM_CURSOR_UL_ANGLE = "ul_angle"
|
||||
ELM_CURSOR_UMBRELLA = "umbrella"
|
||||
ELM_CURSOR_UR_ANGLE = "ur_angle"
|
||||
ELM_CURSOR_WATCH = "watch"
|
||||
ELM_CURSOR_XTERM = "xterm"
|
||||
|
||||
|
||||
def init():
|
||||
cdef int argc, i, arg_len
|
||||
cdef char **argv, *arg
|
||||
argc = len(sys.argv)
|
||||
argv = <char **>PyMem_Malloc(argc * sizeof(char *))
|
||||
for i from 0 <= i < argc:
|
||||
arg = _fruni(sys.argv[i])
|
||||
arg_len = len(arg)
|
||||
argv[i] = <char *>PyMem_Malloc(arg_len + 1)
|
||||
memcpy(argv[i], arg, arg_len + 1)
|
||||
|
||||
elm_init(argc, argv)
|
||||
|
||||
def shutdown():
|
||||
elm_shutdown()
|
||||
|
||||
def run():
|
||||
with nogil:
|
||||
elm_run()
|
||||
|
||||
def exit():
|
||||
elm_exit()
|
||||
|
||||
def policy_set(policy, value):
|
||||
return elm_policy_set(policy, value)
|
||||
|
||||
def policy_get(policy):
|
||||
return elm_policy_get(policy)
|
||||
|
||||
def coords_finger_size_adjust(times_w, w, times_h, h):
|
||||
cdef Evas_Coord width
|
||||
cdef Evas_Coord height
|
||||
width = w
|
||||
height = h
|
||||
elm_coords_finger_size_adjust(times_w, &width, times_h, &height)
|
||||
|
||||
# class ElementaryObjectMeta(type):
|
||||
# def __init__(cls, name, bases, dict_):
|
||||
# type.__init__(cls, name, bases, dict_)
|
||||
# cls._fetch_evt_callbacks()
|
||||
#
|
||||
# def _fetch_evt_callbacks(cls):
|
||||
# if "__evas_event_callbacks__" in cls.__dict__:
|
||||
# return
|
||||
#
|
||||
# cls.__evas_event_callbacks__ = []
|
||||
# append = cls.__evas_event_callbacks__.append
|
||||
#
|
||||
# for name in dir(cls):
|
||||
# val = getattr(cls, name)
|
||||
# if not callable(val) or not hasattr(val, "evas_event_callback"):
|
||||
# continue
|
||||
# evt = getattr(val, "evas_event_callback")
|
||||
# append((name, evt))
|
||||
|
||||
include "efl.elementary_configuration.pxi"
|
||||
include "efl.elementary_need.pxi"
|
||||
include "efl.elementary_theme.pxi"
|
||||
include "efl.elementary_object.pxi"
|
||||
include "efl.elementary_object_item.pxi"
|
||||
include "efl.elementary_gesture_layer.pxi"
|
||||
include "efl.elementary_layout_class.pxi"
|
||||
include "efl.elementary_layout.pxi"
|
||||
include "efl.elementary_image.pxi"
|
||||
include "efl.elementary_button.pxi"
|
||||
include "efl.elementary_window.pxi"
|
||||
include "efl.elementary_innerwindow.pxi"
|
||||
include "efl.elementary_background.pxi"
|
||||
include "efl.elementary_icon.pxi"
|
||||
include "efl.elementary_box.pxi"
|
||||
include "efl.elementary_frame.pxi"
|
||||
include "efl.elementary_flip.pxi"
|
||||
include "efl.elementary_scroller.pxi"
|
||||
include "efl.elementary_label.pxi"
|
||||
include "efl.elementary_table.pxi"
|
||||
include "efl.elementary_clock.pxi"
|
||||
include "efl.elementary_hover.pxi"
|
||||
include "efl.elementary_entry.pxi"
|
||||
include "efl.elementary_bubble.pxi"
|
||||
include "efl.elementary_photo.pxi"
|
||||
include "efl.elementary_hoversel.pxi"
|
||||
include "efl.elementary_toolbar.pxi"
|
||||
include "efl.elementary_list.pxi"
|
||||
include "efl.elementary_slider.pxi"
|
||||
include "efl.elementary_naviframe.pxi"
|
||||
include "efl.elementary_radio.pxi"
|
||||
include "efl.elementary_check.pxi"
|
||||
include "efl.elementary_genlist.pxi"
|
||||
include "efl.elementary_gengrid.pxi"
|
||||
include "efl.elementary_spinner.pxi"
|
||||
include "efl.elementary_notify.pxi"
|
||||
include "efl.elementary_fileselector.pxi"
|
||||
include "efl.elementary_fileselector_entry.pxi"
|
||||
include "efl.elementary_fileselector_button.pxi"
|
||||
include "efl.elementary_separator.pxi"
|
||||
include "efl.elementary_progressbar.pxi"
|
||||
include "efl.elementary_menu.pxi"
|
||||
include "efl.elementary_panel.pxi"
|
||||
include "efl.elementary_web.pxi"
|
||||
include "efl.elementary_actionslider.pxi"
|
||||
include "efl.elementary_calendar.pxi"
|
||||
include "efl.elementary_colorselector.pxi"
|
||||
include "efl.elementary_index.pxi"
|
||||
include "efl.elementary_ctxpopup.pxi"
|
||||
include "efl.elementary_grid.pxi"
|
||||
include "efl.elementary_video.pxi"
|
||||
include "efl.elementary_conformant.pxi"
|
||||
include "efl.elementary_dayselector.pxi"
|
||||
include "efl.elementary_panes.pxi"
|
||||
include "efl.elementary_thumb.pxi"
|
||||
include "efl.elementary_diskselector.pxi"
|
||||
include "efl.elementary_datetime.pxi"
|
||||
include "efl.elementary_map.pxi"
|
||||
include "efl.elementary_mapbuf.pxi"
|
||||
include "efl.elementary_multibuttonentry.pxi"
|
||||
include "efl.elementary_transit.pxi"
|
||||
include "efl.elementary_slideshow.pxi"
|
||||
include "efl.elementary_segment_control.pxi"
|
||||
include "efl.elementary_popup.pxi"
|
||||
include "efl.elementary_plug.pxi"
|
||||
include "efl.elementary_photocam.pxi"
|
||||
include "efl.elementary_flipselector.pxi"
|
|
@ -0,0 +1,80 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Actionslider(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_actionslider_add(parent.obj))
|
||||
|
||||
def selected_label_get(self):
|
||||
return elm_actionslider_selected_label_get(self.obj)
|
||||
|
||||
property selected_label:
|
||||
def __get__(self):
|
||||
return elm_actionslider_selected_label_get(self.obj)
|
||||
|
||||
def indicator_pos_set(self, pos):
|
||||
elm_actionslider_indicator_pos_set(self.obj, pos)
|
||||
|
||||
def indicator_pos_get(self):
|
||||
return elm_actionslider_indicator_pos_get(self.obj)
|
||||
|
||||
property indicator_pos:
|
||||
def __get__(self):
|
||||
return elm_actionslider_indicator_pos_get(self.obj)
|
||||
def __set__(self, pos):
|
||||
elm_actionslider_indicator_pos_set(self.obj, pos)
|
||||
|
||||
def magnet_pos_set(self, pos):
|
||||
elm_actionslider_magnet_pos_set(self.obj, pos)
|
||||
|
||||
def magnet_pos_get(self):
|
||||
return elm_actionslider_magnet_pos_get(self.obj)
|
||||
|
||||
property magnet_pos:
|
||||
def __get__(self):
|
||||
return self.magnet_pos_get()
|
||||
def __set__(self, pos):
|
||||
self.magnet_pos_set(pos)
|
||||
|
||||
def enabled_pos_set(self, pos):
|
||||
elm_actionslider_enabled_pos_set(self.obj, pos)
|
||||
|
||||
def enabled_pos_get(self):
|
||||
return elm_actionslider_enabled_pos_get(self.obj)
|
||||
|
||||
property enabled_pos:
|
||||
def __get__(self):
|
||||
return elm_actionslider_enabled_pos_get(self.obj)
|
||||
def __set__(self, pos):
|
||||
elm_actionslider_enabled_pos_set(self.obj, pos)
|
||||
|
||||
def callback_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("selected", _cb_string_conv, func, *args, **kwargs)
|
||||
|
||||
def callback_selected_del(self, func):
|
||||
self._callback_del_full("selected", _cb_string_conv, func)
|
||||
|
||||
def callback_pos_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("pos_changed", _cb_string_conv, func, *args, **kwargs)
|
||||
|
||||
def callback_pos_changed_del(self, func):
|
||||
self._callback_del_full("pos_changed", _cb_string_conv, func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_actionslider", Actionslider)
|
|
@ -0,0 +1,98 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Background(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_bg_add(parent.obj))
|
||||
|
||||
def file_set(self, filename, group = ""):
|
||||
return bool(elm_bg_file_set(self.obj, _cfruni(filename), _cfruni(group)))
|
||||
|
||||
def file_get(self):
|
||||
cdef const_char_ptr filename, group
|
||||
|
||||
elm_bg_file_get(self.obj, &filename, &group)
|
||||
if filename == NULL:
|
||||
filename = ""
|
||||
if group == NULL:
|
||||
group = ""
|
||||
return (_ctouni(filename), _ctouni(group))
|
||||
|
||||
property file:
|
||||
def __get__(self):
|
||||
cdef const_char_ptr filename, group
|
||||
elm_bg_file_get(self.obj, &filename, &group)
|
||||
if filename == NULL:
|
||||
filename = ""
|
||||
if group == NULL:
|
||||
group = ""
|
||||
return (_ctouni(filename), _ctouni(group))
|
||||
|
||||
def __set__(self, value):
|
||||
if isinstance(value, tuple) or isinstance(value, list):
|
||||
filename, group = value
|
||||
else:
|
||||
filename = value
|
||||
group = ""
|
||||
elm_bg_file_set(self.obj, _cfruni(filename), _cfruni(group))
|
||||
|
||||
def option_set(self, option):
|
||||
elm_bg_option_set(self.obj, option)
|
||||
|
||||
def option_get(self):
|
||||
return elm_bg_option_get(self.obj)
|
||||
|
||||
property option:
|
||||
def __get__(self):
|
||||
return elm_bg_option_get(self.obj)
|
||||
|
||||
def __set__(self, value):
|
||||
elm_bg_option_set(self.obj, value)
|
||||
|
||||
def color_set(self, r, g, b):
|
||||
elm_bg_color_set(self.obj, r, g, b)
|
||||
|
||||
def color_get(self):
|
||||
cdef int r, g, b
|
||||
|
||||
elm_bg_color_get(self.obj, &r, &g, &b)
|
||||
return (r, g, b)
|
||||
|
||||
property color:
|
||||
def __get__(self):
|
||||
cdef int r, g, b
|
||||
elm_bg_color_get(self.obj, &r, &g, &b)
|
||||
return (r, g, b)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef int r, g, b
|
||||
r, g, b = value
|
||||
elm_bg_color_set(self.obj, r, g, b)
|
||||
|
||||
def load_size_set(self, w, h):
|
||||
elm_bg_load_size_set(self.obj, w, h)
|
||||
|
||||
property load_size:
|
||||
def __set__(self, value):
|
||||
cdef Evas_Coord w, h
|
||||
w, h = value
|
||||
elm_bg_load_size_set(self.obj, w, h)
|
||||
|
||||
|
||||
_object_mapping_register("elm_bg", Background)
|
|
@ -0,0 +1,194 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from efl.evas cimport evas_object_box_layout_horizontal
|
||||
from efl.evas cimport evas_object_box_layout_vertical
|
||||
from efl.evas cimport evas_object_box_layout_homogeneous_vertical
|
||||
from efl.evas cimport evas_object_box_layout_homogeneous_horizontal
|
||||
from efl.evas cimport evas_object_box_layout_homogeneous_max_size_horizontal
|
||||
from efl.evas cimport evas_object_box_layout_homogeneous_max_size_vertical
|
||||
from efl.evas cimport evas_object_box_layout_flow_horizontal
|
||||
from efl.evas cimport evas_object_box_layout_flow_vertical
|
||||
from efl.evas cimport evas_object_box_layout_stack
|
||||
from efl.evas cimport elm_box_layout_transition
|
||||
|
||||
# ctypedef enum Elm_Box_CLayout:
|
||||
# ELM_BOX_LAYOUT_HORIZONTAL
|
||||
# ELM_BOX_LAYOUT_VERTICAL
|
||||
# ELM_BOX_LAYOUT_HOMOGENEOUS_VERTICAL
|
||||
# ELM_BOX_LAYOUT_HOMOGENEOUS_HORIZONTAL
|
||||
# ELM_BOX_LAYOUT_HOMOGENEOUS_MAX_SIZE_HORIZONTAL
|
||||
# ELM_BOX_LAYOUT_HOMOGENEOUS_MAX_SIZE_VERTICAL
|
||||
# ELM_BOX_LAYOUT_FLOW_HORIZONTAL
|
||||
# ELM_BOX_LAYOUT_FLOW_VERTICAL
|
||||
# ELM_BOX_LAYOUT_STACK
|
||||
|
||||
cdef Evas_Object_Box_Layout _py_elm_box_layout_resolv(int layout) with gil:
|
||||
if layout == ELM_BOX_LAYOUT_HORIZONTAL:
|
||||
return evas_object_box_layout_horizontal
|
||||
elif layout == ELM_BOX_LAYOUT_VERTICAL:
|
||||
return evas_object_box_layout_vertical
|
||||
elif layout == ELM_BOX_LAYOUT_HOMOGENEOUS_VERTICAL:
|
||||
return evas_object_box_layout_homogeneous_vertical
|
||||
elif layout == ELM_BOX_LAYOUT_HOMOGENEOUS_HORIZONTAL:
|
||||
return evas_object_box_layout_homogeneous_horizontal
|
||||
elif layout == ELM_BOX_LAYOUT_HOMOGENEOUS_MAX_SIZE_HORIZONTAL:
|
||||
return evas_object_box_layout_homogeneous_max_size_horizontal
|
||||
elif layout == ELM_BOX_LAYOUT_HOMOGENEOUS_MAX_SIZE_VERTICAL:
|
||||
return evas_object_box_layout_homogeneous_max_size_vertical
|
||||
elif layout == ELM_BOX_LAYOUT_FLOW_HORIZONTAL:
|
||||
return evas_object_box_layout_flow_horizontal
|
||||
elif layout == ELM_BOX_LAYOUT_FLOW_VERTICAL:
|
||||
return evas_object_box_layout_flow_vertical
|
||||
elif layout == ELM_BOX_LAYOUT_STACK:
|
||||
return evas_object_box_layout_stack
|
||||
return evas_object_box_layout_vertical
|
||||
|
||||
|
||||
cdef class Box(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_box_add(parent.obj))
|
||||
|
||||
def horizontal_set(self, horizontal):
|
||||
elm_box_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def horizontal_get(self):
|
||||
return elm_box_horizontal_get(self.obj)
|
||||
|
||||
property horizontal:
|
||||
def __get__(self):
|
||||
return elm_box_horizontal_get(self.obj)
|
||||
def __set__(self, value):
|
||||
elm_box_horizontal_set(self.obj, value)
|
||||
|
||||
def homogeneous_set(self, homogeneous):
|
||||
elm_box_homogeneous_set(self.obj, homogeneous)
|
||||
|
||||
def homogeneous_get(self):
|
||||
return bool(elm_box_homogeneous_get(self.obj))
|
||||
|
||||
property homogeneous:
|
||||
def __get__(self):
|
||||
return bool(elm_box_homogeneous_get(self.obj))
|
||||
|
||||
def __set__(self, value):
|
||||
elm_box_homogeneous_set(self.obj, value)
|
||||
|
||||
def pack_start(self, evasObject obj):
|
||||
elm_box_pack_start(self.obj, obj.obj)
|
||||
|
||||
def pack_end(self, evasObject obj):
|
||||
elm_box_pack_end(self.obj, obj.obj)
|
||||
|
||||
def pack_before(self, evasObject obj, evasObject before):
|
||||
elm_box_pack_before(self.obj, obj.obj, before.obj)
|
||||
|
||||
def pack_after(self, evasObject obj, evasObject after):
|
||||
elm_box_pack_after(self.obj, obj.obj, after.obj)
|
||||
|
||||
def clear(self):
|
||||
elm_box_clear(self.obj)
|
||||
|
||||
def unpack(self, evasObject obj):
|
||||
elm_box_unpack(self.obj, obj.obj)
|
||||
|
||||
def unpack_all(self):
|
||||
elm_box_unpack_all(self.obj)
|
||||
|
||||
def children_get(self):
|
||||
return _object_list_to_python(elm_box_children_get(self.obj))
|
||||
|
||||
property children:
|
||||
def __get__(self):
|
||||
return _object_list_to_python(elm_box_children_get(self.obj))
|
||||
#def __set__(self, value):
|
||||
#TODO: unpack_all() and then get the objects from value and pack_end() them.
|
||||
def __del__(self):
|
||||
elm_box_clear(self.obj)
|
||||
|
||||
def padding_set(self, horizontal, vertical):
|
||||
elm_box_padding_set(self.obj, horizontal, vertical)
|
||||
|
||||
def padding_get(self):
|
||||
cdef int horizontal, vertical
|
||||
|
||||
elm_box_padding_get(self.obj, &horizontal, &vertical)
|
||||
return (horizontal, vertical)
|
||||
|
||||
property padding:
|
||||
def __get__(self):
|
||||
cdef int horizontal, vertical
|
||||
elm_box_padding_get(self.obj, &horizontal, &vertical)
|
||||
return (horizontal, vertical)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef int horizontal, vertical
|
||||
horizontal, vertical = value
|
||||
elm_box_padding_set(self.obj, horizontal, vertical)
|
||||
|
||||
def align_set(self, horizontal, vertical):
|
||||
elm_box_align_set(self.obj, horizontal, vertical)
|
||||
|
||||
def align_get(self):
|
||||
cdef double horizontal, vertical
|
||||
|
||||
elm_box_align_get(self.obj, &horizontal, &vertical)
|
||||
return (horizontal, vertical)
|
||||
|
||||
property align:
|
||||
def __get__(self):
|
||||
cdef double horizontal, vertical
|
||||
elm_box_align_get(self.obj, &horizontal, &vertical)
|
||||
return (horizontal, vertical)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef double horizontal, vertical
|
||||
horizontal, vertical = value
|
||||
elm_box_align_set(self.obj, horizontal, vertical)
|
||||
|
||||
def recalculate(self):
|
||||
elm_box_recalculate(self.obj)
|
||||
|
||||
def layout_set(self, layout):
|
||||
cdef Evas_Object_Box_Layout ly
|
||||
|
||||
ly = _py_elm_box_layout_resolv(layout)
|
||||
elm_box_layout_set(self.obj, ly, NULL, NULL)
|
||||
|
||||
property layout:
|
||||
def __set__(self, layout):
|
||||
cdef Evas_Object_Box_Layout ly
|
||||
ly = _py_elm_box_layout_resolv(layout)
|
||||
elm_box_layout_set(self.obj, ly, NULL, NULL)
|
||||
|
||||
def layout_transition(self, duration, from_layout, to_layout):
|
||||
cdef Elm_Box_Transition *t
|
||||
cdef Evas_Object_Box_Layout ly_from, ly_to
|
||||
|
||||
ly_from = _py_elm_box_layout_resolv(from_layout)
|
||||
ly_to = _py_elm_box_layout_resolv(to_layout)
|
||||
t = elm_box_transition_new(duration,
|
||||
ly_from, NULL, NULL,
|
||||
ly_to, NULL, NULL,
|
||||
NULL, NULL)
|
||||
elm_box_layout_set(self.obj, elm_box_layout_transition, t,
|
||||
elm_box_transition_free)
|
||||
|
||||
|
||||
_object_mapping_register("elm_box", Box)
|
|
@ -0,0 +1,44 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Bubble(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_bubble_add(parent.obj))
|
||||
|
||||
def pos_set(self, pos):
|
||||
elm_bubble_pos_set(self.obj, pos)
|
||||
|
||||
def pos_get(self):
|
||||
return elm_bubble_pos_get(self.obj)
|
||||
|
||||
property pos:
|
||||
def __get__(self):
|
||||
return elm_bubble_pos_get(self.obj)
|
||||
|
||||
def __set__(self, value):
|
||||
elm_bubble_pos_set(self.obj, value)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_bubble", Bubble)
|
|
@ -0,0 +1,85 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Button(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_button_add(parent.obj))
|
||||
|
||||
def autorepeat_set(self, on):
|
||||
elm_button_autorepeat_set(self.obj, on)
|
||||
|
||||
def autorepeat_get(self):
|
||||
return bool(elm_button_autorepeat_get(self.obj))
|
||||
|
||||
property autorepeat:
|
||||
def __get__(self):
|
||||
return bool(elm_button_autorepeat_get(self.obj))
|
||||
def __set__(self, on):
|
||||
elm_button_autorepeat_set(self.obj, on)
|
||||
|
||||
def autorepeat_initial_timeout_set(self, t):
|
||||
elm_button_autorepeat_initial_timeout_set(self.obj, t)
|
||||
|
||||
def autorepeat_initial_timeout_get(self):
|
||||
return elm_button_autorepeat_initial_timeout_get(self.obj)
|
||||
|
||||
property autorepeat_initial_timeout:
|
||||
def __get__(self):
|
||||
return elm_button_autorepeat_initial_timeout_get(self.obj)
|
||||
def __set__(self, t):
|
||||
elm_button_autorepeat_initial_timeout_set(self.obj, t)
|
||||
|
||||
def autorepeat_gap_timeout_set(self, t):
|
||||
elm_button_autorepeat_gap_timeout_set(self.obj, t)
|
||||
|
||||
def autorepeat_gap_timeout_get(self):
|
||||
return elm_button_autorepeat_gap_timeout_get(self.obj)
|
||||
|
||||
property autorepeat_gap_timeout:
|
||||
def __get__(self):
|
||||
return elm_button_autorepeat_gap_timeout_get(self.obj)
|
||||
def __set__(self, t):
|
||||
elm_button_autorepeat_gap_timeout_set(self.obj, t)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_repeated_add(self, func, *args, **kwargs):
|
||||
self._callback_add("repeated", func, *args, **kwargs)
|
||||
|
||||
def callback_repeated_del(self, func):
|
||||
self._callback_del("repeated", func)
|
||||
|
||||
def callback_pressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("pressed", func, *args, **kwargs)
|
||||
|
||||
def callback_pressed_del(self, func):
|
||||
self._callback_del("pressed", func)
|
||||
|
||||
def callback_unpressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("unpressed", func, *args, **kwargs)
|
||||
|
||||
def callback_unpressed_del(self, func):
|
||||
self._callback_del("unpressed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_button", Button)
|
|
@ -0,0 +1,139 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from datetime import date
|
||||
|
||||
cdef class CalendarMark(object):
|
||||
cdef Elm_Calendar_Mark *obj
|
||||
|
||||
def __init__(self, evasObject cal, mark_type, mark_time, repeat):
|
||||
cdef tm time
|
||||
tmtup = mark_time.timetuple()
|
||||
time.tm_mday = tmtup.tm_mday
|
||||
time.tm_mon = tmtup.tm_mon - 1
|
||||
time.tm_year = tmtup.tm_year - 1900
|
||||
time.tm_wday = tmtup.tm_wday
|
||||
time.tm_yday = tmtup.tm_yday
|
||||
time.tm_isdst = tmtup.tm_isdst
|
||||
self.obj = elm_calendar_mark_add(cal.obj, _cfruni(mark_type), &time, repeat)
|
||||
|
||||
def delete(self):
|
||||
elm_calendar_mark_del(self.obj)
|
||||
|
||||
|
||||
cdef class Calendar(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_calendar_add(parent.obj))
|
||||
|
||||
property weekdays_names:
|
||||
def __get__(self):
|
||||
cdef const_char_ptr *lst
|
||||
cdef const_char_ptr weekday
|
||||
ret = []
|
||||
lst = elm_calendar_weekdays_names_get(self.obj)
|
||||
for i from 0 <= i < 7:
|
||||
weekday = lst[i]
|
||||
if weekday != NULL:
|
||||
ret.append(_ctouni(weekday))
|
||||
return ret
|
||||
|
||||
def __set__(self, weekdays):
|
||||
cdef int i, day_len
|
||||
cdef char **days, *weekday
|
||||
days = <char **>PyMem_Malloc(7 * sizeof(char*))
|
||||
for i from 0 <= i < 7:
|
||||
weekday = _fruni(weekdays[i])
|
||||
day_len = len(weekday)
|
||||
days[i] = <char *>PyMem_Malloc(day_len + 1)
|
||||
memcpy(days[i], weekday, day_len + 1)
|
||||
elm_calendar_weekdays_names_set(self.obj, <const_char_ptr *>days)
|
||||
|
||||
property min_max_year:
|
||||
def __get__(self):
|
||||
cdef int min, max
|
||||
elm_calendar_min_max_year_get(self.obj, &min, &max)
|
||||
return (min, max)
|
||||
def __set__(self, value):
|
||||
cdef int min, max
|
||||
min, max = value
|
||||
elm_calendar_min_max_year_set(self.obj, min, max)
|
||||
|
||||
property select_mode:
|
||||
def __get__(self):
|
||||
return elm_calendar_select_mode_get(self.obj)
|
||||
def __set__(self, mode):
|
||||
elm_calendar_select_mode_set(self.obj, mode)
|
||||
|
||||
property selected_time:
|
||||
def __get__(self):
|
||||
cdef tm time
|
||||
elm_calendar_selected_time_get(self.obj, &time)
|
||||
ret = date( time.tm_year + 1900,
|
||||
time.tm_mon + 1,
|
||||
time.tm_mday)
|
||||
return ret
|
||||
|
||||
def __set__(self, selected_time):
|
||||
cdef tm time
|
||||
tmtup = selected_time.timetuple()
|
||||
time.tm_mday = tmtup.tm_mday
|
||||
time.tm_mon = tmtup.tm_mon - 1
|
||||
time.tm_year = tmtup.tm_year - 1900
|
||||
time.tm_wday = tmtup.tm_wday
|
||||
time.tm_yday = tmtup.tm_yday
|
||||
time.tm_isdst = tmtup.tm_isdst
|
||||
elm_calendar_selected_time_set(self.obj, &time)
|
||||
|
||||
def format_function_set(self, format_func):
|
||||
pass
|
||||
#elm_calendar_format_function_set(self.obj, format_func)
|
||||
|
||||
def mark_add(self, mark_type, mark_time, repeat):
|
||||
return CalendarMark(self, mark_type, mark_time, repeat)
|
||||
|
||||
property marks:
|
||||
#def __get__(self):
|
||||
#const_Eina_List *elm_calendar_marks_get(self.obj)
|
||||
#def __set__(self, value):
|
||||
def __del__(self):
|
||||
elm_calendar_marks_clear(self.obj)
|
||||
|
||||
def marks_draw(self):
|
||||
elm_calendar_marks_draw(self.obj)
|
||||
|
||||
property interval:
|
||||
def __get__(self):
|
||||
return elm_calendar_interval_get(self.obj)
|
||||
def __set__(self, interval):
|
||||
elm_calendar_interval_set(self.obj, interval)
|
||||
|
||||
property first_day_of_week:
|
||||
def __get__(self):
|
||||
return elm_calendar_first_day_of_week_get(self.obj)
|
||||
def __set__(self, day):
|
||||
elm_calendar_first_day_of_week_set(self.obj, day)
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_calendar", Calendar)
|
|
@ -0,0 +1,52 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Check(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_check_add(parent.obj))
|
||||
|
||||
def state_set(self, value):
|
||||
if value:
|
||||
elm_check_state_set(self.obj, 1)
|
||||
else:
|
||||
elm_check_state_set(self.obj, 0)
|
||||
|
||||
def state_get(self):
|
||||
cdef Eina_Bool state
|
||||
state = elm_check_state_get(self.obj)
|
||||
if state == 0:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
property state:
|
||||
def __get__(self):
|
||||
return bool(elm_check_state_get(self.obj))
|
||||
|
||||
def __set__(self, value):
|
||||
elm_check_state_set(self.obj, value)
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_check", Check)
|
|
@ -0,0 +1,116 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Clock(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_clock_add(parent.obj))
|
||||
|
||||
def time_set(self, hours, minutes, seconds):
|
||||
elm_clock_time_set(self.obj, hours, minutes, seconds)
|
||||
|
||||
def time_get(self):
|
||||
cdef int hrs, min, sec
|
||||
|
||||
elm_clock_time_get(self.obj, &hrs, &min, &sec)
|
||||
return (hrs, min, sec)
|
||||
|
||||
property time:
|
||||
def __get__(self):
|
||||
cdef int hrs, min, sec
|
||||
elm_clock_time_get(self.obj, &hrs, &min, &sec)
|
||||
return (hrs, min, sec)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef int hrs, min, sec
|
||||
hrs, min, sec = value
|
||||
elm_clock_time_set(self.obj, hrs, min, sec)
|
||||
|
||||
def edit_set(self, edit):
|
||||
elm_clock_edit_set(self.obj, edit)
|
||||
|
||||
def edit_get(self, edit):
|
||||
return bool(elm_clock_edit_get(self.obj))
|
||||
|
||||
property edit:
|
||||
def __get__(self):
|
||||
return bool(elm_clock_edit_get(self.obj))
|
||||
|
||||
def __set__(self, edit):
|
||||
elm_clock_edit_set(self.obj, edit)
|
||||
|
||||
def edit_mode_set(self, mode):
|
||||
elm_clock_edit_mode_set(self.obj, mode)
|
||||
|
||||
def edit_mode_get(self):
|
||||
return elm_clock_edit_mode_get(self.obj)
|
||||
|
||||
property edit_mode:
|
||||
def __get__(self):
|
||||
return elm_clock_edit_mode_get(self.obj)
|
||||
|
||||
def __set__(self, mode):
|
||||
elm_clock_edit_mode_set(self.obj, mode)
|
||||
|
||||
def show_am_pm_set(self, am_pm):
|
||||
elm_clock_show_am_pm_set(self.obj, am_pm)
|
||||
|
||||
def show_am_pm_get(self):
|
||||
return elm_clock_show_am_pm_get(self.obj)
|
||||
|
||||
property show_am_pm:
|
||||
def __get__(self):
|
||||
return elm_clock_show_am_pm_get(self.obj)
|
||||
|
||||
def __set__(self, am_pm):
|
||||
elm_clock_show_am_pm_set(self.obj, am_pm)
|
||||
|
||||
def show_seconds_set(self, seconds):
|
||||
elm_clock_show_seconds_set(self.obj, seconds)
|
||||
|
||||
def show_seconds_get(self):
|
||||
return elm_clock_show_seconds_get(self.obj)
|
||||
|
||||
property show_seconds:
|
||||
def __get__(self):
|
||||
return elm_clock_show_seconds_get(self.obj)
|
||||
|
||||
def __set__(self, seconds):
|
||||
elm_clock_show_seconds_set(self.obj, seconds)
|
||||
|
||||
def first_interval_set(self, interval):
|
||||
elm_clock_first_interval_set(self.obj, interval)
|
||||
|
||||
def first_interval_get(self):
|
||||
return elm_clock_first_interval_get(self.obj)
|
||||
|
||||
property first_interval:
|
||||
def __get__(self):
|
||||
return elm_clock_first_interval_get(self.obj)
|
||||
|
||||
def __set__(self, interval):
|
||||
elm_clock_first_interval_set(self.obj, interval)
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_clock", Clock)
|
|
@ -0,0 +1,125 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class ColorselectorPaletteItem(ObjectItem):
|
||||
|
||||
def __init__(self, evasObject cs, r, g, b, a):
|
||||
cdef Elm_Object_Item *item = elm_colorselector_palette_color_add(cs.obj, r, g, b, a)
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def color_get(self):
|
||||
cdef int r, g, b, a
|
||||
elm_colorselector_palette_item_color_get(self.item, &r, &g, &b, &a)
|
||||
return (r, g, b, a)
|
||||
|
||||
def color_set(self, r, g, b, a):
|
||||
elm_colorselector_palette_item_color_set(self.item, r, g, b, a)
|
||||
|
||||
property color:
|
||||
def __get__(self):
|
||||
cdef int r, g, b, a
|
||||
elm_colorselector_palette_item_color_get(self.item, &r, &g, &b, &a)
|
||||
return (r, g, b, a)
|
||||
def __set__(self, value):
|
||||
cdef int r, g, b, a
|
||||
r, g, b, a = value
|
||||
elm_colorselector_palette_item_color_set(self.item, r, g, b, a)
|
||||
|
||||
|
||||
cdef class Colorselector(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_colorselector_add(parent.obj))
|
||||
|
||||
def color_set(self, r, g, b, a):
|
||||
elm_colorselector_color_set(self.obj, r, g, b, a)
|
||||
|
||||
def color_get(self):
|
||||
cdef int r, g, b, a
|
||||
elm_colorselector_color_get(self.obj, &r, &g, &b, &a)
|
||||
return (r, g, b, a)
|
||||
|
||||
property color:
|
||||
def __get__(self):
|
||||
cdef int r, g, b, a
|
||||
elm_colorselector_color_get(self.obj, &r, &g, &b, &a)
|
||||
return (r, g, b, a)
|
||||
def __set__(self, value):
|
||||
cdef int r, g, b, a
|
||||
r, g, b, a = value
|
||||
elm_colorselector_color_set(self.obj, r, g, b, a)
|
||||
|
||||
def mode_set(self, mode):
|
||||
elm_colorselector_mode_set(self.obj, mode)
|
||||
|
||||
def mode_get(self):
|
||||
return elm_colorselector_mode_get(self.obj)
|
||||
|
||||
property mode:
|
||||
def __get__(self):
|
||||
return elm_colorselector_mode_get(self.obj)
|
||||
def __set__(self, mode):
|
||||
elm_colorselector_mode_set(self.obj, mode)
|
||||
|
||||
def palette_color_add(self, r, g, b, a):
|
||||
return ColorselectorPaletteItem(self, r, g, b, a)
|
||||
|
||||
def palette_clear(self):
|
||||
elm_colorselector_palette_clear(self.obj)
|
||||
|
||||
def palette_name_set(self, palette_name):
|
||||
elm_colorselector_palette_name_set(self.obj, _cfruni(palette_name))
|
||||
|
||||
def palette_name_get(self):
|
||||
return _ctouni(elm_colorselector_palette_name_get(self.obj))
|
||||
|
||||
property palette_name:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_colorselector_palette_name_get(self.obj))
|
||||
def __set__(self, palette_name):
|
||||
elm_colorselector_palette_name_set(self.obj, _cfruni(palette_name))
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
def callback_color_item_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("color,item,selected",
|
||||
_cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_color_item_selected_del(self, func):
|
||||
self._callback_del_full("color,item,selected",
|
||||
_cb_object_item_conv, func)
|
||||
|
||||
def callback_color_item_longpressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("color,item,longpressed",
|
||||
_cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_color_item_longpressed_del(self, func):
|
||||
self._callback_del_full("color,item,longpressed",
|
||||
_cb_object_item_conv, func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_colorselector", Colorselector)
|
|
@ -0,0 +1,311 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Configuration(object):
|
||||
|
||||
def save(self):
|
||||
return bool(elm_config_save())
|
||||
|
||||
def reload(self):
|
||||
elm_config_reload()
|
||||
|
||||
def all_flush(self):
|
||||
elm_config_all_flush()
|
||||
|
||||
property profile:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_config_profile_get())
|
||||
def __set__(self, profile):
|
||||
elm_config_profile_set(_cfruni(profile))
|
||||
|
||||
def profile_dir_get(self, profile, is_user):
|
||||
return _ctouni(elm_config_profile_dir_get(_cfruni(profile), is_user))
|
||||
|
||||
property profile_list:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst = elm_config_profile_list_get()
|
||||
return tuple(_strings_to_python(lst))
|
||||
|
||||
property scroll_bounce_enabled:
|
||||
def __get__(self):
|
||||
return bool(elm_config_scroll_bounce_enabled_get())
|
||||
def __set__(self, enabled):
|
||||
elm_config_scroll_bounce_enabled_set(enabled)
|
||||
|
||||
property scroll_bounce_friction:
|
||||
def __get__(self):
|
||||
return elm_config_scroll_bounce_friction_get()
|
||||
def __set__(self, friction):
|
||||
elm_config_scroll_bounce_friction_set(friction)
|
||||
|
||||
property scroll_page_scroll_friction:
|
||||
def __get__(self):
|
||||
return elm_config_scroll_page_scroll_friction_get()
|
||||
def __set__(self, friction):
|
||||
elm_config_scroll_page_scroll_friction_set(friction)
|
||||
|
||||
property scroll_bring_in_scroll_friction:
|
||||
def __get__(self):
|
||||
return elm_config_scroll_bring_in_scroll_friction_get()
|
||||
def __set__(self, friction):
|
||||
elm_config_scroll_bring_in_scroll_friction_set(friction)
|
||||
|
||||
property scroll_zoom_friction:
|
||||
def __get__(self):
|
||||
return elm_config_scroll_zoom_friction_get()
|
||||
def __set__(self, friction):
|
||||
elm_config_scroll_zoom_friction_set(friction)
|
||||
|
||||
property scroll_thumbscroll_enabled:
|
||||
def __get__(self):
|
||||
return bool(elm_config_scroll_thumbscroll_enabled_get())
|
||||
def __set__(self, enabled):
|
||||
elm_config_scroll_thumbscroll_enabled_set(enabled)
|
||||
|
||||
property scroll_thumbscroll_threshold:
|
||||
def __get__(self):
|
||||
return elm_config_scroll_thumbscroll_threshold_get()
|
||||
def __set__(self, threshold):
|
||||
elm_config_scroll_thumbscroll_threshold_set(threshold)
|
||||
|
||||
property scroll_thumbscroll_momentum_threshold:
|
||||
def __get__(self):
|
||||
return elm_config_scroll_thumbscroll_momentum_threshold_get()
|
||||
def __set__(self, threshold):
|
||||
elm_config_scroll_thumbscroll_momentum_threshold_set(threshold)
|
||||
|
||||
property scroll_thumbscroll_friction:
|
||||
def __get__(self):
|
||||
return elm_config_scroll_thumbscroll_friction_get()
|
||||
def __set__(self, friction):
|
||||
elm_config_scroll_thumbscroll_friction_set(friction)
|
||||
|
||||
property scroll_thumbscroll_border_friction:
|
||||
def __get__(self):
|
||||
return elm_config_scroll_thumbscroll_border_friction_get()
|
||||
def __set__(self, friction):
|
||||
elm_config_scroll_thumbscroll_border_friction_set(friction)
|
||||
|
||||
property scroll_thumbscroll_sensitivity_friction:
|
||||
def __get__(self):
|
||||
return elm_config_scroll_thumbscroll_sensitivity_friction_get()
|
||||
def __set__(self, friction):
|
||||
elm_config_scroll_thumbscroll_sensitivity_friction_set(friction)
|
||||
|
||||
|
||||
property longpress_timeout:
|
||||
def __get__(self):
|
||||
return elm_config_longpress_timeout_get()
|
||||
def __set__(self, longpress_timeout):
|
||||
elm_config_longpress_timeout_set(longpress_timeout)
|
||||
|
||||
property tooltip_delay:
|
||||
def __get__(self):
|
||||
return elm_config_tooltip_delay_get()
|
||||
def __set__(self, delay):
|
||||
elm_config_tooltip_delay_set(delay)
|
||||
|
||||
property cursor_engine_only:
|
||||
def __get__(self):
|
||||
return elm_config_cursor_engine_only_get()
|
||||
def __set__(self, engine_only):
|
||||
elm_config_cursor_engine_only_set(engine_only)
|
||||
|
||||
property scale:
|
||||
def __get__(self):
|
||||
return elm_config_scale_get()
|
||||
def __set__(self, scale):
|
||||
elm_config_scale_set(scale)
|
||||
|
||||
property password_show_last:
|
||||
def __get__(self):
|
||||
return elm_config_password_show_last_get()
|
||||
def __set__(self, password_show_last):
|
||||
elm_config_password_show_last_set(password_show_last)
|
||||
|
||||
property password_show_last_timeout:
|
||||
def __get__(self):
|
||||
return elm_config_password_show_last_timeout_get()
|
||||
def __set__(self, password_show_last_timeout):
|
||||
elm_config_password_show_last_timeout_set(password_show_last_timeout)
|
||||
|
||||
property engine:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_config_engine_get())
|
||||
def __set__(self, engine):
|
||||
elm_config_engine_set(_cfruni(engine))
|
||||
|
||||
property preferred_engine:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_config_preferred_engine_get())
|
||||
def __set__(self, engine):
|
||||
elm_config_preferred_engine_set(_cfruni(engine))
|
||||
|
||||
property text_classes_list:
|
||||
def __get__(self):
|
||||
cdef Eina_List *lst
|
||||
cdef Elm_Text_Class *data
|
||||
cdef const_char_ptr name, desc
|
||||
ret = []
|
||||
lst = elm_config_text_classes_list_get()
|
||||
while lst:
|
||||
data = <Elm_Text_Class *>lst.data
|
||||
if data != NULL:
|
||||
name = data.name
|
||||
desc = data.desc
|
||||
ret.append((_ctouni(name), _ctouni(desc)))
|
||||
lst = lst.next
|
||||
return ret
|
||||
|
||||
property font_overlay_list:
|
||||
def __get__(self):
|
||||
cdef const_Eina_List *lst
|
||||
cdef Elm_Font_Overlay *data
|
||||
cdef const_char_ptr text_class, font
|
||||
cdef Evas_Font_Size size
|
||||
ret = []
|
||||
lst = elm_config_font_overlay_list_get()
|
||||
while lst:
|
||||
data = <Elm_Font_Overlay *>lst.data
|
||||
if data != NULL:
|
||||
text_class = data.text_class
|
||||
font = data.font
|
||||
size = data.size
|
||||
ret.append((_ctouni(text_class), _ctouni(font), size))
|
||||
lst = lst.next
|
||||
return ret
|
||||
|
||||
def font_overlay_set(self, text_class, font, size):
|
||||
elm_config_font_overlay_set(_cfruni(text_class), _cfruni(font), size)
|
||||
|
||||
def font_overlay_unset(self, text_class):
|
||||
elm_config_font_overlay_unset(_cfruni(text_class))
|
||||
|
||||
def font_overlay_apply(self):
|
||||
elm_config_font_overlay_apply()
|
||||
|
||||
property finger_size:
|
||||
def __get__(self):
|
||||
return elm_config_finger_size_get()
|
||||
def __set__(self, size):
|
||||
elm_config_finger_size_set(size)
|
||||
|
||||
property cache_flush_interval:
|
||||
def __get__(self):
|
||||
return elm_config_cache_flush_interval_get()
|
||||
def __set__(self, size):
|
||||
elm_config_cache_flush_interval_set(size)
|
||||
|
||||
property cache_flush_enabled:
|
||||
def __get__(self):
|
||||
return bool(elm_config_cache_flush_enabled_get())
|
||||
def __set__(self, enabled):
|
||||
elm_config_cache_flush_enabled_set(enabled)
|
||||
|
||||
property cache_font_cache_size:
|
||||
def __get__(self):
|
||||
return elm_config_cache_font_cache_size_get()
|
||||
def __set__(self, size):
|
||||
elm_config_cache_font_cache_size_set(size)
|
||||
|
||||
property cache_image_cache_size:
|
||||
def __get__(self):
|
||||
return elm_config_cache_image_cache_size_get()
|
||||
def __set__(self, size):
|
||||
elm_config_cache_image_cache_size_set(size)
|
||||
|
||||
|
||||
property cache_edje_file_cache_size:
|
||||
def __get__(self):
|
||||
return elm_config_cache_edje_file_cache_size_get()
|
||||
def __set__(self, size):
|
||||
elm_config_cache_edje_file_cache_size_set(size)
|
||||
|
||||
property cache_edje_collection_cache_size:
|
||||
def __get__(self):
|
||||
return elm_config_cache_edje_collection_cache_size_get()
|
||||
def __set__(self, size):
|
||||
elm_config_cache_edje_collection_cache_size_set(size)
|
||||
|
||||
property focus_highlight_enabled:
|
||||
def __get__(self):
|
||||
return bool(elm_config_focus_highlight_enabled_get())
|
||||
def __set__(self, enable):
|
||||
elm_config_focus_highlight_enabled_set(enable)
|
||||
|
||||
property focus_highlight_animate:
|
||||
def __get__(self):
|
||||
return bool(elm_config_focus_highlight_animate_get())
|
||||
def __set__(self, animate):
|
||||
elm_config_focus_highlight_animate_set(animate)
|
||||
|
||||
property mirrored:
|
||||
def __get__(self):
|
||||
return bool(elm_config_mirrored_get())
|
||||
def __set__(self, mirrored):
|
||||
elm_config_mirrored_set(mirrored)
|
||||
|
||||
|
||||
def config_finger_size_get():
|
||||
return elm_config_finger_size_get()
|
||||
|
||||
def config_finger_size_set(size):
|
||||
elm_config_finger_size_set(size)
|
||||
|
||||
def config_tooltip_delay_get():
|
||||
return elm_config_tooltip_delay_get()
|
||||
|
||||
def config_tooltip_delay_set(delay):
|
||||
elm_config_tooltip_delay_set(delay)
|
||||
|
||||
def focus_highlight_enabled_get():
|
||||
return elm_config_focus_highlight_enabled_get()
|
||||
|
||||
def focus_highlight_enabled_set(enabled):
|
||||
elm_config_focus_highlight_enabled_set(enabled)
|
||||
|
||||
def focus_highlight_animate_get():
|
||||
return elm_config_focus_highlight_animate_get()
|
||||
|
||||
def focus_highlight_animate_set(animate):
|
||||
elm_config_focus_highlight_animate_set(animate)
|
||||
|
||||
def preferred_engine_get():
|
||||
return _ctouni(elm_config_preferred_engine_get())
|
||||
|
||||
def preferred_engine_set(engine):
|
||||
elm_config_preferred_engine_set(engine)
|
||||
|
||||
def engine_get():
|
||||
return _ctouni(elm_config_engine_get())
|
||||
|
||||
def engine_set(engine):
|
||||
elm_config_engine_set(_cfruni(engine))
|
||||
|
||||
def scale_get():
|
||||
return elm_config_scale_get()
|
||||
|
||||
def scale_set(scale):
|
||||
elm_config_scale_set(scale)
|
||||
|
||||
def cursor_engine_only_get():
|
||||
return elm_config_cursor_engine_only_get()
|
||||
|
||||
def cursor_engine_only_set(engine_only):
|
||||
elm_config_cursor_engine_only_set(engine_only)
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class Conformant(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_conformant_add(parent.obj))
|
||||
|
||||
|
||||
_object_mapping_register("elm_conformant", Conformant)
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class CtxpopupItem(ObjectItem):
|
||||
def __init__(self, evasObject ctxpopup, label = None, evasObject icon = None, callback = None, *args, **kargs):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if callback:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
item = elm_ctxpopup_item_append(ctxpopup.obj,
|
||||
_cfruni(label) if label is not None else NULL,
|
||||
icon.obj if icon is not None else NULL,
|
||||
cb,
|
||||
<void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
|
||||
cdef class Ctxpopup(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_ctxpopup_add(parent.obj))
|
||||
|
||||
def hover_parent_set(self, evasObject parent):
|
||||
elm_ctxpopup_hover_parent_set(self.obj, parent.obj)
|
||||
|
||||
def hover_parent_get(self):
|
||||
return object_from_instance(elm_ctxpopup_hover_parent_get(self.obj))
|
||||
|
||||
property parent:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_ctxpopup_hover_parent_get(self.obj))
|
||||
|
||||
def __set__(self, evasObject parent):
|
||||
elm_ctxpopup_hover_parent_set(self.obj, parent.obj)
|
||||
|
||||
def clear(self):
|
||||
elm_ctxpopup_clear(self.obj)
|
||||
|
||||
def horizontal_set(self, horizontal):
|
||||
elm_ctxpopup_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def horizontal_get(self):
|
||||
return bool(elm_ctxpopup_horizontal_get(self.obj))
|
||||
|
||||
property horizontal:
|
||||
def __get__(self):
|
||||
return bool(elm_ctxpopup_horizontal_get(self.obj))
|
||||
|
||||
def __set__(self, horizontal):
|
||||
elm_ctxpopup_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def item_append(self, label, evasObject icon = None, func = None, *args, **kwargs):
|
||||
return CtxpopupItem(self, label, icon, func, *args, **kwargs)
|
||||
|
||||
def direction_priority_set(self, first, second, third, fourth):
|
||||
elm_ctxpopup_direction_priority_set(self.obj, first, second, third, fourth)
|
||||
|
||||
def direction_priority_get(self):
|
||||
cdef Elm_Ctxpopup_Direction first, second, third, fourth
|
||||
elm_ctxpopup_direction_priority_get(self.obj, &first, &second, &third, &fourth)
|
||||
return (first, second, third, fourth)
|
||||
|
||||
property direction_priority:
|
||||
def __get__(self):
|
||||
cdef Elm_Ctxpopup_Direction first, second, third, fourth
|
||||
elm_ctxpopup_direction_priority_get(self.obj, &first, &second, &third, &fourth)
|
||||
return (first, second, third, fourth)
|
||||
|
||||
def __set__(self, priority):
|
||||
cdef Elm_Ctxpopup_Direction first, second, third, fourth
|
||||
first, second, third, fourth = priority
|
||||
elm_ctxpopup_direction_priority_set(self.obj, first, second, third, fourth)
|
||||
|
||||
def direction_get(self):
|
||||
return elm_ctxpopup_direction_get(self.obj)
|
||||
|
||||
property direction:
|
||||
def __get__(self):
|
||||
return elm_ctxpopup_direction_get(self.obj)
|
||||
|
||||
def dismiss(self):
|
||||
elm_ctxpopup_dismiss(self.obj)
|
||||
|
||||
def callback_dismissed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("dismissed", func, *args, **kwargs)
|
||||
|
||||
def callback_dismissed_del(self, func):
|
||||
self._callback_del("dismissed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_ctxpopup", Ctxpopup)
|
|
@ -0,0 +1,143 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
cdef class Datetime(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_datetime_add(parent.obj))
|
||||
|
||||
property format:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_datetime_format_get(self.obj))
|
||||
def __set__(self, fmt):
|
||||
elm_datetime_format_set(self.obj, _cfruni(fmt))
|
||||
|
||||
property value_max:
|
||||
def __get__(self):
|
||||
cdef tm time
|
||||
elm_datetime_value_max_get(self.obj, &time)
|
||||
ret = datetime( time.tm_year + 1900,
|
||||
time.tm_mon + 1,
|
||||
time.tm_mday,
|
||||
time.tm_hour,
|
||||
time.tm_min,
|
||||
time.tm_sec)
|
||||
return ret
|
||||
|
||||
def __set__(self, newtime):
|
||||
cdef tm time
|
||||
tmtup = newtime.timetuple()
|
||||
time.tm_sec = tmtup.tm_sec
|
||||
time.tm_min = tmtup.tm_min
|
||||
time.tm_hour = tmtup.tm_hour
|
||||
time.tm_mday = tmtup.tm_mday
|
||||
time.tm_mon = tmtup.tm_mon - 1
|
||||
time.tm_year = tmtup.tm_year - 1900
|
||||
time.tm_wday = tmtup.tm_wday
|
||||
time.tm_yday = tmtup.tm_yday
|
||||
time.tm_isdst = tmtup.tm_isdst
|
||||
elm_datetime_value_max_set(self.obj, &time)
|
||||
|
||||
property value_min:
|
||||
def __get__(self):
|
||||
cdef tm time
|
||||
elm_datetime_value_min_get(self.obj, &time)
|
||||
ret = datetime( time.tm_year + 1900,
|
||||
time.tm_mon + 1,
|
||||
time.tm_mday,
|
||||
time.tm_hour,
|
||||
time.tm_min,
|
||||
time.tm_sec)
|
||||
return ret
|
||||
|
||||
def __set__(self, newtime):
|
||||
cdef tm time
|
||||
tmtup = newtime.timetuple()
|
||||
time.tm_sec = tmtup.tm_sec
|
||||
time.tm_min = tmtup.tm_min
|
||||
time.tm_hour = tmtup.tm_hour
|
||||
time.tm_mday = tmtup.tm_mday
|
||||
time.tm_mon = tmtup.tm_mon - 1
|
||||
time.tm_year = tmtup.tm_year - 1900
|
||||
time.tm_wday = tmtup.tm_wday
|
||||
time.tm_yday = tmtup.tm_yday
|
||||
time.tm_isdst = tmtup.tm_isdst
|
||||
elm_datetime_value_min_set(self.obj, &time)
|
||||
|
||||
property field_limit:
|
||||
def __get__(self):
|
||||
cdef int min, max
|
||||
cdef Elm_Datetime_Field_Type fieldtype = ELM_DATETIME_YEAR
|
||||
elm_datetime_field_limit_get(self.obj, fieldtype, &min, &max)
|
||||
return (fieldtype, min, max)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef int min, max
|
||||
cdef Elm_Datetime_Field_Type fieldtype
|
||||
min, max, fieldtype = value
|
||||
elm_datetime_field_limit_set(self.obj, fieldtype, min, max)
|
||||
|
||||
property value:
|
||||
def __get__(self):
|
||||
cdef tm time
|
||||
elm_datetime_value_get(self.obj, &time)
|
||||
ret = datetime( time.tm_year + 1900,
|
||||
time.tm_mon + 1,
|
||||
time.tm_mday,
|
||||
time.tm_hour,
|
||||
time.tm_min,
|
||||
time.tm_sec)
|
||||
return ret
|
||||
|
||||
def __set__(self, newtime):
|
||||
cdef tm time
|
||||
tmtup = newtime.timetuple()
|
||||
time.tm_sec = tmtup.tm_sec
|
||||
time.tm_min = tmtup.tm_min
|
||||
time.tm_hour = tmtup.tm_hour
|
||||
time.tm_mday = tmtup.tm_mday
|
||||
time.tm_mon = tmtup.tm_mon - 1
|
||||
time.tm_year = tmtup.tm_year - 1900
|
||||
time.tm_wday = tmtup.tm_wday
|
||||
time.tm_yday = tmtup.tm_yday
|
||||
time.tm_isdst = tmtup.tm_isdst
|
||||
elm_datetime_value_set(self.obj, &time)
|
||||
|
||||
def field_visible_get(self, fieldtype):
|
||||
return bool(elm_datetime_field_visible_get(self.obj, fieldtype))
|
||||
|
||||
def field_visible_set(self, fieldtype, visible):
|
||||
elm_datetime_field_visible_set(self.obj, fieldtype, visible)
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
def callback_languge_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("language,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_language_changed_del(self, func):
|
||||
self._callback_del("language,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_datetime", Datetime)
|
|
@ -0,0 +1,61 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Dayselector(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_dayselector_add(parent.obj))
|
||||
|
||||
def day_selected_set(self, day, selected):
|
||||
elm_dayselector_day_selected_set(self.obj, day, selected)
|
||||
|
||||
def day_selected_get(self, day):
|
||||
return bool(elm_dayselector_day_selected_get(self.obj, day))
|
||||
|
||||
property week_start:
|
||||
def __get__(self):
|
||||
return elm_dayselector_week_start_get(self.obj)
|
||||
def __set__(self, day):
|
||||
elm_dayselector_week_start_set(self.obj, day)
|
||||
|
||||
property weekend_start:
|
||||
def __get__(self):
|
||||
return elm_dayselector_weekend_start_get(self.obj)
|
||||
def __set__(self, day):
|
||||
elm_dayselector_weekend_start_set(self.obj, day)
|
||||
|
||||
property weekend_length:
|
||||
def __get__(self):
|
||||
return elm_dayselector_weekend_length_get(self.obj)
|
||||
def __set__(self, length):
|
||||
elm_dayselector_weekend_length_set(self.obj, length)
|
||||
|
||||
def callback_dayselector_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("dayselector,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_dayselector_changed_del(self, func):
|
||||
self._callback_del("dayselector,changed", func)
|
||||
|
||||
def callback_language_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("language,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_language_changed_del(self, func):
|
||||
self._callback_del("language,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_dayselector", Dayselector)
|
|
@ -0,0 +1,169 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class DiskselectorItem(ObjectItem):
|
||||
|
||||
def __init__(self, evasObject diskselector, label, evasObject icon=None, callback=None, *args, **kargs):
|
||||
cdef Evas_Object* icon_obj = NULL
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if icon is not None:
|
||||
icon_obj = icon.obj
|
||||
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
|
||||
item = elm_diskselector_item_append(diskselector.obj, _cfruni(label), icon_obj, cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
property selected:
|
||||
def __set__(self, selected):
|
||||
elm_diskselector_item_selected_set(self.item, selected)
|
||||
def __get__(self):
|
||||
return bool(elm_diskselector_item_selected_get(self.item))
|
||||
|
||||
property prev:
|
||||
def __get__(self):
|
||||
cdef Elm_Object_Item *it = elm_diskselector_item_prev_get(self.item)
|
||||
return _object_item_to_python(it)
|
||||
|
||||
property next:
|
||||
def __get__(self):
|
||||
cdef Elm_Object_Item *it = elm_diskselector_item_next_get(self.item)
|
||||
return _object_item_to_python(it)
|
||||
|
||||
|
||||
cdef class Diskselector(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_diskselector_add(parent.obj))
|
||||
|
||||
property round_enabled:
|
||||
def __set__(self, enabled):
|
||||
elm_diskselector_round_enabled_set(self.obj, enabled)
|
||||
def __get__(self):
|
||||
return bool(elm_diskselector_round_enabled_get(self.obj))
|
||||
|
||||
property side_text_max_length:
|
||||
def __get__(self):
|
||||
return elm_diskselector_side_text_max_length_get(self.obj)
|
||||
def __set__(self, length):
|
||||
elm_diskselector_side_text_max_length_set(self.obj, length)
|
||||
|
||||
property display_item_num:
|
||||
def __set__(self, num):
|
||||
elm_diskselector_display_item_num_set(self.obj, num)
|
||||
def __get__(self):
|
||||
return elm_diskselector_display_item_num_get(self.obj)
|
||||
|
||||
property bounce:
|
||||
def __set__(self, bounce):
|
||||
h_bounce, v_bounce = bounce
|
||||
elm_scroller_bounce_set(self.obj, h_bounce, v_bounce)
|
||||
def __get__(self):
|
||||
cdef Eina_Bool h_bounce, v_bounce
|
||||
elm_scroller_bounce_get(self.obj, &h_bounce, &v_bounce)
|
||||
return (h_bounce, v_bounce)
|
||||
|
||||
property scroller_policy:
|
||||
def __get__(self):
|
||||
cdef Elm_Scroller_Policy h_policy, v_policy
|
||||
elm_scroller_policy_get(self.obj, &h_policy, &v_policy)
|
||||
return (h_policy, v_policy)
|
||||
def __set__(self, policy):
|
||||
h_policy, v_policy = policy
|
||||
elm_scroller_policy_set(self.obj, h_policy, v_policy)
|
||||
|
||||
def clear(self):
|
||||
elm_diskselector_clear(self.obj)
|
||||
|
||||
property items:
|
||||
def __get__(self):
|
||||
cdef Elm_Object_Item *it
|
||||
cdef const_Eina_List *lst
|
||||
|
||||
lst = elm_diskselector_items_get(self.obj)
|
||||
ret = []
|
||||
ret_append = ret.append
|
||||
while lst:
|
||||
it = <Elm_Object_Item *>lst.data
|
||||
lst = lst.next
|
||||
o = _object_item_to_python(it)
|
||||
if o is not None:
|
||||
ret_append(o)
|
||||
return ret
|
||||
|
||||
def item_append(self, label, evasObject icon = None, callback = None, *args, **kwargs):
|
||||
return DiskselectorItem(self, label, icon, callback, *args, **kwargs)
|
||||
|
||||
property selected_item:
|
||||
def __get__(self):
|
||||
cdef Elm_Object_Item *it = elm_diskselector_selected_item_get(self.obj)
|
||||
return _object_item_to_python(it)
|
||||
|
||||
property first_item:
|
||||
def __get__(self):
|
||||
cdef Elm_Object_Item *it = elm_diskselector_first_item_get(self.obj)
|
||||
return _object_item_to_python(it)
|
||||
|
||||
property last_item:
|
||||
def __get__(self):
|
||||
cdef Elm_Object_Item *it = elm_diskselector_last_item_get(self.obj)
|
||||
return _object_item_to_python(it)
|
||||
|
||||
def callback_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("selected", _cb_object_item_conv, func, *args, **kwargs)
|
||||
|
||||
def callback_selected_del(self, func):
|
||||
self._callback_del_full("selected", _cb_object_item_conv, func)
|
||||
|
||||
def callback_scroll_anim_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,anim,start", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_anim_start_del(self, func):
|
||||
self._callback_del("scroll,anim,start", func)
|
||||
|
||||
def callback_scroll_anim_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,anim,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_anim_stop_del(self, func):
|
||||
self._callback_del("scroll,anim,stop", func)
|
||||
|
||||
def callback_scroll_drag_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,drag,start", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_drag_start_del(self, func):
|
||||
self._callback_del("scroll,drag,start", func)
|
||||
|
||||
def callback_scroll_drag_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,drag,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_drag_stop_del(self, func):
|
||||
self._callback_del("scroll,drag,stop", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_diskselector", Diskselector)
|
|
@ -0,0 +1,683 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
def Entry_markup_to_utf8(str):
|
||||
cdef const_char_ptr string
|
||||
string = elm_entry_markup_to_utf8(str)
|
||||
if string == NULL:
|
||||
return None
|
||||
return string
|
||||
|
||||
def Entry_utf8_to_markup(str):
|
||||
cdef const_char_ptr string
|
||||
string = elm_entry_utf8_to_markup(str)
|
||||
if string == NULL:
|
||||
return None
|
||||
return string
|
||||
|
||||
class EntryAnchorInfo:
|
||||
def __init__(self):
|
||||
self.name = None
|
||||
self.button = 0
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
self.w = 0
|
||||
self.h = 0
|
||||
|
||||
class EntryAnchorHoverInfo:
|
||||
def __init__(self):
|
||||
self.anchor_info = None
|
||||
self.hover = None
|
||||
self.hover_parent = (0, 0, 0, 0)
|
||||
self.hover_left = False
|
||||
self.hover_right = False
|
||||
self.hover_top = False
|
||||
self.hover_bottom = False
|
||||
|
||||
def _entryanchor_conv(long addr):
|
||||
cdef Elm_Entry_Anchor_Info *ei = <Elm_Entry_Anchor_Info *>addr
|
||||
eai = EntryAnchorInfo()
|
||||
eai.name = ei.name
|
||||
eai.button = ei.button
|
||||
eai.x = ei.x
|
||||
eai.y = ei.y
|
||||
eai.w = ei.w
|
||||
eai.h = ei.h
|
||||
return eai
|
||||
|
||||
def _entryanchorhover_conv(long addr):
|
||||
cdef Elm_Entry_Anchor_Hover_Info *ehi = <Elm_Entry_Anchor_Hover_Info *>addr
|
||||
eahi = EntryAnchorHoverInfo()
|
||||
eahi.anchor_info = <object>ehi.anchor_info
|
||||
eahi.hover = Hover(None, <object>ehi.hover)
|
||||
eahi.hover_parent = (ehi.hover_parent.x, ehi.hover_parent.y,
|
||||
ehi.hover_parent.w, ehi.hover_parent.h)
|
||||
eahi.hover_left = ehi.hover_left
|
||||
eahi.hover_right = ehi.hover_right
|
||||
eahi.hover_top = ehi.hover_top
|
||||
eahi.hover_bottom = ehi.hover_bottom
|
||||
return eahi
|
||||
|
||||
cdef class Entry(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_entry_add(parent.obj))
|
||||
|
||||
def single_line_set(self, single_line):
|
||||
elm_entry_single_line_set(self.obj, single_line)
|
||||
|
||||
def single_line_get(self):
|
||||
return bool(elm_entry_single_line_get(self.obj))
|
||||
|
||||
property single_line:
|
||||
def __get__(self):
|
||||
return bool(elm_entry_single_line_get(self.obj))
|
||||
|
||||
def __set__(self, single_line):
|
||||
elm_entry_single_line_set(self.obj, single_line)
|
||||
|
||||
def password_set(self, password):
|
||||
elm_entry_password_set(self.obj, password)
|
||||
|
||||
def password_get(self):
|
||||
return bool(elm_entry_password_get(self.obj))
|
||||
|
||||
property password:
|
||||
def __get__(self):
|
||||
return bool(elm_entry_password_get(self.obj))
|
||||
|
||||
def __set__(self, password):
|
||||
elm_entry_password_set(self.obj, password)
|
||||
|
||||
def entry_set(self, entry):
|
||||
elm_entry_entry_set(self.obj, _cfruni(entry))
|
||||
|
||||
def entry_get(self):
|
||||
return _ctouni(elm_entry_entry_get(self.obj))
|
||||
|
||||
property entry:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_entry_entry_get(self.obj))
|
||||
|
||||
def __set__(self, entry):
|
||||
elm_entry_entry_set(self.obj, _cfruni(entry))
|
||||
|
||||
def entry_append(self, text):
|
||||
elm_entry_entry_append(self.obj, _cfruni(text))
|
||||
|
||||
def is_empty(self):
|
||||
return elm_entry_is_empty(self.obj)
|
||||
|
||||
def selection_get(self):
|
||||
return _ctouni(elm_entry_selection_get(self.obj))
|
||||
|
||||
property selection:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_entry_selection_get(self.obj))
|
||||
|
||||
def textblock_get(self):
|
||||
cdef Evas_Object *o
|
||||
o = elm_entry_textblock_get(self.obj)
|
||||
return object_from_instance(o)
|
||||
|
||||
property textblock:
|
||||
def __get__(self):
|
||||
cdef Evas_Object *o
|
||||
o = elm_entry_textblock_get(self.obj)
|
||||
return object_from_instance(o)
|
||||
|
||||
def calc_force(self):
|
||||
elm_entry_calc_force(self.obj)
|
||||
|
||||
def entry_insert(self, entry):
|
||||
elm_entry_entry_insert(self.obj, _cfruni(entry))
|
||||
|
||||
def line_wrap_set(self, wrap):
|
||||
elm_entry_line_wrap_set(self.obj, wrap)
|
||||
|
||||
def line_wrap_get(self):
|
||||
return elm_entry_line_wrap_get(self.obj)
|
||||
|
||||
property line_wrap:
|
||||
def __get__(self):
|
||||
return elm_entry_line_wrap_get(self.obj)
|
||||
|
||||
def __set__(self, wrap):
|
||||
elm_entry_line_wrap_set(self.obj, wrap)
|
||||
|
||||
def editable_set(self, editable):
|
||||
elm_entry_editable_set(self.obj, editable)
|
||||
|
||||
def editable_get(self):
|
||||
return bool(elm_entry_editable_get(self.obj))
|
||||
|
||||
property editable:
|
||||
def __get__(self):
|
||||
return bool(elm_entry_editable_get(self.obj))
|
||||
|
||||
def __set__(self, editable):
|
||||
elm_entry_editable_set(self.obj, editable)
|
||||
|
||||
def select_none(self):
|
||||
elm_entry_select_none(self.obj)
|
||||
|
||||
def select_all(self):
|
||||
elm_entry_select_all(self.obj)
|
||||
|
||||
def cursor_next(self):
|
||||
|
||||
return bool(elm_entry_cursor_next(self.obj))
|
||||
|
||||
def cursor_prev(self):
|
||||
return bool(elm_entry_cursor_prev(self.obj))
|
||||
|
||||
def cursor_up(self):
|
||||
return bool(elm_entry_cursor_up(self.obj))
|
||||
|
||||
def cursor_down(self):
|
||||
return bool(elm_entry_cursor_down(self.obj))
|
||||
|
||||
def cursor_begin_set(self):
|
||||
elm_entry_cursor_begin_set(self.obj)
|
||||
|
||||
def cursor_end_set(self):
|
||||
elm_entry_cursor_end_set(self.obj)
|
||||
|
||||
def cursor_line_begin_set(self):
|
||||
elm_entry_cursor_line_begin_set(self.obj)
|
||||
|
||||
def cursor_line_end_set(self):
|
||||
elm_entry_cursor_line_end_set(self.obj)
|
||||
|
||||
def cursor_selection_begin(self):
|
||||
elm_entry_cursor_selection_begin(self.obj)
|
||||
|
||||
def cursor_selection_end(self):
|
||||
elm_entry_cursor_selection_end(self.obj)
|
||||
|
||||
def cursor_is_format_get(self):
|
||||
return bool(elm_entry_cursor_is_format_get(self.obj))
|
||||
|
||||
def cursor_is_visible_format_get(self):
|
||||
return bool(elm_entry_cursor_is_visible_format_get(self.obj))
|
||||
|
||||
def cursor_content_get(self):
|
||||
return elm_entry_cursor_content_get(self.obj)
|
||||
|
||||
def cursor_geometry_get(self):
|
||||
cdef Evas_Coord x, y, w, h
|
||||
#TODO: Check return status for success
|
||||
elm_entry_cursor_geometry_get(self.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
def cursor_pos_set(self, pos):
|
||||
elm_entry_cursor_pos_set(self.obj, pos)
|
||||
|
||||
def cursor_pos_get(self):
|
||||
return elm_entry_cursor_pos_get(self.obj)
|
||||
|
||||
property cursor_pos:
|
||||
def __get__(self):
|
||||
return elm_entry_cursor_pos_get(self.obj)
|
||||
|
||||
def __set__(self, pos):
|
||||
elm_entry_cursor_pos_set(self.obj, pos)
|
||||
|
||||
def selection_cut(self):
|
||||
elm_entry_selection_cut(self.obj)
|
||||
|
||||
def selection_copy(self):
|
||||
elm_entry_selection_copy(self.obj)
|
||||
|
||||
def selection_paste(self):
|
||||
elm_entry_selection_paste(self.obj)
|
||||
|
||||
def context_menu_clear(self):
|
||||
elm_entry_context_menu_clear(self.obj)
|
||||
|
||||
# TODO XXX
|
||||
# def context_menu_item_add(self, label, icon_file, icon_type, cb, data):
|
||||
#elm_entry_context_menu_item_add(self.obj, label, icon_file, icon_type, func, data);
|
||||
|
||||
def context_menu_disabled_set(self, disabled):
|
||||
elm_entry_context_menu_disabled_set(self.obj, disabled)
|
||||
|
||||
def context_menu_disabled_get(self):
|
||||
return elm_entry_context_menu_disabled_get(self.obj)
|
||||
|
||||
property context_menu_disabled:
|
||||
def __get__(self):
|
||||
return elm_entry_context_menu_disabled_get(self.obj)
|
||||
|
||||
def __set__(self, disabled):
|
||||
elm_entry_context_menu_disabled_set(self.obj, disabled)
|
||||
|
||||
|
||||
# elm_entry_item_provider_append() # TODO XXX
|
||||
|
||||
# elm_entry_item_provider_prepend() # TODO XXX
|
||||
|
||||
# elm_entry_item_provider_remove() # TODO XXX
|
||||
|
||||
# elm_entry_markup_filter_append() # TODO XXX
|
||||
|
||||
# elm_entry_markup_filter_prepend() # TODO XXX
|
||||
|
||||
# elm_entry_markup_filter_remove() # TODO XXX
|
||||
|
||||
markup_to_utf8 = staticmethod(Entry_markup_to_utf8)
|
||||
|
||||
utf8_to_markup = staticmethod(Entry_utf8_to_markup)
|
||||
|
||||
def file_set(self, file, format):
|
||||
return bool(elm_entry_file_set(self.obj, _cfruni(file), format))
|
||||
|
||||
def file_get(self):
|
||||
cdef const_char_ptr file
|
||||
cdef Elm_Text_Format format
|
||||
|
||||
elm_entry_file_get(self.obj, &file, &format)
|
||||
return (_ctouni(file), format)
|
||||
|
||||
property file:
|
||||
def __get__(self):
|
||||
cdef const_char_ptr file
|
||||
cdef Elm_Text_Format format
|
||||
elm_entry_file_get(self.obj, &file, &format)
|
||||
return (_ctouni(file), format)
|
||||
|
||||
def __set__(self, value):
|
||||
file, format = value
|
||||
elm_entry_file_set(self.obj, _cfruni(file), format)
|
||||
|
||||
def file_save(self):
|
||||
elm_entry_file_save(self.obj)
|
||||
|
||||
def autosave_set(self, autosave):
|
||||
elm_entry_autosave_set(self.obj, autosave)
|
||||
|
||||
def autosave_get(self):
|
||||
return elm_entry_autosave_get(self.obj)
|
||||
|
||||
property autosave:
|
||||
def __get__(self):
|
||||
return elm_entry_autosave_get(self.obj)
|
||||
|
||||
def __set__(self, autosave):
|
||||
elm_entry_autosave_set(self.obj, autosave)
|
||||
|
||||
def scrollable_set(self, scrollable):
|
||||
elm_entry_scrollable_set(self.obj, scrollable)
|
||||
|
||||
def scrollable_get(self):
|
||||
return bool(elm_entry_scrollable_get(self.obj))
|
||||
|
||||
property scrollable:
|
||||
def __get__(self):
|
||||
return bool(elm_entry_scrollable_get(self.obj))
|
||||
|
||||
def __set__(self, scrollable):
|
||||
elm_entry_scrollable_set(self.obj, scrollable)
|
||||
|
||||
def icon_visible_set(self, visible):
|
||||
elm_entry_icon_visible_set(self.obj, visible)
|
||||
|
||||
property icon_visible:
|
||||
def __set__(self, visible):
|
||||
elm_entry_icon_visible_set(self.obj, visible)
|
||||
|
||||
def scrollbar_policy_set(self, Elm_Scroller_Policy h, Elm_Scroller_Policy v):
|
||||
elm_scroller_policy_set(self.obj, h, v)
|
||||
|
||||
property scrollbar_policy:
|
||||
def __set__(self, value):
|
||||
cdef Elm_Scroller_Policy h, v
|
||||
h, v = value
|
||||
elm_scroller_policy_set(self.obj, h, v)
|
||||
|
||||
def bounce_set(self, h_bounce, v_bounce):
|
||||
elm_scroller_bounce_set(self.obj, h_bounce, v_bounce)
|
||||
|
||||
def bounce_get(self):
|
||||
cdef Eina_Bool h_bounce, v_bounce
|
||||
|
||||
elm_scroller_bounce_get(self.obj, &h_bounce, &v_bounce)
|
||||
return (h_bounce, v_bounce)
|
||||
|
||||
property bounce:
|
||||
def __get__(self):
|
||||
cdef Eina_Bool h_bounce, v_bounce
|
||||
elm_scroller_bounce_get(self.obj, &h_bounce, &v_bounce)
|
||||
return (h_bounce, v_bounce)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef Eina_Bool h_bounce, v_bounce
|
||||
h_bounce, v_bounce = value
|
||||
elm_scroller_bounce_set(self.obj, h_bounce, v_bounce)
|
||||
|
||||
def input_panel_layout_set(self, layout):
|
||||
elm_entry_input_panel_layout_set(self.obj, layout)
|
||||
|
||||
def input_panel_layout_get(self):
|
||||
return elm_entry_input_panel_layout_get(self.obj)
|
||||
|
||||
property input_panel_layout:
|
||||
def __get__(self):
|
||||
return elm_entry_input_panel_layout_get(self.obj)
|
||||
|
||||
def __set__(self, layout):
|
||||
elm_entry_input_panel_layout_set(self.obj, layout)
|
||||
|
||||
def input_panel_enabled_set(self, enabled):
|
||||
elm_entry_input_panel_enabled_set(self.obj, enabled)
|
||||
|
||||
def input_panel_enabled_get(self):
|
||||
return bool(elm_entry_input_panel_enabled_get(self.obj))
|
||||
|
||||
property input_panel_enabled:
|
||||
def __get__(self):
|
||||
return bool(elm_entry_input_panel_enabled_get(self.obj))
|
||||
|
||||
def __set__(self, enabled):
|
||||
elm_entry_input_panel_enabled_set(self.obj, enabled)
|
||||
|
||||
def input_panel_show(self):
|
||||
elm_entry_input_panel_show(self.obj)
|
||||
|
||||
def input_panel_hide(self):
|
||||
elm_entry_input_panel_hide(self.obj)
|
||||
|
||||
def input_panel_language_set(self, lang):
|
||||
elm_entry_input_panel_language_set(self.obj, lang)
|
||||
|
||||
def input_panel_language_get(self):
|
||||
return elm_entry_input_panel_language_get(self.obj)
|
||||
|
||||
property input_panel_language:
|
||||
def __get__(self):
|
||||
return elm_entry_input_panel_language_get(self.obj)
|
||||
|
||||
def __set__(self, lang):
|
||||
elm_entry_input_panel_language_set(self.obj, lang)
|
||||
|
||||
# TODO XXX elm_entry_input_panel_imdata_set() ??
|
||||
|
||||
# TODO XXX elm_entry_input_panel_imdata_get() ??
|
||||
|
||||
def input_panel_return_key_type_set(self, return_key_type):
|
||||
elm_entry_input_panel_return_key_type_set(self.obj, return_key_type)
|
||||
|
||||
def input_panel_return_key_type_get(self):
|
||||
return elm_entry_input_panel_return_key_type_get(self.obj)
|
||||
|
||||
property input_panel_return_key_type:
|
||||
def __get__(self):
|
||||
return elm_entry_input_panel_return_key_type_get(self.obj)
|
||||
|
||||
def __set__(self, return_key_type):
|
||||
elm_entry_input_panel_return_key_type_set(self.obj, return_key_type)
|
||||
|
||||
def input_panel_return_key_disabled_set(self, disabled):
|
||||
elm_entry_input_panel_return_key_disabled_set(self.obj, disabled)
|
||||
|
||||
def input_panel_return_key_disabled_get(self):
|
||||
return elm_entry_input_panel_return_key_disabled_get(self.obj)
|
||||
|
||||
property input_panel_return_key_disabled:
|
||||
def __get__(self):
|
||||
return elm_entry_input_panel_return_key_disabled_get(self.obj)
|
||||
|
||||
def __set__(self, disabled):
|
||||
elm_entry_input_panel_return_key_disabled_set(self.obj, disabled)
|
||||
|
||||
def input_panel_return_key_autoenabled_set(self, enabled):
|
||||
elm_entry_input_panel_return_key_autoenabled_set(self.obj, enabled)
|
||||
|
||||
property input_panel_return_key_autoenabled:
|
||||
def __set__(self, enabled):
|
||||
elm_entry_input_panel_return_key_autoenabled_set(self.obj, enabled)
|
||||
|
||||
def imf_context_reset(self):
|
||||
elm_entry_imf_context_reset(self.obj)
|
||||
|
||||
def prediction_allow_set(self, allow):
|
||||
elm_entry_prediction_allow_set(self.obj, allow)
|
||||
|
||||
def prediction_allow_get(self):
|
||||
return elm_entry_prediction_allow_get(self.obj)
|
||||
|
||||
property prediction_allow:
|
||||
def __get__(self):
|
||||
return elm_entry_prediction_allow_get(self.obj)
|
||||
|
||||
def __set__(self, allow):
|
||||
elm_entry_prediction_allow_set(self.obj, allow)
|
||||
|
||||
# TODO XXX elm_entry_filter_accept_set()
|
||||
# TODO XXX elm_entry_imf_context_get() ??
|
||||
|
||||
def cnp_mode_set(self, mode):
|
||||
elm_entry_cnp_mode_set(self.obj, mode)
|
||||
|
||||
def cnp_mode_get(self):
|
||||
return elm_entry_cnp_mode_get(self.obj)
|
||||
|
||||
property cnp_mode:
|
||||
def __get__(self):
|
||||
return elm_entry_cnp_mode_get(self.obj)
|
||||
|
||||
def __set__(self, mode):
|
||||
elm_entry_cnp_mode_set(self.obj, mode)
|
||||
|
||||
def anchor_hover_parent_set(self, evasObject anchor_hover_parent):
|
||||
elm_entry_anchor_hover_parent_set(self.obj, anchor_hover_parent.obj)
|
||||
|
||||
def anchor_hover_parent_get(self):
|
||||
cdef Evas_Object *anchor_hover_parent
|
||||
anchor_hover_parent = elm_entry_anchor_hover_parent_get(self.obj)
|
||||
return object_from_instance(anchor_hover_parent)
|
||||
|
||||
property anchor_hover_parent:
|
||||
def __get__(self):
|
||||
cdef Evas_Object *anchor_hover_parent
|
||||
anchor_hover_parent = elm_entry_anchor_hover_parent_get(self.obj)
|
||||
return object_from_instance(anchor_hover_parent)
|
||||
|
||||
def __set__(self, evasObject anchor_hover_parent):
|
||||
elm_entry_anchor_hover_parent_set(self.obj, anchor_hover_parent.obj)
|
||||
|
||||
def anchor_hover_style_set(self, style):
|
||||
elm_entry_anchor_hover_style_set(self.obj, _cfruni(style))
|
||||
|
||||
def anchor_hover_style_get(self):
|
||||
return _ctouni(elm_entry_anchor_hover_style_get(self.obj))
|
||||
|
||||
property anchor_hover_style:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_entry_anchor_hover_style_get(self.obj))
|
||||
|
||||
def __set__(self, style):
|
||||
elm_entry_anchor_hover_style_set(self.obj, _cfruni(style))
|
||||
|
||||
def anchor_hover_end(self):
|
||||
elm_entry_anchor_hover_end(self.obj)
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
def callback_changed_user_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed,user", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_user_del(self, func):
|
||||
self._callback_del("changed,user", func)
|
||||
|
||||
def callback_activated_add(self, func, *args, **kwargs):
|
||||
self._callback_add("activated", func, *args, **kwargs)
|
||||
|
||||
def callback_activated_del(self, func):
|
||||
self._callback_del("activated", func)
|
||||
|
||||
def callback_press_add(self, func, *args, **kwargs):
|
||||
self._callback_add("press", func, *args, **kwargs)
|
||||
|
||||
def callback_press_del(self, func):
|
||||
self._callback_del("press", func)
|
||||
|
||||
def callback_longpressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("longpressed", func, *args, **kwargs)
|
||||
|
||||
def callback_longpressed_del(self, func):
|
||||
self._callback_del("longpressed", func)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_double_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked,double", func, *args, **kwargs)
|
||||
|
||||
def callback_double_clicked_del(self, func):
|
||||
self._callback_del("clicked,double", func)
|
||||
|
||||
def callback_triple_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked,triple", func, *args, **kwargs)
|
||||
|
||||
def callback_triple_clicked_del(self, func):
|
||||
self._callback_del("clicked,triple", func)
|
||||
|
||||
def callback_focused_add(self, func, *args, **kwargs):
|
||||
self._callback_add("focused", func, *args, **kwargs)
|
||||
|
||||
def callback_focused_del(self, func):
|
||||
self._callback_del("focused", func)
|
||||
|
||||
def callback_unfocused_add(self, func, *args, **kwargs):
|
||||
self._callback_add("unfocused", func, *args, **kwargs)
|
||||
|
||||
def callback_unfocused_del(self, func):
|
||||
self._callback_del("unfocused", func)
|
||||
|
||||
def callback_selection_paste_add(self, func, *args, **kwargs):
|
||||
self._callback_add("selection,paste", func, *args, **kwargs)
|
||||
|
||||
def callback_selection_paste_del(self, func):
|
||||
self._callback_del("selection,paste", func)
|
||||
|
||||
def callback_selection_copy_add(self, func, *args, **kwargs):
|
||||
self._callback_add("selection,copy", func, *args, **kwargs)
|
||||
|
||||
def callback_selection_copy_del(self, func):
|
||||
self._callback_del("selection,copy", func)
|
||||
|
||||
def callback_selection_cut_add(self, func, *args, **kwargs):
|
||||
self._callback_add("selection,cut", func, *args, **kwargs)
|
||||
|
||||
def callback_selection_cut_del(self, func):
|
||||
self._callback_del("selection,cut", func)
|
||||
|
||||
def callback_selection_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("selection,start", func, *args, **kwargs)
|
||||
|
||||
def callback_selection_start_del(self, func):
|
||||
self._callback_del("selection,start", func)
|
||||
|
||||
def callback_selection_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("selection,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_selection_changed_del(self, func):
|
||||
self._callback_del("selection,changed", func)
|
||||
|
||||
def callback_selection_cleared_add(self, func, *args, **kwargs):
|
||||
self._callback_add("selection,cleared", func, *args, **kwargs)
|
||||
|
||||
def callback_selection_cleared_del(self, func):
|
||||
self._callback_del("selection,cleared", func)
|
||||
|
||||
def callback_cursor_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("cursor,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_cursor_changed_del(self, func):
|
||||
self._callback_del("cursor,changed", func)
|
||||
|
||||
def callback_anchor_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("anchor,clicked", _entryanchor_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_anchor_clicked_del(self, func):
|
||||
self._callback_del_full("anchor,clicked", _entryanchor_conv,
|
||||
func)
|
||||
|
||||
def callback_anchor_in_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("anchor,in", _entryanchor_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_anchor_in_del(self, func):
|
||||
self._callback_del_full("anchor,in", _entryanchor_conv,
|
||||
func)
|
||||
|
||||
def callback_anchor_out_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("anchor,out", _entryanchor_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_anchor_out_del(self, func):
|
||||
self._callback_del_full("anchor,out", _entryanchor_conv,
|
||||
func)
|
||||
|
||||
def callback_anchor_up_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("anchor,up", _entryanchor_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_anchor_up_del(self, func):
|
||||
self._callback_del_full("anchor,up", _entryanchor_conv,
|
||||
func)
|
||||
|
||||
def callback_anchor_down_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("anchor,down", _entryanchor_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_anchor_down_del(self, func):
|
||||
self._callback_del_full("anchor,down", _entryanchor_conv,
|
||||
func)
|
||||
|
||||
def callback_anchor_hover_opened_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("anchor,hover,opened", _entryanchorhover_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_anchor_hover_opened_del(self, func):
|
||||
self._callback_del_full("anchor,hover,opened", _entryanchorhover_conv,
|
||||
func)
|
||||
|
||||
def callback_preedit_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("preedit,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_preedit_changed_del(self, func):
|
||||
self._callback_del("preedit,changed", func)
|
||||
|
||||
def callback_language_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("language,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_language_changed_del(self, func):
|
||||
self._callback_del("language,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_entry", Entry)
|
|
@ -0,0 +1,138 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Fileselector(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_fileselector_add(parent.obj))
|
||||
|
||||
def is_save_set(self, is_save):
|
||||
elm_fileselector_is_save_set(self.obj, is_save)
|
||||
|
||||
def is_save_get(self):
|
||||
return elm_fileselector_is_save_get(self.obj)
|
||||
|
||||
property is_save:
|
||||
def __get__(self):
|
||||
return elm_fileselector_is_save_get(self.obj)
|
||||
|
||||
def __set__(self, is_save):
|
||||
elm_fileselector_is_save_set(self.obj, is_save)
|
||||
|
||||
def folder_only_set(self, folder_only):
|
||||
elm_fileselector_folder_only_set(self.obj, folder_only)
|
||||
|
||||
def folder_only_get(self):
|
||||
return elm_fileselector_folder_only_get(self.obj)
|
||||
|
||||
property folder_only:
|
||||
def __get__(self):
|
||||
return elm_fileselector_folder_only_get(self.obj)
|
||||
|
||||
def __set__(self, folder_only):
|
||||
elm_fileselector_folder_only_set(self.obj, folder_only)
|
||||
|
||||
def buttons_ok_cancel_set(self, buttons):
|
||||
elm_fileselector_buttons_ok_cancel_set(self.obj, buttons)
|
||||
|
||||
def buttons_ok_cancel_get(self):
|
||||
return elm_fileselector_buttons_ok_cancel_get(self.obj)
|
||||
|
||||
property buttons_ok_cancel:
|
||||
def __get__(self):
|
||||
return elm_fileselector_buttons_ok_cancel_get(self.obj)
|
||||
|
||||
def __set__(self, buttons):
|
||||
elm_fileselector_buttons_ok_cancel_set(self.obj, buttons)
|
||||
|
||||
def expandable_set(self, expand):
|
||||
elm_fileselector_expandable_set(self.obj, expand)
|
||||
|
||||
def expandable_get(self):
|
||||
return elm_fileselector_expandable_get(self.obj)
|
||||
|
||||
property expandable:
|
||||
def __get__(self):
|
||||
return elm_fileselector_expandable_get(self.obj)
|
||||
|
||||
def __set__(self, expand):
|
||||
elm_fileselector_expandable_set(self.obj, expand)
|
||||
|
||||
def path_set(self, path):
|
||||
elm_fileselector_path_set(self.obj, _cfruni(path))
|
||||
|
||||
def path_get(self):
|
||||
return _ctouni(elm_fileselector_path_get(self.obj))
|
||||
|
||||
property path:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_fileselector_path_get(self.obj))
|
||||
|
||||
def __set__(self, path):
|
||||
elm_fileselector_path_set(self.obj, _cfruni(path))
|
||||
|
||||
def selected_set(self, path):
|
||||
return elm_fileselector_selected_set(self.obj, _cfruni(path))
|
||||
|
||||
def selected_get(self):
|
||||
return _ctouni(elm_fileselector_selected_get(self.obj))
|
||||
|
||||
property selected:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_fileselector_selected_get(self.obj))
|
||||
|
||||
def __set__(self, path):
|
||||
#TODO: Check return value for success
|
||||
elm_fileselector_selected_set(self.obj, _cfruni(path))
|
||||
|
||||
def mode_set(self, mode):
|
||||
elm_fileselector_mode_set(self.obj, mode)
|
||||
|
||||
def mode_get(self):
|
||||
return elm_fileselector_mode_get(self.obj)
|
||||
|
||||
property mode:
|
||||
def __get__(self):
|
||||
return elm_fileselector_mode_get(self.obj)
|
||||
|
||||
def __set__(self, mode):
|
||||
elm_fileselector_mode_set(self.obj, mode)
|
||||
|
||||
def callback_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("selected", _cb_string_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_selected_del(self, func):
|
||||
self._callback_del_full("selected", _cb_string_conv, func)
|
||||
|
||||
def callback_directory_open_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("directory,open", _cb_string_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_directory_open_del(self, func):
|
||||
self._callback_del_full("directory,open", _cb_string_conv, func)
|
||||
|
||||
def callback_done_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("done", _cb_string_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_done_del(self, func):
|
||||
self._callback_del_full("done", _cb_string_conv, func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_fileselector", Fileselector)
|
|
@ -0,0 +1,130 @@
|
|||
# Copyright (c) 2011 Fabiano Fidêncio
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class FileselectorButton(Button):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_fileselector_button_add(parent.obj))
|
||||
|
||||
def window_title_set(self, title):
|
||||
elm_fileselector_button_window_title_set(self.obj, _cfruni(title))
|
||||
|
||||
def window_title_get(self):
|
||||
return _ctouni(elm_fileselector_button_window_title_get(self.obj))
|
||||
|
||||
property window_title:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_fileselector_button_window_title_get(self.obj))
|
||||
|
||||
def __set__(self, title):
|
||||
elm_fileselector_button_window_title_set(self.obj, _cfruni(title))
|
||||
|
||||
def window_size_set(self, width, height):
|
||||
elm_fileselector_button_window_size_set(self.obj, width, height)
|
||||
|
||||
def window_size_get(self):
|
||||
cdef Evas_Coord w, h
|
||||
elm_fileselector_button_window_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property window_size:
|
||||
def __get__(self):
|
||||
cdef Evas_Coord w, h
|
||||
elm_fileselector_button_window_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef Evas_Coord w, h
|
||||
w, h = value
|
||||
elm_fileselector_button_window_size_set(self.obj, w, h)
|
||||
|
||||
def path_set(self, path):
|
||||
elm_fileselector_button_path_set(self.obj, _cfruni(path))
|
||||
|
||||
def path_get(self):
|
||||
return _ctouni(elm_fileselector_button_path_get(self.obj))
|
||||
|
||||
property path:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_fileselector_button_path_get(self.obj))
|
||||
|
||||
def __set__(self, path):
|
||||
elm_fileselector_button_path_set(self.obj, _cfruni(path))
|
||||
|
||||
def expandable_set(self, expand):
|
||||
elm_fileselector_button_expandable_set(self.obj, expand)
|
||||
|
||||
def expandable_get(self):
|
||||
return bool(elm_fileselector_button_expandable_get(self.obj))
|
||||
|
||||
property expandable:
|
||||
def __get__(self):
|
||||
return bool(elm_fileselector_button_expandable_get(self.obj))
|
||||
|
||||
def __set__(self, expand):
|
||||
elm_fileselector_button_expandable_set(self.obj, expand)
|
||||
|
||||
def folder_only_set(self, folder_only):
|
||||
elm_fileselector_button_folder_only_set(self.obj, folder_only)
|
||||
|
||||
def folder_only_get(self):
|
||||
return bool(elm_fileselector_button_folder_only_get(self.obj))
|
||||
|
||||
property folder_only:
|
||||
def __get__(self):
|
||||
return bool(elm_fileselector_button_folder_only_get(self.obj))
|
||||
|
||||
def __set__(self, folder_only):
|
||||
elm_fileselector_button_folder_only_set(self.obj, folder_only)
|
||||
|
||||
def is_save_set(self, is_save):
|
||||
elm_fileselector_button_is_save_set(self.obj, is_save)
|
||||
|
||||
def is_save_get(self):
|
||||
return bool(elm_fileselector_button_is_save_get(self.obj))
|
||||
|
||||
property is_save:
|
||||
def __get__(self):
|
||||
return bool(elm_fileselector_button_is_save_get(self.obj))
|
||||
|
||||
def __set__(self, is_save):
|
||||
elm_fileselector_button_is_save_set(self.obj, is_save)
|
||||
|
||||
def inwin_mode_set(self, inwin_mode):
|
||||
elm_fileselector_button_inwin_mode_set(self.obj, inwin_mode)
|
||||
|
||||
def inwin_mode_get(self):
|
||||
return bool(elm_fileselector_button_inwin_mode_get(self.obj))
|
||||
|
||||
property inwin_mode:
|
||||
def __get__(self):
|
||||
return bool(elm_fileselector_button_inwin_mode_get(self.obj))
|
||||
|
||||
def __set__(self, inwin_mode):
|
||||
elm_fileselector_button_inwin_mode_set(self.obj, inwin_mode)
|
||||
|
||||
def callback_file_chosen_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("file,chosen", _cb_string_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_file_chosen_del(self, func):
|
||||
self._callback_del_full("file,chosen", _cb_string_conv, func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_fileselector_button", FileselectorButton)
|
|
@ -0,0 +1,216 @@
|
|||
# Copyright (c) 2011 Fabiano Fidêncio
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class FileselectorEntry(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_fileselector_entry_add(parent.obj))
|
||||
|
||||
def window_title_set(self, title):
|
||||
elm_fileselector_entry_window_title_set(self.obj, _cfruni(title))
|
||||
|
||||
def window_title_get(self):
|
||||
return _ctouni(elm_fileselector_entry_window_title_get(self.obj))
|
||||
|
||||
property window_title:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_fileselector_entry_window_title_get(self.obj))
|
||||
|
||||
def __set__(self, title):
|
||||
elm_fileselector_entry_window_title_set(self.obj, _cfruni(title))
|
||||
|
||||
def window_size_set(self, width, height):
|
||||
elm_fileselector_entry_window_size_set(self.obj, width, height)
|
||||
|
||||
def window_size_get(self):
|
||||
cdef Evas_Coord w
|
||||
cdef Evas_Coord h
|
||||
elm_fileselector_entry_window_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property window_size:
|
||||
def __get__(self):
|
||||
cdef Evas_Coord w, h
|
||||
elm_fileselector_entry_window_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef Evas_Coord w, h
|
||||
w, h = value
|
||||
elm_fileselector_entry_window_size_set(self.obj, w, h)
|
||||
|
||||
def path_set(self, path):
|
||||
elm_fileselector_entry_path_set(self.obj, _cfruni(path))
|
||||
|
||||
def path_get(self):
|
||||
return _ctouni(elm_fileselector_entry_path_get(self.obj))
|
||||
|
||||
property path:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_fileselector_entry_path_get(self.obj))
|
||||
|
||||
def __set__(self, path):
|
||||
elm_fileselector_entry_path_set(self.obj, _cfruni(path))
|
||||
|
||||
def expandable_set(self, expand):
|
||||
elm_fileselector_entry_expandable_set(self.obj, expand)
|
||||
|
||||
def expandable_get(self):
|
||||
return bool(elm_fileselector_entry_expandable_get(self.obj))
|
||||
|
||||
property expandable:
|
||||
def __get__(self):
|
||||
return bool(elm_fileselector_entry_expandable_get(self.obj))
|
||||
|
||||
def __set__(self, expand):
|
||||
elm_fileselector_entry_expandable_set(self.obj, expand)
|
||||
|
||||
def folder_only_set(self, folder_only):
|
||||
elm_fileselector_entry_folder_only_set(self.obj, folder_only)
|
||||
|
||||
def folder_only_get(self):
|
||||
return bool(elm_fileselector_entry_folder_only_get(self.obj))
|
||||
|
||||
property folder_only:
|
||||
def __get__(self):
|
||||
return bool(elm_fileselector_entry_folder_only_get(self.obj))
|
||||
|
||||
def __set__(self, folder_only):
|
||||
elm_fileselector_entry_folder_only_set(self.obj, folder_only)
|
||||
|
||||
def is_save_set(self, is_save):
|
||||
elm_fileselector_entry_is_save_set(self.obj, is_save)
|
||||
|
||||
def is_save_get(self):
|
||||
return bool(elm_fileselector_entry_is_save_get(self.obj))
|
||||
|
||||
property is_save:
|
||||
def __get__(self):
|
||||
return bool(elm_fileselector_entry_is_save_get(self.obj))
|
||||
|
||||
def __set__(self, is_save):
|
||||
elm_fileselector_entry_is_save_set(self.obj, is_save)
|
||||
|
||||
def inwin_mode_set(self, inwin_mode):
|
||||
elm_fileselector_entry_inwin_mode_set(self.obj, inwin_mode)
|
||||
|
||||
def inwin_mode_get(self):
|
||||
return bool(elm_fileselector_entry_inwin_mode_get(self.obj))
|
||||
|
||||
property inwin_mode:
|
||||
def __get__(self):
|
||||
return bool(elm_fileselector_entry_inwin_mode_get(self.obj))
|
||||
|
||||
def __set__(self, inwin_mode):
|
||||
elm_fileselector_entry_inwin_mode_set(self.obj, inwin_mode)
|
||||
|
||||
def selected_set(self, path):
|
||||
elm_fileselector_entry_selected_set(self.obj, _cfruni(path))
|
||||
|
||||
def selected_get(self):
|
||||
return _ctouni(elm_fileselector_entry_selected_get(self.obj))
|
||||
|
||||
property selected:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_fileselector_entry_selected_get(self.obj))
|
||||
|
||||
def __set__(self, path):
|
||||
elm_fileselector_entry_selected_set(self.obj, _cfruni(path))
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
def callback_activated_add(self, func, *args, **kwargs):
|
||||
self._callback_add("activated", func, *args, **kwargs)
|
||||
|
||||
def callback_activated_del(self, func):
|
||||
self._callback_del("activated", func)
|
||||
|
||||
def callback_press_add(self, func, *args, **kwargs):
|
||||
self._callback_add("press", func, *args, **kwargs)
|
||||
|
||||
def callback_press_del(self, func):
|
||||
self._callback_del("press", func)
|
||||
|
||||
def callback_longpressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("longpressed", func, *args, **kwargs)
|
||||
|
||||
def callback_longpressed_del(self, func):
|
||||
self._callback_del("longpressed", func)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_clicked_double_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked,double", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_double_del(self, func):
|
||||
self._callback_del("clicked,double", func)
|
||||
|
||||
def callback_focused_add(self, func, *args, **kwargs):
|
||||
self._callback_add("focused", func, *args, **kwargs)
|
||||
|
||||
def callback_focused_del(self, func):
|
||||
self._callback_del("focused", func)
|
||||
|
||||
def callback_unfocused_add(self, func, *args, **kwargs):
|
||||
self._callback_add("unfocused", func, *args, **kwargs)
|
||||
|
||||
def callback_unfocused_del(self, func):
|
||||
self._callback_del("unfocused", func)
|
||||
|
||||
def callback_selection_paste_add(self, func, *args, **kwargs):
|
||||
self._callback_add("selection,paste", func, *args, **kwargs)
|
||||
|
||||
def callback_selection_paste_del(self, func):
|
||||
self._callback_del("selection,paste", func)
|
||||
|
||||
def callback_selection_copy_add(self, func, *args, **kwargs):
|
||||
self._callback_add("selection,copy", func, *args, **kwargs)
|
||||
|
||||
def callback_selection_copy_del(self, func):
|
||||
self._callback_del("selection,copy", func)
|
||||
|
||||
def callback_selection_cut_add(self, func, *args, **kwargs):
|
||||
self._callback_add("selection,cut", func, *args, **kwargs)
|
||||
|
||||
def callback_selection_cut_del(self, func):
|
||||
self._callback_del("selection,cut", func)
|
||||
|
||||
def callback_unpressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("unpressed", func, *args, **kwargs)
|
||||
|
||||
def callback_unpressed_del(self, func):
|
||||
self._callback_del("unpressed", func)
|
||||
|
||||
def callback_file_chosen_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("file,chosen", _cb_string_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_file_chosen_del(self, func):
|
||||
self._callback_del_full("file,chosen", _cb_string_conv, func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_fileselector_entry", FileselectorEntry)
|
|
@ -0,0 +1,76 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class Flip(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_flip_add(parent.obj))
|
||||
|
||||
def front_visible_get(self):
|
||||
return elm_flip_front_visible_get(self.obj)
|
||||
|
||||
property front_visible:
|
||||
def __get__(self):
|
||||
return elm_flip_front_visible_get(self.obj)
|
||||
|
||||
def perspective_set(self, foc, x, y):
|
||||
elm_flip_perspective_set(self.obj, foc, x, y)
|
||||
|
||||
def go(self, flip_mode):
|
||||
elm_flip_go(self.obj, flip_mode)
|
||||
|
||||
def interaction_set(self, mode):
|
||||
elm_flip_interaction_set(self.obj, mode)
|
||||
|
||||
def interaction_get(self):
|
||||
return elm_flip_interaction_get(self.obj)
|
||||
|
||||
property interaction:
|
||||
def __get__(self):
|
||||
return elm_flip_interaction_get(self.obj)
|
||||
|
||||
def __set__(self, mode):
|
||||
elm_flip_interaction_set(self.obj, mode)
|
||||
|
||||
def interaction_direction_enabled_set(self, direction, enable):
|
||||
elm_flip_interaction_direction_enabled_set(self.obj, direction, enable)
|
||||
|
||||
def interaction_direction_enabled_get(self, direction):
|
||||
return elm_flip_interaction_direction_enabled_get(self.obj, direction)
|
||||
|
||||
def interaction_direction_hitsize_set(self, direction, hitsize):
|
||||
elm_flip_interaction_direction_hitsize_set(self.obj, direction, hitsize)
|
||||
|
||||
def interaction_direction_hitsize_get(self, direction):
|
||||
return elm_flip_interaction_direction_hitsize_get(self.obj, direction)
|
||||
|
||||
def callback_animate_begin_add(self, func, *args, **kwargs):
|
||||
self._callback_add("animate,begin", func, *args, **kwargs)
|
||||
|
||||
def callback_animate_begin_del(self, func):
|
||||
self._callback_del("animate,begin", func)
|
||||
|
||||
def callback_animate_done_add(self, func, *args, **kwargs):
|
||||
self._callback_add("animate,done", func, *args, **kwargs)
|
||||
|
||||
def callback_animate_done_del(self, func):
|
||||
self._callback_del("animate,done", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_flip", Flip)
|
|
@ -0,0 +1,134 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class FlipSelectorItem(ObjectItem):
|
||||
|
||||
property selected:
|
||||
def __set__(self, selected):
|
||||
elm_flipselector_item_selected_set(self.item, selected)
|
||||
|
||||
def __get__(self):
|
||||
return bool(elm_flipselector_item_selected_get(self.item))
|
||||
|
||||
property prev:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_flipselector_item_prev_get(self.item))
|
||||
|
||||
property next:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_flipselector_item_next_get(self.item))
|
||||
|
||||
|
||||
cdef class FlipSelector(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_flipselector_add(parent.obj))
|
||||
|
||||
def next(self):
|
||||
elm_flipselector_flip_next(self.obj)
|
||||
|
||||
def prev(self):
|
||||
elm_flipselector_flip_prev(self.obj)
|
||||
|
||||
def item_append(self, label = None, callback = None, *args, **kwargs):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
cdef FlipSelectorItem ret = FlipSelectorItem()
|
||||
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
ret.params = (callback, args, kwargs)
|
||||
item = elm_flipselector_item_append(self.obj,
|
||||
_cfruni(label),
|
||||
cb,
|
||||
<void *>self)
|
||||
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return
|
||||
|
||||
def item_prepend(self, label = None, callback = None, *args, **kwargs):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
cdef FlipSelectorItem ret = FlipSelectorItem()
|
||||
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
ret.params = (callback, args, kwargs)
|
||||
item = elm_flipselector_item_append(self.obj,
|
||||
_cfruni(label),
|
||||
cb,
|
||||
<void *>self)
|
||||
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return
|
||||
|
||||
property items:
|
||||
def __get__(self):
|
||||
return tuple(_object_item_list_to_python(elm_flipselector_items_get(self.obj)))
|
||||
|
||||
property first_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_flipselector_first_item_get(self.obj))
|
||||
|
||||
property last_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_flipselector_last_item_get(self.obj))
|
||||
|
||||
property selected_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_flipselector_selected_item_get(self.obj))
|
||||
|
||||
property first_interval:
|
||||
def __set__(self, interval):
|
||||
elm_flipselector_first_interval_set(self.obj, interval)
|
||||
|
||||
def __get__(self):
|
||||
return elm_flipselector_first_interval_get(self.obj)
|
||||
|
||||
def callback_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add("selected", func, *args, **kwargs)
|
||||
|
||||
def callback_selected_del(self, func):
|
||||
self._callback_del("selected", func)
|
||||
|
||||
def callback_overflowed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("overflowed", func, *args, **kwargs)
|
||||
|
||||
def callback_overflowed_del(self, func):
|
||||
self._callback_del("overflowed", func)
|
||||
|
||||
def callback_underflowed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("underflowed", func, *args, **kwargs)
|
||||
|
||||
def callback_underflowed_del(self, func):
|
||||
self._callback_del("underflowed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_flipselector", FlipSelector)
|
|
@ -0,0 +1,61 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Frame(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_frame_add(parent.obj))
|
||||
|
||||
def autocollapse_set(self, autocollapse):
|
||||
elm_frame_autocollapse_set(self.obj, autocollapse)
|
||||
|
||||
def autocollapse_get(self):
|
||||
return elm_frame_autocollapse_get(self.obj)
|
||||
|
||||
property autocollapse:
|
||||
def __get__(self):
|
||||
return elm_frame_autocollapse_get(self.obj)
|
||||
|
||||
def __set__(self, autocollapse):
|
||||
elm_frame_autocollapse_set(self.obj, autocollapse)
|
||||
|
||||
def collapse_set(self, autocollapse):
|
||||
elm_frame_collapse_set(self.obj, autocollapse)
|
||||
|
||||
def collapse_get(self):
|
||||
return elm_frame_collapse_get(self.obj)
|
||||
|
||||
property collapse:
|
||||
def __get__(self):
|
||||
return elm_frame_collapse_get(self.obj)
|
||||
|
||||
def __set__(self, autocollapse):
|
||||
elm_frame_collapse_set(self.obj, autocollapse)
|
||||
|
||||
def collapse_go(self, collapse):
|
||||
elm_frame_collapse_go(self.obj, collapse)
|
||||
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_frame", Frame)
|
|
@ -0,0 +1,811 @@
|
|||
# Copyright (c) 2010 ProFUSION embedded systems
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
||||
cdef _py_elm_gengrid_item_call(func, Evas_Object *obj, part, data) with gil:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
return func(o, _ctouni(part), data)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return None
|
||||
|
||||
cdef char *_py_elm_gengrid_item_text_get(void *data, Evas_Object *obj, const_char_ptr part) with gil:
|
||||
cdef GengridItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef GengridItemClass itc = params[0]
|
||||
|
||||
func = itc._text_get_func
|
||||
if func is None:
|
||||
return NULL
|
||||
|
||||
ret = _py_elm_gengrid_item_call(func, obj, part, params[1])
|
||||
if ret is not None:
|
||||
return strdup(_fruni(ret))
|
||||
else:
|
||||
return NULL
|
||||
|
||||
cdef Evas_Object *_py_elm_gengrid_item_content_get(void *data, Evas_Object *obj, const_char_ptr part) with gil:
|
||||
cdef GengridItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef evasObject icon
|
||||
cdef GengridItemClass itc = params[0]
|
||||
|
||||
func = itc._content_get_func
|
||||
if func is None:
|
||||
return NULL
|
||||
|
||||
ret = _py_elm_gengrid_item_call(func, obj, part, params[1])
|
||||
if ret is not None:
|
||||
try:
|
||||
icon = ret
|
||||
return icon.obj
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return NULL
|
||||
else:
|
||||
return NULL
|
||||
|
||||
cdef Eina_Bool _py_elm_gengrid_item_state_get(void *data, Evas_Object *obj, const_char_ptr part) with gil:
|
||||
cdef GengridItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef GengridItemClass itc = params[0]
|
||||
|
||||
func = itc._state_get_func
|
||||
if func is None:
|
||||
return False
|
||||
|
||||
ret = _py_elm_gengrid_item_call(func, obj, part, params[1])
|
||||
if ret is not None:
|
||||
return bool(ret)
|
||||
else:
|
||||
return False
|
||||
|
||||
cdef void _py_elm_gengrid_object_item_del(void *data, Evas_Object *obj) with gil:
|
||||
cdef GengridItem item = <object>data
|
||||
cdef object params
|
||||
cdef GengridItemClass itc
|
||||
|
||||
if item is None:
|
||||
return
|
||||
|
||||
params = item.params
|
||||
itc = params[0]
|
||||
|
||||
func = itc._del_func
|
||||
if func is not None:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
func(o, params[1])
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
item._unset_obj()
|
||||
Py_DECREF(item)
|
||||
|
||||
cdef void _py_elm_gengrid_item_func(void *data, Evas_Object *obj, void *event_info) with gil:
|
||||
cdef GengridItem item = <object>data
|
||||
cdef object func = item.params[2]
|
||||
|
||||
if func is not None:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
func(item, o, item.params[1])
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef class GengridItemClass:
|
||||
|
||||
cdef Elm_Gengrid_Item_Class obj
|
||||
cdef readonly object _item_style
|
||||
cdef readonly object _text_get_func
|
||||
cdef readonly object _content_get_func
|
||||
cdef readonly object _state_get_func
|
||||
cdef readonly object _del_func
|
||||
|
||||
def __cinit__(self, *a, **ka):
|
||||
self._item_style = "default"
|
||||
self._text_get_func = None
|
||||
self._content_get_func = None
|
||||
self._state_get_func = None
|
||||
self._del_func = None
|
||||
|
||||
self.obj.item_style = NULL
|
||||
self.obj.func.text_get = _py_elm_gengrid_item_text_get
|
||||
self.obj.func.content_get = _py_elm_gengrid_item_content_get
|
||||
self.obj.func.state_get = _py_elm_gengrid_item_state_get
|
||||
self.obj.func.del_ = _py_elm_gengrid_object_item_del
|
||||
|
||||
def __init__(self, item_style=None, text_get_func=None,
|
||||
content_get_func=None, state_get_func=None, del_func=None):
|
||||
if item_style:
|
||||
self._item_style = item_style
|
||||
|
||||
if text_get_func and not callable(text_get_func):
|
||||
raise TypeError("text_get_func is not callable!")
|
||||
elif text_get_func:
|
||||
self._text_get_func = text_get_func
|
||||
else:
|
||||
self._text_get_func = self.text_get
|
||||
|
||||
if content_get_func and not callable(content_get_func):
|
||||
raise TypeError("content_get_func is not callable!")
|
||||
elif content_get_func:
|
||||
self._content_get_func = content_get_func
|
||||
else:
|
||||
self._content_get_func = self.content_get
|
||||
|
||||
if state_get_func and not callable(state_get_func):
|
||||
raise TypeError("state_get_func is not callable!")
|
||||
elif state_get_func:
|
||||
self._state_get_func = state_get_func
|
||||
else:
|
||||
self._state_get_func = self.state_get
|
||||
|
||||
if del_func and not callable(del_func):
|
||||
raise TypeError("del_func is not callable!")
|
||||
elif del_func:
|
||||
self._del_func = del_func
|
||||
else:
|
||||
try:
|
||||
self._del_func = self.delete
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
self.obj.item_style = _cfruni(self._item_style)
|
||||
|
||||
def __str__(self):
|
||||
return ("%s(item_style=%r, text_get_func=%s, content_get_func=%s, "
|
||||
"state_get_func=%s, del_func=%s)") % \
|
||||
(self.__class__.__name__,
|
||||
self._item_style,
|
||||
self._text_get_func,
|
||||
self._content_get_func,
|
||||
self._state_get_func,
|
||||
self._del_func)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Gengrid_Item_Class=%#x, "
|
||||
"item_style=%r, text_get_func=%s, content_get_func=%s, "
|
||||
"state_get_func=%s, del_func=%s)") % \
|
||||
(self.__class__.__name__,
|
||||
<unsigned long><void *>self,
|
||||
PY_REFCOUNT(self),
|
||||
<unsigned long>&self.obj,
|
||||
self._item_style,
|
||||
self._text_get_func,
|
||||
self._content_get_func,
|
||||
self._state_get_func,
|
||||
self._del_func)
|
||||
|
||||
property item_style:
|
||||
def __get__(self):
|
||||
return self._item_style
|
||||
|
||||
def text_get(self, evasObject obj, part, item_data):
|
||||
return None
|
||||
|
||||
def content_get(self, evasObject obj, part, item_data):
|
||||
return None
|
||||
|
||||
def state_get(self, evasObject obj, part, item_data):
|
||||
return False
|
||||
|
||||
|
||||
cdef class GengridItem(ObjectItem):
|
||||
|
||||
cdef int _set_obj(self, Elm_Object_Item *item) except 0:
|
||||
assert self.item == NULL, "Object must be clean"
|
||||
self.item = item
|
||||
Py_INCREF(self)
|
||||
return 1
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
assert self.item != NULL, "Object must wrap something"
|
||||
self.item = NULL
|
||||
|
||||
def __str__(self):
|
||||
return "%s(item_class=%s, func=%s, item_data=%s)" % \
|
||||
(self.__class__.__name__,
|
||||
self.params[0].__class__.__name__,
|
||||
self.params[2],
|
||||
self.params[1])
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
"item_class=%s, func=%s, item_data=%r)") % \
|
||||
(self.__class__.__name__,
|
||||
<unsigned long><void*>self,
|
||||
PY_REFCOUNT(self),
|
||||
<unsigned long>self.item,
|
||||
self.params[0].__class__.__name__,
|
||||
self.params[2],
|
||||
self.params[1])
|
||||
|
||||
def data_get(self):
|
||||
(item_class, item_data, func) = self.params
|
||||
return item_data
|
||||
|
||||
property data:
|
||||
def __get__(self):
|
||||
return self.data_get()
|
||||
|
||||
def next_get(self):
|
||||
return _object_item_to_python(elm_gengrid_item_next_get(self.item))
|
||||
|
||||
property next:
|
||||
def __get__(self):
|
||||
return self.next_get()
|
||||
|
||||
def prev_get(self):
|
||||
return _object_item_to_python(elm_gengrid_item_prev_get(self.item))
|
||||
|
||||
property prev:
|
||||
def __get__(self):
|
||||
return self.prev_get()
|
||||
|
||||
def gengrid_get(self):
|
||||
return object_from_instance(elm_object_item_widget_get(self.item))
|
||||
|
||||
property gengrid:
|
||||
def __get__(self):
|
||||
return self.gengrid_get()
|
||||
|
||||
def index_get(self):
|
||||
return elm_gengrid_item_index_get(self.item)
|
||||
|
||||
property index:
|
||||
def __get__(self):
|
||||
return self.index_get()
|
||||
|
||||
def delete(self):
|
||||
elm_object_item_del(self.item)
|
||||
|
||||
def update(self):
|
||||
elm_gengrid_item_update(self.item)
|
||||
|
||||
def selected_set(self, selected):
|
||||
elm_gengrid_item_selected_set(self.item, bool(selected))
|
||||
|
||||
def selected_get(self):
|
||||
return bool(elm_gengrid_item_selected_get(self.item))
|
||||
|
||||
property selected:
|
||||
def __get__(self):
|
||||
return self.selected_get()
|
||||
|
||||
def __set__(self, selected):
|
||||
self.selected_set(selected)
|
||||
|
||||
def show(self, scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN):
|
||||
elm_gengrid_item_show(self.item, scrollto_type)
|
||||
|
||||
def bring_in(self, scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN):
|
||||
elm_gengrid_item_bring_in(self.item, scrollto_type)
|
||||
|
||||
def pos_get(self):
|
||||
cdef unsigned int x, y
|
||||
elm_gengrid_item_pos_get(self.item, &x, &y)
|
||||
return (x, y)
|
||||
|
||||
# XXX TODO elm_gengrid_item_item_class_update
|
||||
|
||||
# XXX TODO elm_gengrid_item_item_class_get
|
||||
|
||||
def tooltip_text_set(self, text):
|
||||
elm_gengrid_item_tooltip_text_set(self.item, _cfruni(text))
|
||||
|
||||
property tooltip_text:
|
||||
def __get__(self):
|
||||
return self.tooltip_text_get()
|
||||
|
||||
def tooltip_content_cb_set(self, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
|
||||
cdef void *cbdata
|
||||
|
||||
data = (func, self, args, kargs)
|
||||
Py_INCREF(data)
|
||||
cbdata = <void *>data
|
||||
elm_gengrid_item_tooltip_content_cb_set(self.item,
|
||||
_tooltip_item_content_create,
|
||||
cbdata,
|
||||
_tooltip_item_data_del_cb)
|
||||
|
||||
def item_tooltip_unset(self):
|
||||
elm_gengrid_item_tooltip_unset(self.item)
|
||||
|
||||
def tooltip_style_set(self, style=None):
|
||||
if style:
|
||||
elm_gengrid_item_tooltip_style_set(self.item, _cfruni(style))
|
||||
else:
|
||||
elm_gengrid_item_tooltip_style_set(self.item, NULL)
|
||||
|
||||
def tooltip_style_get(self):
|
||||
return _ctouni(elm_gengrid_item_tooltip_style_get(self.item))
|
||||
|
||||
property tooltip_style:
|
||||
def __get__(self):
|
||||
return self.tooltip_style_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.tooltip_style_set(value)
|
||||
|
||||
def tooltip_window_mode_set(self, disable):
|
||||
elm_gengrid_item_tooltip_window_mode_set(self.item, bool(disable))
|
||||
|
||||
def tooltip_window_mode_get(self):
|
||||
return bool(elm_gengrid_item_tooltip_window_mode_get(self.item))
|
||||
|
||||
property tooltip_window_mode:
|
||||
def __get__(self):
|
||||
return self.tooltip_window_mode_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.tooltip_window_mode_set(value)
|
||||
|
||||
def cursor_set(self, char *cursor):
|
||||
elm_gengrid_item_cursor_set(self.item, _cfruni(cursor))
|
||||
|
||||
def cursor_get(self):
|
||||
return _ctouni(elm_gengrid_item_cursor_get(self.item))
|
||||
|
||||
property cursor:
|
||||
def __get__(self):
|
||||
return self.cursor_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.cursor_set(value)
|
||||
|
||||
def cursor_unset(self):
|
||||
elm_gengrid_item_cursor_unset(self.item)
|
||||
|
||||
def cursor_style_set(self, style=None):
|
||||
if style:
|
||||
elm_gengrid_item_cursor_style_set(self.item, _cfruni(style))
|
||||
else:
|
||||
elm_gengrid_item_cursor_style_set(self.item, NULL)
|
||||
|
||||
def cursor_style_get(self):
|
||||
return _ctouni(elm_gengrid_item_cursor_style_get(self.item))
|
||||
|
||||
property cursor_style:
|
||||
def __get__(self):
|
||||
return self.cursor_style_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.cursor_style_set(value)
|
||||
|
||||
def cursor_engine_only_set(self, engine_only):
|
||||
elm_gengrid_item_cursor_engine_only_set(self.item, bool(engine_only))
|
||||
|
||||
def cursor_engine_only_get(self):
|
||||
return elm_gengrid_item_cursor_engine_only_get(self.item)
|
||||
|
||||
property cursor_engine_only:
|
||||
def __get__(self):
|
||||
return self.cursor_engine_only_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.cursor_engine_only_set(value)
|
||||
|
||||
def select_mode_set(self, mode):
|
||||
elm_gengrid_item_select_mode_set(self.item, mode)
|
||||
|
||||
def select_mode_get(self):
|
||||
return elm_gengrid_item_select_mode_get(self.item)
|
||||
|
||||
property select_mode:
|
||||
def __get__(self):
|
||||
return self.select_mode_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.select_mode_set(value)
|
||||
|
||||
|
||||
cdef class Gengrid(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_gengrid_add(parent.obj))
|
||||
|
||||
def clear(self):
|
||||
elm_gengrid_clear(self.obj)
|
||||
|
||||
def multi_select_set(self, multi):
|
||||
elm_gengrid_multi_select_set(self.obj, bool(multi))
|
||||
|
||||
def multi_select_get(self):
|
||||
return bool(elm_gengrid_multi_select_get(self.obj))
|
||||
|
||||
property multi_select:
|
||||
def __get__(self):
|
||||
return self.multi_select_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.multi_select_set(value)
|
||||
|
||||
def horizontal_set(self, setting):
|
||||
elm_gengrid_horizontal_set(self.obj, bool(setting))
|
||||
|
||||
def horizontal_get(self):
|
||||
return bool(elm_gengrid_horizontal_get(self.obj))
|
||||
|
||||
property horizontal:
|
||||
def __get__(self):
|
||||
return self.horizontal_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.horizontal_set(value)
|
||||
|
||||
def bounce_set(self, h_bounce, v_bounce):
|
||||
elm_scroller_bounce_set(self.obj, bool(h_bounce), bool(v_bounce))
|
||||
|
||||
def bounce_get(self):
|
||||
cdef Eina_Bool h_bounce, v_bounce
|
||||
elm_scroller_bounce_get(self.obj, &h_bounce, &v_bounce)
|
||||
return (h_bounce, v_bounce)
|
||||
|
||||
property bounce:
|
||||
def __get__(self):
|
||||
return self.bouce_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.bouce_set(*value)
|
||||
|
||||
def item_append(self, GengridItemClass item_class not None,
|
||||
item_data, func=None):
|
||||
cdef GengridItem ret = GengridItem()
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_gengrid_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_gengrid_item_append( self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
cb,
|
||||
<void*>ret)
|
||||
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
|
||||
def item_prepend(self, GengridItemClass item_class not None,
|
||||
item_data, func=None):
|
||||
cdef GengridItem ret = GengridItem()
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_gengrid_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_gengrid_item_prepend(self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
cb,
|
||||
<void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
|
||||
def item_insert_before(self, GengridItemClass item_class not None,
|
||||
item_data, GengridItem before_item=None,
|
||||
func=None):
|
||||
cdef GengridItem ret = GengridItem()
|
||||
cdef Elm_Object_Item *item, *before
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
before = _object_item_from_python(before_item)
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_gengrid_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
(item_class, item_data, func)
|
||||
item = elm_gengrid_item_insert_before( self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
before,
|
||||
cb,
|
||||
<void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
|
||||
def item_insert_after(self, GengridItemClass item_class not None,
|
||||
item_data, GengridItem after_item=None,
|
||||
func=None):
|
||||
cdef GengridItem ret = GengridItem()
|
||||
cdef Elm_Object_Item *item, *after
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
after = _object_item_from_python(after_item)
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_gengrid_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_gengrid_item_insert_after( self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
after,
|
||||
cb,
|
||||
<void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
|
||||
# XXX TODO elm_gengrid_item_sorted_insert()
|
||||
|
||||
def selected_item_get(self):
|
||||
return _object_item_to_python(elm_gengrid_selected_item_get(self.obj))
|
||||
|
||||
property selected_item:
|
||||
def __get__(self):
|
||||
return self.selected_item_get()
|
||||
|
||||
def selected_items_get(self):
|
||||
return _object_item_list_to_python(elm_gengrid_selected_items_get(self.obj))
|
||||
|
||||
property selected_items:
|
||||
def __get__(self):
|
||||
return self.selected_items_get()
|
||||
|
||||
def realized_items_get(self):
|
||||
return _object_item_list_to_python(elm_gengrid_realized_items_get(self.obj))
|
||||
|
||||
property realized_items:
|
||||
def __get__(self):
|
||||
return self.realized_items_get()
|
||||
|
||||
def realized_items_update(self):
|
||||
elm_gengrid_realized_items_update(self.obj)
|
||||
|
||||
def first_item_get(self):
|
||||
return _object_item_to_python(elm_gengrid_first_item_get(self.obj))
|
||||
|
||||
property first_item:
|
||||
def __get__(self):
|
||||
return self.first_item_get()
|
||||
|
||||
def last_item_get(self):
|
||||
return _object_item_to_python(elm_gengrid_last_item_get(self.obj))
|
||||
|
||||
property last_item:
|
||||
def __get__(self):
|
||||
return self.last_item_get()
|
||||
|
||||
def scroller_policy_set(self, policy_h, policy_v):
|
||||
elm_scroller_policy_set(self.obj, policy_h, policy_v)
|
||||
|
||||
def scroller_policy_get(self):
|
||||
cdef Elm_Scroller_Policy policy_h, policy_v
|
||||
elm_scroller_policy_get(self.obj, &policy_h, &policy_v)
|
||||
return (policy_h, policy_v)
|
||||
|
||||
property scroller_policy:
|
||||
def __get__(self):
|
||||
return self.scroller_policy_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.scroller_policy_set(*value)
|
||||
|
||||
def item_size_set(self, w, h):
|
||||
elm_gengrid_item_size_set(self.obj, w, h)
|
||||
|
||||
def item_size_get(self):
|
||||
cdef Evas_Coord x, y
|
||||
elm_gengrid_item_size_get(self.obj, &x, &y)
|
||||
return (x, y)
|
||||
|
||||
def items_count(self):
|
||||
return elm_gengrid_items_count(self.obj)
|
||||
|
||||
property item_size:
|
||||
def __get__(self):
|
||||
return self.item_size_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.item_size_set(value)
|
||||
|
||||
def group_item_size_set(self, w, h):
|
||||
elm_gengrid_group_item_size_set(self.obj, w, h)
|
||||
|
||||
def group_item_size_get(self):
|
||||
cdef Evas_Coord w, h
|
||||
elm_gengrid_group_item_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property group_item_size:
|
||||
def __get__(self):
|
||||
return self.group_item_size_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.group_item_size_set(*value)
|
||||
|
||||
def align_set(self, align_x, align_y):
|
||||
elm_gengrid_align_set(self.obj, align_x, align_y)
|
||||
|
||||
def align_get(self):
|
||||
cdef double align_x, align_y
|
||||
elm_gengrid_align_get(self.obj, &align_x, &align_y)
|
||||
return (align_x, align_y)
|
||||
|
||||
property align:
|
||||
def __get__(self):
|
||||
return self.align_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.align_set(*value)
|
||||
|
||||
def reorder_mode_set(self, mode):
|
||||
elm_gengrid_reorder_mode_set(self.obj, bool(mode))
|
||||
|
||||
def reorder_mode_get(self, mode):
|
||||
return bool(elm_gengrid_reorder_mode_get(self.obj))
|
||||
|
||||
property reorder_mode:
|
||||
def __get__(self):
|
||||
return self.reorder_mode_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.reorder_mode_set(value)
|
||||
|
||||
def page_relative_set(self, h_pagerel, v_pagerel):
|
||||
elm_scroller_page_relative_set(self.obj, h_pagerel, v_pagerel)
|
||||
|
||||
def page_relative_get(self):
|
||||
cdef double h_pagerel, v_pagerel
|
||||
elm_scroller_page_relative_get(self.obj, &h_pagerel, &v_pagerel)
|
||||
return (h_pagerel, v_pagerel)
|
||||
|
||||
property page_relative:
|
||||
def __get__(self):
|
||||
return self.page_relative_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.page_relative_set(*value)
|
||||
|
||||
def page_size_set(self, h_pagesize, v_pagesize):
|
||||
elm_scroller_page_size_set(self.obj, h_pagesize, v_pagesize)
|
||||
|
||||
def current_page_get(self):
|
||||
cdef int h_pagenum, v_pagenum
|
||||
elm_scroller_current_page_get(self.obj, &h_pagenum, &v_pagenum)
|
||||
return (h_pagenum, v_pagenum)
|
||||
|
||||
property current_page:
|
||||
def __get__(self):
|
||||
return self.current_page_get()
|
||||
|
||||
def last_page_get(self):
|
||||
cdef int h_pagenum, v_pagenum
|
||||
elm_scroller_last_page_get(self.obj, &h_pagenum, &v_pagenum)
|
||||
return (h_pagenum, v_pagenum)
|
||||
|
||||
property last_page:
|
||||
def __get__(self):
|
||||
return self.last_page_get()
|
||||
|
||||
def page_show(self, h_pagenum, v_pagenum):
|
||||
elm_gengrid_page_show(self.obj, h_pagenum, v_pagenum)
|
||||
|
||||
def page_bring_in(self, h_pagenum, v_pagenum):
|
||||
elm_scroller_page_bring_in(self.obj, h_pagenum, v_pagenum)
|
||||
|
||||
def filled_set(self, fill):
|
||||
elm_gengrid_filled_set(self.obj, bool(fill))
|
||||
|
||||
def filled_get(self, fill):
|
||||
return bool(elm_gengrid_filled_get(self.obj))
|
||||
|
||||
property filled:
|
||||
def __get__(self):
|
||||
return self.filled_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.filled_set(value)
|
||||
|
||||
def select_mode_set(self, mode):
|
||||
elm_gengrid_select_mode_set(self.obj, mode)
|
||||
|
||||
def select_mode_get(self):
|
||||
return elm_gengrid_select_mode_get(self.obj)
|
||||
|
||||
property select_mode:
|
||||
def __get__(self):
|
||||
return self.select_mode_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.select_mode_set(value)
|
||||
|
||||
def highlight_mode_set(self, highlight):
|
||||
elm_gengrid_highlight_mode_set(self.obj, bool(highlight))
|
||||
|
||||
def highlight_mode_get(self, fill):
|
||||
return bool(elm_gengrid_highlight_mode_get(self.obj))
|
||||
|
||||
property highlight_mode:
|
||||
def __get__(self):
|
||||
return self.highlight_mode_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.highlight_mode_set(value)
|
||||
|
||||
def callback_clicked_double_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("clicked,double", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_double_del(self, func):
|
||||
self._callback_del_full("clicked,double", _cb_object_item_conv, func)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("clicked", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del_full("clicked", _cb_object_item_conv, func)
|
||||
|
||||
def callback_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("selected", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_selected_del(self, func):
|
||||
self._callback_del_full("selected", _cb_object_item_conv, func)
|
||||
|
||||
def callback_unselected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("unselected", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_unselected_del(self, func):
|
||||
self._callback_del_full("unselected", _cb_object_item_conv, func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_gengrid", Gengrid)
|
|
@ -0,0 +1,923 @@
|
|||
# Copyright (c) 2010 ProFUSION embedded systems
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
||||
|
||||
cdef _py_elm_genlist_item_call(func, Evas_Object *obj, part, data) with gil:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
return func(o, _ctouni(part), data)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return None
|
||||
|
||||
cdef char *_py_elm_genlist_item_text_get(void *data, Evas_Object *obj, const_char_ptr part) with gil:
|
||||
cdef GenlistItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef GenlistItemClass itc = params[0]
|
||||
|
||||
func = itc._text_get_func
|
||||
if func is None:
|
||||
return NULL
|
||||
|
||||
ret = _py_elm_genlist_item_call(func, obj, part, params[1])
|
||||
if ret is not None:
|
||||
return strdup(_fruni(ret))
|
||||
else:
|
||||
return NULL
|
||||
|
||||
cdef Evas_Object *_py_elm_genlist_item_content_get(void *data, Evas_Object *obj, const_char_ptr part) with gil:
|
||||
cdef GenlistItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef evasObject icon
|
||||
cdef GenlistItemClass itc = params[0]
|
||||
|
||||
func = itc._content_get_func
|
||||
if func is None:
|
||||
return NULL
|
||||
|
||||
ret = _py_elm_genlist_item_call(func, obj, part, params[1])
|
||||
if ret is not None:
|
||||
try:
|
||||
icon = ret
|
||||
return icon.obj
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return NULL
|
||||
else:
|
||||
return NULL
|
||||
|
||||
cdef Eina_Bool _py_elm_genlist_item_state_get(void *data, Evas_Object *obj, const_char_ptr part) with gil:
|
||||
cdef GenlistItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef GenlistItemClass itc = params[0]
|
||||
|
||||
func = itc._state_get_func
|
||||
if func is None:
|
||||
return False
|
||||
|
||||
ret = _py_elm_genlist_item_call(func, obj, part, params[1])
|
||||
if ret is not None:
|
||||
return bool(ret)
|
||||
else:
|
||||
return False
|
||||
|
||||
cdef void _py_elm_genlist_object_item_del(void *data, Evas_Object *obj) with gil:
|
||||
cdef GenlistItem item = <object>data
|
||||
cdef object params
|
||||
cdef GenlistItemClass itc
|
||||
|
||||
if item is None:
|
||||
return
|
||||
|
||||
params = item.params
|
||||
itc = params[0]
|
||||
|
||||
func = itc._del_func
|
||||
if func is not None:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
func(o, params[1])
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
item._unset_obj()
|
||||
Py_DECREF(item)
|
||||
|
||||
cdef void _py_elm_genlist_item_func(void *data, Evas_Object *obj, void *event_info) with gil:
|
||||
cdef GenlistItem item = <object>data
|
||||
cdef object func = item.params[2]
|
||||
|
||||
if func is not None:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
func(item, o, item.params[1])
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef class GenlistItemClass:
|
||||
cdef Elm_Genlist_Item_Class obj
|
||||
cdef readonly object _item_style
|
||||
cdef readonly object _text_get_func
|
||||
cdef readonly object _content_get_func
|
||||
cdef readonly object _state_get_func
|
||||
cdef readonly object _del_func
|
||||
|
||||
def __cinit__(self, *a, **ka):
|
||||
self._item_style = "default"
|
||||
self._text_get_func = None
|
||||
self._content_get_func = None
|
||||
self._state_get_func = None
|
||||
self._del_func = None
|
||||
|
||||
self.obj.item_style = NULL
|
||||
self.obj.func.text_get = _py_elm_genlist_item_text_get
|
||||
self.obj.func.content_get = _py_elm_genlist_item_content_get
|
||||
self.obj.func.state_get = _py_elm_genlist_item_state_get
|
||||
self.obj.func.del_ = _py_elm_genlist_object_item_del
|
||||
|
||||
def __init__(self, item_style=None, text_get_func=None,
|
||||
content_get_func=None, state_get_func=None, del_func=None):
|
||||
if item_style:
|
||||
self._item_style = item_style
|
||||
|
||||
if text_get_func and not callable(text_get_func):
|
||||
raise TypeError("text_get_func is not callable!")
|
||||
elif text_get_func:
|
||||
self._text_get_func = text_get_func
|
||||
else:
|
||||
self._text_get_func = self.text_get
|
||||
|
||||
if content_get_func and not callable(content_get_func):
|
||||
raise TypeError("content_get_func is not callable!")
|
||||
elif content_get_func:
|
||||
self._content_get_func = content_get_func
|
||||
else:
|
||||
self._content_get_func = self.content_get
|
||||
|
||||
if state_get_func and not callable(state_get_func):
|
||||
raise TypeError("state_get_func is not callable!")
|
||||
elif state_get_func:
|
||||
self._state_get_func = state_get_func
|
||||
else:
|
||||
self._state_get_func = self.state_get
|
||||
|
||||
if del_func and not callable(del_func):
|
||||
raise TypeError("del_func is not callable!")
|
||||
elif del_func:
|
||||
self._del_func = del_func
|
||||
else:
|
||||
try:
|
||||
self._del_func = self.delete
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
self.obj.item_style = _fruni(self._item_style)
|
||||
|
||||
def __str__(self):
|
||||
return ("%s(item_style=%r, text_get_func=%s, content_get_func=%s, "
|
||||
"state_get_func=%s, del_func=%s)") % \
|
||||
(self.__class__.__name__,
|
||||
self._item_style,
|
||||
self._text_get_func,
|
||||
self._content_get_func,
|
||||
self._state_get_func,
|
||||
self._del_func)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Genlist_Item_Class=%#x, "
|
||||
"item_style=%r, text_get_func=%s, content_get_func=%s, "
|
||||
"state_get_func=%s, del_func=%s)") % \
|
||||
(self.__class__.__name__,
|
||||
<unsigned long><void *>self,
|
||||
PY_REFCOUNT(self),
|
||||
<unsigned long>&self.obj,
|
||||
self._item_style,
|
||||
self._text_get_func,
|
||||
self._content_get_func,
|
||||
self._state_get_func,
|
||||
self._del_func)
|
||||
|
||||
property item_style:
|
||||
def __get__(self):
|
||||
return self._item_style
|
||||
|
||||
def text_get(self, evasObject obj, part, item_data):
|
||||
return None
|
||||
|
||||
def content_get(self, evasObject obj, part, item_data):
|
||||
return None
|
||||
|
||||
def state_get(self, evasObject obj, part, item_data):
|
||||
return False
|
||||
|
||||
|
||||
cdef class GenlistItem(ObjectItem):
|
||||
|
||||
cdef int _set_obj(self, Elm_Object_Item *item, params=None) except 0:
|
||||
assert self.item == NULL, "Object must be clean"
|
||||
self.item = item
|
||||
Py_INCREF(self)
|
||||
return 1
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
assert self.item != NULL, "Object must wrap something"
|
||||
self.item = NULL
|
||||
|
||||
def __str__(self):
|
||||
return "%s(item_class=%s, func=%s, item_data=%s)" % \
|
||||
(self.__class__.__name__,
|
||||
self.params[0].__class__.__name__,
|
||||
self.params[2],
|
||||
self.params[1])
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
"item_class=%s, func=%s, item_data=%r)") % \
|
||||
(self.__class__.__name__,
|
||||
<unsigned long><void*>self,
|
||||
PY_REFCOUNT(self),
|
||||
<unsigned long>self.item,
|
||||
self.params[0].__class__.__name__,
|
||||
self.params[2],
|
||||
self.params[1])
|
||||
|
||||
def data_get(self):
|
||||
return self.params[1]
|
||||
|
||||
property data:
|
||||
def __get__(self):
|
||||
return self.data_get()
|
||||
|
||||
def next_get(self):
|
||||
return _object_item_to_python(elm_genlist_item_next_get(self.item))
|
||||
|
||||
property next:
|
||||
def __get__(self):
|
||||
return self.next_get()
|
||||
|
||||
def prev_get(self):
|
||||
return _object_item_to_python(elm_genlist_item_prev_get(self.item))
|
||||
|
||||
property prev:
|
||||
def __get__(self):
|
||||
return self.prev_get()
|
||||
|
||||
def selected_set(self, selected):
|
||||
elm_genlist_item_selected_set(self.item, bool(selected))
|
||||
|
||||
def selected_get(self):
|
||||
return bool(elm_genlist_item_selected_get(self.item))
|
||||
|
||||
property selected:
|
||||
def __get__(self):
|
||||
return self.selected_get()
|
||||
|
||||
def __set__(self, selected):
|
||||
self.selected_set(selected)
|
||||
|
||||
def show(self, scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN):
|
||||
elm_genlist_item_show(self.item, scrollto_type)
|
||||
|
||||
def bring_in(self, scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN):
|
||||
elm_genlist_item_bring_in(self.item, scrollto_type)
|
||||
|
||||
def update(self):
|
||||
elm_genlist_item_update(self.item)
|
||||
|
||||
#def item_class_update(self, Elm_Genlist_Item_Class itc):
|
||||
#elm_genlist_item_item_class_update(self.item, itc)
|
||||
|
||||
#def item_class_get(self):
|
||||
#return elm_genlist_item_item_class_get(self.item)
|
||||
|
||||
def index_get(self):
|
||||
return elm_genlist_item_index_get(self.item)
|
||||
|
||||
def tooltip_text_set(self, char *text):
|
||||
elm_genlist_item_tooltip_text_set(self.item, _cfruni(text))
|
||||
|
||||
def tooltip_content_cb_set(self, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
|
||||
cdef void *cbdata
|
||||
|
||||
data = (func, self, args, kargs)
|
||||
Py_INCREF(data)
|
||||
cbdata = <void *>data
|
||||
elm_genlist_item_tooltip_content_cb_set(self.item,
|
||||
_tooltip_item_content_create,
|
||||
cbdata,
|
||||
_tooltip_item_data_del_cb)
|
||||
|
||||
def tooltip_unset(self):
|
||||
elm_genlist_item_tooltip_unset(self.item)
|
||||
|
||||
def tooltip_style_set(self, style=None):
|
||||
if style:
|
||||
elm_genlist_item_tooltip_style_set(self.item, _cfruni(style))
|
||||
else:
|
||||
elm_genlist_item_tooltip_style_set(self.item, NULL)
|
||||
|
||||
def tooltip_style_get(self):
|
||||
return _ctouni(elm_genlist_item_tooltip_style_get(self.item))
|
||||
|
||||
def tooltip_window_mode_set(self, disable):
|
||||
return bool(elm_genlist_item_tooltip_window_mode_set(self.item, disable))
|
||||
|
||||
def tooltip_window_mode_get(self):
|
||||
return bool(elm_genlist_item_tooltip_window_mode_get(self.item))
|
||||
|
||||
def cursor_set(self, cursor):
|
||||
elm_genlist_item_cursor_set(self.item, _cfruni(cursor))
|
||||
|
||||
def cursor_get(self):
|
||||
return _ctouni(elm_genlist_item_cursor_get(self.item))
|
||||
|
||||
def cursor_unset(self):
|
||||
elm_genlist_item_cursor_unset(self.item)
|
||||
|
||||
def cursor_style_set(self, style=None):
|
||||
if style:
|
||||
elm_genlist_item_cursor_style_set(self.item, _cfruni(style))
|
||||
else:
|
||||
elm_genlist_item_cursor_style_set(self.item, NULL)
|
||||
|
||||
def cursor_style_get(self):
|
||||
return _ctouni(elm_genlist_item_cursor_style_get(self.item))
|
||||
|
||||
def cursor_engine_only_set(self, engine_only):
|
||||
elm_genlist_item_cursor_engine_only_set(self.item, bool(engine_only))
|
||||
|
||||
def cursor_engine_only_get(self):
|
||||
return elm_genlist_item_cursor_engine_only_get(self.item)
|
||||
|
||||
def parent_get(self):
|
||||
return _object_item_to_python(elm_genlist_item_parent_get(self.item))
|
||||
|
||||
property parent:
|
||||
def __get__(self):
|
||||
return self.parent_get()
|
||||
|
||||
def subitems_clear(self):
|
||||
elm_genlist_item_subitems_clear(self.item)
|
||||
|
||||
def expanded_set(self, expanded):
|
||||
elm_genlist_item_expanded_set(self.item, bool(expanded))
|
||||
|
||||
def expanded_get(self, ):
|
||||
return bool(elm_genlist_item_expanded_get(self.item))
|
||||
|
||||
property expanded:
|
||||
def __get__(self):
|
||||
return self.expanded_get()
|
||||
|
||||
def __set__(self, expanded):
|
||||
self.expanded_set(expanded)
|
||||
|
||||
def expanded_depth_get(self):
|
||||
return elm_genlist_item_expanded_depth_get(self.item)
|
||||
|
||||
def all_contents_unset(self):
|
||||
cdef Eina_List *lst
|
||||
elm_genlist_item_all_contents_unset(self.item, &lst)
|
||||
return _object_item_list_to_python(lst)
|
||||
|
||||
def promote(self):
|
||||
elm_genlist_item_promote(self.item)
|
||||
|
||||
def demote(self):
|
||||
elm_genlist_item_demote(self.item)
|
||||
|
||||
def fields_update(self, parts, itf):
|
||||
elm_genlist_item_fields_update(self.item, _cfruni(parts), itf)
|
||||
|
||||
def decorate_mode_set(self, decorate_it_type, decorate_it_set):
|
||||
elm_genlist_item_decorate_mode_set(self.item, _cfruni(decorate_it_type), decorate_it_set)
|
||||
|
||||
def decorate_mode_get(self):
|
||||
return _ctouni(elm_genlist_item_decorate_mode_get(self.item))
|
||||
|
||||
def type_get(self):
|
||||
cdef Elm_Genlist_Item_Type ittype = elm_genlist_item_type_get(self.item)
|
||||
return <Elm_Genlist_Item_Type>ittype
|
||||
|
||||
def flip_set(self, flip):
|
||||
elm_genlist_item_flip_set(self.item, flip)
|
||||
|
||||
def flip_get(self):
|
||||
return bool(elm_genlist_item_flip_get(self.item))
|
||||
|
||||
def select_mode_set(self, mode):
|
||||
elm_genlist_item_select_mode_set(self.item, mode)
|
||||
|
||||
def select_mode_get(self):
|
||||
return elm_genlist_item_select_mode_get(self.item)
|
||||
|
||||
|
||||
cdef class Genlist(Object):
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_genlist_add(parent.obj))
|
||||
|
||||
def clear(self):
|
||||
elm_genlist_clear(self.obj)
|
||||
|
||||
def multi_select_set(self, multi):
|
||||
elm_genlist_multi_select_set(self.obj, bool(multi))
|
||||
|
||||
def multi_select_get(self):
|
||||
return bool(elm_genlist_multi_select_get(self.obj))
|
||||
|
||||
def mode_set(self, mode = ELM_LIST_COMPRESS):
|
||||
elm_genlist_mode_set(self.obj, mode)
|
||||
|
||||
def mode_get(self):
|
||||
return elm_genlist_mode_get(self.obj)
|
||||
|
||||
def bounce_set(self, h_bounce, v_bounce):
|
||||
elm_scroller_bounce_set(self.obj, bool(h_bounce), bool(v_bounce))
|
||||
|
||||
def bounce_get(self):
|
||||
cdef Eina_Bool h_bounce, v_bounce
|
||||
elm_scroller_bounce_get(self.obj, &h_bounce, &v_bounce)
|
||||
return (h_bounce, v_bounce)
|
||||
|
||||
def item_append(self,
|
||||
GenlistItemClass item_class not None,
|
||||
item_data,
|
||||
GenlistItem parent_item=None,
|
||||
int flags=ELM_GENLIST_ITEM_NONE,
|
||||
func=None):
|
||||
cdef GenlistItem ret = GenlistItem()
|
||||
cdef Elm_Object_Item *item, *parent
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
parent = _object_item_from_python(parent_item) if parent_item is not None else NULL
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_genlist_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_genlist_item_append( self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
parent,
|
||||
<Elm_Genlist_Item_Type>flags,
|
||||
cb,
|
||||
<void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
|
||||
def item_prepend( self,
|
||||
GenlistItemClass item_class not None,
|
||||
item_data,
|
||||
GenlistItem parent_item=None,
|
||||
int flags=ELM_GENLIST_ITEM_NONE,
|
||||
func=None):
|
||||
cdef GenlistItem ret = GenlistItem()
|
||||
cdef Elm_Object_Item *item, *parent
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
parent = _object_item_from_python(parent_item) if parent_item is not None else NULL
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_genlist_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_genlist_item_prepend(self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
parent,
|
||||
<Elm_Genlist_Item_Type>flags,
|
||||
cb,
|
||||
<void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
|
||||
def item_insert_before( self,
|
||||
GenlistItemClass item_class not None,
|
||||
item_data,
|
||||
#API XXX: parent
|
||||
GenlistItem before_item=None,
|
||||
int flags=ELM_GENLIST_ITEM_NONE,
|
||||
func=None
|
||||
#API XXX: *args, **kwargs
|
||||
):
|
||||
cdef GenlistItem ret = GenlistItem()
|
||||
cdef Elm_Object_Item *item, *before
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
before = _object_item_from_python(before_item)
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_genlist_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_genlist_item_insert_before( self.obj,
|
||||
&item_class.obj,
|
||||
<void*>ret,
|
||||
NULL,
|
||||
before,
|
||||
<Elm_Genlist_Item_Type>flags, cb,
|
||||
<void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
|
||||
def item_insert_after( self,
|
||||
GenlistItemClass item_class not None,
|
||||
item_data,
|
||||
#API XXX: parent
|
||||
GenlistItem after_item=None,
|
||||
int flags=ELM_GENLIST_ITEM_NONE,
|
||||
func=None
|
||||
#API XXX: *args, **kwargs
|
||||
):
|
||||
cdef GenlistItem ret = GenlistItem()
|
||||
cdef Elm_Object_Item *item, *after
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
after = _object_item_from_python(after_item)
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _py_elm_genlist_item_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_genlist_item_insert_after(self.obj, &item_class.obj,
|
||||
<void*>ret,
|
||||
NULL,
|
||||
after,
|
||||
<Elm_Genlist_Item_Type>flags, cb,
|
||||
<void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
Py_DECREF(ret)
|
||||
return None
|
||||
|
||||
#Elm_Object_Item *elm_genlist_item_sorted_insert(self.obj, Elm_Genlist_Item_Class *itc, void *data, Elm_Object_Item *parent, Elm_Genlist_Item_Type flags, Eina_Compare_Cb comp, Evas_Smart_Cb func, void *func_data)
|
||||
|
||||
def selected_item_get(self):
|
||||
return _object_item_to_python(elm_genlist_selected_item_get(self.obj))
|
||||
|
||||
property selected_item:
|
||||
def __get__(self):
|
||||
return self.selected_item_get()
|
||||
|
||||
def selected_items_get(self):
|
||||
return _object_item_list_to_python(elm_genlist_selected_items_get(self.obj))
|
||||
|
||||
def realized_items_get(self):
|
||||
return _object_item_list_to_python(elm_genlist_realized_items_get(self.obj))
|
||||
|
||||
def first_item_get(self):
|
||||
return _object_item_to_python(elm_genlist_first_item_get(self.obj))
|
||||
|
||||
property first_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_genlist_first_item_get(self.obj))
|
||||
|
||||
def last_item_get(self):
|
||||
return _object_item_to_python(elm_genlist_last_item_get(self.obj))
|
||||
|
||||
property last_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_genlist_last_item_get(self.obj))
|
||||
|
||||
def scroller_policy_set(self, policy_h, policy_v):
|
||||
elm_scroller_policy_set(self.obj, policy_h, policy_v)
|
||||
|
||||
def scroller_policy_get(self):
|
||||
cdef Elm_Scroller_Policy policy_h, policy_v
|
||||
elm_scroller_policy_get(self.obj, &policy_h, &policy_v)
|
||||
return (policy_h, policy_v)
|
||||
|
||||
def realized_items_update(self):
|
||||
elm_genlist_realized_items_update(self.obj)
|
||||
|
||||
def items_count(self):
|
||||
return elm_genlist_items_count(self.obj)
|
||||
|
||||
def homogeneous_set(self, homogeneous):
|
||||
elm_genlist_homogeneous_set(self.obj, bool(homogeneous))
|
||||
|
||||
def homogeneous_get(self):
|
||||
return bool(elm_genlist_homogeneous_get(self.obj))
|
||||
|
||||
def block_count_set(self, int n):
|
||||
elm_genlist_block_count_set(self.obj, n)
|
||||
|
||||
def block_count_get(self):
|
||||
return elm_genlist_block_count_get(self.obj)
|
||||
|
||||
def longpress_timeout_set(self, timeout):
|
||||
elm_genlist_longpress_timeout_set(self.obj, timeout)
|
||||
|
||||
def longpress_timeout_get(self):
|
||||
return elm_genlist_longpress_timeout_get(self.obj)
|
||||
|
||||
def at_xy_item_get(self, int x, int y):
|
||||
return _object_item_to_python(elm_genlist_at_xy_item_get(self.obj, x, y, NULL))
|
||||
|
||||
def decorated_item_get(self):
|
||||
return _object_item_to_python(elm_genlist_decorated_item_get(self.obj))
|
||||
|
||||
def reorder_mode_set(self, reorder_mode):
|
||||
elm_genlist_reorder_mode_set(self.obj, reorder_mode)
|
||||
|
||||
def reorder_mode_get(self):
|
||||
return bool(elm_genlist_reorder_mode_get(self.obj))
|
||||
|
||||
def decorate_mode_set(self, decorated):
|
||||
elm_genlist_decorate_mode_set(self.obj, decorated)
|
||||
|
||||
def decorate_mode_get(self):
|
||||
return bool(elm_genlist_decorate_mode_get(self.obj))
|
||||
|
||||
def tree_effect_enabled_set(self, enabled):
|
||||
elm_genlist_tree_effect_enabled_set(self.obj, enabled)
|
||||
|
||||
def tree_effect_enabled_get(self):
|
||||
return bool(elm_genlist_tree_effect_enabled_get(self.obj))
|
||||
|
||||
def highlight_mode_set(self, highlight):
|
||||
elm_genlist_highlight_mode_set(self.obj, highlight)
|
||||
|
||||
def highlight_mode_get(self):
|
||||
return bool(elm_genlist_highlight_mode_get(self.obj))
|
||||
|
||||
def select_mode_set(self, mode):
|
||||
elm_genlist_select_mode_set(self.obj, mode)
|
||||
|
||||
def select_mode_get(self):
|
||||
return elm_genlist_select_mode_get(self.obj)
|
||||
|
||||
def callback_activated_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("activated", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_activated_del(self, func):
|
||||
self._callback_del_full("activated", _cb_object_item_conv, func)
|
||||
|
||||
def callback_clicked_double_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("clicked,double", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_double_del(self, func):
|
||||
self._callback_del_full("clicked,double", _cb_object_item_conv, func)
|
||||
|
||||
def callback_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("selected", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_selected_del(self, func):
|
||||
self._callback_del_full("selected", _cb_object_item_conv, func)
|
||||
|
||||
def callback_unselected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("unselected", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_unselected_del(self, func):
|
||||
self._callback_del_full("unselected", _cb_object_item_conv, func)
|
||||
|
||||
def callback_expanded_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("expanded", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_expanded_del(self, func):
|
||||
self._callback_del_full("expanded", _cb_object_item_conv, func)
|
||||
|
||||
def callback_contracted_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("contracted", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_contracted_del(self, func):
|
||||
self._callback_del_full("contracted", _cb_object_item_conv, func)
|
||||
|
||||
def callback_expand_request_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("expand,request", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_expand_request_del(self, func):
|
||||
self._callback_del_full("expand,request", _cb_object_item_conv, func)
|
||||
|
||||
def callback_contract_request_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("contract,request", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_contract_request_del(self, func):
|
||||
self._callback_del_full("contract,request", _cb_object_item_conv, func)
|
||||
|
||||
def callback_realized_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("realized", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_realized_del(self, func):
|
||||
self._callback_del_full("realized", _cb_object_item_conv, func)
|
||||
|
||||
def callback_unrealized_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("unrealized", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_unrealized_del(self, func):
|
||||
self._callback_del_full("unrealized", _cb_object_item_conv, func)
|
||||
|
||||
def callback_drag_start_up_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("drag,start,up", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_drag_start_up_del(self, func):
|
||||
self._callback_del_full("drag,start,up", _cb_object_item_conv, func)
|
||||
|
||||
def callback_drag_start_down_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("drag,start,down", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_drag_start_down_del(self, func):
|
||||
self._callback_del_full("drag,start,down", _cb_object_item_conv, func)
|
||||
|
||||
def callback_drag_start_left_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("drag,start,left", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_drag_start_left_del(self, func):
|
||||
self._callback_del_full("drag,start,left", _cb_object_item_conv, func)
|
||||
|
||||
def callback_drag_start_right_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("drag,start,right", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_drag_start_right_del(self, func):
|
||||
self._callback_del_full("drag,start,right", _cb_object_item_conv, func)
|
||||
|
||||
def callback_drag_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("drag,stop", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_drag_stop_del(self, func):
|
||||
self._callback_del_full("drag,stop", _cb_object_item_conv, func)
|
||||
|
||||
def callback_drag_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("drag", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_drag_del(self, func):
|
||||
self._callback_del_full("drag", _cb_object_item_conv, func)
|
||||
|
||||
def callback_longpressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("longpressed", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_longpressed_del(self, func):
|
||||
self._callback_del_full("longpressed", _cb_object_item_conv, func)
|
||||
|
||||
def callback_scroll_anim_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,anim,start", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_anim_start_del(self, func):
|
||||
self._callback_del("scroll,anim,start", func)
|
||||
|
||||
def callback_scroll_anim_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,anim,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_anim_stop_del(self, func):
|
||||
self._callback_del("scroll,anim,stop", func)
|
||||
|
||||
def callback_scroll_drag_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,drag,start", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_drag_start_del(self, func):
|
||||
self._callback_del("scroll,drag,start", func)
|
||||
|
||||
def callback_scroll_drag_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,drag,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_drag_stop_del(self, func):
|
||||
self._callback_del("scroll,drag,stop", func)
|
||||
|
||||
def callback_edge_top_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,top", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_top_del(self, func):
|
||||
self._callback_del("edge,top", func)
|
||||
|
||||
def callback_edge_bottom_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,bottom", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_bottom_del(self, func):
|
||||
self._callback_del("edge,bottom", func)
|
||||
|
||||
def callback_edge_left_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,left", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_left_del(self, func):
|
||||
self._callback_del("edge,left", func)
|
||||
|
||||
def callback_edge_right_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,right", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_right_del(self, func):
|
||||
self._callback_del("edge,right", func)
|
||||
|
||||
def callback_multi_swipe_left_add(self, func, *args, **kwargs):
|
||||
self._callback_add("multi,swipe,left", func, *args, **kwargs)
|
||||
|
||||
def callback_multi_swipe_left_del(self, func):
|
||||
self._callback_del("multi,swipe,left", func)
|
||||
|
||||
def callback_multi_swipe_right_add(self, func, *args, **kwargs):
|
||||
self._callback_add("multi,swipe,right", func, *args, **kwargs)
|
||||
|
||||
def callback_multi_swipe_right_del(self, func):
|
||||
self._callback_del("multi,swipe,right", func)
|
||||
|
||||
def callback_multi_swipe_up_add(self, func, *args, **kwargs):
|
||||
self._callback_add("multi,swipe,up", func, *args, **kwargs)
|
||||
|
||||
def callback_multi_swipe_up_del(self, func):
|
||||
self._callback_del("multi,swipe,up", func)
|
||||
|
||||
def callback_multi_swipe_down_add(self, func, *args, **kwargs):
|
||||
self._callback_add("multi,swipe,down", func, *args, **kwargs)
|
||||
|
||||
def callback_multi_swipe_down_del(self, func):
|
||||
self._callback_del("multi,swipe,down", func)
|
||||
|
||||
def callback_multi_pinch_out_add(self, func, *args, **kwargs):
|
||||
self._callback_add("multi,pinch,out", func, *args, **kwargs)
|
||||
|
||||
def callback_multi_pinch_out_del(self, func):
|
||||
self._callback_del("multi,pinch,out", func)
|
||||
|
||||
def callback_multi_pinch_in_add(self, func, *args, **kwargs):
|
||||
self._callback_add("multi,pinch,in", func, *args, **kwargs)
|
||||
|
||||
def callback_multi_pinch_in_del(self, func):
|
||||
self._callback_del("multi,pinch,in", func)
|
||||
|
||||
def callback_swipe_add(self, func, *args, **kwargs):
|
||||
self._callback_add("swipe", func, *args, **kwargs)
|
||||
|
||||
def callback_swipe_del(self, func):
|
||||
self._callback_del("swipe", func)
|
||||
|
||||
def callback_moved_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("moved", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_moved_del(self, func):
|
||||
self._callback_del_full("moved", _cb_object_item_conv, func)
|
||||
|
||||
def callback_moved_after_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("moved,after", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_moved_after_del(self, func):
|
||||
self._callback_del_full("moved,after", _cb_object_item_conv, func)
|
||||
|
||||
def callback_moved_before_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("moved,before", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_moved_before_del(self, func):
|
||||
self._callback_del_full("moved,before", _cb_object_item_conv, func)
|
||||
|
||||
def callback_language_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("language,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_language_changed_del(self, func):
|
||||
self._callback_del("language,changed", func)
|
||||
|
||||
def callback_tree_effect_finished_add(self, func, *args, **kwargs):
|
||||
self._callback_add("tree,effect,finished", func, *args, **kwargs)
|
||||
|
||||
def callback_tree_effect_finished_del(self, func):
|
||||
self._callback_del("tree,effect,finished", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_genlist", Genlist)
|
|
@ -0,0 +1,79 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from efl cimport evas
|
||||
|
||||
cdef Evas_Event_Flags _gesture_layer_event_cb(void *data, void *event_info) with gil:
|
||||
(callback, args, kwargs) = <object>data
|
||||
try:
|
||||
ret = callback(args, kwargs)
|
||||
if ret is not None:
|
||||
return <Evas_Event_Flags>ret
|
||||
else:
|
||||
return evas.EVAS_EVENT_FLAG_NONE
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef class GestureLayer(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_gesture_layer_add(parent.obj))
|
||||
|
||||
def cb_set(self, Elm_Gesture_Type idx, callback, Elm_Gesture_State cb_type, *args, **kwargs):
|
||||
cdef Elm_Gesture_Event_Cb cb = NULL
|
||||
|
||||
if callback:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _gesture_layer_event_cb
|
||||
|
||||
data = (callback, args, kwargs)
|
||||
|
||||
elm_gesture_layer_cb_set( self.obj,
|
||||
idx,
|
||||
cb_type,
|
||||
cb,
|
||||
<void *>data)
|
||||
|
||||
property hold_events:
|
||||
def __get__(self):
|
||||
return bool(elm_gesture_layer_hold_events_get(self.obj))
|
||||
|
||||
def __set__(self, hold_events):
|
||||
elm_gesture_layer_hold_events_set(self.obj, hold_events)
|
||||
|
||||
property zoom_step:
|
||||
def __set__(self, step):
|
||||
elm_gesture_layer_zoom_step_set(self.obj, step)
|
||||
|
||||
def __get__(self):
|
||||
return elm_gesture_layer_zoom_step_get(self.obj)
|
||||
|
||||
property rotate_step:
|
||||
def __set__(self, step):
|
||||
elm_gesture_layer_rotate_step_set(self.obj, step)
|
||||
|
||||
def __get__(self):
|
||||
return elm_gesture_layer_rotate_step_get(self.obj)
|
||||
|
||||
def attach(self, evasObject target):
|
||||
return bool(elm_gesture_layer_attach(self.obj, target.obj))
|
||||
|
||||
|
||||
_object_mapping_register("elm_gesture_layer", GestureLayer)
|
|
@ -0,0 +1,69 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class Grid(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
# Object.__init__(self, parent.evas)
|
||||
self._set_obj(elm_grid_add(parent.obj))
|
||||
|
||||
def size_set(self, w, h):
|
||||
elm_grid_size_set(self.obj, w, h)
|
||||
|
||||
def size_get(self):
|
||||
cdef Evas_Coord w, h
|
||||
elm_grid_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property size:
|
||||
def __set__(self, value):
|
||||
w, h = value
|
||||
elm_grid_size_set(self.obj, w, h)
|
||||
|
||||
def __get__(self):
|
||||
cdef Evas_Coord w, h
|
||||
elm_grid_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
def pack(self, evasObject subobj, x, y, w, h):
|
||||
elm_grid_pack(self.obj, subobj.obj, x, y, w, h)
|
||||
|
||||
def unpack(self, evasObject subobj):
|
||||
elm_grid_unpack(self.obj, subobj.obj)
|
||||
|
||||
def clear(self, clear):
|
||||
elm_grid_clear(self.obj, clear)
|
||||
|
||||
def pack_set(self, evasObject subobj, x, y, w, h):
|
||||
elm_grid_pack_set(subobj.obj, x, y, w, h)
|
||||
|
||||
def pack_get(self, evasObject subobj):
|
||||
cdef Evas_Coord x, y, w, h
|
||||
elm_grid_pack_get(subobj.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
def children_get(self):
|
||||
return _object_list_to_python(elm_box_children_get(self.obj))
|
||||
|
||||
property children:
|
||||
def __get__(self):
|
||||
return _object_list_to_python(elm_box_children_get(self.obj))
|
||||
|
||||
|
||||
_object_mapping_register("elm_grid", Grid)
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Hover(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent, obj = None):
|
||||
# TODO is this right ??
|
||||
if obj is None:
|
||||
self._set_obj(elm_hover_add(parent.obj))
|
||||
else:
|
||||
self._set_obj(<Evas_Object*>obj)
|
||||
|
||||
def target_set(self, evasObject target):
|
||||
elm_hover_target_set(self.obj, target.obj)
|
||||
|
||||
def target_get(self):
|
||||
return object_from_instance(elm_hover_target_get(self.obj))
|
||||
|
||||
property target:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_hover_target_get(self.obj))
|
||||
def __set__(self, evasObject target):
|
||||
elm_hover_target_set(self.obj, target.obj)
|
||||
|
||||
def parent_set(self, evasObject parent):
|
||||
elm_hover_parent_set(self.obj, parent.obj)
|
||||
|
||||
def parent_get(self):
|
||||
return object_from_instance(elm_hover_parent_get(self.obj))
|
||||
|
||||
property parent:
|
||||
def __set__(self, evasObject parent):
|
||||
elm_hover_parent_set(self.obj, parent.obj)
|
||||
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_hover_parent_get(self.obj))
|
||||
|
||||
def best_content_location_get(self, axis):
|
||||
return _ctouni(elm_hover_best_content_location_get(self.obj, axis))
|
||||
|
||||
def dismiss(self):
|
||||
elm_hover_dismiss(self.obj)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_smart_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("smart,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_smart_changed_del(self, func):
|
||||
self._callback_del("smart,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_hover", Hover)
|
|
@ -0,0 +1,141 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class HoverselItem(ObjectItem):
|
||||
|
||||
def __init__(self, evasObject hoversel, label, icon_file, icon_type,
|
||||
callback, *args, **kargs):
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if callback:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
item = elm_hoversel_item_add( hoversel.obj,
|
||||
_cfruni(label) if label is not None else NULL,
|
||||
_cfruni(icon_file) if icon_file is not None else NULL,
|
||||
icon_type,
|
||||
cb,
|
||||
<void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def icon_set(self, icon_file, icon_group, icon_type):
|
||||
elm_hoversel_item_icon_set(self.item, _cfruni(icon_file), _cfruni(icon_group), icon_type)
|
||||
|
||||
def icon_get(self):
|
||||
cdef const_char_ptr cicon_file, cicon_group
|
||||
cdef Elm_Icon_Type cicon_type
|
||||
elm_hoversel_item_icon_get(self.item, &cicon_file, &cicon_group, &cicon_type)
|
||||
return (_ctouni(cicon_file), _ctouni(cicon_group), cicon_type)
|
||||
|
||||
property icon:
|
||||
def __set__(self, value):
|
||||
icon_file, icon_group, icon_type = value
|
||||
elm_hoversel_item_icon_set(self.item, _cfruni(icon_file), _cfruni(icon_group), icon_type)
|
||||
|
||||
def __get__(self):
|
||||
cdef const_char_ptr cicon_file, cicon_group
|
||||
cdef Elm_Icon_Type cicon_type
|
||||
elm_hoversel_item_icon_get(self.item, &cicon_file, &cicon_group, &cicon_type)
|
||||
return (_ctouni(cicon_file), _ctouni(cicon_group), cicon_type)
|
||||
|
||||
|
||||
cdef class Hoversel(Button):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
# Object.__init__(self, parent.evas)
|
||||
self._set_obj(elm_hoversel_add(parent.obj))
|
||||
|
||||
def horizontal_set(self, horizontal):
|
||||
elm_hoversel_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def horizontal_get(self):
|
||||
return bool(elm_hoversel_horizontal_get(self.obj))
|
||||
|
||||
property horizontal:
|
||||
def __set__(self, horizontal):
|
||||
elm_hoversel_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def __get__(self):
|
||||
return bool(elm_hoversel_horizontal_get(self.obj))
|
||||
|
||||
def hover_parent_set(self, evasObject parent):
|
||||
elm_hoversel_hover_parent_set(self.obj, parent.obj)
|
||||
|
||||
def hover_parent_get(self):
|
||||
return object_from_instance(elm_hoversel_hover_parent_get(self.obj))
|
||||
|
||||
property hover_parent:
|
||||
def __set__(self, evasObject parent):
|
||||
elm_hoversel_hover_parent_set(self.obj, parent.obj)
|
||||
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_hoversel_hover_parent_get(self.obj))
|
||||
|
||||
def hover_begin(self):
|
||||
elm_hoversel_hover_begin(self.obj)
|
||||
|
||||
def hover_end(self):
|
||||
elm_hoversel_hover_end(self.obj)
|
||||
|
||||
def expanded_get(self):
|
||||
return bool(elm_hoversel_expanded_get(self.obj))
|
||||
|
||||
property expanded:
|
||||
def __get__(self):
|
||||
return bool(elm_hoversel_expanded_get(self.obj))
|
||||
|
||||
def clear(self):
|
||||
elm_hoversel_clear(self.obj)
|
||||
|
||||
def items_get(self):
|
||||
return _object_item_list_to_python(elm_hoversel_items_get(self.obj))
|
||||
|
||||
property items:
|
||||
def __get__(self):
|
||||
return _object_item_list_to_python(elm_hoversel_items_get(self.obj))
|
||||
|
||||
def item_add(self, label = None, icon_file = None, icon_type = ELM_ICON_NONE, callback = None, *args, **kwargs):
|
||||
return HoverselItem(self, label, icon_file, icon_type, callback, *args, **kwargs)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("selected", _cb_object_item_conv, func, *args, **kwargs)
|
||||
|
||||
def callback_selected_del(self, func):
|
||||
self._callback_del_full("selected", _cb_object_item_conv, func)
|
||||
|
||||
def callback_dismissed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("dismissed", func, *args, **kwargs)
|
||||
|
||||
def callback_dismissed_del(self, func):
|
||||
self._callback_del("dismissed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_hoversel", Hoversel)
|
|
@ -0,0 +1,78 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Icon(Image):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_icon_add(parent.obj))
|
||||
|
||||
def thumb_set(self, filename, group = None):
|
||||
if group == None:
|
||||
elm_icon_thumb_set(self.obj, _cfruni(filename), NULL)
|
||||
else:
|
||||
elm_icon_thumb_set(self.obj, _cfruni(filename), _cfruni(group))
|
||||
|
||||
property thumb:
|
||||
def __set__(self, value):
|
||||
if isinstance(value, tuple):
|
||||
filename, group = value
|
||||
else:
|
||||
filename = value
|
||||
group = None
|
||||
# TODO: check return value
|
||||
elm_icon_thumb_set(self.obj, _cfruni(filename), _cfruni(group))
|
||||
|
||||
def standard_set(self, name):
|
||||
return bool(elm_icon_standard_set(self.obj, _cfruni(name)))
|
||||
|
||||
def standard_get(self):
|
||||
return _ctouni(elm_icon_standard_get(self.obj))
|
||||
|
||||
property standard:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_icon_standard_get(self.obj))
|
||||
def __set__(self, name):
|
||||
# TODO: check return value
|
||||
elm_icon_standard_set(self.obj, _cfruni(name))
|
||||
|
||||
def order_lookup_set(self, order):
|
||||
elm_icon_order_lookup_set(self.obj, order)
|
||||
|
||||
def order_lookup_get(self):
|
||||
return elm_icon_order_lookup_get(self.obj)
|
||||
|
||||
property order_lookup:
|
||||
def __get__(self):
|
||||
return elm_icon_order_lookup_get(self.obj)
|
||||
def __set__(self, order):
|
||||
elm_icon_order_lookup_set(self.obj, order)
|
||||
|
||||
def callback_thumb_done_add(self, func, *args, **kwargs):
|
||||
self._callback_add("thumb,done", func, *args, **kwargs)
|
||||
|
||||
def callback_thumb_done_del(self, func):
|
||||
self._callback_del("thumb,done", func)
|
||||
|
||||
def callback_thumb_error_add(self, func, *args, **kwargs):
|
||||
self._callback_add("thumb,error", func, *args, **kwargs)
|
||||
|
||||
def callback_thumb_error_del(self, func):
|
||||
self._callback_del("thumb,error", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_icon", Icon)
|
|
@ -0,0 +1,227 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Image(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_image_add(parent.obj))
|
||||
|
||||
#def memfile_set(self, img, size, format, key):
|
||||
#return bool(elm_image_memfile_set(self.obj, img, size, _cfruni(format), _cfruni(key)))
|
||||
|
||||
def file_set(self, filename, group = None):
|
||||
if group == None:
|
||||
elm_image_file_set(self.obj, _cfruni(filename), NULL)
|
||||
else:
|
||||
elm_image_file_set(self.obj, _cfruni(filename), _cfruni(group))
|
||||
|
||||
def file_get(self):
|
||||
cdef const_char_ptr filename, group
|
||||
elm_image_file_get(self.obj, &filename, &group)
|
||||
return (_ctouni(filename), _ctouni(group))
|
||||
|
||||
property file:
|
||||
def __set__(self, value):
|
||||
if isinstance(value, tuple):
|
||||
filename, group = value
|
||||
else:
|
||||
filename = value
|
||||
group = None
|
||||
# TODO: check return value
|
||||
elm_image_file_set(self.obj, _cfruni(filename), _cfruni(group))
|
||||
|
||||
def __get__(self):
|
||||
cdef const_char_ptr filename, group
|
||||
elm_image_file_get(self.obj, &filename, &group)
|
||||
return (_ctouni(filename), _ctouni(group))
|
||||
|
||||
def smooth_set(self, smooth):
|
||||
elm_image_smooth_set(self.obj, smooth)
|
||||
|
||||
def smooth_get(self):
|
||||
return bool(elm_image_smooth_get(self.obj))
|
||||
|
||||
property smooth:
|
||||
def __get__(self):
|
||||
return bool(elm_image_smooth_get(self.obj))
|
||||
|
||||
def __set__(self, smooth):
|
||||
elm_image_smooth_set(self.obj, smooth)
|
||||
|
||||
def object_size_get(self):
|
||||
cdef int width, height
|
||||
elm_image_object_size_get(self.obj, &width, &height)
|
||||
return (width, height)
|
||||
|
||||
property object_size:
|
||||
def __get__(self):
|
||||
cdef int width, height
|
||||
elm_image_object_size_get(self.obj, &width, &height)
|
||||
return (width, height)
|
||||
|
||||
def no_scale_set(self, no_scale):
|
||||
elm_image_no_scale_set(self.obj, no_scale)
|
||||
|
||||
def no_scale_get(self):
|
||||
return bool(elm_image_no_scale_get(self.obj))
|
||||
|
||||
property no_scale:
|
||||
def __get__(self):
|
||||
return bool(elm_image_no_scale_get(self.obj))
|
||||
def __set__(self, no_scale):
|
||||
elm_image_no_scale_set(self.obj, no_scale)
|
||||
|
||||
def resizable_set(self, size_up, size_down):
|
||||
elm_image_resizable_set(self.obj, size_up, size_down)
|
||||
|
||||
def resizable_get(self):
|
||||
cdef Eina_Bool size_up, size_down
|
||||
elm_image_resizable_get(self.obj, &size_up, &size_down)
|
||||
return (size_up, size_down)
|
||||
|
||||
property resizable:
|
||||
def __get__(self):
|
||||
cdef Eina_Bool size_up, size_down
|
||||
elm_image_resizable_get(self.obj, &size_up, &size_down)
|
||||
return (size_up, size_down)
|
||||
|
||||
def __set__(self, value):
|
||||
size_up, size_down = value
|
||||
elm_image_resizable_set(self.obj, size_up, size_down)
|
||||
|
||||
def fill_outside_set(self, fill_outside):
|
||||
elm_image_fill_outside_set(self.obj, fill_outside)
|
||||
|
||||
def fill_outside_get(self):
|
||||
return bool(elm_image_fill_outside_get(self.obj))
|
||||
|
||||
property fill_outside:
|
||||
def __get__(self):
|
||||
return bool(elm_image_fill_outside_get(self.obj))
|
||||
|
||||
def __set__(self, fill_outside):
|
||||
elm_image_fill_outside_set(self.obj, fill_outside)
|
||||
|
||||
def preload_disabled_set(self, disabled):
|
||||
elm_image_preload_disabled_set(self.obj, disabled)
|
||||
|
||||
property preload_disabled:
|
||||
def __set__(self, disabled):
|
||||
elm_image_preload_disabled_set(self.obj, disabled)
|
||||
|
||||
def prescale_set(self, size):
|
||||
elm_image_prescale_set(self.obj, size)
|
||||
|
||||
def prescale_get(self):
|
||||
return elm_image_prescale_get(self.obj)
|
||||
|
||||
property prescale:
|
||||
def __get__(self):
|
||||
return elm_image_prescale_get(self.obj)
|
||||
def __set__(self, size):
|
||||
elm_image_prescale_set(self.obj, size)
|
||||
|
||||
def orient_set(self, orientation):
|
||||
elm_image_orient_set(self.obj, orientation)
|
||||
|
||||
def orient_get(self):
|
||||
return elm_image_orient_get(self.obj)
|
||||
|
||||
property orient:
|
||||
def __get__(self):
|
||||
return elm_image_orient_get(self.obj)
|
||||
def __set__(self, orientation):
|
||||
elm_image_orient_set(self.obj, orientation)
|
||||
|
||||
def editable_set(self, editable):
|
||||
elm_image_editable_set(self.obj, editable)
|
||||
|
||||
def editable_get(self):
|
||||
return bool(elm_image_editable_get(self.obj))
|
||||
|
||||
property editable:
|
||||
def __get__(self):
|
||||
return bool(elm_image_editable_get(self.obj))
|
||||
def __set__(self, editable):
|
||||
elm_image_editable_set(self.obj, editable)
|
||||
|
||||
def object_get(self):
|
||||
return object_from_instance(elm_image_object_get(self.obj))
|
||||
|
||||
property object:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_image_object_get(self.obj))
|
||||
|
||||
def aspect_fixed_set(self, fixed):
|
||||
elm_image_aspect_fixed_set(self.obj, fixed)
|
||||
|
||||
def aspect_fixed_get(self):
|
||||
return bool(elm_image_aspect_fixed_get(self.obj))
|
||||
|
||||
property aspect_fixed:
|
||||
def __get__(self):
|
||||
return bool(elm_image_aspect_fixed_get(self.obj))
|
||||
def __set__(self, fixed):
|
||||
elm_image_aspect_fixed_set(self.obj, fixed)
|
||||
|
||||
def animated_available_get(self):
|
||||
return bool(elm_image_animated_available_get(self.obj))
|
||||
|
||||
property animated_available:
|
||||
def __get__(self):
|
||||
return bool(elm_image_animated_available_get(self.obj))
|
||||
|
||||
def animated_set(self, animated):
|
||||
elm_image_animated_set(self.obj, animated)
|
||||
|
||||
def animated_get(self):
|
||||
return bool(elm_image_animated_get(self.obj))
|
||||
|
||||
property animated:
|
||||
def __get__(self):
|
||||
return bool(elm_image_animated_get(self.obj))
|
||||
def __set__(self, animated):
|
||||
elm_image_animated_set(self.obj, animated)
|
||||
|
||||
def animated_play_set(self, play):
|
||||
elm_image_animated_play_set(self.obj, play)
|
||||
|
||||
def animated_play_get(self):
|
||||
return bool(elm_image_animated_play_get(self.obj))
|
||||
|
||||
property animated_play:
|
||||
|
||||
def __get__(self):
|
||||
return bool(elm_image_animated_play_get(self.obj))
|
||||
def __set__(self, play):
|
||||
elm_image_animated_play_set(self.obj, play)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_drop_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("drop", _cb_string_conv, func, *args, **kwargs)
|
||||
|
||||
def callback_drop_del(self, func):
|
||||
self._callback_del_full("drop", _cb_string_conv, func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_image", Image)
|
|
@ -0,0 +1,199 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef enum Elm_Index_Item_Insert_Kind:
|
||||
ELM_INDEX_ITEM_INSERT_APPEND
|
||||
ELM_INDEX_ITEM_INSERT_PREPEND
|
||||
ELM_INDEX_ITEM_INSERT_BEFORE
|
||||
ELM_INDEX_ITEM_INSERT_AFTER
|
||||
ELM_INDEX_ITEM_INSERT_SORTED
|
||||
|
||||
|
||||
cdef class IndexItem(ObjectItem):
|
||||
def __init__(self, kind, evasObject index, letter, IndexItem before_after = None,
|
||||
callback = None, *args, **kargs):
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
|
||||
if kind == ELM_INDEX_ITEM_INSERT_APPEND:
|
||||
item = elm_index_item_append(index.obj, _cfruni(letter), cb, <void*>self)
|
||||
elif kind == ELM_INDEX_ITEM_INSERT_PREPEND:
|
||||
item = elm_index_item_prepend(index.obj, _cfruni(letter), cb, <void*>self)
|
||||
#elif kind == ELM_INDEX_ITEM_INSERT_SORTED:
|
||||
#item = elm_index_item_sorted_insert(index.obj, _cfruni(letter), cb, <void*>self, cmp_f, cmp_data_f)
|
||||
else:
|
||||
if before_after == None:
|
||||
raise ValueError("need a valid after object to add an item before/after another item")
|
||||
if kind == ELM_INDEX_ITEM_INSERT_BEFORE:
|
||||
item = elm_index_item_insert_before(index.obj, before_after.item, _cfruni(letter), cb, <void*>self)
|
||||
else:
|
||||
item = elm_index_item_insert_after(index.obj, before_after.item, _cfruni(letter), cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def selected_set(self, selected):
|
||||
elm_index_item_selected_set(self.item, selected)
|
||||
|
||||
property selected:
|
||||
def __set__(self, selected):
|
||||
elm_index_item_selected_set(self.item, selected)
|
||||
|
||||
def letter_get(self):
|
||||
return _ctouni(elm_index_item_letter_get(self.item))
|
||||
|
||||
property letter:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_index_item_letter_get(self.item))
|
||||
|
||||
cdef Elm_Object_Item *_elm_index_item_from_python(IndexItem item):
|
||||
if item is None:
|
||||
return NULL
|
||||
else:
|
||||
return item.item
|
||||
|
||||
|
||||
cdef class Index(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_index_add(parent.obj))
|
||||
|
||||
def autohide_disabled_set(self, disabled):
|
||||
elm_index_autohide_disabled_set(self.obj, disabled)
|
||||
|
||||
def autohide_disabled_get(self):
|
||||
return bool(elm_index_autohide_disabled_get(self.obj))
|
||||
|
||||
property autohide_disabled:
|
||||
def __get__(self):
|
||||
return bool(elm_index_autohide_disabled_get(self.obj))
|
||||
|
||||
def __set__(self, disabled):
|
||||
elm_index_autohide_disabled_set(self.obj, disabled)
|
||||
|
||||
def item_level_set(self, level):
|
||||
elm_index_item_level_set(self.obj, level)
|
||||
|
||||
def item_level_get(self):
|
||||
return elm_index_item_level_get(self.obj)
|
||||
|
||||
property item_level:
|
||||
def __get__(self):
|
||||
return elm_index_item_level_get(self.obj)
|
||||
def __set__(self, level):
|
||||
elm_index_item_level_set(self.obj, level)
|
||||
|
||||
def selected_item_get(self, level):
|
||||
return _object_item_to_python(elm_index_selected_item_get(self.obj, level))
|
||||
|
||||
def item_append(self, letter, callback = None, *args, **kargs):
|
||||
return IndexItem(ELM_INDEX_ITEM_INSERT_APPEND, self, letter,
|
||||
None, callback, *args, **kargs)
|
||||
|
||||
def item_prepend(self, letter, callback = None, *args, **kargs):
|
||||
return IndexItem(ELM_INDEX_ITEM_INSERT_PREPEND, self, letter,
|
||||
None, callback, *args, **kargs)
|
||||
|
||||
def item_insert_after(self, IndexItem after, letter, callback = None, *args, **kargs):
|
||||
return IndexItem(ELM_INDEX_ITEM_INSERT_AFTER, self, letter,
|
||||
after, callback, *args, **kargs)
|
||||
|
||||
def item_insert_before(self, IndexItem before, letter, callback = None, *args, **kargs):
|
||||
return IndexItem(ELM_INDEX_ITEM_INSERT_BEFORE, self, letter,
|
||||
before, callback, *args, **kargs)
|
||||
|
||||
#def item_sorted_insert(self, letter, callback = None, *args, **kargs):
|
||||
#return IndexItem(ELM_INDEX_ITEM_INSERT_SORTED, self, letter,
|
||||
#None, callback, *args, **kargs)
|
||||
|
||||
def item_find(self, data):
|
||||
# XXX: This doesn't seem right.
|
||||
# return _object_item_to_python(elm_index_item_find(self.obj, <void*>data))
|
||||
pass
|
||||
|
||||
def item_clear(self):
|
||||
elm_index_item_clear(self.obj)
|
||||
|
||||
def level_go(self, level):
|
||||
elm_index_level_go(self.obj, level)
|
||||
|
||||
def indicator_disabled_set(self, disabled):
|
||||
elm_index_indicator_disabled_set(self.obj, disabled)
|
||||
|
||||
def indicator_disabled_get(self):
|
||||
return bool(elm_index_indicator_disabled_get(self.obj))
|
||||
|
||||
property indicator_disabled:
|
||||
def __get__(self):
|
||||
return bool(elm_index_indicator_disabled_get(self.obj))
|
||||
def __set__(self, disabled):
|
||||
elm_index_indicator_disabled_set(self.obj, disabled)
|
||||
|
||||
def horizontal_set(self, horizontal):
|
||||
elm_index_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def horizontal_get(self):
|
||||
return bool(elm_index_horizontal_get(self.obj))
|
||||
|
||||
property horizontal:
|
||||
def __get__(self):
|
||||
return bool(elm_index_horizontal_get(self.obj))
|
||||
def __set__(self, horizontal):
|
||||
elm_index_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("changed", _cb_object_item_conv, func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del_full("changed", _cb_object_item_conv, func)
|
||||
|
||||
def callback_delay_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("delay,changed", _cb_object_item_conv, func, *args, **kwargs)
|
||||
|
||||
def callback_delay_changed_del(self, func):
|
||||
self._callback_del_full("delay,changed", _cb_object_item_conv, func)
|
||||
|
||||
def callback_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("selected", _cb_object_item_conv, func, *args, **kwargs)
|
||||
|
||||
def callback_selected_del(self, func):
|
||||
self._callback_del_full("selected", _cb_object_item_conv, func)
|
||||
|
||||
def callback_level_up_add(self, func, *args, **kwargs):
|
||||
self._callback_add("level,up", func, *args, **kwargs)
|
||||
|
||||
def callback_level_up_del(self, func):
|
||||
self._callback_del("level,up", func)
|
||||
|
||||
def callback_level_down_add(self, func, *args, **kwargs):
|
||||
self._callback_add("level,down", func, *args, **kwargs)
|
||||
|
||||
def callback_level_down_del(self, func):
|
||||
self._callback_del("level,down", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_index", Index)
|
|
@ -0,0 +1,58 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class InnerWindow(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_win_inwin_add(parent.obj))
|
||||
|
||||
def activate(self):
|
||||
elm_win_inwin_activate(self.obj)
|
||||
|
||||
def content_set(self, evasObject content):
|
||||
cdef Evas_Object *o
|
||||
if content is not None:
|
||||
o = content.obj
|
||||
else:
|
||||
o = NULL
|
||||
elm_win_inwin_content_set(self.obj, o)
|
||||
|
||||
def content_get(self):
|
||||
return object_from_instance(elm_win_inwin_content_get(self.obj))
|
||||
|
||||
def content_unset(self):
|
||||
return object_from_instance(elm_win_inwin_content_unset(self.obj))
|
||||
|
||||
property content:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_win_inwin_content_get(self.obj))
|
||||
|
||||
def __set__(self, evasObject content):
|
||||
cdef Evas_Object *o
|
||||
if content is not None:
|
||||
o = content.obj
|
||||
else:
|
||||
o = NULL
|
||||
elm_win_inwin_content_set(self.obj, o)
|
||||
|
||||
def __del__(self):
|
||||
elm_win_inwin_content_unset(self.obj)
|
||||
|
||||
|
||||
_object_mapping_register("elm_inwin", InnerWindow)
|
|
@ -0,0 +1,91 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Label(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_label_add(parent.obj))
|
||||
|
||||
def line_wrap_set(self, Elm_Wrap_Type wrap):
|
||||
elm_label_line_wrap_set(self.obj, wrap)
|
||||
|
||||
def line_wrap_get(self):
|
||||
return elm_label_line_wrap_get(self.obj)
|
||||
|
||||
property line_wrap:
|
||||
def __get__(self):
|
||||
return elm_label_line_wrap_get(self.obj)
|
||||
def __set__(self, wrap):
|
||||
elm_label_line_wrap_set(self.obj, wrap)
|
||||
|
||||
def wrap_width_set(self, int w):
|
||||
elm_label_wrap_width_set(self.obj, w)
|
||||
|
||||
def wrap_width_get(self):
|
||||
return elm_label_wrap_width_get(self.obj)
|
||||
|
||||
property wrap_width:
|
||||
def __get__(self):
|
||||
return elm_label_wrap_width_get(self.obj)
|
||||
def __set__(self, w):
|
||||
elm_label_wrap_width_set(self.obj, w)
|
||||
|
||||
def ellipsis_set(self, bool ellipsis):
|
||||
elm_label_ellipsis_set(self.obj, ellipsis)
|
||||
|
||||
def ellipsis_get(self):
|
||||
return elm_label_ellipsis_get(self.obj)
|
||||
|
||||
property ellipsis:
|
||||
def __get__(self):
|
||||
return elm_label_ellipsis_get(self.obj)
|
||||
def __set__(self, ellipsis):
|
||||
elm_label_ellipsis_set(self.obj, ellipsis)
|
||||
|
||||
def slide_set(self, bool slide):
|
||||
elm_label_slide_set(self.obj, slide)
|
||||
|
||||
def slide_get(self):
|
||||
return elm_label_slide_get(self.obj)
|
||||
|
||||
property slide:
|
||||
def __get__(self):
|
||||
return elm_label_slide_get(self.obj)
|
||||
def __set__(self, slide):
|
||||
elm_label_slide_set(self.obj, slide)
|
||||
|
||||
def slide_duration_set(self, duration):
|
||||
elm_label_slide_duration_set(self.obj, duration)
|
||||
|
||||
def slide_duration_get(self):
|
||||
return elm_label_slide_duration_get(self.obj)
|
||||
|
||||
property slide_duration:
|
||||
def __get__(self):
|
||||
return elm_label_slide_duration_get(self.obj)
|
||||
def __set__(self, duration):
|
||||
elm_label_slide_duration_set(self.obj, duration)
|
||||
|
||||
def callback_language_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("language,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_language_changed_del(self, func):
|
||||
self._callback_del("language,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_label", Label)
|
|
@ -0,0 +1,45 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Layout(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_layout_add(parent.obj))
|
||||
|
||||
def content_set(self, swallow, evasObject content):
|
||||
cdef Evas_Object *o
|
||||
if content is not None:
|
||||
o = content.obj
|
||||
else:
|
||||
o = NULL
|
||||
elm_layout_content_set(self.obj, _cfruni(swallow), o)
|
||||
|
||||
def content_get(self, swallow):
|
||||
return object_from_instance(elm_layout_content_get(self.obj, _cfruni(swallow)))
|
||||
|
||||
def content_unset(self, swallow):
|
||||
return object_from_instance(elm_layout_content_unset(self.obj, _cfruni(swallow)))
|
||||
|
||||
def text_set(self, part, text):
|
||||
elm_layout_text_set(self.obj, _cfruni(part), _cfruni(text))
|
||||
|
||||
def text_get(self, part):
|
||||
return _ctouni(elm_layout_text_get(self.obj, _cfruni(part)))
|
||||
|
||||
|
||||
_object_mapping_register("elm_layout", Layout)
|
|
@ -0,0 +1,139 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class LayoutClass(Object):
|
||||
|
||||
def file_set(self, filename, group):
|
||||
return bool(elm_layout_file_set(self.obj, _cfruni(filename), _cfruni(group)))
|
||||
|
||||
property file:
|
||||
def __set__(self, value):
|
||||
filename, group = value
|
||||
# TODO: check return value
|
||||
elm_layout_file_set(self.obj, _cfruni(filename), _cfruni(group))
|
||||
|
||||
def theme_set(self, clas, group, style):
|
||||
return bool(elm_layout_theme_set(self.obj, _cfruni(clas), _cfruni(group), _cfruni(style)))
|
||||
|
||||
property theme:
|
||||
def __set__(self, theme):
|
||||
clas, group, style = theme
|
||||
# TODO: check return value
|
||||
elm_layout_theme_set(self.obj, _cfruni(clas), _cfruni(group), _cfruni(style))
|
||||
|
||||
def signal_emit(self, emission, source):
|
||||
elm_layout_signal_emit(self.obj, _cfruni(emission), _cfruni(source))
|
||||
|
||||
#def signal_callback_add(self, emission, source, func, data):
|
||||
#elm_layout_signal_callback_add(self.obj, _cfruni(emission), _cfruni(source), Edje_Signal_Cb func, voiddata)
|
||||
|
||||
#def signal_callback_del(self, emission, source, func):
|
||||
#elm_layout_signal_callback_del(self.obj, _cfruni(emission), _cfruni(source), Edje_Signal_Cb func)
|
||||
|
||||
def box_append(self, part, evasObject child):
|
||||
return bool(elm_layout_box_append(self.obj, _cfruni(part), child.obj))
|
||||
|
||||
def box_prepend(self, part, evasObject child):
|
||||
return bool(elm_layout_box_prepend(self.obj, _cfruni(part), child.obj))
|
||||
|
||||
def box_insert_before(self, part, evasObject child, evasObject reference):
|
||||
return bool(elm_layout_box_insert_before(self.obj, _cfruni(part), child.obj, reference.obj))
|
||||
|
||||
def box_insert_at(self, part, evasObject child, pos):
|
||||
return bool(elm_layout_box_insert_at(self.obj, _cfruni(part), child.obj, pos))
|
||||
|
||||
def box_remove(self, part, evasObject child):
|
||||
return object_from_instance(elm_layout_box_remove(self.obj, _cfruni(part), child.obj))
|
||||
|
||||
def box_remove_all(self, part, clear):
|
||||
return bool(elm_layout_box_remove_all(self.obj, _cfruni(part), clear))
|
||||
|
||||
def table_pack(self, part, evasObject child_obj, col, row, colspan, rowspan):
|
||||
return bool(elm_layout_table_pack(self.obj, _cfruni(part), child_obj.obj, col, row, colspan, rowspan))
|
||||
|
||||
def table_unpack(self, part, evasObject child_obj):
|
||||
return object_from_instance(elm_layout_table_unpack(self.obj, _cfruni(part), child_obj.obj))
|
||||
|
||||
def table_clear(self, part, clear):
|
||||
return bool(elm_layout_table_clear(self.obj, _cfruni(part), clear))
|
||||
|
||||
def edje_get(self):
|
||||
return object_from_instance(elm_layout_edje_get(self.obj))
|
||||
|
||||
property edje:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_layout_edje_get(self.obj))
|
||||
|
||||
def data_get(self, key):
|
||||
return _ctouni(elm_layout_data_get(self.obj, _cfruni(key)))
|
||||
|
||||
def sizing_eval(self):
|
||||
elm_layout_sizing_eval(self.obj)
|
||||
|
||||
def part_cursor_set(self, part_name, cursor):
|
||||
return bool(elm_layout_part_cursor_set(self.obj, _cfruni(part_name), _cfruni(cursor)))
|
||||
|
||||
def part_cursor_get(self, part_name):
|
||||
return _ctouni(elm_layout_part_cursor_get(self.obj, _cfruni(part_name)))
|
||||
|
||||
def part_cursor_unset(self, part_name):
|
||||
return bool(elm_layout_part_cursor_unset(self.obj, _cfruni(part_name)))
|
||||
|
||||
def part_cursor_style_set(self, part_name, style):
|
||||
return bool(elm_layout_part_cursor_style_set(self.obj, _cfruni(part_name), _cfruni(style)))
|
||||
|
||||
def part_cursor_style_get(self, part_name):
|
||||
return _ctouni(elm_layout_part_cursor_style_get(self.obj, _cfruni(part_name)))
|
||||
|
||||
def part_cursor_engine_only_set(self, part_name, engine_only):
|
||||
return bool(elm_layout_part_cursor_engine_only_set(self.obj, _cfruni(part_name), engine_only))
|
||||
|
||||
def part_cursor_engine_only_get(self, part_name):
|
||||
return bool(elm_layout_part_cursor_engine_only_get(self.obj, _cfruni(part_name)))
|
||||
|
||||
def icon_set(self, evasObject icon):
|
||||
elm_layout_icon_set(self.obj, icon.obj if icon else NULL)
|
||||
|
||||
def icon_get(self):
|
||||
return object_from_instance(elm_layout_icon_get(self.obj))
|
||||
|
||||
property icon:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_layout_icon_get(self.obj))
|
||||
|
||||
def __set__(self, evasObject icon):
|
||||
elm_layout_icon_set(self.obj, icon.obj if icon else NULL)
|
||||
|
||||
def end_set(self, evasObject end):
|
||||
elm_layout_end_set(self.obj, end.obj if end else NULL)
|
||||
|
||||
def end_get(self):
|
||||
return object_from_instance(elm_layout_end_get(self.obj))
|
||||
|
||||
property end:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_layout_end_get(self.obj))
|
||||
|
||||
def __set__(self, evasObject end):
|
||||
elm_layout_end_set(self.obj, end.obj if end else NULL)
|
||||
|
||||
def callback_theme_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("theme,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_theme_changed_del(self, func):
|
||||
self._callback_del("theme,changed", func)
|
|
@ -0,0 +1,381 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef enum Elm_List_Item_Insert_Kind:
|
||||
ELM_LIST_ITEM_INSERT_APPEND
|
||||
ELM_LIST_ITEM_INSERT_PREPEND
|
||||
ELM_LIST_ITEM_INSERT_BEFORE
|
||||
ELM_LIST_ITEM_INSERT_AFTER
|
||||
ELM_LIST_ITEM_INSERT_SORTED
|
||||
|
||||
cdef class ListItem(ObjectItem):
|
||||
|
||||
def __init__(self, kind, evasObject list, label, evasObject icon = None,
|
||||
evasObject end = None, ListItem before_after = None,
|
||||
callback = None, *args, **kargs):
|
||||
|
||||
cdef Evas_Object* icon_obj = NULL
|
||||
cdef Evas_Object* end_obj = NULL
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if icon is not None:
|
||||
icon_obj = icon.obj
|
||||
if end is not None:
|
||||
end_obj = end.obj
|
||||
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
|
||||
if kind == ELM_LIST_ITEM_INSERT_APPEND:
|
||||
item = elm_list_item_append( list.obj,
|
||||
_cfruni(label),
|
||||
icon_obj,
|
||||
end_obj,
|
||||
cb,
|
||||
<void*>self)
|
||||
|
||||
elif kind == ELM_LIST_ITEM_INSERT_PREPEND:
|
||||
item = elm_list_item_prepend( list.obj,
|
||||
_cfruni(label),
|
||||
icon_obj,
|
||||
end_obj,
|
||||
cb,
|
||||
<void*>self)
|
||||
|
||||
#elif kind == ELM_LIST_ITEM_INSERT_SORTED:
|
||||
#item = elm_list_item_sorted_insert( list.obj,
|
||||
#_cfruni(label),
|
||||
#icon_obj,
|
||||
#end_obj,
|
||||
#cb,
|
||||
#<void*>self,
|
||||
#cmp_f)
|
||||
|
||||
else:
|
||||
if before_after == None:
|
||||
raise ValueError("need a valid after object to add an item before/after another item")
|
||||
|
||||
if kind == ELM_LIST_ITEM_INSERT_BEFORE:
|
||||
item = elm_list_item_insert_before(list.obj,
|
||||
before_after.item,
|
||||
_cfruni(label),
|
||||
icon_obj,
|
||||
end_obj,
|
||||
cb,
|
||||
<void*>self)
|
||||
|
||||
else:
|
||||
item = elm_list_item_insert_after( list.obj,
|
||||
before_after.item,
|
||||
_cfruni(label),
|
||||
icon_obj,
|
||||
end_obj,
|
||||
cb,
|
||||
<void*>self)
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def __str__(self):
|
||||
return ("%s(label=%r, icon=%s, end=%s, "
|
||||
"callback=%r, args=%r, kargs=%s)") % \
|
||||
(self.__class__.__name__, self.text_get(), bool(self.part_content_get("icon")),
|
||||
bool(self.part_content_get("end")), self.params[0], self.params[1], self.params[2])
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
"label=%r, icon=%s, end=%s, "
|
||||
"callback=%r, args=%r, kargs=%s)") % \
|
||||
(self.__class__.__name__, <unsigned long><void *>self,
|
||||
PY_REFCOUNT(self), <unsigned long><void *>self.item,
|
||||
self.text_get(), bool(self.part_content_get("icon")),
|
||||
bool(self.part_content_get("end")), self.params[0], self.params[1], self.params[2])
|
||||
|
||||
def selected_set(self, selected):
|
||||
elm_list_item_selected_set(self.item, selected)
|
||||
|
||||
def selected_get(self):
|
||||
return bool(elm_list_item_selected_get(self.item))
|
||||
|
||||
property selected:
|
||||
def __get__(self):
|
||||
return bool(elm_list_item_selected_get(self.item))
|
||||
|
||||
def __set__(self, selected):
|
||||
elm_list_item_selected_set(self.item, selected)
|
||||
|
||||
def separator_set(self, separator):
|
||||
elm_list_item_separator_set(self.item, separator)
|
||||
|
||||
def separator_get(self):
|
||||
return bool(elm_list_item_separator_get(self.item))
|
||||
|
||||
property separator:
|
||||
def __get__(self):
|
||||
return bool(elm_list_item_separator_get(self.item))
|
||||
|
||||
def __set__(self, separator):
|
||||
elm_list_item_separator_set(self.item, separator)
|
||||
|
||||
def show(self):
|
||||
elm_list_item_show(self.item)
|
||||
|
||||
def bring_in(self):
|
||||
elm_list_item_bring_in(self.item)
|
||||
|
||||
def object_get(self):
|
||||
return object_from_instance(elm_list_item_object_get(self.item))
|
||||
|
||||
property object:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_list_item_object_get(self.item))
|
||||
|
||||
def prev_get(self):
|
||||
return _object_item_to_python(elm_list_item_prev(self.item))
|
||||
|
||||
property prev:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_list_item_prev(self.item))
|
||||
|
||||
def next_get(self):
|
||||
return _object_item_to_python(elm_list_item_next(self.item))
|
||||
|
||||
property next:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_list_item_next(self.item))
|
||||
|
||||
cdef class List(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_list_add(parent.obj))
|
||||
|
||||
def go(self):
|
||||
elm_list_go(self.obj)
|
||||
|
||||
def multi_select_set(self, multi):
|
||||
elm_list_multi_select_set(self.obj, multi)
|
||||
|
||||
def multi_select_get(self):
|
||||
return bool(elm_list_multi_select_get(self.obj))
|
||||
|
||||
property multi_select:
|
||||
def __get__(self):
|
||||
return elm_list_multi_select_get(self.obj)
|
||||
|
||||
def __set__(self, multi):
|
||||
elm_list_multi_select_set(self.obj, multi)
|
||||
|
||||
def mode_set(self, Elm_List_Mode mode):
|
||||
elm_list_mode_set(self.obj, mode)
|
||||
|
||||
def mode_get(self):
|
||||
return elm_list_mode_get(self.obj)
|
||||
|
||||
property mode:
|
||||
def __get__(self):
|
||||
return elm_list_mode_get(self.obj)
|
||||
|
||||
def __set__(self, Elm_List_Mode mode):
|
||||
elm_list_mode_set(self.obj, mode)
|
||||
|
||||
property horizontal:
|
||||
def __get__(self):
|
||||
return elm_list_horizontal_get(self.obj)
|
||||
|
||||
def __set__(self, horizontal):
|
||||
elm_list_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def select_mode_set(self, mode):
|
||||
elm_list_select_mode_set(self.obj, mode)
|
||||
|
||||
def select_mode_get(self):
|
||||
return elm_list_select_mode_get(self.obj)
|
||||
|
||||
property select_mode:
|
||||
def __set__(self, mode):
|
||||
elm_list_select_mode_set(self.obj, mode)
|
||||
|
||||
def __get__(self):
|
||||
return elm_list_select_mode_get(self.obj)
|
||||
|
||||
def bounce_set(self, h, v):
|
||||
elm_scroller_bounce_set(self.obj, h, v)
|
||||
|
||||
def bounce_get(self):
|
||||
cdef Eina_Bool h, v
|
||||
elm_scroller_bounce_get(self.obj, &h, &v)
|
||||
return (h, v)
|
||||
|
||||
property bounce:
|
||||
def __set__(self, value):
|
||||
h, v = value
|
||||
elm_scroller_bounce_set(self.obj, h, v)
|
||||
|
||||
def scroller_policy_set(self, policy_h, policy_v):
|
||||
elm_scroller_policy_set(self.obj, policy_h, policy_v)
|
||||
|
||||
def scroller_policy_get(self):
|
||||
cdef Elm_Scroller_Policy policy_h, policy_v
|
||||
elm_scroller_policy_get(self.obj, &policy_h, &policy_v)
|
||||
return (policy_h, policy_v)
|
||||
|
||||
property scroller_policy:
|
||||
def __set__(self, value):
|
||||
policy_h, policy_v = value
|
||||
elm_scroller_policy_set(self.obj, policy_h, policy_v)
|
||||
|
||||
def __get__(self):
|
||||
cdef Elm_Scroller_Policy policy_h, policy_v
|
||||
elm_scroller_policy_get(self.obj, &policy_h, &policy_v)
|
||||
return (policy_h, policy_v)
|
||||
|
||||
def item_append(self, label, evasObject icon = None,
|
||||
evasObject end = None, callback = None, *args, **kargs):
|
||||
return ListItem(ELM_LIST_ITEM_INSERT_APPEND, self, label, icon, end,
|
||||
None, callback, *args, **kargs)
|
||||
|
||||
def item_prepend(self, label, evasObject icon = None,
|
||||
evasObject end = None, callback = None, *args, **kargs):
|
||||
return ListItem(ELM_LIST_ITEM_INSERT_PREPEND, self, label, icon, end,
|
||||
None, callback, *args, **kargs)
|
||||
|
||||
def item_insert_before(self, ListItem before, label, evasObject icon = None,
|
||||
evasObject end = None, callback = None, *args, **kargs):
|
||||
return ListItem(ELM_LIST_ITEM_INSERT_BEFORE, self, label, icon, end,
|
||||
before, callback, *args, **kargs)
|
||||
|
||||
def item_insert_after(self, ListItem after, label, evasObject icon = None,
|
||||
evasObject end = None, callback = None, *args, **kargs):
|
||||
return ListItem(ELM_LIST_ITEM_INSERT_AFTER, self, label, icon, end,
|
||||
after, callback, *args, **kargs)
|
||||
|
||||
#def item_sorted_insert(self, label, evasObject icon = None,
|
||||
#evasObject end = None, callback = None, cmp_func=None, *args, **kargs):
|
||||
#return ListItem(ELM_LIST_ITEM_INSERT_SORTED, self, label, icon, end,
|
||||
#None, callback, *args, **kargs)
|
||||
|
||||
def clear(self):
|
||||
elm_list_clear(self.obj)
|
||||
|
||||
def items_get(self):
|
||||
return _object_item_list_to_python(elm_list_items_get(self.obj))
|
||||
|
||||
property items:
|
||||
def __get__(self):
|
||||
return _object_item_list_to_python(elm_list_items_get(self.obj))
|
||||
|
||||
def selected_item_get(self):
|
||||
return _object_item_to_python(elm_list_selected_item_get(self.obj))
|
||||
|
||||
property selected_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_list_selected_item_get(self.obj))
|
||||
|
||||
def selected_items_get(self):
|
||||
return _object_item_list_to_python(elm_list_selected_items_get(self.obj))
|
||||
|
||||
property selected_items:
|
||||
def __get__(self):
|
||||
return _object_item_list_to_python(elm_list_selected_items_get(self.obj))
|
||||
|
||||
def first_item_get(self):
|
||||
return _object_item_to_python(elm_list_first_item_get(self.obj))
|
||||
|
||||
property first_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_list_first_item_get(self.obj))
|
||||
|
||||
def last_item_get(self):
|
||||
return _object_item_to_python(elm_list_last_item_get(self.obj))
|
||||
|
||||
property last_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_list_last_item_get(self.obj))
|
||||
|
||||
def callback_activated_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("activated", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_activated_del(self, func):
|
||||
self._callback_del_full("activated", _cb_object_item_conv, func)
|
||||
|
||||
def callback_clicked_double_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("clicked,double", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_double_del(self, func):
|
||||
self._callback_del_full("clicked,double", _cb_object_item_conv, func)
|
||||
|
||||
def callback_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("selected", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_selected_del(self, func):
|
||||
self._callback_del_full("selected", _cb_object_item_conv, func)
|
||||
|
||||
def callback_unselected_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("unselected", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_unselected_del(self, func):
|
||||
self._callback_del_full("unselected", _cb_object_item_conv, func)
|
||||
|
||||
def callback_longpressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("longpressed", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_longpressed_del(self, func):
|
||||
self._callback_del_full("longpressed", _cb_object_item_conv, func)
|
||||
|
||||
def callback_edge_top_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,top", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_top_del(self, func):
|
||||
self._callback_del("edge,top", func)
|
||||
|
||||
def callback_edge_bottom_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,bottom", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_bottom_del(self, func):
|
||||
self._callback_del("edge,bottom", func)
|
||||
|
||||
def callback_edge_left_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,left", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_left_del(self, func):
|
||||
self._callback_del("edge,left", func)
|
||||
|
||||
def callback_edge_right_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,right", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_right_del(self, func):
|
||||
self._callback_del("edge,right", func)
|
||||
|
||||
def callback_language_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("language,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_language_changed_del(self, func):
|
||||
self._callback_del("language,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_list", List)
|
|
@ -0,0 +1,790 @@
|
|||
# Copyright (c) 2012 Davide Andreoli <dave@gurumeditation.it>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef _elm_map_overlay_to_python(Elm_Map_Overlay *ov):
|
||||
cdef void *data
|
||||
|
||||
if ov == NULL:
|
||||
return None
|
||||
data = elm_map_overlay_data_get(ov)
|
||||
if data == NULL:
|
||||
return None
|
||||
return <object>data
|
||||
|
||||
cdef void _map_overlay_get_callback(void *data, Evas_Object *map, Elm_Map_Overlay *overlay) with gil:
|
||||
cdef Object obj
|
||||
|
||||
# obj = <Object>evas_object_data_get(map, "python-evas")
|
||||
obj = object_from_instance(map)
|
||||
try:
|
||||
(func, args, kwargs) = <object>data
|
||||
func(obj, _elm_map_overlay_to_python(overlay), *args, **kwargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
cdef void _map_overlay_del_cb(void *data, Evas_Object *map, Elm_Map_Overlay *overlay) with gil:
|
||||
ov = <object>data
|
||||
ov.__del_cb()
|
||||
|
||||
cdef void _map_route_callback(void *data, Evas_Object *map, Elm_Map_Route *route) with gil:
|
||||
cdef Object obj
|
||||
|
||||
# obj = <Object>evas_object_data_get(map, "python-evas")
|
||||
obj = object_from_instance(map)
|
||||
(proute, func, args, kwargs) = <object>data
|
||||
try:
|
||||
func(obj, proute, *args, **kwargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
Py_DECREF(<object>data)
|
||||
|
||||
cdef void _map_name_callback(void *data, Evas_Object *map, Elm_Map_Name *name) with gil:
|
||||
cdef Object obj
|
||||
|
||||
# obj = <Object>evas_object_data_get(map, "python-evas")
|
||||
obj = object_from_instance(map)
|
||||
(pname, func, args, kwargs) = <object>data
|
||||
try:
|
||||
func(obj, pname, *args, **kwargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
Py_DECREF(<object>data)
|
||||
|
||||
|
||||
cdef class MapRoute(object):
|
||||
cdef Elm_Map_Route *route
|
||||
|
||||
def __cinit__(self):
|
||||
self.route = NULL
|
||||
|
||||
def __init__(self, evasObject map,
|
||||
Elm_Map_Route_Type type, Elm_Map_Route_Method method,
|
||||
double flon, double flat, double tlon, double tlat,
|
||||
func, *args, **kwargs):
|
||||
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
|
||||
data = (self, func, args, kwargs)
|
||||
self.route = elm_map_route_add(map.obj, type, method,
|
||||
flon, flat, tlon, tlat,
|
||||
_map_route_callback, <void *>data)
|
||||
Py_INCREF(data)
|
||||
Py_INCREF(self)
|
||||
|
||||
def delete(self):
|
||||
elm_map_route_del(self.route)
|
||||
self.route = NULL
|
||||
Py_DECREF(self)
|
||||
|
||||
def distance_get(self):
|
||||
return elm_map_route_distance_get(self.route)
|
||||
|
||||
property distance:
|
||||
def __get__(self):
|
||||
return self.distance_get()
|
||||
|
||||
def node_get(self):
|
||||
return elm_map_route_node_get(self.route)
|
||||
|
||||
property node:
|
||||
def __get__(self):
|
||||
return self.node_get()
|
||||
|
||||
def waypoint_get(self):
|
||||
return elm_map_route_waypoint_get(self.route)
|
||||
|
||||
property waypoint:
|
||||
def __get__(self):
|
||||
return self.waypoint_get()
|
||||
|
||||
|
||||
cdef class MapName(object):
|
||||
cdef Elm_Map_Name *name
|
||||
|
||||
def __cinit__(self):
|
||||
self.name = NULL
|
||||
|
||||
def __init__(self, evasObject map, address, double lon, double lat,
|
||||
func, *args, **kwargs):
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
|
||||
data = (self, func, args, kwargs)
|
||||
if address:
|
||||
self.name = elm_map_name_add(map.obj, address, lon, lat,
|
||||
_map_name_callback, <void *>data)
|
||||
else:
|
||||
self.name = elm_map_name_add(map.obj, NULL, lon, lat,
|
||||
_map_name_callback, <void *>data)
|
||||
Py_INCREF(data)
|
||||
Py_INCREF(self)
|
||||
|
||||
def delete(self):
|
||||
elm_map_name_del(self.name)
|
||||
self.name = NULL
|
||||
Py_DECREF(self)
|
||||
|
||||
def address_get(self):
|
||||
return _ctouni(elm_map_name_address_get(self.name))
|
||||
|
||||
property address:
|
||||
def __get__(self):
|
||||
return self.address_get()
|
||||
|
||||
def region_get(self):
|
||||
cdef double lon, lat
|
||||
|
||||
elm_map_name_region_get(self.name, &lon, &lat)
|
||||
return (lon, lat)
|
||||
|
||||
property region:
|
||||
def __get__(self):
|
||||
return self.region_get()
|
||||
|
||||
|
||||
cdef class MapOverlay(object):
|
||||
cdef Elm_Map_Overlay *overlay
|
||||
cdef void* cb_get_data
|
||||
|
||||
def __cinit__(self):
|
||||
self.overlay = NULL
|
||||
self.cb_get_data = NULL
|
||||
|
||||
def __init__(self, evasObject Map, double lon, double lat):
|
||||
self.overlay = elm_map_overlay_add(Map.obj, lon, lat)
|
||||
elm_map_overlay_data_set(self.overlay, <void *>self)
|
||||
elm_map_overlay_del_cb_set(self.overlay, _map_overlay_del_cb, <void *>self)
|
||||
Py_INCREF(self)
|
||||
|
||||
def __del_cb(self):
|
||||
self.overlay = NULL
|
||||
Py_DECREF(self)
|
||||
|
||||
def delete(self):
|
||||
if self.overlay == NULL:
|
||||
raise ValueError("Object already deleted")
|
||||
elm_map_overlay_del(self.overlay)
|
||||
|
||||
def type_get(self):
|
||||
return elm_map_overlay_type_get(self.overlay)
|
||||
|
||||
property type:
|
||||
def __get__(self):
|
||||
return self.type_get()
|
||||
|
||||
def hide_set(self, hide):
|
||||
elm_map_overlay_hide_set(self.overlay, bool(hide))
|
||||
|
||||
def hide_get(self):
|
||||
return bool(elm_map_overlay_hide_get(self.overlay))
|
||||
|
||||
property hide:
|
||||
def __get__(self):
|
||||
return self.hide_get()
|
||||
def __set__(self, value):
|
||||
self.hide_set(value)
|
||||
|
||||
def displayed_zoom_min_set(self, zoom):
|
||||
elm_map_overlay_displayed_zoom_min_set(self.overlay, zoom)
|
||||
|
||||
def displayed_zoom_min_get(self):
|
||||
return elm_map_overlay_displayed_zoom_min_get(self.overlay)
|
||||
|
||||
property displayed_zoom_min:
|
||||
def __get__(self):
|
||||
return self.displayed_zoom_min_get()
|
||||
def __set__(self, value):
|
||||
self.displayed_zoom_min_set(value)
|
||||
|
||||
def paused_set(self, paused):
|
||||
elm_map_overlay_paused_set(self.overlay, paused)
|
||||
|
||||
def paused_get(self):
|
||||
return elm_map_overlay_paused_get(self.overlay)
|
||||
|
||||
property paused:
|
||||
def __get__(self):
|
||||
return self.paused_get()
|
||||
def __set__(self, value):
|
||||
self.paused_set(value)
|
||||
|
||||
def visible_get(self):
|
||||
return bool(elm_map_overlay_visible_get(self.overlay))
|
||||
|
||||
property visible:
|
||||
def __get__(self):
|
||||
return self.visible_get()
|
||||
|
||||
def content_set(self, Object content):
|
||||
elm_map_overlay_content_set(self.overlay, content.obj)
|
||||
|
||||
def content_get(self):
|
||||
return object_from_instance(elm_map_overlay_content_get(self.overlay))
|
||||
|
||||
property content:
|
||||
def __get__(self):
|
||||
return self.content_get()
|
||||
def __set__(self, value):
|
||||
self.content_set(value)
|
||||
|
||||
def icon_set(self, Object icon):
|
||||
elm_map_overlay_icon_set(self.overlay, icon.obj)
|
||||
|
||||
def icon_get(self):
|
||||
return object_from_instance(elm_map_overlay_icon_get(self.overlay))
|
||||
|
||||
property icon:
|
||||
def __get__(self):
|
||||
return self.icon_get()
|
||||
def __set__(self, value):
|
||||
self.icon_set(value)
|
||||
|
||||
def region_set(self, lon, lat):
|
||||
elm_map_overlay_region_set(self.overlay, lon, lat)
|
||||
|
||||
def region_get(self):
|
||||
cdef double lon, lat
|
||||
elm_map_overlay_region_get(self.overlay, &lon, &lat)
|
||||
return (lon, lat)
|
||||
|
||||
property region:
|
||||
def __get__(self):
|
||||
return self.region_get()
|
||||
def __set__(self, value):
|
||||
self.region_set(*value)
|
||||
|
||||
def color_set(self, r, g, b, a):
|
||||
elm_map_overlay_color_set(self.overlay, r, g, b, a)
|
||||
|
||||
def color_get(self):
|
||||
cdef int r, g, b, a
|
||||
elm_map_overlay_color_get(self.overlay, &r, &g, &b, &a)
|
||||
return (r, g, b, a)
|
||||
|
||||
property color:
|
||||
def __get__(self):
|
||||
return self.color_get()
|
||||
def __set__(self, value):
|
||||
self.color_set(*value)
|
||||
|
||||
def show(self):
|
||||
elm_map_overlay_show(self.overlay)
|
||||
|
||||
def callback_clicked_set(self, func, *args, **kwargs):
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
cb_data = (func, args, kwargs)
|
||||
elm_map_overlay_get_cb_set(self.overlay, _map_overlay_get_callback,
|
||||
<void *>cb_data)
|
||||
Py_INCREF(cb_data)
|
||||
self.cb_get_data
|
||||
|
||||
def callback_clicked_unset(self, func):
|
||||
elm_map_overlay_get_cb_set(self.overlay, NULL, NULL)
|
||||
cb_data = <object>self.cb_get_data
|
||||
self.cb_get_data = NULL
|
||||
Py_DECREF(cb_data)
|
||||
|
||||
|
||||
cdef class MapOverlayClass(MapOverlay):
|
||||
|
||||
def __init__(self, evasObject Map):
|
||||
self.overlay = elm_map_overlay_class_add(Map.obj)
|
||||
elm_map_overlay_data_set(self.overlay, <void *>self)
|
||||
elm_map_overlay_del_cb_set(self.overlay, _map_overlay_del_cb, <void *>self)
|
||||
Py_INCREF(self)
|
||||
|
||||
def append(self, MapOverlay overlay):
|
||||
elm_map_overlay_class_append(self.overlay, overlay.overlay)
|
||||
|
||||
def remove(self, MapOverlay overlay):
|
||||
elm_map_overlay_class_remove(self.overlay, overlay.overlay)
|
||||
|
||||
def zoom_max_set(self, zoom):
|
||||
elm_map_overlay_class_zoom_max_set(self.overlay, zoom)
|
||||
|
||||
def zoom_max_get(self):
|
||||
return elm_map_overlay_class_zoom_max_get(self.overlay)
|
||||
|
||||
property zoom_max:
|
||||
def __get__(self):
|
||||
return self.zoom_max_get()
|
||||
def __set__(self, value):
|
||||
self.zoom_max_set(value)
|
||||
|
||||
def members_get(self):
|
||||
cdef Eina_List *lst
|
||||
cdef Elm_Map_Overlay *ov
|
||||
lst = elm_map_overlay_group_members_get(self.overlay)# TODO this is somehow wrong... group <> class
|
||||
|
||||
ret = []
|
||||
ret_append = ret.append
|
||||
while lst:
|
||||
ov = <Elm_Map_Overlay *>lst.data
|
||||
lst = lst.next
|
||||
o = _elm_map_overlay_to_python(ov)
|
||||
if o is not None:
|
||||
ret_append(o)
|
||||
return ret
|
||||
|
||||
property members:
|
||||
def __get__(self):
|
||||
return self.members_get()
|
||||
|
||||
|
||||
cdef class MapOverlayBubble(MapOverlay):
|
||||
|
||||
def __init__(self, evasObject Map):
|
||||
self.overlay = elm_map_overlay_bubble_add(Map.obj)
|
||||
elm_map_overlay_data_set(self.overlay, <void *>self)
|
||||
elm_map_overlay_del_cb_set(self.overlay, _map_overlay_del_cb, <void *>self)
|
||||
Py_INCREF(self)
|
||||
|
||||
def follow(self, MapOverlay overlay):
|
||||
elm_map_overlay_bubble_follow(self.overlay, overlay.overlay)
|
||||
|
||||
def content_append(self, evasObject content):
|
||||
elm_map_overlay_bubble_content_append(self.overlay, content.obj)
|
||||
|
||||
def content_clear(self):
|
||||
elm_map_overlay_bubble_content_clear(self.overlay)
|
||||
|
||||
|
||||
cdef class MapOverlayLine(MapOverlay):
|
||||
|
||||
def __init__(self, evasObject Map, flon, flat, tlot, tlat):
|
||||
self.overlay = elm_map_overlay_line_add(Map.obj, flon, flat, tlot, tlat)
|
||||
elm_map_overlay_data_set(self.overlay, <void *>self)
|
||||
elm_map_overlay_del_cb_set(self.overlay, _map_overlay_del_cb, <void *>self)
|
||||
Py_INCREF(self)
|
||||
|
||||
|
||||
cdef class MapOverlayPolygon(MapOverlay):
|
||||
|
||||
def __init__(self, evasObject Map):
|
||||
self.overlay = elm_map_overlay_polygon_add(Map.obj)
|
||||
elm_map_overlay_data_set(self.overlay, <void *>self)
|
||||
elm_map_overlay_del_cb_set(self.overlay, _map_overlay_del_cb, <void *>self)
|
||||
Py_INCREF(self)
|
||||
|
||||
def region_add(self, lon, lat):
|
||||
elm_map_overlay_polygon_region_add(self.overlay, lon, lat)
|
||||
|
||||
|
||||
cdef class MapOverlayCircle(MapOverlay):
|
||||
|
||||
def __init__(self, evasObject Map, lon, lat, radius):
|
||||
self.overlay = elm_map_overlay_circle_add(Map.obj, lon, lat, radius)
|
||||
elm_map_overlay_data_set(self.overlay, <void *>self)
|
||||
elm_map_overlay_del_cb_set(self.overlay, _map_overlay_del_cb, <void *>self)
|
||||
Py_INCREF(self)
|
||||
|
||||
|
||||
cdef class MapOverlayScale(MapOverlay):
|
||||
|
||||
def __init__(self, evasObject Map, x, y):
|
||||
self.overlay = elm_map_overlay_scale_add(Map.obj, x, y)
|
||||
elm_map_overlay_data_set(self.overlay, <void *>self)
|
||||
elm_map_overlay_del_cb_set(self.overlay, _map_overlay_del_cb, <void *>self)
|
||||
Py_INCREF(self)
|
||||
|
||||
|
||||
cdef class MapOverlayRoute(MapOverlay):
|
||||
|
||||
def __init__(self, evasObject Map, MapRoute route):
|
||||
self.overlay = elm_map_overlay_route_add(Map.obj, route.route)
|
||||
elm_map_overlay_data_set(self.overlay, <void *>self)
|
||||
elm_map_overlay_del_cb_set(self.overlay, _map_overlay_del_cb, <void *>self)
|
||||
Py_INCREF(self)
|
||||
|
||||
|
||||
cdef class Map(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
# Object.__init__(self, parent.evas)
|
||||
self._set_obj(elm_map_add(parent.obj))
|
||||
|
||||
def zoom_set(self, zoom):
|
||||
elm_map_zoom_set(self.obj, zoom)
|
||||
|
||||
def zoom_get(self):
|
||||
return elm_map_zoom_get(self.obj)
|
||||
|
||||
property zoom:
|
||||
def __get__(self):
|
||||
return self.zoom_get()
|
||||
def __set__(self, value):
|
||||
self.zoom_set(value)
|
||||
|
||||
def zoom_mode_set(self, mode):
|
||||
elm_map_zoom_mode_set(self.obj, mode)
|
||||
|
||||
def zoom_mode_get(self):
|
||||
return elm_map_zoom_mode_get(self.obj)
|
||||
|
||||
property zoom_mode:
|
||||
def __get__(self):
|
||||
return self.zoom_mode_get()
|
||||
def __set__(self, value):
|
||||
self.zoom_mode_set(value)
|
||||
|
||||
def zoom_min_set(self, zoom):
|
||||
elm_map_zoom_min_set(self.obj, zoom)
|
||||
|
||||
def zoom_min_get(self):
|
||||
return elm_map_zoom_min_get(self.obj)
|
||||
|
||||
property zoom_min:
|
||||
def __get__(self):
|
||||
return self.zoom_min_get()
|
||||
def __set__(self, value):
|
||||
self.zoom_min_set(value)
|
||||
|
||||
def zoom_max_set(self, zoom):
|
||||
elm_map_zoom_max_set(self.obj, zoom)
|
||||
|
||||
def zoom_max_get(self):
|
||||
return elm_map_zoom_max_get(self.obj)
|
||||
|
||||
property zoom_max:
|
||||
def __get__(self):
|
||||
return self.zoom_max_get()
|
||||
def __set__(self, value):
|
||||
self.zoom_max_set(value)
|
||||
|
||||
def region_get(self):
|
||||
cdef double lon, lat
|
||||
elm_map_region_get(self.obj, &lon, &lat)
|
||||
return (lon, lat)
|
||||
|
||||
property region:
|
||||
def __get__(self):
|
||||
return self.region_get()
|
||||
|
||||
def region_bring_in(self, lon, lat):
|
||||
elm_map_region_bring_in(self.obj, lon, lat)
|
||||
|
||||
def region_show(self, lon, lat):
|
||||
elm_map_region_show(self.obj, lon, lat)
|
||||
|
||||
def canvas_to_region_convert(self, x, y):
|
||||
cdef double lon, lat
|
||||
elm_map_canvas_to_region_convert(self.obj, x, y, &lon, &lat)
|
||||
return (lon, lat)
|
||||
|
||||
def region_to_canvas_convert(self, lon, lat):
|
||||
cdef Evas_Coord x, y
|
||||
elm_map_region_to_canvas_convert(self.obj, lon, lat, &x, &y)
|
||||
return (x, y)
|
||||
|
||||
def paused_set(self, paused):
|
||||
elm_map_paused_set(self.obj, bool(paused))
|
||||
|
||||
def paused_get(self):
|
||||
return bool(elm_map_paused_get(self.obj))
|
||||
|
||||
property paused:
|
||||
def __get__(self):
|
||||
return self.paused_get()
|
||||
def __set__(self, value):
|
||||
self.paused_set(value)
|
||||
|
||||
def rotate_set(self, degree, cx, cy):
|
||||
elm_map_rotate_set(self.obj, degree, cx, cy)
|
||||
|
||||
def rotate_get(self):
|
||||
cdef double degree
|
||||
cdef Evas_Coord cx, cy
|
||||
elm_map_rotate_get(self.obj, °ree, &cx, &cy)
|
||||
return (degree, cx, cy)
|
||||
|
||||
property rotate:
|
||||
def __get__(self):
|
||||
return self.rotate_get()
|
||||
def __set__(self, value):
|
||||
self.rotate_set(*value)
|
||||
|
||||
def wheel_disabled_set(self, disabled):
|
||||
elm_map_wheel_disabled_set(self.obj, bool(disabled))
|
||||
|
||||
def wheel_disabled_get(self):
|
||||
return bool(elm_map_wheel_disabled_get(self.obj))
|
||||
|
||||
property wheel_disabled:
|
||||
def __get__(self):
|
||||
return self.wheel_disabled_get()
|
||||
def __set__(self, value):
|
||||
self.wheel_disabled_set(value)
|
||||
|
||||
def user_agent_set(self, user_agent):
|
||||
elm_map_user_agent_set(self.obj, user_agent)
|
||||
|
||||
def user_agent_get(self):
|
||||
return elm_map_user_agent_get(self.obj)
|
||||
|
||||
property user_agent:
|
||||
def __get__(self):
|
||||
return self.user_agent_get()
|
||||
def __set__(self, value):
|
||||
self.user_agent_set(value)
|
||||
|
||||
def overlay_add(self, lon, lat):
|
||||
return MapOverlay(self, lon, lat)
|
||||
|
||||
def overlays_get(self):
|
||||
cdef Eina_List *lst
|
||||
cdef Elm_Map_Overlay *ov
|
||||
lst = elm_map_overlays_get(self.obj)
|
||||
|
||||
ret = []
|
||||
ret_append = ret.append
|
||||
while lst:
|
||||
ov = <Elm_Map_Overlay *>lst.data
|
||||
lst = lst.next
|
||||
o = _elm_map_overlay_to_python(ov)
|
||||
if o is not None:
|
||||
ret_append(o)
|
||||
return ret
|
||||
|
||||
property overlays:
|
||||
def __get__(self):
|
||||
return self.overlays_get()
|
||||
|
||||
def overlays_show(self, overlays):
|
||||
cdef Eina_List *lst
|
||||
|
||||
lst = NULL
|
||||
for overlay in overlays:
|
||||
ov = <MapOverlay>overlay
|
||||
lst = eina_list_append(lst, ov.overlay)
|
||||
elm_map_overlays_show(lst)
|
||||
eina_list_free(lst)
|
||||
|
||||
def overlay_bubble_add(self):
|
||||
return MapOverlayBubble(self)
|
||||
|
||||
def overlay_line_add(self, flon, flat, tlon, tlat):
|
||||
return MapOverlayLine(self, flon, flat, tlon, tlat)
|
||||
|
||||
def overlay_polygon_add(self):
|
||||
return MapOverlayPolygon(self)
|
||||
|
||||
def overlay_circle_add(self, lon, lat, radius):
|
||||
return MapOverlayCircle(self, lon, lat, radius)
|
||||
|
||||
def overlay_scale_add(self, x, y):
|
||||
return MapOverlayScale(self, x, y)
|
||||
|
||||
def overlay_class_add(self):
|
||||
return MapOverlayClass(self)
|
||||
|
||||
def overlay_route_add(self, route):
|
||||
return MapOverlayRoute(self, route)
|
||||
|
||||
def tile_load_status_get(self):
|
||||
cdef int try_num, finish_num
|
||||
|
||||
elm_map_tile_load_status_get(self.obj, &try_num, &finish_num)
|
||||
return (try_num, finish_num)
|
||||
|
||||
property tile_load_status_get:
|
||||
def __get__(self):
|
||||
return self.tile_load_status_get_get()
|
||||
|
||||
def sources_get(self, type):
|
||||
cdef const_char_ptr *lst
|
||||
|
||||
i = 0
|
||||
ret = []
|
||||
lst = elm_map_sources_get(self.obj, type)
|
||||
while (lst[i]):
|
||||
ret.append(_ctouni(lst[i]))
|
||||
i += 1
|
||||
|
||||
return ret
|
||||
|
||||
def source_set(self, type, source_name):
|
||||
elm_map_source_set(self.obj, type, _cfruni(source_name))
|
||||
|
||||
def source_get(self, type):
|
||||
return _ctouni(elm_map_source_get(self.obj, type))
|
||||
|
||||
def route_add(self, Elm_Map_Route_Type type, Elm_Map_Route_Method method,
|
||||
double flon, double flat, double tlon, double tlat,
|
||||
route_cb, *args, **kwargs):
|
||||
return MapRoute(self, type, method, flon, flat, tlon, tlat,
|
||||
route_cb, *args, **kwargs)
|
||||
|
||||
def name_add(self, address, double lon, double lat,
|
||||
name_cb, *args, **kwargs):
|
||||
return MapName(self, address, lon, lat, name_cb, *args, **kwargs)
|
||||
|
||||
# TODO elm_map_track_add
|
||||
|
||||
# TODO elm_map_track_remove
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_clicked_double_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked,double", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_double_del(self, func):
|
||||
self._callback_del("clicked,double", func)
|
||||
|
||||
def callback_press_add(self, func, *args, **kwargs):
|
||||
self._callback_add("press", func, *args, **kwargs)
|
||||
|
||||
def callback_press_del(self, func):
|
||||
self._callback_del("press", func)
|
||||
|
||||
def callback_longpressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("longpressed", func, *args, **kwargs)
|
||||
|
||||
def callback_longpressed_del(self, func):
|
||||
self._callback_del("longpressed", func)
|
||||
|
||||
def callback_scroll_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_del(self, func):
|
||||
self._callback_del("scroll", func)
|
||||
|
||||
def callback_scroll_drag_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,drag,start", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_drag_start_del(self, func):
|
||||
self._callback_del("scroll,drag,start", func)
|
||||
|
||||
def callback_scroll_drag_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,drag,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_drag_stop_del(self, func):
|
||||
self._callback_del("scroll,drag,stop", func)
|
||||
|
||||
def callback_scroll_anim_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,anim,start", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_anim_start_del(self, func):
|
||||
self._callback_del("scroll,anim,start", func)
|
||||
|
||||
def callback_scroll_anim_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,anim,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_anim_stop_del(self, func):
|
||||
self._callback_del("scroll,anim,stop", func)
|
||||
|
||||
def callback_zoom_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("zoom,start", func, *args, **kwargs)
|
||||
|
||||
def callback_zoom_start_del(self, func):
|
||||
self._callback_del("zoom,start", func)
|
||||
|
||||
def callback_zoom_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("zoom,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_zoom_stop_del(self, func):
|
||||
self._callback_del("zoom,stop", func)
|
||||
|
||||
def callback_zoom_change_add(self, func, *args, **kwargs):
|
||||
self._callback_add("zoom,change", func, *args, **kwargs)
|
||||
|
||||
def callback_zoom_change_del(self, func):
|
||||
self._callback_del("zoom,change", func)
|
||||
|
||||
def callback_tile_load_add(self, func, *args, **kwargs):
|
||||
self._callback_add("tile,load", func, *args, **kwargs)
|
||||
|
||||
def callback_tile_load_del(self, func):
|
||||
self._callback_del("tile,load", func)
|
||||
|
||||
def callback_tile_loaded_add(self, func, *args, **kwargs):
|
||||
self._callback_add("tile,loaded", func, *args, **kwargs)
|
||||
|
||||
def callback_tile_loaded_del(self, func):
|
||||
self._callback_del("tile,loaded", func)
|
||||
|
||||
def callback_tile_loaded_fail_add(self, func, *args, **kwargs):
|
||||
self._callback_add("tile,loaded,fail", func, *args, **kwargs)
|
||||
|
||||
def callback_tile_loaded_fail_del(self, func):
|
||||
self._callback_del("tile,loaded,fail", func)
|
||||
|
||||
def callback_route_load_add(self, func, *args, **kwargs):
|
||||
self._callback_add("route,load", func, *args, **kwargs)
|
||||
|
||||
def callback_route_load_del(self, func):
|
||||
self._callback_del("route,load", func)
|
||||
|
||||
def callback_route_loaded_add(self, func, *args, **kwargs):
|
||||
self._callback_add("route,loaded", func, *args, **kwargs)
|
||||
|
||||
def callback_route_loaded_del(self, func):
|
||||
self._callback_del("route,loaded", func)
|
||||
|
||||
def callback_route_loaded_fail_add(self, func, *args, **kwargs):
|
||||
self._callback_add("route,loaded,fail", func, *args, **kwargs)
|
||||
|
||||
def callback_route_loaded_fail_del(self, func):
|
||||
self._callback_del("route,loaded,fail", func)
|
||||
|
||||
def callback_name_load_add(self, func, *args, **kwargs):
|
||||
self._callback_add("name,load", func, *args, **kwargs)
|
||||
|
||||
def callback_name_load_del(self, func):
|
||||
self._callback_del("name,load", func)
|
||||
|
||||
def callback_name_loaded_add(self, func, *args, **kwargs):
|
||||
self._callback_add("name,loaded", func, *args, **kwargs)
|
||||
|
||||
def callback_name_loaded_del(self, func):
|
||||
self._callback_del("name,loaded", func)
|
||||
|
||||
def callback_name_loaded_fail_add(self, func, *args, **kwargs):
|
||||
self._callback_add("name,loaded,fail", func, *args, **kwargs)
|
||||
|
||||
def callback_name_loaded_fail_del(self, func):
|
||||
self._callback_del("name,loaded,fail", func)
|
||||
|
||||
def callback_overlay_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("overlay,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_overlay_clicked_del(self, func):
|
||||
self._callback_del("overlay,clicked", func)
|
||||
|
||||
def callback_overlay_del_add(self, func, *args, **kwargs):
|
||||
self._callback_add("overlay,del", func, *args, **kwargs)
|
||||
|
||||
def callback_overlay_del_del(self, func):
|
||||
self._callback_del("overlay,del", func)
|
||||
|
||||
def callback_loaded_add(self, func, *args, **kwargs):
|
||||
self._callback_add("loaded", func, *args, **kwargs)
|
||||
|
||||
def callback_loaded_del(self, func):
|
||||
self._callback_del("loaded", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_map", Map)
|
|
@ -0,0 +1,61 @@
|
|||
# Copyright (c) 2012 Davide Andreoli <dave@gurumeditation.it>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Mapbuf(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_mapbuf_add(parent.obj))
|
||||
|
||||
def enabled_set(self, enabled):
|
||||
elm_mapbuf_enabled_set(self.obj, enabled)
|
||||
|
||||
def enabled_get(self):
|
||||
return bool(elm_mapbuf_enabled_get(self.obj))
|
||||
|
||||
property enabled:
|
||||
def __get__(self):
|
||||
return bool(elm_mapbuf_enabled_get(self.obj))
|
||||
def __set__(self, enabled):
|
||||
elm_mapbuf_enabled_set(self.obj, enabled)
|
||||
|
||||
def smooth_set(self, smooth):
|
||||
elm_mapbuf_smooth_set(self.obj, smooth)
|
||||
|
||||
def smooth_get(self):
|
||||
return bool(elm_mapbuf_smooth_get(self.obj))
|
||||
|
||||
property smooth:
|
||||
def __get__(self):
|
||||
return bool(elm_mapbuf_smooth_get(self.obj))
|
||||
def __set__(self, smooth):
|
||||
elm_mapbuf_smooth_set(self.obj, smooth)
|
||||
|
||||
def alpha_set(self, alpha):
|
||||
elm_mapbuf_alpha_set(self.obj, alpha)
|
||||
|
||||
def alpha_get(self):
|
||||
return bool(elm_mapbuf_alpha_get(self.obj))
|
||||
|
||||
property alpha:
|
||||
def __get__(self):
|
||||
return bool(elm_mapbuf_alpha_get(self.obj))
|
||||
def __set__(self, alpha):
|
||||
elm_mapbuf_alpha_set(self.obj, alpha)
|
||||
|
||||
|
||||
_object_mapping_register("elm_mapbuf", Mapbuf)
|
|
@ -0,0 +1,208 @@
|
|||
# Copyright (c) 2010 Boris Faure
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class MenuItem(ObjectItem):
|
||||
|
||||
def __init__( self,
|
||||
evasObject menu,
|
||||
MenuItem parent = None,
|
||||
label = None,
|
||||
icon = None,
|
||||
callback = None,
|
||||
*args, **kargs):
|
||||
|
||||
cdef Elm_Object_Item *item, *parent_obj = NULL
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
parent_obj = parent.item if parent is not None else NULL
|
||||
|
||||
if callback is not None:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
item = elm_menu_item_add( menu.obj,
|
||||
parent_obj,
|
||||
_cfruni(icon) if icon is not None else NULL,
|
||||
_cfruni(label) if label is not None else NULL,
|
||||
cb,
|
||||
<void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def object_get(self):
|
||||
return object_from_instance(elm_menu_item_object_get(self.item))
|
||||
|
||||
def icon_name_set(self, icon):
|
||||
elm_menu_item_icon_name_set(self.item, _cfruni(icon))
|
||||
|
||||
def icon_name_get(self):
|
||||
return _ctouni(elm_menu_item_icon_name_get(self.item))
|
||||
|
||||
property icon_name:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_menu_item_icon_name_get(self.item))
|
||||
def __set__(self, icon):
|
||||
elm_menu_item_icon_name_set(self.item, _cfruni(icon))
|
||||
|
||||
def selected_set(self, selected):
|
||||
elm_menu_item_selected_set(self.item, selected)
|
||||
|
||||
def selected_get(self):
|
||||
return elm_menu_item_selected_get(self.item)
|
||||
|
||||
property selected:
|
||||
def __get__(self):
|
||||
return elm_menu_item_selected_get(self.item)
|
||||
def __set__(self, selected):
|
||||
elm_menu_item_selected_set(self.item, selected)
|
||||
|
||||
def is_separator(self):
|
||||
return False
|
||||
|
||||
def subitems_get(self):
|
||||
return _object_item_list_to_python(elm_menu_item_subitems_get(self.item))
|
||||
|
||||
property subitems:
|
||||
def __get__(self):
|
||||
return _object_item_list_to_python(elm_menu_item_subitems_get(self.item))
|
||||
|
||||
def index_get(self):
|
||||
return elm_menu_item_index_get(self.item)
|
||||
|
||||
property index:
|
||||
def __get__(self):
|
||||
return elm_menu_item_index_get(self.item)
|
||||
|
||||
def next_get(self):
|
||||
return _object_item_to_python(elm_menu_item_next_get(self.item))
|
||||
|
||||
property next:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_menu_item_next_get(self.item))
|
||||
|
||||
def prev_get(self):
|
||||
return _object_item_to_python(elm_menu_item_prev_get(self.item))
|
||||
|
||||
property prev:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_menu_item_prev_get(self.item))
|
||||
|
||||
|
||||
cdef class MenuSeparatorItem(ObjectItem):
|
||||
def __init__(self, evasObject menu, MenuItem parent):
|
||||
cdef Elm_Object_Item *parent_obj = NULL
|
||||
|
||||
if parent:
|
||||
parent_obj = parent.item
|
||||
item = elm_menu_item_separator_add(menu.obj, parent_obj)
|
||||
if not item:
|
||||
raise RuntimeError("Error creating separator")
|
||||
|
||||
self._set_obj(item)
|
||||
|
||||
def is_separator(self):
|
||||
return True
|
||||
|
||||
def next_get(self):
|
||||
return _object_item_to_python(elm_menu_item_next_get(self.item))
|
||||
|
||||
property next:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_menu_item_next_get(self.item))
|
||||
|
||||
def prev_get(self):
|
||||
return _object_item_to_python(elm_menu_item_prev_get(self.item))
|
||||
|
||||
property prev:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_menu_item_prev_get(self.item))
|
||||
|
||||
|
||||
cdef class Menu(Object):
|
||||
|
||||
def __init__(self, evasObject parent, obj = None):
|
||||
if obj is None:
|
||||
self._set_obj(elm_menu_add(parent.obj))
|
||||
else:
|
||||
self._set_obj(<Evas_Object*>obj)
|
||||
|
||||
def parent_set(self, evasObject parent):
|
||||
elm_menu_parent_set(self.obj, parent.obj)
|
||||
|
||||
def parent_get(self):
|
||||
return object_from_instance(elm_menu_parent_get(self.obj))
|
||||
|
||||
property parent:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_menu_parent_get(self.obj))
|
||||
def __set__(self, evasObject parent):
|
||||
elm_menu_parent_set(self.obj, parent.obj)
|
||||
|
||||
def move(self, x, y):
|
||||
elm_menu_move(self.obj, x, y)
|
||||
|
||||
def close(self):
|
||||
elm_menu_close(self.obj)
|
||||
|
||||
def items_get(self):
|
||||
return _object_item_list_to_python(elm_menu_items_get(self.obj))
|
||||
|
||||
property items:
|
||||
def __get__(self):
|
||||
return _object_item_list_to_python(elm_menu_items_get(self.obj))
|
||||
|
||||
def item_add(self, parent = None, label = None, icon = None, callback = None, *args, **kwargs):
|
||||
return MenuItem(self, parent, label, icon, callback, *args, **kwargs)
|
||||
|
||||
def item_separator_add(self, parent = None):
|
||||
return MenuSeparatorItem(self, parent)
|
||||
|
||||
def selected_item_get(self):
|
||||
return _object_item_to_python(elm_menu_selected_item_get(self.obj))
|
||||
|
||||
property selected_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_menu_selected_item_get(self.obj))
|
||||
|
||||
def last_item_get(self):
|
||||
return _object_item_to_python(elm_menu_last_item_get(self.obj))
|
||||
|
||||
property last_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_menu_last_item_get(self.obj))
|
||||
|
||||
def first_item_get(self):
|
||||
return _object_item_to_python(elm_menu_first_item_get(self.obj))
|
||||
|
||||
property first_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_menu_first_item_get(self.obj))
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_menu", Menu)
|
|
@ -0,0 +1,260 @@
|
|||
# Copyright (c) 2012 Davide Andreoli <dave@gurumeditation.it>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef Eina_Bool _multibuttonentry_filter_callback(Evas_Object *obj, const_char_ptr item_label, void *item_data, void *data) with gil:
|
||||
try:
|
||||
(mbe, callback, a, ka) = <object>data
|
||||
ret = callback(mbe, item_label, *a, **ka)
|
||||
if isinstance(ret, str):
|
||||
# TODO this is BROKEN! the doc say should work, but it's a const char* :/
|
||||
# free(<void*>item_label)
|
||||
# item_label = strdup(ret)
|
||||
return 1
|
||||
elif ret:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
cdef enum Elm_MultiButtonEntry_Item_Insert_Kind:
|
||||
ELM_MULTIBUTTONENTRY_INSERT_APPEND
|
||||
ELM_MULTIBUTTONENTRY_INSERT_PREPEND
|
||||
ELM_MULTIBUTTONENTRY_INSERT_BEFORE
|
||||
ELM_MULTIBUTTONENTRY_INSERT_AFTER
|
||||
|
||||
|
||||
cdef class MultiButtonEntryItem(ObjectItem):
|
||||
|
||||
def __init__(self, kind, evasObject mbe, label,
|
||||
MultiButtonEntryItem before_after = None,
|
||||
callback = None, *args, **kargs):
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if callback:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
|
||||
if kind == ELM_MULTIBUTTONENTRY_INSERT_PREPEND:
|
||||
item = elm_multibuttonentry_item_prepend(mbe.obj,
|
||||
_cfruni(label), cb, <void*>self)
|
||||
elif kind == ELM_MULTIBUTTONENTRY_INSERT_APPEND:
|
||||
item = elm_multibuttonentry_item_append(mbe.obj,
|
||||
_cfruni(label), cb, <void*>self)
|
||||
elif kind == ELM_MULTIBUTTONENTRY_INSERT_BEFORE:
|
||||
item = elm_multibuttonentry_item_insert_before(mbe.obj,
|
||||
before_after.item, _cfruni(label), cb, <void*>self)
|
||||
elif kind == ELM_MULTIBUTTONENTRY_INSERT_AFTER:
|
||||
item = elm_multibuttonentry_item_insert_after(mbe.obj,
|
||||
before_after.item, _cfruni(label), cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def __str__(self):
|
||||
return ("%s(label=%r, callback=%r, args=%r, kargs=%s)") % \
|
||||
(self.__class__.__name__, self.text_get(), self.params[0], self.params[1], self.params[2])
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
"label=%r, callback=%r, args=%r, kargs=%s)") % \
|
||||
(self.__class__.__name__, <unsigned long><void *>self,
|
||||
PY_REFCOUNT(self), <unsigned long><void *>self.item,
|
||||
self.text_get(), self.params[0], self.params[1], self.params[2])
|
||||
|
||||
def selected_set(self, selected):
|
||||
elm_multibuttonentry_item_selected_set(self.item, bool(selected))
|
||||
|
||||
def selected_get(self):
|
||||
return bool(elm_multibuttonentry_item_selected_get(self.item))
|
||||
|
||||
property selected:
|
||||
def __get__(self):
|
||||
return self.selected_get()
|
||||
def __set__(self, value):
|
||||
self.selected_set(value)
|
||||
|
||||
def prev_get(self):
|
||||
return _object_item_to_python(elm_multibuttonentry_item_prev_get(self.item))
|
||||
|
||||
property prev:
|
||||
def __get__(self):
|
||||
return self.prev_get()
|
||||
|
||||
def next_get(self):
|
||||
return _object_item_to_python(elm_multibuttonentry_item_next_get(self.item))
|
||||
|
||||
property next:
|
||||
def __get__(self):
|
||||
return self.next_get()
|
||||
|
||||
|
||||
cdef class MultiButtonEntry(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_multibuttonentry_add(parent.obj))
|
||||
|
||||
def entry_get(self):
|
||||
return object_from_instance(elm_multibuttonentry_entry_get(self.obj))
|
||||
|
||||
property entry:
|
||||
def __get__(self):
|
||||
return self.entry_get()
|
||||
|
||||
def expanded_set(self, enabled):
|
||||
elm_multibuttonentry_expanded_set(self.obj, bool(enabled))
|
||||
|
||||
def expanded_get(self):
|
||||
return bool(elm_multibuttonentry_expanded_get(self.obj))
|
||||
|
||||
property expanded:
|
||||
def __get__(self):
|
||||
return self.expanded_get()
|
||||
def __set__(self, value):
|
||||
self.expanded_set(value)
|
||||
|
||||
def item_prepend(self, label, func = None, *args, **kwargs):
|
||||
return MultiButtonEntryItem(ELM_MULTIBUTTONENTRY_INSERT_PREPEND,
|
||||
self, label, None, func, *args, **kwargs)
|
||||
|
||||
def item_append(self, label, func = None, *args, **kwargs):
|
||||
return MultiButtonEntryItem(ELM_MULTIBUTTONENTRY_INSERT_APPEND,
|
||||
self, label, None, func, *args, **kwargs)
|
||||
|
||||
def item_insert_before(self, MultiButtonEntryItem before, label, func = None, *args, **kwargs):
|
||||
return MultiButtonEntryItem(ELM_MULTIBUTTONENTRY_INSERT_BEFORE,
|
||||
self, label, before, func, *args, **kwargs)
|
||||
|
||||
def item_insert_after(self, MultiButtonEntryItem after, label, func = None, *args, **kwargs):
|
||||
return MultiButtonEntryItem(ELM_MULTIBUTTONENTRY_INSERT_AFTER,
|
||||
self, label, after, func, *args, **kwargs)
|
||||
|
||||
def items_get(self):
|
||||
return _object_item_list_to_python(elm_multibuttonentry_items_get(self.obj))
|
||||
|
||||
property items:
|
||||
def __get__(self):
|
||||
return self.items_get()
|
||||
|
||||
def first_item_get(self):
|
||||
return _object_item_to_python(elm_multibuttonentry_first_item_get(self.obj))
|
||||
|
||||
property first_item:
|
||||
def __get__(self):
|
||||
return self.first_item_get()
|
||||
|
||||
def last_item_get(self):
|
||||
return _object_item_to_python(elm_multibuttonentry_last_item_get(self.obj))
|
||||
|
||||
property last_item:
|
||||
def __get__(self):
|
||||
return self.last_item_get()
|
||||
|
||||
def selected_item_get(self):
|
||||
return _object_item_to_python(elm_multibuttonentry_selected_item_get(self.obj))
|
||||
|
||||
property selected_item:
|
||||
def __get__(self):
|
||||
return self.selected_item_get()
|
||||
|
||||
def clear(self):
|
||||
elm_multibuttonentry_clear(self.obj)
|
||||
|
||||
def filter_append(self, func, *args, **kwargs):
|
||||
cbdata = (self, func, args, kwargs)
|
||||
elm_multibuttonentry_item_filter_append(self.obj,
|
||||
_multibuttonentry_filter_callback, <void *>cbdata)
|
||||
Py_INCREF(cbdata)
|
||||
|
||||
def filter_prepend(self, func, *args, **kwargs):
|
||||
cbdata = (self, func, args, kwargs)
|
||||
elm_multibuttonentry_item_filter_prepend(self.obj,
|
||||
_multibuttonentry_filter_callback, <void *>cbdata)
|
||||
Py_INCREF(cbdata)
|
||||
|
||||
def filter_remove(self, func, *args, **kwargs):
|
||||
#TODO
|
||||
pass
|
||||
|
||||
def callback_item_selected_add(self, func, *args, **kwargs):
|
||||
self._callback_add("item,selected", func, *args, **kwargs)
|
||||
|
||||
def callback_item_selected_del(self, func):
|
||||
self._callback_del("item,selected", func)
|
||||
|
||||
def callback_item_added_add(self, func, *args, **kwargs):
|
||||
self._callback_add("item,added", func, *args, **kwargs)
|
||||
|
||||
def callback_item_added_del(self, func):
|
||||
self._callback_del("item,added", func)
|
||||
|
||||
def callback_item_deleted_add(self, func, *args, **kwargs):
|
||||
self._callback_add("item,deleted", func, *args, **kwargs)
|
||||
|
||||
def callback_item_deleted_del(self, func):
|
||||
self._callback_del("item,deleted", func)
|
||||
|
||||
def callback_item_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("item,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_item_clicked_del(self, func):
|
||||
self._callback_del("item,clicked", func)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_focused_add(self, func, *args, **kwargs):
|
||||
self._callback_add("focused", func, *args, **kwargs)
|
||||
|
||||
def callback_focused_del(self, func):
|
||||
self._callback_del("focused", func)
|
||||
|
||||
def callback_unfocused_add(self, func, *args, **kwargs):
|
||||
self._callback_add("unfocused", func, *args, **kwargs)
|
||||
|
||||
def callback_unfocused_del(self, func):
|
||||
self._callback_del("unfocused", func)
|
||||
|
||||
def callback_expanded_add(self, func, *args, **kwargs):
|
||||
self._callback_add("expanded", func, *args, **kwargs)
|
||||
|
||||
def callback_expanded_del(self, func):
|
||||
self._callback_del("expanded", func)
|
||||
|
||||
def callback_contracted_add(self, func, *args, **kwargs):
|
||||
self._callback_add("contracted", func, *args, **kwargs)
|
||||
|
||||
def callback_contracted_del(self, func):
|
||||
self._callback_del("contracted", func)
|
||||
|
||||
def callback_expand_state_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("expand,state,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_expand_state_changed_del(self, func):
|
||||
self._callback_del("expand,state,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_multibuttonentry", MultiButtonEntry)
|
|
@ -0,0 +1,191 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
# Copyright (c) 2010-2010 ProFUSION embedded systems
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class NaviframeItem(ObjectItem):
|
||||
|
||||
def item_pop_to(self):
|
||||
_METHOD_DEPRECATED(self, "pop_to")
|
||||
elm_naviframe_item_pop_to(self.item)
|
||||
|
||||
def pop_to(self):
|
||||
elm_naviframe_item_pop_to(self.item)
|
||||
|
||||
def item_promote(self):
|
||||
_METHOD_DEPRECATED(self, "promote")
|
||||
elm_naviframe_item_promote(self.item)
|
||||
|
||||
def promote(self):
|
||||
elm_naviframe_item_promote(self.item)
|
||||
|
||||
def style_set(self, style):
|
||||
elm_naviframe_item_style_set(self.item, _cfruni(style))
|
||||
|
||||
def style_get(self):
|
||||
return _ctouni(elm_naviframe_item_style_get(self.item))
|
||||
|
||||
property style:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_naviframe_item_style_get(self.item))
|
||||
def __set__(self, style):
|
||||
elm_naviframe_item_style_set(self.item, _cfruni(style))
|
||||
|
||||
def title_visible_set(self, visible):
|
||||
elm_naviframe_item_title_visible_set(self.item, visible)
|
||||
|
||||
def title_visible_get(self):
|
||||
return bool(elm_naviframe_item_title_visible_get(self.item))
|
||||
|
||||
property title_visible:
|
||||
def __get__(self):
|
||||
return bool(elm_naviframe_item_title_visible_get(self.item))
|
||||
def __set__(self, visible):
|
||||
elm_naviframe_item_title_visible_set(self.item, visible)
|
||||
|
||||
|
||||
cdef class Naviframe(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_naviframe_add(parent.obj))
|
||||
|
||||
def item_push(self, title_label, evasObject prev_btn, evasObject next_btn, evasObject content, const_char_ptr item_style):
|
||||
cdef NaviframeItem ret = NaviframeItem()
|
||||
cdef Elm_Object_Item *item
|
||||
|
||||
item = elm_naviframe_item_push(self.obj, _cfruni(title_label),
|
||||
prev_btn.obj if prev_btn else NULL,
|
||||
next_btn.obj if next_btn else NULL,
|
||||
content.obj if content else NULL,
|
||||
_cfruni(item_style) if item_style else NULL)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
||||
def item_insert_before(self, NaviframeItem before, title_label, evasObject prev_btn, evasObject next_btn, evasObject content, const_char_ptr item_style):
|
||||
cdef NaviframeItem ret = NaviframeItem()
|
||||
cdef Elm_Object_Item *item
|
||||
|
||||
item = elm_naviframe_item_insert_before(self.obj, before.item, _cfruni(title_label), prev_btn.obj, next_btn.obj, content.obj, _cfruni(item_style))
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
||||
def item_insert_after(self, NaviframeItem after, title_label, evasObject prev_btn, evasObject next_btn, evasObject content, const_char_ptr item_style):
|
||||
cdef NaviframeItem ret = NaviframeItem()
|
||||
cdef Elm_Object_Item *item
|
||||
|
||||
item = elm_naviframe_item_insert_after(self.obj, after.item, _cfruni(title_label), prev_btn.obj, next_btn.obj, content.obj, _cfruni(item_style))
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
||||
def item_pop(self):
|
||||
return object_from_instance(elm_naviframe_item_pop(self.obj))
|
||||
|
||||
def content_preserve_on_pop_set(self, preserve):
|
||||
elm_naviframe_content_preserve_on_pop_set(self.obj, preserve)
|
||||
|
||||
def content_preserve_on_pop_get(self):
|
||||
return bool(elm_naviframe_content_preserve_on_pop_get(self.obj))
|
||||
|
||||
property content_preserve_on_pop:
|
||||
def __get__(self):
|
||||
return bool(elm_naviframe_content_preserve_on_pop_get(self.obj))
|
||||
def __set__(self, preserve):
|
||||
elm_naviframe_content_preserve_on_pop_set(self.obj, preserve)
|
||||
|
||||
def top_item_get(self):
|
||||
return _object_item_to_python(elm_naviframe_top_item_get(self.obj))
|
||||
|
||||
property top_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_naviframe_top_item_get(self.obj))
|
||||
|
||||
def bottom_item_get(self):
|
||||
return _object_item_to_python(elm_naviframe_bottom_item_get(self.obj))
|
||||
|
||||
property bottom_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_naviframe_bottom_item_get(self.obj))
|
||||
|
||||
def prev_btn_auto_pushed_set(self, auto_pushed):
|
||||
elm_naviframe_prev_btn_auto_pushed_set(self.obj, auto_pushed)
|
||||
|
||||
def prev_btn_auto_pushed_get(self):
|
||||
return bool(elm_naviframe_prev_btn_auto_pushed_get(self.obj))
|
||||
|
||||
property prev_btn_auto_pushed:
|
||||
def __get__(self):
|
||||
return bool(elm_naviframe_prev_btn_auto_pushed_get(self.obj))
|
||||
def __set__(self, auto_pushed):
|
||||
elm_naviframe_prev_btn_auto_pushed_set(self.obj, auto_pushed)
|
||||
|
||||
def items_get(self):
|
||||
return _object_item_list_to_python(elm_naviframe_items_get(self.obj))
|
||||
|
||||
property items:
|
||||
def __get__(self):
|
||||
return _object_item_list_to_python(elm_naviframe_items_get(self.obj))
|
||||
|
||||
def event_enabled_set(self, enabled):
|
||||
elm_naviframe_event_enabled_set(self.obj, enabled)
|
||||
|
||||
def event_enabled_get(self):
|
||||
return bool(elm_naviframe_event_enabled_get(self.obj))
|
||||
|
||||
property event_enabled:
|
||||
def __get__(self):
|
||||
return bool(elm_naviframe_event_enabled_get(self.obj))
|
||||
def __set__(self, enabled):
|
||||
elm_naviframe_event_enabled_set(self.obj, enabled)
|
||||
|
||||
def item_simple_push(self, evasObject content):
|
||||
cdef NaviframeItem ret = NaviframeItem()
|
||||
cdef Elm_Object_Item *item
|
||||
|
||||
item = elm_naviframe_item_simple_push(self.obj, content.obj)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
||||
def item_simple_promote(self, evasObject content):
|
||||
elm_naviframe_item_simple_promote(self.obj, content.obj)
|
||||
|
||||
def callback_transition_finished_add(self, func, *args, **kwargs):
|
||||
self._callback_add("transition,finished", func, *args, **kwargs)
|
||||
|
||||
def callback_transition_finished_del(self, func):
|
||||
self._callback_del("transition,finished", func)
|
||||
|
||||
def callback_title_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("title,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_title_clicked_del(self, func):
|
||||
self._callback_del("title,clicked", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_naviframe", Naviframe)
|
|
@ -0,0 +1,29 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
def need_efreet():
|
||||
return bool(elm_need_efreet())
|
||||
|
||||
def need_e_dbus():
|
||||
return bool(elm_need_e_dbus())
|
||||
|
||||
def need_ethumb():
|
||||
return bool(elm_need_ethumb())
|
||||
|
||||
def need_web():
|
||||
return bool(elm_need_web())
|
|
@ -0,0 +1,95 @@
|
|||
# Copyright (c) 2008-2009 ProFUSION embedded systems
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
cdef class Notify(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_notify_add(parent.obj))
|
||||
|
||||
def parent_set(self, evasObject parent):
|
||||
cdef Evas_Object *o
|
||||
if parent is not None:
|
||||
o = parent.obj
|
||||
else:
|
||||
o = NULL
|
||||
elm_notify_parent_set(self.obj, o)
|
||||
|
||||
def parent_get(self):
|
||||
return object_from_instance(elm_notify_parent_get(self.obj))
|
||||
|
||||
property parent:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_notify_parent_get(self.obj))
|
||||
def __set__(self, evasObject parent):
|
||||
cdef Evas_Object *o
|
||||
if parent is not None:
|
||||
o = parent.obj
|
||||
else:
|
||||
o = NULL
|
||||
elm_notify_parent_set(self.obj, o)
|
||||
|
||||
def orient_set(self, int orient):
|
||||
elm_notify_orient_set(self.obj, orient)
|
||||
|
||||
def orient_get(self):
|
||||
return elm_notify_orient_get(self.obj)
|
||||
|
||||
property orient:
|
||||
def __get__(self):
|
||||
return elm_notify_orient_get(self.obj)
|
||||
def __set__(self, orient):
|
||||
elm_notify_orient_set(self.obj, orient)
|
||||
|
||||
def timeout_set(self, double timeout):
|
||||
elm_notify_timeout_set(self.obj, timeout)
|
||||
|
||||
def timeout_get(self):
|
||||
return elm_notify_timeout_get(self.obj)
|
||||
|
||||
property timeout:
|
||||
def __get__(self):
|
||||
return elm_notify_timeout_get(self.obj)
|
||||
def __set__(self, timeout):
|
||||
elm_notify_timeout_set(self.obj, timeout)
|
||||
|
||||
def allow_events_set(self, repeat):
|
||||
elm_notify_allow_events_set(self.obj, repeat)
|
||||
|
||||
def allow_events_get(self):
|
||||
return bool(elm_notify_allow_events_get(self.obj))
|
||||
|
||||
property allow_events:
|
||||
def __get__(self):
|
||||
return bool(elm_notify_allow_events_get(self.obj))
|
||||
def __set__(self, allow_events):
|
||||
elm_notify_allow_events_set(self.obj, allow_events)
|
||||
|
||||
def callback_timeout_add(self, func, *args, **kwargs):
|
||||
self._callback_add("timeout", func, *args, **kwargs)
|
||||
|
||||
def callback_timeout_del(self, func):
|
||||
self._callback_del("timeout", func)
|
||||
|
||||
def callback_block_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("block,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_block_clicked_del(self, func):
|
||||
self._callback_del("block,clicked", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_notify", Notify)
|
|
@ -0,0 +1,603 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
from efl.evas cimport Object as evasObject
|
||||
from efl.evas cimport EventKeyDown, EventKeyUp
|
||||
# from efl.evas cimport evas_object_data_get
|
||||
from efl.evas cimport evas_object_smart_callback_add
|
||||
from efl.evas cimport evas_object_smart_callback_del
|
||||
from efl.evas import EVAS_CALLBACK_KEY_DOWN
|
||||
from efl.evas import EVAS_CALLBACK_KEY_UP
|
||||
# from evas cimport eina_list_append
|
||||
|
||||
# from evas.c_evas import _extended_object_mapping_register
|
||||
|
||||
#API XXX: Callbacks!
|
||||
cdef void _object_callback(void *data,
|
||||
Evas_Object *o, void *event_info) with gil:
|
||||
cdef Object obj
|
||||
cdef object event, ei
|
||||
# obj = <Object>evas_object_data_get(o, "python-evas")
|
||||
obj = object_from_instance(o)
|
||||
event = <object>data
|
||||
lst = tuple(obj._elmcallbacks[event])
|
||||
for event_conv, func, args, kargs in lst:
|
||||
try:
|
||||
if event_conv is None:
|
||||
func(obj, *args, **kargs)
|
||||
else:
|
||||
ei = event_conv(<long>event_info)
|
||||
func(obj, ei, *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
cdef Evas_Object *_tooltip_content_create(void *data, Evas_Object *o, Evas_Object *t) with gil:
|
||||
cdef Object ret, obj, tooltip
|
||||
|
||||
# obj = <Object>evas_object_data_get(o, "python-evas")
|
||||
# tooltip = Object_from_instance(t)
|
||||
obj = object_from_instance(o)
|
||||
tooltip = object_from_instance(t)
|
||||
(func, args, kargs) = <object>data
|
||||
ret = func(obj, tooltip, *args, **kargs)
|
||||
if not ret:
|
||||
return NULL
|
||||
return ret.obj
|
||||
|
||||
cdef void _tooltip_data_del_cb(void *data, Evas_Object *o, void *event_info) with gil:
|
||||
Py_DECREF(<object>data)
|
||||
|
||||
cdef Eina_Bool _event_dispatcher(o, src, Evas_Callback_Type t, event_info):
|
||||
cdef Object obj = o
|
||||
cdef object ret
|
||||
for func, args, kargs in obj._elm_event_cbs:
|
||||
try:
|
||||
ret = func(obj, src, t, event_info, *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
if ret:
|
||||
return True
|
||||
return False
|
||||
|
||||
#TODO: More event types
|
||||
cdef Eina_Bool _event_callback(void *data, Evas_Object *o, Evas_Object *src, Evas_Callback_Type t, void *event_info) with gil:
|
||||
cdef Object obj = object_from_instance(o)
|
||||
cdef Object src_obj = object_from_instance(src)
|
||||
cdef Eina_Bool ret = False
|
||||
cdef EventKeyDown down_event
|
||||
cdef EventKeyUp up_event
|
||||
if t == EVAS_CALLBACK_KEY_DOWN:
|
||||
down_event = EventKeyDown()
|
||||
down_event._set_obj(event_info)
|
||||
ret = _event_dispatcher(obj, src_obj, t, down_event)
|
||||
down_event._unset_obj()
|
||||
elif t == EVAS_CALLBACK_KEY_UP:
|
||||
up_event = EventKeyUp()
|
||||
up_event._set_obj(event_info)
|
||||
ret = _event_dispatcher(obj, src_obj, t, up_event)
|
||||
up_event._unset_obj()
|
||||
|
||||
|
||||
cdef void _event_data_del_cb(void *data, Evas_Object *o, void *event_info) with gil:
|
||||
pass
|
||||
# Py_DECREF(<object>data)
|
||||
|
||||
# MOVED TO efl.eo.pyx
|
||||
# cdef _strings_to_python(const_Eina_List *lst):
|
||||
# cdef const_char_ptr s
|
||||
# ret = []
|
||||
# while lst:
|
||||
# s = <const_char_ptr>lst.data
|
||||
# if s != NULL:
|
||||
# ret.append(_ctouni(s))
|
||||
# lst = lst.next
|
||||
# return ret
|
||||
#
|
||||
# cdef Eina_List * _strings_from_python(strings):
|
||||
# cdef Eina_List *lst = NULL
|
||||
# for s in strings:
|
||||
# lst = eina_list_append(lst, _cfruni(s))
|
||||
# return lst
|
||||
|
||||
def _cb_string_conv(long addr):
|
||||
cdef const_char_ptr s = <const_char_ptr>addr
|
||||
if s == NULL:
|
||||
return None
|
||||
else:
|
||||
return s
|
||||
|
||||
# MOVED TO efl.eo.pyx
|
||||
# cdef _object_list_to_python(const_Eina_List *lst):
|
||||
# cdef Evas_Object *o
|
||||
# ret = []
|
||||
# while lst:
|
||||
# o = <Evas_Object *>lst.data
|
||||
# obj = Object_from_instance(o)
|
||||
# ret.append(obj)
|
||||
# lst = lst.next
|
||||
# return ret
|
||||
|
||||
# cdef class Canvas(evas.c_evas.Canvas):
|
||||
# def __init__(self):
|
||||
# pass
|
||||
|
||||
cdef class Object(evasObject):
|
||||
|
||||
def part_text_set(self, part, text):
|
||||
elm_object_part_text_set(self.obj, _cfruni(part) if part is not None else NULL, _cfruni(text))
|
||||
|
||||
def text_set(self, text):
|
||||
elm_object_text_set(self.obj, _cfruni(text))
|
||||
|
||||
def part_text_get(self, part):
|
||||
return _ctouni(elm_object_part_text_get(self.obj, _cfruni(part) if part is not None else NULL))
|
||||
|
||||
def text_get(self):
|
||||
return _ctouni(elm_object_text_get(self.obj))
|
||||
|
||||
property text:
|
||||
def __get__(self):
|
||||
return self.text_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.text_set(value)
|
||||
|
||||
def part_content_set(self, part, evasObject content):
|
||||
elm_object_part_content_set(self.obj, _cfruni(part), content.obj)
|
||||
|
||||
def content_set(self, evasObject obj):
|
||||
elm_object_part_content_set(self.obj, NULL, obj.obj)
|
||||
|
||||
def part_content_get(self, part):
|
||||
return object_from_instance(elm_object_part_content_get(self.obj, _cfruni(part)))
|
||||
|
||||
def content_get(self):
|
||||
return object_from_instance(elm_object_content_get(self.obj))
|
||||
|
||||
def part_content_unset(self, part):
|
||||
return object_from_instance(elm_object_part_content_unset(self.obj, _cfruni(part)))
|
||||
|
||||
def content_unset(self):
|
||||
return object_from_instance(elm_object_content_unset(self.obj))
|
||||
|
||||
property content:
|
||||
def __get__(self):
|
||||
return self.content_get()
|
||||
def __set__(self, content):
|
||||
self.content_set(content)
|
||||
def __del__(self):
|
||||
self.content_unset()
|
||||
|
||||
def access_info_set(self, txt):
|
||||
elm_object_access_info_set(self.obj, _cfruni(txt))
|
||||
|
||||
def name_find(self, name not None, int recurse = 0):
|
||||
return object_from_instance(elm_object_name_find(self.obj, _cfruni(name), recurse))
|
||||
|
||||
def style_set(self, style):
|
||||
elm_object_style_set(self.obj, _cfruni(style))
|
||||
|
||||
def style_get(self):
|
||||
return _ctouni(elm_object_style_get(self.obj))
|
||||
|
||||
property style:
|
||||
def __get__(self):
|
||||
return self.style_get()
|
||||
def __set__(self, value):
|
||||
self.style_set(value)
|
||||
|
||||
def disabled_set(self, disabled):
|
||||
elm_object_disabled_set(self.obj, disabled)
|
||||
|
||||
def disabled_get(self):
|
||||
return bool(elm_object_disabled_get(self.obj))
|
||||
|
||||
property disabled:
|
||||
def __get__(self):
|
||||
return self.disabled_get()
|
||||
def __set__(self, disabled):
|
||||
self.disabled_set(disabled)
|
||||
|
||||
def widget_check(self):
|
||||
return bool(elm_object_widget_check(self.obj))
|
||||
|
||||
def parent_widget_get(self):
|
||||
return object_from_instance(elm_object_parent_widget_get(self.obj))
|
||||
|
||||
property parent_widget:
|
||||
def __get__(self):
|
||||
return self.parent_widget_get()
|
||||
|
||||
def top_widget_get(self):
|
||||
return object_from_instance(elm_object_top_widget_get(self.obj))
|
||||
|
||||
property top_widget:
|
||||
def __get__(self):
|
||||
return self.top_widget_get()
|
||||
|
||||
def widget_type_get(self):
|
||||
return elm_object_widget_type_get(self.obj)
|
||||
|
||||
property widget_type:
|
||||
def __get__(self):
|
||||
return elm_object_widget_type_get(self.obj)
|
||||
|
||||
def signal_emit(self, emission, source):
|
||||
elm_object_signal_emit(self.obj, _cfruni(emission), _cfruni(source))
|
||||
|
||||
#def signal_callback_add(self, emission, source, func, data):
|
||||
#elm_object_signal_callback_add(self.obj, emission, source, func, data)
|
||||
|
||||
#def signal_callback_del(self, emission, source, func):
|
||||
#elm_object_signal_callback_del(self.obj, emission, source, func)
|
||||
|
||||
# XXX: Clashes badly with evas event_callback_*
|
||||
def elm_event_callback_add(self, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
|
||||
if self._elm_event_cbs is None:
|
||||
self._elm_event_cbs = []
|
||||
|
||||
if not self._elm_event_cbs:
|
||||
elm_object_event_callback_add(self.obj, _event_callback, NULL)
|
||||
|
||||
data = (func, args, kargs)
|
||||
self._elm_event_cbs.append(data)
|
||||
|
||||
def elm_event_callback_del(self, func, *args, **kargs):
|
||||
data = (func, args, kargs)
|
||||
self._elm_event_cbs.remove(data)
|
||||
|
||||
if not self._elm_event_cbs:
|
||||
elm_object_event_callback_del(self.obj, _event_callback, NULL)
|
||||
|
||||
# Cursors
|
||||
def cursor_set(self, cursor):
|
||||
elm_object_cursor_set(self.obj, _cfruni(cursor))
|
||||
|
||||
def cursor_get(self):
|
||||
return _ctouni(elm_object_cursor_get(self.obj))
|
||||
|
||||
def cursor_unset(self):
|
||||
elm_object_cursor_unset(self.obj)
|
||||
|
||||
property cursor:
|
||||
def __get__(self):
|
||||
return self.cursor_get()
|
||||
def __set__(self, value):
|
||||
self.cursor_set(value)
|
||||
def __del__(self):
|
||||
self.cursor_unset()
|
||||
|
||||
def cursor_style_set(self, style=None):
|
||||
elm_object_cursor_style_set(self.obj, _cfruni(style) if style is not None else NULL)
|
||||
|
||||
def cursor_style_get(self):
|
||||
return _ctouni(elm_object_cursor_style_get(self.obj))
|
||||
|
||||
property cursor_style:
|
||||
def __get__(self):
|
||||
return self.cursor_style_get()
|
||||
def __set__(self, value):
|
||||
self.cursor_style_set(value)
|
||||
|
||||
def cursor_theme_search_enabled_set(self, engine_only):
|
||||
elm_object_cursor_theme_search_enabled_set(self.obj, bool(engine_only))
|
||||
|
||||
def cursor_theme_search_enabled_get(self):
|
||||
return elm_object_cursor_theme_search_enabled_get(self.obj)
|
||||
|
||||
property cursor_theme_search_enabled:
|
||||
def __get__(self):
|
||||
return self.cursor_theme_search_enabled_get()
|
||||
def __set__(self, value):
|
||||
self.cursor_theme_search_enabled_set(value)
|
||||
|
||||
# Focus
|
||||
def focus_get(self):
|
||||
return bool(elm_object_focus_get(self.obj))
|
||||
|
||||
def focus_set(self, focus):
|
||||
elm_object_focus_set(self.obj, focus)
|
||||
|
||||
def focus_allow_set(self, allow):
|
||||
elm_object_focus_allow_set(self.obj, allow)
|
||||
|
||||
def focus_allow_get(self):
|
||||
return elm_object_focus_allow_get(self.obj)
|
||||
|
||||
property focus_allow:
|
||||
def __get__(self):
|
||||
return self.focus_allow_get()
|
||||
def __set__(self, value):
|
||||
self.focus_allow_set(value)
|
||||
|
||||
def focus_custom_chain_set(self, objs):
|
||||
elm_object_focus_custom_chain_unset(self.obj)
|
||||
cdef Object obj
|
||||
for obj in objs:
|
||||
elm_object_focus_custom_chain_append(self.obj, obj.obj, NULL)
|
||||
|
||||
def focus_custom_chain_unset(self):
|
||||
elm_object_focus_custom_chain_unset(self.obj)
|
||||
|
||||
def focus_custom_chain_get(self):
|
||||
return _object_list_to_python(elm_object_focus_custom_chain_get(self.obj))
|
||||
|
||||
property focus_custom_chain:
|
||||
def __get__(self):
|
||||
return self.focus_custom_chain_get()
|
||||
def __set__(self, value):
|
||||
self.focus_custom_chain_set(value)
|
||||
def __del__(self):
|
||||
self.focus_custom_chain_unset()
|
||||
|
||||
def focus_custom_chain_append(self, Object child, Object relative_child=None):
|
||||
cdef Evas_Object *rel = NULL
|
||||
if relative_child:
|
||||
rel = relative_child.obj
|
||||
elm_object_focus_custom_chain_append(self.obj, child.obj, rel)
|
||||
|
||||
def focus_custom_chain_prepend(self, Object child, Object relative_child=None):
|
||||
cdef Evas_Object *rel = NULL
|
||||
if relative_child:
|
||||
rel = relative_child.obj
|
||||
elm_object_focus_custom_chain_prepend(self.obj, child.obj, rel)
|
||||
|
||||
#def focus_next(self, direction):
|
||||
#elm_object_focus_next(self.obj, direction)
|
||||
|
||||
def tree_focus_allow_set(self, focusable):
|
||||
elm_object_tree_focus_allow_set(self.obj, focusable)
|
||||
|
||||
def tree_focus_allow_get(self):
|
||||
return bool(elm_object_tree_focus_allow_get(self.obj))
|
||||
|
||||
property tree_focus_allow:
|
||||
def __get__(self):
|
||||
return self.tree_focus_allow_get()
|
||||
def __set__(self, value):
|
||||
self.tree_focus_allow_set(value)
|
||||
|
||||
# Mirroring
|
||||
def mirrored_get(self):
|
||||
return bool(elm_object_mirrored_get(self.obj))
|
||||
|
||||
def mirrored_set(self, mirrored):
|
||||
elm_object_mirrored_set(self.obj, mirrored)
|
||||
|
||||
property mirrored:
|
||||
def __get__(self):
|
||||
return self.mirrored_get()
|
||||
def __set__(self, value):
|
||||
self.mirrored_set(value)
|
||||
|
||||
def mirrored_automatic_get(self):
|
||||
return bool(elm_object_mirrored_automatic_get(self.obj))
|
||||
|
||||
def mirrored_automatic_set(self, automatic):
|
||||
elm_object_mirrored_automatic_set(self.obj, automatic)
|
||||
|
||||
property mirrored_automatic:
|
||||
def __get__(self):
|
||||
return self.mirrored_automatic_get()
|
||||
def __set__(self, value):
|
||||
self.mirrored_automatic_set(value)
|
||||
|
||||
# Scaling
|
||||
def scale_set(self, scale):
|
||||
elm_object_scale_set(self.obj, scale)
|
||||
|
||||
def scale_get(self):
|
||||
return elm_object_scale_get(self.obj)
|
||||
|
||||
property scale:
|
||||
def __get__(self):
|
||||
return self.scale_get()
|
||||
def __set__(self, value):
|
||||
self.scale_set(value)
|
||||
|
||||
# Scrollhints
|
||||
def scroll_hold_push(self):
|
||||
elm_object_scroll_hold_push(self.obj)
|
||||
|
||||
def scroll_hold_pop(self):
|
||||
elm_object_scroll_hold_pop(self.obj)
|
||||
|
||||
def scroll_freeze_push(self):
|
||||
elm_object_scroll_freeze_push(self.obj)
|
||||
|
||||
def scroll_freeze_pop(self):
|
||||
elm_object_scroll_freeze_pop(self.obj)
|
||||
|
||||
def scroll_lock_x_set(self, lock):
|
||||
elm_object_scroll_lock_x_set(self.obj, lock)
|
||||
|
||||
def scroll_lock_y_set(self, lock):
|
||||
elm_object_scroll_lock_y_set(self.obj, lock)
|
||||
|
||||
def scroll_lock_x_get(self):
|
||||
return bool(elm_object_scroll_lock_x_get(self.obj))
|
||||
|
||||
def scroll_lock_y_get(self):
|
||||
return bool(elm_object_scroll_lock_y_get(self.obj))
|
||||
|
||||
property scroll_lock_x:
|
||||
def __get__(self):
|
||||
return self.scroll_lock_x_get()
|
||||
def __set__(self, value):
|
||||
self.scroll_lock_x_set(value)
|
||||
|
||||
property scroll_lock_y:
|
||||
def __get__(self):
|
||||
return self.scroll_lock_y_get()
|
||||
def __set__(self, value):
|
||||
self.scroll_lock_y_set(value)
|
||||
|
||||
# Theme
|
||||
# property theme:
|
||||
# """A theme to be used for this object and its children.
|
||||
#
|
||||
# This sets a specific theme that will be used for the given object and any
|
||||
# child objects it has. If @p th is NULL then the theme to be used is
|
||||
# cleared and the object will inherit its theme from its parent (which
|
||||
# ultimately will use the default theme if no specific themes are set).
|
||||
#
|
||||
# Use special themes with great care as this will annoy users and make
|
||||
# configuration difficult. Avoid any custom themes at all if it can be
|
||||
# helped.
|
||||
#
|
||||
# @type: L{Theme}
|
||||
#
|
||||
# """
|
||||
# def __set__(self, Theme th):
|
||||
# elm_object_theme_set(self.obj, th.th)
|
||||
# def __get__(self):
|
||||
# cdef Theme th = Theme()
|
||||
# th.th = elm_object_theme_get(self.obj)
|
||||
# return th
|
||||
|
||||
# Tooltips
|
||||
def tooltip_show(self):
|
||||
elm_object_tooltip_show(self.obj)
|
||||
|
||||
def tooltip_hide(self):
|
||||
elm_object_tooltip_hide(self.obj)
|
||||
|
||||
def tooltip_text_set(self, text):
|
||||
elm_object_tooltip_text_set(self.obj, _cfruni(text))
|
||||
|
||||
def tooltip_domain_translatable_text_set(self, domain, text):
|
||||
elm_object_tooltip_domain_translatable_text_set(self.obj, _cfruni(domain), _cfruni(text))
|
||||
|
||||
def tooltip_translatable_text_set(self, text):
|
||||
elm_object_tooltip_translatable_text_set(self.obj, _cfruni(text))
|
||||
|
||||
def tooltip_content_cb_set(self, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
|
||||
cdef void *cbdata
|
||||
|
||||
data = (func, args, kargs)
|
||||
Py_INCREF(data)
|
||||
cbdata = <void *>data
|
||||
elm_object_tooltip_content_cb_set(self.obj, _tooltip_content_create,
|
||||
cbdata, _tooltip_data_del_cb)
|
||||
|
||||
def tooltip_unset(self):
|
||||
elm_object_tooltip_unset(self.obj)
|
||||
|
||||
def tooltip_style_set(self, style=None):
|
||||
elm_object_tooltip_style_set(self.obj, _cfruni(style) if style is not None else NULL)
|
||||
|
||||
def tooltip_style_get(self):
|
||||
return _ctouni(elm_object_tooltip_style_get(self.obj))
|
||||
|
||||
property tooltip_style:
|
||||
def __get__(self):
|
||||
return self.tooltip_style_get()
|
||||
def __set__(self, value):
|
||||
self.tooltip_style_set(value)
|
||||
|
||||
def tooltip_window_mode_set(self, disable):
|
||||
return bool(elm_object_tooltip_window_mode_set(self.obj, disable))
|
||||
|
||||
def tooltip_window_mode_get(self):
|
||||
return bool(elm_object_tooltip_window_mode_get(self.obj))
|
||||
|
||||
property tooltip_window_mode:
|
||||
def __get__(self):
|
||||
return self.tooltip_window_mode_get()
|
||||
def __set__(self, value):
|
||||
self.tooltip_window_mode_set(value)
|
||||
|
||||
#Translatable text
|
||||
def domain_translatable_text_part_set(self, part, domain, text):
|
||||
elm_object_domain_translatable_text_part_set(self.obj, _cfruni(part), _cfruni(domain), _cfruni(text))
|
||||
|
||||
def domain_translatable_text_set(self, domain, text):
|
||||
elm_object_domain_translatable_text_set(self.obj, _cfruni(domain), _cfruni(text))
|
||||
|
||||
def translatable_text_set(self, text):
|
||||
elm_object_translatable_text_set(self.obj, _cfruni(text))
|
||||
|
||||
def translatable_text_part_get(self, part):
|
||||
return _ctouni(elm_object_translatable_text_part_get(self.obj, _cfruni(part)))
|
||||
|
||||
def translatable_text_get(self):
|
||||
return _ctouni(elm_object_translatable_text_get(self.obj))
|
||||
|
||||
property translatable_text:
|
||||
def __get__(self):
|
||||
return self.translatable_text_get()
|
||||
def __set__(self, value):
|
||||
self.translatable_text_set(value)
|
||||
|
||||
# Callbacks
|
||||
def _callback_add_full(self, event, event_conv, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
if event_conv is not None and not callable(event_conv):
|
||||
raise TypeError("event_conv must be None or callable")
|
||||
|
||||
if self._elmcallbacks is None:
|
||||
self._elmcallbacks = {}
|
||||
|
||||
e = intern(event)
|
||||
lst = self._elmcallbacks.setdefault(e, [])
|
||||
if not lst:
|
||||
evas_object_smart_callback_add(self.obj, _fruni(event),
|
||||
_object_callback, <void *>e)
|
||||
lst.append((event_conv, func, args, kargs))
|
||||
|
||||
def _callback_del_full(self, event, event_conv, func):
|
||||
try:
|
||||
lst = self._elmcallbacks[event]
|
||||
except KeyError as e:
|
||||
raise ValueError("Unknown event %r" % event)
|
||||
|
||||
i = -1
|
||||
ec = None
|
||||
f = None
|
||||
for i, (ec, f, a, k) in enumerate(lst):
|
||||
if event_conv == ec and func == f:
|
||||
break
|
||||
|
||||
if f != func or ec != event_conv:
|
||||
raise ValueError("Callback %s was not registered with event %r" %
|
||||
(func, event))
|
||||
|
||||
lst.pop(i)
|
||||
if lst:
|
||||
return
|
||||
self._elmcallbacks.pop(event)
|
||||
evas_object_smart_callback_del(self.obj, _fruni(event), _object_callback)
|
||||
|
||||
def _callback_add(self, event, func, *args, **kargs):
|
||||
return self._callback_add_full(event, None, func, *args, **kargs)
|
||||
|
||||
def _callback_del(self, event, func):
|
||||
return self._callback_del_full(event, None, func)
|
||||
|
||||
def _get_obj_addr(self):
|
||||
return <long>self.obj
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
# Copyright (c) 2010 ProFUSION embedded systems
|
||||
#
|
||||
#This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef Evas_Object *_tooltip_item_content_create(void *data, Evas_Object *o, Evas_Object *t, void *it) with gil:
|
||||
cdef Object ret, obj, tooltip
|
||||
|
||||
# obj = <Object>evas_object_data_get(o, "python-evas")
|
||||
obj = object_from_instance(o)
|
||||
tooltip = object_from_instance(t)
|
||||
(func, item, args, kargs) = <object>data
|
||||
ret = func(obj, item, *args, **kargs)
|
||||
if not ret:
|
||||
return NULL
|
||||
return ret.obj
|
||||
|
||||
cdef void _tooltip_item_data_del_cb(void *data, Evas_Object *o, void *event_info) with gil:
|
||||
Py_DECREF(<object>data)
|
||||
|
||||
cdef class ObjectItem
|
||||
|
||||
def _cb_object_item_conv(long addr):
|
||||
cdef Elm_Object_Item *it = <Elm_Object_Item *>addr
|
||||
return _object_item_to_python(it)
|
||||
|
||||
cdef Elm_Object_Item * _object_item_from_python(ObjectItem item) except NULL:
|
||||
if item is None or item.item is NULL:
|
||||
raise TypeError("Invalid item!")
|
||||
return item.item
|
||||
|
||||
cdef _object_item_to_python(Elm_Object_Item *it):
|
||||
cdef void *data
|
||||
cdef object item
|
||||
|
||||
if it == NULL:
|
||||
return None
|
||||
|
||||
data = elm_object_item_data_get(it)
|
||||
if data == NULL:
|
||||
return None
|
||||
|
||||
item = <object>data
|
||||
return item
|
||||
|
||||
cdef _object_item_list_to_python(const_Eina_List *lst):
|
||||
cdef Elm_Object_Item *it
|
||||
ret = []
|
||||
ret_append = ret.append
|
||||
while lst:
|
||||
it = <Elm_Object_Item *>lst.data
|
||||
lst = lst.next
|
||||
o = _object_item_to_python(it)
|
||||
if o is not None:
|
||||
ret_append(o)
|
||||
return ret
|
||||
|
||||
cdef void _object_item_del_cb(void *data, Evas_Object *o, void *event_info) with gil:
|
||||
cdef ObjectItem d = <object>data
|
||||
d.item = NULL
|
||||
Py_DECREF(d)
|
||||
|
||||
cdef void _object_item_callback(void *data, Evas_Object *obj, void *event_info) with gil:
|
||||
cdef ObjectItem item = <object>data
|
||||
(callback, a, ka) = item.params
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
callback(o, item, *a, **ka)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
|
||||
cdef class ObjectItem(object):
|
||||
|
||||
# Notes to bindings' developers:
|
||||
# ==============================
|
||||
#
|
||||
# After calling _set_obj, Elm_Object_Item's "data" contains the python item
|
||||
# instance pointer, and the attribute "item", that you see below, contains
|
||||
# a pointer to Elm_Object_Item.
|
||||
#
|
||||
# The variable params holds callback data, usually the tuple
|
||||
# (callback, args, kwargs). Note that some of the generic object item
|
||||
# functions expect this tuple. Use custom functions if you assign the
|
||||
# params differently.
|
||||
#
|
||||
# Gen type widgets MUST set the params BEFORE adding the item as the
|
||||
# items need their data immediately when adding them.
|
||||
|
||||
cdef Elm_Object_Item *item
|
||||
cdef object params
|
||||
|
||||
def __dealloc__(self):
|
||||
if self.item != NULL:
|
||||
elm_object_item_del_cb_set(self.item, NULL)
|
||||
elm_object_item_del(self.item)
|
||||
self.item = NULL
|
||||
|
||||
cdef int _set_obj(self, Elm_Object_Item *item) except 0:
|
||||
assert self.item == NULL, "Object must be clean"
|
||||
self.item = item
|
||||
elm_object_item_data_set(item, <void*>self)
|
||||
elm_object_item_del_cb_set(item, _object_item_del_cb)
|
||||
Py_INCREF(self)
|
||||
return 1
|
||||
|
||||
def widget_get(self):
|
||||
return object_from_instance(elm_object_item_widget_get(self.item))
|
||||
|
||||
def part_content_set(self, part, Object content not None):
|
||||
elm_object_item_part_content_set(self.item, _cfruni(part), content.obj)
|
||||
|
||||
def content_set(self, Object content not None):
|
||||
elm_object_item_content_set(self.item, content.obj)
|
||||
|
||||
def part_content_get(self, part):
|
||||
return object_from_instance(elm_object_item_part_content_get(self.item, _cfruni(part)))
|
||||
|
||||
def content_get(self):
|
||||
return object_from_instance(elm_object_item_content_get(self.item))
|
||||
|
||||
def part_content_unset(self, part):
|
||||
return object_from_instance(elm_object_item_part_content_unset(self.item, _cfruni(part)))
|
||||
|
||||
def content_unset(self):
|
||||
return object_from_instance(elm_object_item_content_unset(self.item))
|
||||
|
||||
def part_text_set(self, part, text):
|
||||
elm_object_item_part_text_set(self.item, _cfruni(part), _cfruni(text))
|
||||
|
||||
def text_set(self, text):
|
||||
elm_object_item_text_set(self.item, _cfruni(text))
|
||||
|
||||
def part_text_get(self, part):
|
||||
return _ctouni(elm_object_item_part_text_get(self.item, _cfruni(part)))
|
||||
|
||||
def text_get(self):
|
||||
return _ctouni(elm_object_item_text_get(self.item))
|
||||
|
||||
property text:
|
||||
def __get__(self):
|
||||
return self.text_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.text_set(value)
|
||||
|
||||
def access_info_set(self, txt):
|
||||
elm_object_item_access_info_set(self.item, _cfruni(txt))
|
||||
|
||||
def data_get(self):
|
||||
(callback, a, ka) = self.params
|
||||
return (a, ka)
|
||||
|
||||
def data_set(self, *args, **kwargs):
|
||||
(callback, a, ka) = self.params
|
||||
self.params = tuple(callback, *args, **kwargs)
|
||||
|
||||
property data:
|
||||
def __get__(self):
|
||||
return self.data_get()
|
||||
#def __set__(self, data):
|
||||
#self.data_set(data)
|
||||
|
||||
def signal_emit(self, emission, source):
|
||||
elm_object_item_signal_emit(self.item, _cfruni(emission), _cfruni(source))
|
||||
|
||||
def disabled_set(self, disabled):
|
||||
elm_object_item_disabled_set(self.item, disabled)
|
||||
|
||||
def disabled_get(self):
|
||||
return bool(elm_object_item_disabled_get(self.item))
|
||||
|
||||
property disabled:
|
||||
def __get__(self):
|
||||
return self.disabled_get()
|
||||
def __set__(self, disabled):
|
||||
self.disabled_set(disabled)
|
||||
|
||||
#def delete_cb_set(self, del_cb):
|
||||
#elm_object_item_del_cb_set(self.item, del_cb)
|
||||
|
||||
def delete(self):
|
||||
if self.item == NULL:
|
||||
raise ValueError("Object already deleted")
|
||||
elm_object_item_del(self.item)
|
||||
Py_DECREF(self)
|
||||
|
||||
def tooltip_text_set(self, char *text):
|
||||
elm_object_item_tooltip_text_set(self.item, _cfruni(text))
|
||||
|
||||
def tooltip_window_mode_set(self, disable):
|
||||
return bool(elm_object_item_tooltip_window_mode_set(self.item, disable))
|
||||
|
||||
def tooltip_window_mode_get(self):
|
||||
return bool(elm_object_item_tooltip_window_mode_get(self.item))
|
||||
|
||||
def tooltip_content_cb_set(self, func, *args, **kargs):
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
|
||||
cdef void *cbdata
|
||||
|
||||
data = (func, args, kargs)
|
||||
Py_INCREF(data)
|
||||
cbdata = <void *>data
|
||||
elm_object_item_tooltip_content_cb_set(self.item, _tooltip_item_content_create,
|
||||
cbdata, _tooltip_item_data_del_cb)
|
||||
|
||||
def tooltip_unset(self):
|
||||
elm_object_item_tooltip_unset(self.item)
|
||||
|
||||
def tooltip_style_set(self, style=None):
|
||||
elm_object_item_tooltip_style_set(self.item, _cfruni(style) if style is not None else NULL)
|
||||
|
||||
def tooltip_style_get(self):
|
||||
return _ctouni(elm_object_item_tooltip_style_get(self.item))
|
||||
|
||||
def cursor_set(self, char *cursor):
|
||||
elm_object_item_cursor_set(self.item, _cfruni(cursor))
|
||||
|
||||
def cursor_get(self):
|
||||
return _ctouni(elm_object_item_cursor_get(self.item))
|
||||
|
||||
def cursor_unset(self):
|
||||
elm_object_item_cursor_unset(self.item)
|
||||
|
||||
def cursor_style_set(self, style=None):
|
||||
elm_object_item_cursor_style_set(self.item, _cfruni(style) if style is not None else NULL)
|
||||
|
||||
def cursor_style_get(self):
|
||||
return _ctouni(elm_object_item_cursor_style_get(self.item))
|
||||
|
||||
def cursor_engine_only_set(self, engine_only):
|
||||
elm_object_item_cursor_engine_only_set(self.item, bool(engine_only))
|
||||
|
||||
def cursor_engine_only_get(self):
|
||||
return elm_object_item_cursor_engine_only_get(self.item)
|
||||
|
||||
|
||||
_object_mapping_register("elm_object_item", ObjectItem)
|
|
@ -0,0 +1,53 @@
|
|||
# Copyright (c) 2010 Boris Faure
|
||||
# 2010 Sebastian Krzyszkowiak
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Panel(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_panel_add(parent.obj))
|
||||
|
||||
def orient_set(self, orient):
|
||||
elm_panel_orient_set(self.obj, orient)
|
||||
|
||||
def orient_get(self):
|
||||
return elm_panel_orient_get(self.obj)
|
||||
|
||||
property orient:
|
||||
def __set__(self, orient):
|
||||
elm_panel_orient_set(self.obj, orient)
|
||||
def __get__(self):
|
||||
return elm_panel_orient_get(self.obj)
|
||||
|
||||
def hidden_set(self, hidden):
|
||||
elm_panel_orient_set(self.obj, hidden)
|
||||
|
||||
def hidden_get(self):
|
||||
return elm_panel_hidden_get(self.obj)
|
||||
|
||||
property hidden:
|
||||
def __set__(self, hidden):
|
||||
elm_panel_hidden_set(self.obj, hidden)
|
||||
def __get__(self):
|
||||
return elm_panel_hidden_get(self.obj)
|
||||
|
||||
def toggle(self):
|
||||
elm_panel_toggle(self.obj)
|
||||
|
||||
|
||||
_object_mapping_register("elm_panel", Panel)
|
|
@ -0,0 +1,73 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Panes(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_panes_add(parent.obj))
|
||||
|
||||
property fixed:
|
||||
def __set__(self, fixed):
|
||||
elm_panes_fixed_set(self.obj, fixed)
|
||||
def __get__(self):
|
||||
return bool(elm_panes_fixed_get(self.obj))
|
||||
|
||||
property content_left_size:
|
||||
def __get__(self):
|
||||
return elm_panes_content_left_size_get(self.obj)
|
||||
def __set__(self, size):
|
||||
elm_panes_content_left_size_set(self.obj, size)
|
||||
|
||||
property content_right_size:
|
||||
def __get__(self):
|
||||
return elm_panes_content_right_size_get(self.obj)
|
||||
def __set__(self, size):
|
||||
elm_panes_content_right_size_set(self.obj, size)
|
||||
|
||||
property horizontal:
|
||||
def __set__(self, horizontal):
|
||||
elm_panes_horizontal_set(self.obj, horizontal)
|
||||
def __get__(self):
|
||||
return bool(elm_panes_horizontal_get(self.obj))
|
||||
|
||||
def callback_press_add(self, func, *args, **kwargs):
|
||||
self._callback_add("press", func, *args, **kwargs)
|
||||
|
||||
def callback_press_del(self, func):
|
||||
self._callback_del("press", func)
|
||||
|
||||
def callback_unpress_add(self, func, *args, **kwargs):
|
||||
self._callback_add("unpress", func, *args, **kwargs)
|
||||
|
||||
def callback_unpress_del(self, func):
|
||||
self._callback_del("unpress", func)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_clicked_double_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked,double", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_double_del(self, func):
|
||||
self._callback_del("clicked,double", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_panes", Panes)
|
|
@ -0,0 +1,104 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class Photo(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_photo_add(parent.obj))
|
||||
|
||||
def file_set(self, filename):
|
||||
if filename:
|
||||
return bool(elm_photo_file_set(self.obj, _cfruni(filename)))
|
||||
else:
|
||||
return bool(elm_photo_file_set(self.obj, NULL))
|
||||
|
||||
property file:
|
||||
def __set__(self, filename):
|
||||
# TODO: check return status
|
||||
if filename:
|
||||
elm_photo_file_set(self.obj, _cfruni(filename))
|
||||
else:
|
||||
elm_photo_file_set(self.obj, NULL)
|
||||
|
||||
def thumb_set(self, filename, group = None):
|
||||
elm_photo_thumb_set(self.obj, _cfruni(filename), _cfruni(group))
|
||||
|
||||
property thumb:
|
||||
def __set__(self, value):
|
||||
if isinstance(value, tuple):
|
||||
filename, group = value
|
||||
else:
|
||||
filename = value
|
||||
group = None
|
||||
elm_photo_thumb_set(self.obj, _cfruni(filename), _cfruni(group))
|
||||
|
||||
def size_set(self, size):
|
||||
elm_photo_size_set(self.obj, size)
|
||||
|
||||
property size:
|
||||
def __set__(self, size):
|
||||
elm_photo_size_set(self.obj, size)
|
||||
|
||||
def fill_inside_set(self, fill):
|
||||
elm_photo_fill_inside_set(self.obj, fill)
|
||||
|
||||
property fill_inside:
|
||||
def __set__(self, fill):
|
||||
elm_photo_fill_inside_set(self.obj, fill)
|
||||
|
||||
def editable_set(self, fill):
|
||||
elm_photo_editable_set(self.obj, fill)
|
||||
|
||||
property editable:
|
||||
def __set__(self, fill):
|
||||
elm_photo_editable_set(self.obj, fill)
|
||||
|
||||
def aspect_fixed_set(self, fixed):
|
||||
elm_photo_aspect_fixed_set(self.obj, fixed)
|
||||
|
||||
def aspect_fixed_get(self):
|
||||
return elm_photo_aspect_fixed_get(self.obj)
|
||||
|
||||
property aspect_fixed:
|
||||
def __get__(self):
|
||||
return elm_photo_aspect_fixed_get(self.obj)
|
||||
|
||||
def __set__(self, fixed):
|
||||
elm_photo_aspect_fixed_set(self.obj, fixed)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_drag_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("drag,start", func, *args, **kwargs)
|
||||
|
||||
def callback_drag_start_del(self, func):
|
||||
self._callback_del("drag,start", func)
|
||||
|
||||
def callback_drag_end_add(self, func, *args, **kwargs):
|
||||
self._callback_add("drag,end", func, *args, **kwargs)
|
||||
|
||||
def callback_drag_end_del(self, func):
|
||||
self._callback_del("drag,end", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_photo", Photo)
|
|
@ -0,0 +1,188 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from efl.evas cimport Image as evasImage
|
||||
|
||||
cdef class Photocam(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_photocam_add(parent.obj))
|
||||
|
||||
property file:
|
||||
def __set__(self, file):
|
||||
elm_photocam_file_set(self.obj, _cfruni(file))
|
||||
#TODO: handle errors from return status
|
||||
def __get__(self):
|
||||
return _ctouni(elm_photocam_file_get(self.obj))
|
||||
|
||||
property zoom:
|
||||
def __set__(self, zoom):
|
||||
elm_photocam_zoom_set(self.obj, zoom)
|
||||
def __get__(self):
|
||||
return elm_photocam_zoom_get(self.obj)
|
||||
|
||||
property zoom_mode:
|
||||
def __set__(self, mode):
|
||||
elm_photocam_zoom_mode_set(self.obj, mode)
|
||||
def __get__(self):
|
||||
return elm_photocam_zoom_mode_get(self.obj)
|
||||
|
||||
property image_size:
|
||||
def __get__(self):
|
||||
cdef int w, h
|
||||
elm_photocam_image_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property image_region:
|
||||
def __get__(self):
|
||||
cdef int x, y, w, h
|
||||
elm_photocam_image_region_get(self.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
def image_region_show(self, x, y, w, h):
|
||||
elm_photocam_image_region_show(self.obj, x, y, w, h)
|
||||
|
||||
def image_region_bring_in(self, x, y, w, h):
|
||||
elm_photocam_image_region_bring_in(self.obj, x, y, w, h)
|
||||
|
||||
property paused:
|
||||
def __set__(self, paused):
|
||||
elm_photocam_paused_set(self.obj, paused)
|
||||
def __get__(self):
|
||||
return bool(elm_photocam_paused_get(self.obj))
|
||||
|
||||
property internal_image:
|
||||
def __get__(self):
|
||||
cdef evasImage img = evasImage()
|
||||
cdef Evas_Object *obj = elm_photocam_internal_image_get(self.obj)
|
||||
img.obj = obj
|
||||
return img
|
||||
|
||||
property bounce:
|
||||
def __set__(self, value):
|
||||
h_bounce, v_bounce = value
|
||||
elm_scroller_bounce_set(self.obj, h_bounce, v_bounce)
|
||||
def __get__(self):
|
||||
cdef Eina_Bool h_bounce, v_bounce
|
||||
elm_scroller_bounce_get(self.obj, &h_bounce, &v_bounce)
|
||||
return (h_bounce, v_bounce)
|
||||
|
||||
property gesture_enabled:
|
||||
def __set__(self, gesture):
|
||||
elm_photocam_gesture_enabled_set(self.obj, gesture)
|
||||
def __get__(self):
|
||||
return bool(elm_photocam_gesture_enabled_get(self.obj))
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_press_add(self, func, *args, **kwargs):
|
||||
self._callback_add("press", func, *args, **kwargs)
|
||||
|
||||
def callback_press_del(self, func):
|
||||
self._callback_del("press", func)
|
||||
|
||||
def callback_longpressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("longpressed", func, *args, **kwargs)
|
||||
|
||||
def callback_longpressed_del(self, func):
|
||||
self._callback_del("longpressed", func)
|
||||
|
||||
def callback_clicked_double_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked,double", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_double_del(self, func):
|
||||
self._callback_del("clicked,double", func)
|
||||
|
||||
def callback_load_add(self, func, *args, **kwargs):
|
||||
self._callback_add("load", func, *args, **kwargs)
|
||||
|
||||
def callback_load_del(self, func):
|
||||
self._callback_del("load", func)
|
||||
|
||||
def callback_loaded_add(self, func, *args, **kwargs):
|
||||
self._callback_add("loaded", func, *args, **kwargs)
|
||||
|
||||
def callback_loaded_del(self, func):
|
||||
self._callback_del("loaded", func)
|
||||
|
||||
def callback_load_detail_add(self, func, *args, **kwargs):
|
||||
self._callback_add("load,detail", func, *args, **kwargs)
|
||||
|
||||
def callback_load_detail_del(self, func):
|
||||
self._callback_del("load,detail", func)
|
||||
|
||||
def callback_loaded_detail_add(self, func, *args, **kwargs):
|
||||
self._callback_add("loaded,detail", func, *args, **kwargs)
|
||||
|
||||
def callback_loaded_detail_del(self, func):
|
||||
self._callback_del("loaded,detail", func)
|
||||
|
||||
def callback_zoom_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("zoom,start", func, *args, **kwargs)
|
||||
|
||||
def callback_zoom_start_del(self, func):
|
||||
self._callback_del("zoom,start", func)
|
||||
|
||||
def callback_zoom_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("zoom,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_zoom_stop_del(self, func):
|
||||
self._callback_del("zoom,stop", func)
|
||||
|
||||
def callback_zoom_change_add(self, func, *args, **kwargs):
|
||||
self._callback_add("zoom,change", func, *args, **kwargs)
|
||||
|
||||
def callback_zoom_change_del(self, func):
|
||||
self._callback_del("zoom,change", func)
|
||||
|
||||
def callback_scroll_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_del(self, func):
|
||||
self._callback_del("scroll", func)
|
||||
|
||||
def callback_scroll_anim_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,anim,start", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_anim_start_del(self, func):
|
||||
self._callback_del("scroll,anim,start", func)
|
||||
|
||||
def callback_scroll_anim_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,anim,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_anim_stop_del(self, func):
|
||||
self._callback_del("scroll,anim,stop", func)
|
||||
|
||||
def callback_scroll_drag_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,drag,start", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_drag_start_del(self, func):
|
||||
self._callback_del("scroll,drag,start", func)
|
||||
|
||||
def callback_scroll_drag_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,drag,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_drag_stop_del(self, func):
|
||||
self._callback_del("scroll,drag,stop", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_photocam", Photocam)
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from efl.evas cimport Image as evasImage
|
||||
|
||||
cdef class Plug(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_plug_add(parent.obj))
|
||||
|
||||
def connect(self, svcname, svcnum, svcsys):
|
||||
return bool(elm_plug_connect(self.obj, _cfruni(svcname), svcnum, svcsys))
|
||||
|
||||
property image_object:
|
||||
def __get__(self):
|
||||
cdef evasImage img = evasImage()
|
||||
cdef Evas_Object *obj = elm_plug_image_object_get(self.obj)
|
||||
img.obj = obj
|
||||
return img
|
||||
|
||||
|
||||
_object_mapping_register("elm_plug", Plug)
|
|
@ -0,0 +1,104 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class PopupItem(ObjectItem):
|
||||
|
||||
def __init__(self, evasObject popup, label = None, evasObject icon = None, func = None, *args, **kwargs):
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Evas_Smart_Cb cb
|
||||
|
||||
if func is None:
|
||||
cb = NULL
|
||||
elif callable(func):
|
||||
cb = _object_item_callback
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
self.params = (func, args, kwargs)
|
||||
item = elm_popup_item_append(popup.obj, _cfruni(label),
|
||||
icon.obj if icon else NULL,
|
||||
cb, <void *>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def __str__(self):
|
||||
return "%s(func=%s, item_data=%s)" % \
|
||||
(self.__class__.__name__,
|
||||
self.params[0],
|
||||
self.params[1])
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
"item_class=%s, func=%s, item_data=%r)") % \
|
||||
(self.__class__.__name__,
|
||||
<unsigned long><void*>self,
|
||||
PY_REFCOUNT(self),
|
||||
<unsigned long>self.item,
|
||||
self.params[0],
|
||||
self.params[1])
|
||||
|
||||
|
||||
cdef class Popup(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_popup_add(parent.obj))
|
||||
|
||||
def item_append(self, label = None, evasObject icon = None, func = None, *args, **kwargs):
|
||||
return PopupItem(self, label, icon, func, *args, **kwargs)
|
||||
|
||||
property content_text_wrap_type:
|
||||
def __set__(self, wrap):
|
||||
elm_popup_content_text_wrap_type_set(self.obj, wrap)
|
||||
def __get__(self):
|
||||
return elm_popup_content_text_wrap_type_get(self.obj)
|
||||
|
||||
property orient:
|
||||
def __set__(self, orient):
|
||||
elm_popup_orient_set(self.obj, orient)
|
||||
def __get__(self):
|
||||
return elm_popup_orient_get(self.obj)
|
||||
|
||||
property timeout:
|
||||
def __set__(self, timeout):
|
||||
elm_popup_timeout_set(self.obj, timeout)
|
||||
def __get__(self):
|
||||
return elm_popup_timeout_get(self.obj)
|
||||
|
||||
property allow_events:
|
||||
def __set__(self, allow):
|
||||
elm_popup_allow_events_set(self.obj, allow)
|
||||
def __get__(self):
|
||||
return bool(elm_popup_allow_events_get(self.obj))
|
||||
|
||||
def callback_timeout_add(self, func, *args, **kwargs):
|
||||
self._callback_add("timeout", func, *args, **kwargs)
|
||||
|
||||
def callback_timeout_del(self, func):
|
||||
self._callback_del("timeout", func)
|
||||
|
||||
def callback_block_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("block,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_block_clicked_del(self, func):
|
||||
self._callback_del("block,clicked", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_popup", Popup)
|
|
@ -0,0 +1,120 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class Progressbar(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_progressbar_add(parent.obj))
|
||||
|
||||
def pulse_set(self, pulse):
|
||||
elm_progressbar_pulse_set(self.obj, pulse)
|
||||
|
||||
def pulse_get(self):
|
||||
return elm_progressbar_pulse_get(self.obj)
|
||||
|
||||
def pulse(self, state):
|
||||
elm_progressbar_pulse(self.obj, state)
|
||||
|
||||
def value_set(self, value):
|
||||
elm_progressbar_value_set(self.obj, value)
|
||||
|
||||
def value_get(self):
|
||||
return elm_progressbar_value_get(self.obj)
|
||||
|
||||
property value:
|
||||
def __get__(self):
|
||||
return elm_progressbar_value_get(self.obj)
|
||||
|
||||
def __set__(self, value):
|
||||
elm_progressbar_value_set(self.obj, value)
|
||||
|
||||
def span_size_set(self, size):
|
||||
elm_progressbar_span_size_set(self.obj, size)
|
||||
|
||||
def span_size_get(self):
|
||||
return elm_progressbar_span_size_get(self.obj)
|
||||
|
||||
property span_size:
|
||||
def __get__(self):
|
||||
return elm_progressbar_span_size_get(self.obj)
|
||||
|
||||
def __set__(self, size):
|
||||
elm_progressbar_span_size_set(self.obj, size)
|
||||
|
||||
def unit_format_set(self, format):
|
||||
if format is None:
|
||||
elm_progressbar_unit_format_set(self.obj, NULL)
|
||||
else:
|
||||
elm_progressbar_unit_format_set(self.obj, _cfruni(format))
|
||||
|
||||
def unit_format_get(self):
|
||||
return _ctouni(elm_progressbar_unit_format_get(self.obj))
|
||||
|
||||
property unit_format:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_progressbar_unit_format_get(self.obj))
|
||||
|
||||
def __set__(self, format):
|
||||
if format is None:
|
||||
elm_progressbar_unit_format_set(self.obj, NULL)
|
||||
else:
|
||||
elm_progressbar_unit_format_set(self.obj, _cfruni(format))
|
||||
|
||||
property unit_format_function:
|
||||
def __set__(self, func not None):
|
||||
pass
|
||||
#if not callable(func):
|
||||
#raise TypeError("func is not callable")
|
||||
#TODO: char * func(double value)
|
||||
#elm_progressbar_unit_format_function_set(self.obj, func, NULL)
|
||||
|
||||
def horizontal_set(self, horizontal):
|
||||
elm_progressbar_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def horizontal_get(self):
|
||||
return bool(elm_progressbar_horizontal_get(self.obj))
|
||||
|
||||
property horizontal:
|
||||
def __get__(self):
|
||||
return bool(elm_progressbar_horizontal_get(self.obj))
|
||||
|
||||
def __set__(self, horizontal):
|
||||
elm_progressbar_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def inverted_set(self, inverted):
|
||||
elm_progressbar_inverted_set(self.obj, inverted)
|
||||
|
||||
def inverted_get(self):
|
||||
return bool(elm_progressbar_inverted_get(self.obj))
|
||||
|
||||
property inverted:
|
||||
def __get__(self):
|
||||
return bool(elm_progressbar_inverted_get(self.obj))
|
||||
|
||||
def __set__(self, inverted):
|
||||
elm_progressbar_inverted_set(self.obj, inverted)
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_progressbar", Progressbar)
|
|
@ -0,0 +1,85 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Radio(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent, obj=None):
|
||||
if obj is None:
|
||||
self._set_obj(elm_radio_add(parent.obj))
|
||||
else:
|
||||
self._set_obj(<Evas_Object*>obj)
|
||||
|
||||
def group_add(self, evasObject group):
|
||||
elm_radio_group_add(self.obj, group.obj)
|
||||
|
||||
def state_value_set(self, value):
|
||||
elm_radio_state_value_set(self.obj, value)
|
||||
|
||||
def state_value_get(self):
|
||||
return elm_radio_state_value_get(self.obj)
|
||||
|
||||
property state_value:
|
||||
def __get__(self):
|
||||
return elm_radio_state_value_get(self.obj)
|
||||
def __set__(self, value):
|
||||
elm_radio_state_value_set(self.obj, value)
|
||||
|
||||
def value_set(self, value):
|
||||
elm_radio_value_set(self.obj, value)
|
||||
|
||||
def value_get(self):
|
||||
return elm_radio_value_get(self.obj)
|
||||
|
||||
property value:
|
||||
def __get__(self):
|
||||
return elm_radio_value_get(self.obj)
|
||||
def __set__(self, value):
|
||||
elm_radio_value_set(self.obj, value)
|
||||
|
||||
#TODO: Check whether this actually works
|
||||
def value_pointer_set(self, value):
|
||||
cdef int valuep = value
|
||||
elm_radio_value_pointer_set(self.obj, &valuep)
|
||||
|
||||
def selected_object_get(self):
|
||||
cdef Radio r = Radio()
|
||||
cdef Evas_Object *selected = elm_radio_selected_object_get(self.obj)
|
||||
if selected == NULL:
|
||||
return None
|
||||
else:
|
||||
r.obj = selected
|
||||
return r
|
||||
|
||||
property selected_object:
|
||||
def __get__(self):
|
||||
cdef Radio r = Radio()
|
||||
cdef Evas_Object *selected = elm_radio_selected_object_get(self.obj)
|
||||
if selected == NULL:
|
||||
return None
|
||||
else:
|
||||
r.obj = selected
|
||||
return r
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_radio", Radio)
|
|
@ -0,0 +1,236 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Scroller(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_scroller_add(parent.obj))
|
||||
|
||||
def custom_widget_base_theme_set(self, widget, base):
|
||||
elm_scroller_custom_widget_base_theme_set(self.obj, _cfruni(widget), _cfruni(base))
|
||||
|
||||
def content_min_limit(self, w, h):
|
||||
elm_scroller_content_min_limit(self.obj, w, h)
|
||||
|
||||
def region_show(self, x, y, w, h):
|
||||
elm_scroller_region_show(self.obj, x, y, w, h)
|
||||
|
||||
def policy_set(self, policy_h, policy_v):
|
||||
elm_scroller_policy_set(self.obj, policy_h, policy_v)
|
||||
|
||||
def policy_get(self):
|
||||
cdef Elm_Scroller_Policy policy_h, policy_v
|
||||
elm_scroller_policy_get(self.obj, &policy_h, &policy_v)
|
||||
return (policy_h, policy_v)
|
||||
|
||||
property policy:
|
||||
def __get__(self):
|
||||
cdef Elm_Scroller_Policy policy_h, policy_v
|
||||
elm_scroller_policy_get(self.obj, &policy_h, &policy_v)
|
||||
return (policy_h, policy_v)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef Elm_Scroller_Policy policy_h, policy_v
|
||||
policy_h, policy_v = value
|
||||
elm_scroller_policy_set(self.obj, policy_h, policy_v)
|
||||
|
||||
def region_get(self):
|
||||
cdef Evas_Coord x, y, w, h
|
||||
elm_scroller_region_get(self.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
property region:
|
||||
def __get__(self):
|
||||
cdef Evas_Coord x, y, w, h
|
||||
elm_scroller_region_get(self.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
def child_size_get(self):
|
||||
cdef Evas_Coord w, h
|
||||
elm_scroller_child_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property child_size:
|
||||
def __get__(self):
|
||||
cdef Evas_Coord w, h
|
||||
elm_scroller_child_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
def bounce_set(self, h, v):
|
||||
elm_scroller_bounce_set(self.obj, h, v)
|
||||
|
||||
def bounce_get(self):
|
||||
cdef Eina_Bool h, v
|
||||
elm_scroller_bounce_get(self.obj, &h, &v)
|
||||
return (h, v)
|
||||
|
||||
property bounce:
|
||||
def __get__(self):
|
||||
cdef Eina_Bool h, v
|
||||
elm_scroller_bounce_get(self.obj, &h, &v)
|
||||
return (h, v)
|
||||
|
||||
def __set__(self, value):
|
||||
cdef Eina_Bool h, v
|
||||
h, v = value
|
||||
elm_scroller_bounce_set(self.obj, h, v)
|
||||
|
||||
def page_relative_set(self, h_pagerel, v_pagerel):
|
||||
elm_scroller_page_relative_set(self.obj, h_pagerel, v_pagerel)
|
||||
|
||||
def page_relative_get(self):
|
||||
cdef double h_pagerel, v_pagerel
|
||||
elm_scroller_page_relative_get(self.obj, &h_pagerel, &v_pagerel)
|
||||
return (h_pagerel, v_pagerel)
|
||||
|
||||
property page_relative:
|
||||
def __set__(self, value):
|
||||
h_pagerel, v_pagerel = value
|
||||
elm_scroller_page_relative_set(self.obj, h_pagerel, v_pagerel)
|
||||
|
||||
def __get__(self):
|
||||
cdef double h_pagerel, v_pagerel
|
||||
elm_scroller_page_relative_get(self.obj, &h_pagerel, &v_pagerel)
|
||||
return (h_pagerel, v_pagerel)
|
||||
|
||||
def page_size_set(self, h_pagesize, v_pagesize):
|
||||
elm_scroller_page_size_set(self.obj, h_pagesize, v_pagesize)
|
||||
|
||||
property page_size:
|
||||
def __set__(self, value):
|
||||
h_pagesize, v_pagesize = value
|
||||
elm_scroller_page_size_set(self.obj, h_pagesize, v_pagesize)
|
||||
|
||||
def current_page_get(self):
|
||||
cdef int h_pagenumber, v_pagenumber
|
||||
elm_scroller_current_page_get(self.obj, &h_pagenumber, &v_pagenumber)
|
||||
return (h_pagenumber, v_pagenumber)
|
||||
|
||||
property current_page:
|
||||
def __get__(self):
|
||||
cdef int h_pagenumber, v_pagenumber
|
||||
elm_scroller_current_page_get(self.obj, &h_pagenumber, &v_pagenumber)
|
||||
return (h_pagenumber, v_pagenumber)
|
||||
|
||||
def last_page_get(self):
|
||||
cdef int h_pagenumber, v_pagenumber
|
||||
elm_scroller_last_page_get(self.obj, &h_pagenumber, &v_pagenumber)
|
||||
return (h_pagenumber, v_pagenumber)
|
||||
|
||||
property last_page:
|
||||
def __get__(self):
|
||||
cdef int h_pagenumber, v_pagenumber
|
||||
elm_scroller_last_page_get(self.obj, &h_pagenumber, &v_pagenumber)
|
||||
return (h_pagenumber, v_pagenumber)
|
||||
|
||||
def page_show(self, h_pagenumber, v_pagenumber):
|
||||
elm_scroller_page_show(self.obj, h_pagenumber, v_pagenumber)
|
||||
|
||||
def page_bring_in(self, h_pagenumber, v_pagenumber):
|
||||
elm_scroller_page_bring_in(self.obj, h_pagenumber, v_pagenumber)
|
||||
|
||||
def region_bring_in(self, x, y, w, h):
|
||||
elm_scroller_region_bring_in(self.obj, x, y, w, h)
|
||||
|
||||
def propagate_events_set(self, propagation):
|
||||
elm_scroller_propagate_events_set(self.obj, propagation)
|
||||
|
||||
def propagate_events_get(self):
|
||||
return bool(elm_scroller_propagate_events_get(self.obj))
|
||||
|
||||
property propagate_events:
|
||||
def __get__(self):
|
||||
return bool(elm_scroller_propagate_events_get(self.obj))
|
||||
|
||||
def __set__(self, propagation):
|
||||
elm_scroller_propagate_events_set(self.obj, propagation)
|
||||
|
||||
def gravity_set(self, x, y):
|
||||
elm_scroller_gravity_set(self.obj, x, y)
|
||||
|
||||
def gravity_get(self):
|
||||
cdef double x, y
|
||||
elm_scroller_gravity_get(self.obj, &x, &y)
|
||||
return (x, y)
|
||||
|
||||
property gravity:
|
||||
def __get__(self):
|
||||
cdef double x, y
|
||||
elm_scroller_gravity_get(self.obj, &x, &y)
|
||||
return (x, y)
|
||||
|
||||
def __set__(self, value):
|
||||
x, y = value
|
||||
elm_scroller_gravity_set(self.obj, x, y)
|
||||
|
||||
def callback_edge_left_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,left", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_left_del(self, func):
|
||||
self._callback_del("edge,left", func)
|
||||
|
||||
def callback_edge_right_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,right", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_right_del(self, func):
|
||||
self._callback_del("edge,right", func)
|
||||
|
||||
def callback_edge_top_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,top", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_top_del(self, func):
|
||||
self._callback_del("edge,top", func)
|
||||
|
||||
def callback_edge_bottom_add(self, func, *args, **kwargs):
|
||||
self._callback_add("edge,bottom", func, *args, **kwargs)
|
||||
|
||||
def callback_edge_bottom_del(self, func):
|
||||
self._callback_del("edge,bottom", func)
|
||||
|
||||
def callback_scroll_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_del(self, func):
|
||||
self._callback_del("scroll", func)
|
||||
|
||||
def callback_scroll_anim_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,anim,start", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_anim_start_del(self, func):
|
||||
self._callback_del("scroll,anim,start", func)
|
||||
|
||||
def callback_scroll_anim_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,anim,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_anim_stop_del(self, func):
|
||||
self._callback_del("scroll,anim,stop", func)
|
||||
|
||||
def callback_scroll_drag_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,drag,start", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_drag_start_del(self, func):
|
||||
self._callback_del("scroll,drag,start", func)
|
||||
|
||||
def callback_scroll_drag_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("scroll,drag,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_scroll_drag_stop_del(self, func):
|
||||
self._callback_del("scroll,drag,stop", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_scroller", Scroller)
|
|
@ -0,0 +1,102 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class SegmentControlItem(ObjectItem):
|
||||
|
||||
def index_get(self):
|
||||
return elm_segment_control_item_index_get(self.item)
|
||||
|
||||
property index:
|
||||
def __get__(self):
|
||||
return elm_segment_control_item_index_get(self.item)
|
||||
|
||||
def object_get(self):
|
||||
return object_from_instance(elm_segment_control_item_object_get(self.item))
|
||||
|
||||
property object:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_segment_control_item_object_get(self.item))
|
||||
|
||||
def selected_set(self, select):
|
||||
elm_segment_control_item_selected_set(self.item, select)
|
||||
|
||||
property selected:
|
||||
def __set__(self, select):
|
||||
elm_segment_control_item_selected_set(self.item, select)
|
||||
|
||||
|
||||
cdef class SegmentControl(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_segment_control_add(parent.obj))
|
||||
|
||||
def item_add(self, evasObject icon, label = None):
|
||||
cdef SegmentControlItem ret = SegmentControlItem()
|
||||
cdef Elm_Object_Item *item
|
||||
|
||||
item = elm_segment_control_item_add(self.obj,
|
||||
icon.obj if icon else NULL,
|
||||
_cfruni(label))
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
||||
def item_insert_at(self, evasObject icon, label = None, index = 0):
|
||||
cdef SegmentControlItem ret = SegmentControlItem()
|
||||
cdef Elm_Object_Item *item
|
||||
|
||||
item = elm_segment_control_item_insert_at(self.obj,
|
||||
icon.obj if icon else NULL,
|
||||
_cfruni(label), index)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
||||
def item_del_at(self, index):
|
||||
elm_segment_control_item_del_at(self.obj, index)
|
||||
|
||||
property item_count:
|
||||
def __get__(self):
|
||||
return elm_segment_control_item_count_get(self.obj)
|
||||
|
||||
def item_get(self, index):
|
||||
return _object_item_to_python(elm_segment_control_item_get(self.obj, index))
|
||||
|
||||
def item_label_get(self, index):
|
||||
return _ctouni(elm_segment_control_item_label_get(self.obj, index))
|
||||
|
||||
def item_icon_get(self, index):
|
||||
return object_from_instance(elm_segment_control_item_icon_get(self.obj, index))
|
||||
|
||||
property item_selected:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_segment_control_item_selected_get(self.obj))
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("changed", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del_full("changed", _cb_object_item_conv, func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_segment_control", SegmentControl)
|
|
@ -0,0 +1,38 @@
|
|||
# Copyright (c) 2009 Boris Faure
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Separator(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_separator_add(parent.obj))
|
||||
|
||||
def horizontal_set(self, b):
|
||||
elm_separator_horizontal_set(self.obj, b)
|
||||
|
||||
def horizontal_get(self):
|
||||
return elm_separator_horizontal_get(self.obj)
|
||||
|
||||
property horizontal:
|
||||
def __get__(self):
|
||||
return elm_separator_horizontal_get(self.obj)
|
||||
|
||||
def __set__(self, b):
|
||||
elm_separator_horizontal_set(self.obj, b)
|
||||
|
||||
|
||||
_object_mapping_register("elm_separator", Separator)
|
|
@ -0,0 +1,186 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Slider(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_slider_add(parent.obj))
|
||||
|
||||
def span_size_set(self, size):
|
||||
elm_slider_span_size_set(self.obj, size)
|
||||
|
||||
def span_size_get(self):
|
||||
return elm_slider_span_size_get(self.obj)
|
||||
|
||||
property span_size:
|
||||
def __get__(self):
|
||||
return elm_slider_span_size_get(self.obj)
|
||||
|
||||
def __set__(self, size):
|
||||
elm_slider_span_size_set(self.obj, size)
|
||||
|
||||
def unit_format_set(self, format):
|
||||
elm_slider_unit_format_set(self.obj, _cfruni(format))
|
||||
|
||||
def unit_format_get(self):
|
||||
return _ctouni(elm_slider_unit_format_get(self.obj))
|
||||
|
||||
property unit_format:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_slider_unit_format_get(self.obj))
|
||||
|
||||
def __set__(self, format):
|
||||
elm_slider_unit_format_set(self.obj, _cfruni(format))
|
||||
|
||||
def indicator_format_set(self, format):
|
||||
elm_slider_indicator_format_set(self.obj, _cfruni(format))
|
||||
|
||||
def indicator_format_get(self):
|
||||
return _ctouni(elm_slider_indicator_format_get(self.obj))
|
||||
|
||||
property indicator_format:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_slider_indicator_format_get(self.obj))
|
||||
|
||||
def __set__(self, format):
|
||||
elm_slider_indicator_format_set(self.obj, _cfruni(format))
|
||||
|
||||
#TODO: def indicator_format_function_set(self, func, free_func)
|
||||
#~ """Set the format function pointer for the indicator label
|
||||
#~
|
||||
#~ Set the callback function to format the indicator string.
|
||||
#~
|
||||
#~ @see: L{indicator_format_set()} for more info on how this works.
|
||||
#~
|
||||
#~ @param func: The indicator format function.
|
||||
#~ @type func: function
|
||||
#~ @param free_func: The freeing function for the format string.
|
||||
#~ @type free_func: function
|
||||
#~
|
||||
#~ """
|
||||
#elm_slider_indicator_format_function_set(self.obj, char(*func)(double val), void (*free_func)(charstr))
|
||||
|
||||
#TODO: def units_format_function_set(self, func, free_func)
|
||||
#~ """Set the format function pointer for the units label
|
||||
#~
|
||||
#~ Set the callback function to format the units string.
|
||||
#~
|
||||
#~ @see: L{units_format_set() for more info on how this works.
|
||||
#~
|
||||
#~ @param func: The units format function.
|
||||
#~ @type func: function
|
||||
#~ @param free_func: The freeing function for the format string.
|
||||
#~ @type free_func: function
|
||||
#~
|
||||
#~ """
|
||||
#elm_slider_units_format_function_set(self.obj, char(*func)(double val), void (*free_func)(charstr))
|
||||
|
||||
def horizontal_set(self, horizontal):
|
||||
elm_slider_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def horizontal_get(self):
|
||||
return bool(elm_slider_horizontal_get(self.obj))
|
||||
|
||||
property horizontal:
|
||||
def __get__(self):
|
||||
return bool(elm_slider_horizontal_get(self.obj))
|
||||
def __set__(self, horizontal):
|
||||
elm_slider_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def min_max_set(self, min, max):
|
||||
elm_slider_min_max_set(self.obj, min, max)
|
||||
|
||||
def min_max_get(self):
|
||||
cdef double min, max
|
||||
elm_slider_min_max_get(self.obj, &min, &max)
|
||||
return (min, max)
|
||||
|
||||
property min_max:
|
||||
def __get__(self):
|
||||
cdef double min, max
|
||||
elm_slider_min_max_get(self.obj, &min, &max)
|
||||
return (min, max)
|
||||
|
||||
def __set__(self, value):
|
||||
min, max = value
|
||||
elm_slider_min_max_set(self.obj, min, max)
|
||||
|
||||
def value_set(self, value):
|
||||
elm_slider_value_set(self.obj, value)
|
||||
|
||||
def value_get(self):
|
||||
return elm_slider_value_get(self.obj)
|
||||
|
||||
property value:
|
||||
def __get__(self):
|
||||
return elm_slider_value_get(self.obj)
|
||||
def __set__(self, value):
|
||||
elm_slider_value_set(self.obj, value)
|
||||
|
||||
def inverted_set(self, inverted):
|
||||
elm_slider_inverted_set(self.obj, inverted)
|
||||
|
||||
def inverted_get(self):
|
||||
return bool(elm_slider_inverted_get(self.obj))
|
||||
|
||||
property inverted:
|
||||
def __get__(self):
|
||||
return bool(elm_slider_inverted_get(self.obj))
|
||||
|
||||
def __set__(self, inverted):
|
||||
elm_slider_inverted_set(self.obj, inverted)
|
||||
|
||||
def indicator_show_set(self, show):
|
||||
elm_slider_indicator_show_set(self.obj, show)
|
||||
|
||||
def indicator_show_get(self):
|
||||
return bool(elm_slider_indicator_show_get(self.obj))
|
||||
|
||||
property indicator_show:
|
||||
def __get__(self):
|
||||
return bool(elm_slider_indicator_show_get(self.obj))
|
||||
|
||||
def __set__(self, show):
|
||||
elm_slider_indicator_show_set(self.obj, show)
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
def callback_slider_drag_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("slider,drag,start", func, *args, **kwargs)
|
||||
|
||||
def callback_slider_drag_start_del(self, func):
|
||||
self._callback_del("slider,drag,start", func)
|
||||
|
||||
def callback_slider_drag_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("slider,drag,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_slider_drag_stop_del(self, func):
|
||||
self._callback_del("slider,drag,stop", func)
|
||||
|
||||
def callback_delay_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("delay,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_delay_changed_del(self, func):
|
||||
self._callback_del("delay,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_slider", Slider)
|
|
@ -0,0 +1,293 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef _py_elm_slideshow_item_call(func, Evas_Object *obj, data) with gil:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
(args, kwargs) = data
|
||||
return func(o, *args, **kwargs)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return None
|
||||
|
||||
cdef Evas_Object *_py_elm_slideshow_item_get(void *data, Evas_Object *obj) with gil:
|
||||
cdef SlideshowItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef evasObject icon
|
||||
cdef SlideshowItemClass itc = params[0]
|
||||
|
||||
func = itc._get_func
|
||||
if func is None:
|
||||
return NULL
|
||||
|
||||
ret = _py_elm_slideshow_item_call(func, obj, params[1])
|
||||
if ret is not None:
|
||||
try:
|
||||
icon = ret
|
||||
return icon.obj
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return NULL
|
||||
else:
|
||||
return NULL
|
||||
|
||||
cdef void _py_elm_slideshow_item_del(void *data, Evas_Object *obj) with gil:
|
||||
cdef SlideshowItem item = <object>data
|
||||
cdef object params = item.params
|
||||
cdef SlideshowItemClass itc = params[0]
|
||||
|
||||
func = itc._del_func
|
||||
if func is not None:
|
||||
try:
|
||||
o = object_from_instance(obj)
|
||||
func(o, params[1])
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
item._unset_obj()
|
||||
Py_DECREF(item)
|
||||
|
||||
cdef int _py_elm_slideshow_compare_func(const_void *data1, const_void *data2) with gil:
|
||||
cdef SlideshowItem item1 = <object>data1
|
||||
cdef SlideshowItem item2 = <object>data2
|
||||
cdef object params = item1.params
|
||||
cdef object func = params[2]
|
||||
|
||||
if func is None:
|
||||
return 0
|
||||
|
||||
ret = func(item1, item2)
|
||||
if ret is not None:
|
||||
try:
|
||||
return ret
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
cdef class SlideshowItemClass(object):
|
||||
cdef Elm_Slideshow_Item_Class obj
|
||||
cdef readonly object _get_func
|
||||
cdef readonly object _del_func
|
||||
|
||||
def __cinit__(self, *a, **ka):
|
||||
self._get_func = None
|
||||
self._del_func = None
|
||||
|
||||
self.obj.func.get = _py_elm_slideshow_item_get
|
||||
self.obj.func.del_ = _py_elm_slideshow_item_del
|
||||
|
||||
def __init__(self, get_func=None, del_func=None):
|
||||
if get_func and not callable(get_func):
|
||||
raise TypeError("get_func is not callable!")
|
||||
elif get_func:
|
||||
self._get_func = get_func
|
||||
else:
|
||||
self._get_func = self.get
|
||||
|
||||
if del_func and not callable(del_func):
|
||||
raise TypeError("del_func is not callable!")
|
||||
elif del_func:
|
||||
self._del_func = del_func
|
||||
else:
|
||||
try:
|
||||
self._del_func = self.delete
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
def __str__(self):
|
||||
return ("%s(get_func=%s, del_func=%s)") % \
|
||||
(self.__class__.__name__,
|
||||
self._get_func,
|
||||
self._del_func)
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Slideshow_Item_Class=%#x, "
|
||||
"get_func=%s, del_func=%s)") % \
|
||||
(self.__class__.__name__,
|
||||
<unsigned long><void *>self,
|
||||
PY_REFCOUNT(self),
|
||||
<unsigned long>&self.obj,
|
||||
self._get_func,
|
||||
self._del_func)
|
||||
|
||||
def get(self, evasObject obj, item_data):
|
||||
return None
|
||||
|
||||
|
||||
cdef class SlideshowItem(ObjectItem):
|
||||
|
||||
cdef int _set_obj(self, Elm_Object_Item *item, params=None) except 0:
|
||||
assert self.item == NULL, "Object must be clean"
|
||||
self.item = item
|
||||
Py_INCREF(self)
|
||||
return 1
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
assert self.item != NULL, "Object must wrap something"
|
||||
self.item = NULL
|
||||
|
||||
def __str__(self):
|
||||
return "%s(item_class=%s, func=%s, item_data=%s)" % \
|
||||
(self.__class__.__name__,
|
||||
self.params[0].__class__.__name__,
|
||||
self.params[3],
|
||||
self.params[1])
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||
"item_class=%s, func=%s, item_data=%r)") % \
|
||||
(self.__class__.__name__,
|
||||
<unsigned long><void*>self,
|
||||
PY_REFCOUNT(self),
|
||||
<unsigned long>self.obj,
|
||||
self.params[0].__class__.__name__,
|
||||
self.params[3],
|
||||
self.params[1])
|
||||
|
||||
property object:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_slideshow_item_object_get(self.item))
|
||||
|
||||
def show(self):
|
||||
elm_slideshow_item_show(self.item)
|
||||
|
||||
|
||||
cdef class Slideshow(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_slideshow_add(parent.obj))
|
||||
|
||||
def item_add(self, SlideshowItemClass item_class not None, *args, **kwargs):
|
||||
cdef SlideshowItem ret = SlideshowItem()
|
||||
cdef Elm_Object_Item *item
|
||||
|
||||
item_data = (args, kwargs)
|
||||
ret.params = (item_class, item_data)
|
||||
item = elm_slideshow_item_add(self.obj, &item_class.obj, <void*>ret)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
||||
def item_sorted_insert(self, SlideshowItemClass item_class not None,
|
||||
func not None, *args, **kwargs):
|
||||
cdef SlideshowItem ret = SlideshowItem()
|
||||
cdef Elm_Object_Item *item
|
||||
cdef Eina_Compare_Cb compare
|
||||
|
||||
if callable(func):
|
||||
compare = _py_elm_slideshow_compare_func
|
||||
else:
|
||||
raise TypeError("func is not None or callable")
|
||||
|
||||
item_data = (args, kwargs)
|
||||
ret.params = (item_class, item_data, func)
|
||||
item = elm_slideshow_item_sorted_insert(self.obj, &item_class.obj, <void*>ret, compare)
|
||||
if item != NULL:
|
||||
ret._set_obj(item)
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
||||
def next(self):
|
||||
elm_slideshow_next(self.obj)
|
||||
|
||||
def previous(self):
|
||||
elm_slideshow_previous(self.obj)
|
||||
|
||||
property transitions:
|
||||
def __get__(self):
|
||||
return tuple(_strings_to_python(elm_slideshow_transitions_get(self.obj)))
|
||||
|
||||
property transition:
|
||||
def __set__(self, transition):
|
||||
elm_slideshow_transition_set(self.obj, _cfruni(transition))
|
||||
def __get__(self):
|
||||
return _ctouni(elm_slideshow_transition_get(self.obj))
|
||||
|
||||
property timeout:
|
||||
def __set__(self, timeout):
|
||||
elm_slideshow_timeout_set(self.obj, timeout)
|
||||
def __get__(self):
|
||||
return elm_slideshow_timeout_get(self.obj)
|
||||
|
||||
property loop:
|
||||
def __set__(self, loop):
|
||||
elm_slideshow_loop_set(self.obj, loop)
|
||||
def __get__(self):
|
||||
return bool(elm_slideshow_loop_get(self.obj))
|
||||
|
||||
def clear(self):
|
||||
elm_slideshow_clear(self.obj)
|
||||
|
||||
property items:
|
||||
def __get__(self):
|
||||
return tuple(_object_item_list_to_python(elm_slideshow_items_get(self.obj)))
|
||||
|
||||
property current_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_slideshow_item_current_get(self.obj))
|
||||
|
||||
def nth_item_get(self, nth):
|
||||
return _object_item_to_python(elm_slideshow_item_nth_get(self.obj, nth))
|
||||
|
||||
property layout:
|
||||
def __set__(self, layout):
|
||||
elm_slideshow_layout_set(self.obj, _cfruni(layout))
|
||||
def __get__(self):
|
||||
return _ctouni(elm_slideshow_layout_get(self.obj))
|
||||
|
||||
property layouts:
|
||||
def __get__(self):
|
||||
return tuple(_strings_to_python(elm_slideshow_layouts_get(self.obj)))
|
||||
|
||||
property cache_before:
|
||||
def __set__(self, count):
|
||||
elm_slideshow_cache_before_set(self.obj, count)
|
||||
def __get__(self):
|
||||
return elm_slideshow_cache_before_get(self.obj)
|
||||
|
||||
property cache_after:
|
||||
def __set__(self, count):
|
||||
elm_slideshow_cache_after_set(self.obj, count)
|
||||
def __get__(self):
|
||||
return elm_slideshow_cache_after_get(self.obj)
|
||||
|
||||
property count:
|
||||
def __get__(self):
|
||||
return elm_slideshow_count_get(self.obj)
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("changed", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del_full("changed", _cb_object_item_conv, func)
|
||||
|
||||
def callback_transition_end_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("transition,end", _cb_object_item_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_transition_end_del(self, func):
|
||||
self._callback_del_full("transition,end", _cb_object_item_conv, func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_slideshow", Slideshow)
|
|
@ -0,0 +1,159 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Spinner(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_spinner_add(parent.obj))
|
||||
|
||||
def label_format_set(self, format):
|
||||
elm_spinner_label_format_set(self.obj, _cfruni(format))
|
||||
|
||||
def label_format_get(self):
|
||||
return _ctouni(elm_spinner_label_format_get(self.obj))
|
||||
|
||||
property label_format:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_spinner_label_format_get(self.obj))
|
||||
|
||||
def __set__(self, format):
|
||||
elm_spinner_label_format_set(self.obj, _cfruni(format))
|
||||
|
||||
def min_max_set(self, min, max):
|
||||
elm_spinner_min_max_set(self.obj, min, max)
|
||||
|
||||
def min_max_get(self):
|
||||
cdef double min, max
|
||||
elm_spinner_min_max_get(self.obj, &min, &max)
|
||||
return (min, max)
|
||||
|
||||
property min_max:
|
||||
def __get__(self):
|
||||
cdef double min, max
|
||||
elm_spinner_min_max_get(self.obj, &min, &max)
|
||||
return (min, max)
|
||||
|
||||
def __set__(self, value):
|
||||
min, max = value
|
||||
elm_spinner_min_max_set(self.obj, min, max)
|
||||
|
||||
def step_set(self, step):
|
||||
elm_spinner_step_set(self.obj, step)
|
||||
|
||||
def step_get(self):
|
||||
return elm_spinner_step_get(self.obj)
|
||||
|
||||
property step:
|
||||
def __get__(self):
|
||||
return elm_spinner_step_get(self.obj)
|
||||
|
||||
def __set__(self, step):
|
||||
elm_spinner_step_set(self.obj, step)
|
||||
|
||||
def value_set(self, value):
|
||||
elm_spinner_value_set(self.obj, value)
|
||||
|
||||
def value_get(self):
|
||||
return elm_spinner_value_get(self.obj)
|
||||
|
||||
property value:
|
||||
def __get__(self):
|
||||
return elm_spinner_value_get(self.obj)
|
||||
def __set__(self, value):
|
||||
elm_spinner_value_set(self.obj, value)
|
||||
|
||||
def wrap_set(self, wrap):
|
||||
elm_spinner_wrap_set(self.obj, wrap)
|
||||
|
||||
def wrap_get(self):
|
||||
return elm_spinner_wrap_get(self.obj)
|
||||
|
||||
property wrap:
|
||||
def __get__(self):
|
||||
return elm_spinner_wrap_get(self.obj)
|
||||
def __set__(self, wrap):
|
||||
elm_spinner_wrap_set(self.obj, wrap)
|
||||
|
||||
def editable_set(self, editable):
|
||||
elm_spinner_editable_set(self.obj, editable)
|
||||
|
||||
def editable_get(self):
|
||||
return elm_spinner_editable_get(self.obj)
|
||||
|
||||
property editable:
|
||||
def __get__(self):
|
||||
return elm_spinner_editable_get(self.obj)
|
||||
def __set__(self, editable):
|
||||
elm_spinner_editable_set(self.obj, editable)
|
||||
|
||||
def special_value_add(self, value, label):
|
||||
elm_spinner_special_value_add(self.obj, value, _cfruni(label))
|
||||
|
||||
def interval_set(self, interval):
|
||||
elm_spinner_interval_set(self.obj, interval)
|
||||
|
||||
def interval_get(self):
|
||||
return elm_spinner_interval_get(self.obj)
|
||||
|
||||
property interval:
|
||||
def __get__(self):
|
||||
return elm_spinner_interval_get(self.obj)
|
||||
|
||||
def __set__(self, interval):
|
||||
elm_spinner_interval_set(self.obj, interval)
|
||||
|
||||
def base_set(self, base):
|
||||
elm_spinner_base_set(self.obj, base)
|
||||
|
||||
def base_get(self):
|
||||
return elm_spinner_base_get(self.obj)
|
||||
|
||||
property base:
|
||||
def __get__(self):
|
||||
return elm_spinner_base_get(self.obj)
|
||||
|
||||
def __set__(self, base):
|
||||
elm_spinner_base_set(self.obj, base)
|
||||
|
||||
def round_set(self, rnd):
|
||||
elm_spinner_round_set(self.obj, rnd)
|
||||
|
||||
def round_get(self):
|
||||
return elm_spinner_round_get(self.obj)
|
||||
|
||||
property round:
|
||||
def __get__(self):
|
||||
return elm_spinner_round_get(self.obj)
|
||||
|
||||
def __set__(self, rnd):
|
||||
elm_spinner_round_set(self.obj, rnd)
|
||||
|
||||
def callback_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("changed", func, *args, **kwargs)
|
||||
|
||||
def callback_changed_del(self, func):
|
||||
self._callback_del("changed", func)
|
||||
|
||||
def callback_delay_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("delay,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_delay_changed_del(self, func):
|
||||
self._callback_del("delay,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_spinner", Spinner)
|
|
@ -0,0 +1,74 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class Table(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_table_add(parent.obj))
|
||||
|
||||
def homogeneous_set(self, homogeneous):
|
||||
elm_table_homogeneous_set(self.obj, homogeneous)
|
||||
|
||||
def homogeneous_get(self):
|
||||
return elm_table_homogeneous_get(self.obj)
|
||||
|
||||
property homogeneous:
|
||||
def __get__(self):
|
||||
return elm_table_homogeneous_get(self.obj)
|
||||
|
||||
def __set__(self, homogeneous):
|
||||
elm_table_homogeneous_set(self.obj, homogeneous)
|
||||
|
||||
def padding_set(self, horizontal, vertical):
|
||||
elm_table_padding_set(self.obj, horizontal, vertical)
|
||||
|
||||
def padding_get(self):
|
||||
cdef Evas_Coord horizontal, vertical
|
||||
elm_table_padding_get(self.obj, &horizontal, &vertical)
|
||||
return (horizontal, vertical)
|
||||
|
||||
property padding:
|
||||
def __get__(self):
|
||||
cdef Evas_Coord horizontal, vertical
|
||||
elm_table_padding_get(self.obj, &horizontal, &vertical)
|
||||
return (horizontal, vertical)
|
||||
|
||||
def __set__(self, value):
|
||||
horizontal, vertical = value
|
||||
elm_table_padding_set(self.obj, horizontal, vertical)
|
||||
|
||||
def pack(self, evasObject subobj, x, y, w, h):
|
||||
elm_table_pack(self.obj, subobj.obj, x, y, w, h)
|
||||
|
||||
def unpack(self, evasObject subobj):
|
||||
elm_table_unpack(self.obj, subobj.obj)
|
||||
|
||||
def clear(self, clear):
|
||||
elm_table_clear(self.obj, clear)
|
||||
|
||||
def pack_set(evasObject subobj, x, y, w, h):
|
||||
elm_table_pack_set(subobj.obj, x, y, w, h)
|
||||
|
||||
def pack_get(evasObject subobj):
|
||||
cdef int x, y, w, h
|
||||
elm_table_pack_get(subobj.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
|
||||
_object_mapping_register("elm_table", Table)
|
|
@ -0,0 +1,110 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Theme(object):
|
||||
|
||||
cdef Elm_Theme *th
|
||||
|
||||
def __cinit__(self):
|
||||
self.th = NULL
|
||||
|
||||
def __init__(self, default=False):
|
||||
cdef Elm_Theme *th
|
||||
if default:
|
||||
th = elm_theme_default_get()
|
||||
else:
|
||||
th = elm_theme_new()
|
||||
|
||||
if th != NULL:
|
||||
self.th = th
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def __dealloc__(self):
|
||||
if self.th != NULL:
|
||||
elm_theme_free(self.th)
|
||||
self.th = NULL
|
||||
|
||||
def copy(self, Theme thdst):
|
||||
elm_theme_copy(self.th, thdst.th)
|
||||
|
||||
property reference:
|
||||
def __set__(self, Theme thref):
|
||||
elm_theme_ref_set(self.th, thref.th)
|
||||
|
||||
def __get__(self):
|
||||
cdef Theme thref = Theme()
|
||||
thref.th = elm_theme_ref_get(self.th)
|
||||
return thref
|
||||
|
||||
def overlay_add(self, item):
|
||||
elm_theme_overlay_add(self.th, _cfruni(item))
|
||||
|
||||
def overlay_del(self, item):
|
||||
elm_theme_overlay_del(self.th, _cfruni(item))
|
||||
|
||||
property overlay_list:
|
||||
def __get__(self):
|
||||
return tuple(_strings_to_python(elm_theme_overlay_list_get(self.th)))
|
||||
|
||||
def extension_add(self, item):
|
||||
elm_theme_extension_add(self.th, _cfruni(item))
|
||||
|
||||
def extension_del(self, item):
|
||||
elm_theme_extension_del(self.th, _cfruni(item))
|
||||
|
||||
property extension_list:
|
||||
def __get__(self):
|
||||
return tuple(_strings_to_python(elm_theme_extension_list_get(self.th)))
|
||||
|
||||
property order:
|
||||
def __set__(self, theme):
|
||||
elm_theme_set(self.th, _cfruni(theme))
|
||||
|
||||
def __get__(self):
|
||||
return _ctouni(elm_theme_get(self.th))
|
||||
|
||||
property elements:
|
||||
def __get__(self):
|
||||
return tuple(_strings_to_python(elm_theme_list_get(self.th)))
|
||||
|
||||
def flush(self):
|
||||
elm_theme_flush(self.th)
|
||||
|
||||
def data_get(self, key):
|
||||
return _ctouni(elm_theme_data_get(self.th, _cfruni(key)))
|
||||
|
||||
def theme_list_item_path_get(f, in_search_path):
|
||||
cdef Eina_Bool path = in_search_path
|
||||
return _ctouni(elm_theme_list_item_path_get(_cfruni(f), &path))
|
||||
|
||||
def theme_full_flush():
|
||||
elm_theme_full_flush()
|
||||
|
||||
def theme_name_available_list():
|
||||
cdef Eina_List *lst = elm_theme_name_available_list_new()
|
||||
elements = tuple(_strings_to_python(lst))
|
||||
elm_theme_name_available_list_free(lst)
|
||||
return elements
|
||||
|
||||
# for compatibility
|
||||
def theme_overlay_add(item):
|
||||
elm_theme_overlay_add(NULL, item)
|
||||
|
||||
def theme_extension_add(item):
|
||||
elm_theme_extension_add(NULL, item)
|
|
@ -0,0 +1,111 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class Thumb(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_thumb_add(parent.obj))
|
||||
|
||||
def reload(self):
|
||||
elm_thumb_reload(self.obj)
|
||||
|
||||
property file:
|
||||
def __set__(self, value):
|
||||
if isinstance(value, tuple) or isinstance(value, list):
|
||||
file, key = value
|
||||
else:
|
||||
file = value
|
||||
key = None
|
||||
elm_thumb_file_set( self.obj,
|
||||
_cfruni(file) if file is not None else NULL,
|
||||
_cfruni(key) if key is not None else NULL)
|
||||
def __get__(self):
|
||||
cdef const_char_ptr file, key
|
||||
elm_thumb_file_get(self.obj, &file, &key)
|
||||
return(_ctouni(file), _ctouni(key))
|
||||
|
||||
property path:
|
||||
def __get__(self):
|
||||
cdef const_char_ptr path, key
|
||||
elm_thumb_path_get(self.obj, &path, &key)
|
||||
return(_ctouni(path), _ctouni(key))
|
||||
|
||||
property animate:
|
||||
def __set__(self, s):
|
||||
elm_thumb_animate_set(self.obj, s)
|
||||
def __get__(self):
|
||||
return elm_thumb_animate_get(self.obj)
|
||||
|
||||
def ethumb_client_get(self):
|
||||
return None
|
||||
#return elm_thumb_ethumb_client_get(void)
|
||||
|
||||
def ethumb_client_connected_get(self):
|
||||
return bool(elm_thumb_ethumb_client_connected_get())
|
||||
|
||||
property editable:
|
||||
def __set__(self, edit):
|
||||
elm_thumb_editable_set(self.obj, edit)
|
||||
def __get__(self):
|
||||
return bool(elm_thumb_editable_get(self.obj))
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_clicked_double_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked,double", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_double_del(self, func):
|
||||
self._callback_del("clicked,double", func)
|
||||
|
||||
def callback_press_add(self, func, *args, **kwargs):
|
||||
self._callback_add("press", func, *args, **kwargs)
|
||||
|
||||
def callback_press_del(self, func):
|
||||
self._callback_del("press", func)
|
||||
|
||||
def callback_generate_start_add(self, func, *args, **kwargs):
|
||||
self._callback_add("generate,start", func, *args, **kwargs)
|
||||
|
||||
def callback_generate_start_del(self, func):
|
||||
self._callback_del("generate,start", func)
|
||||
|
||||
def callback_generate_stop_add(self, func, *args, **kwargs):
|
||||
self._callback_add("generate,stop", func, *args, **kwargs)
|
||||
|
||||
def callback_generate_stop_del(self, func):
|
||||
self._callback_del("generate,stop", func)
|
||||
|
||||
def callback_generate_error_add(self, func, *args, **kwargs):
|
||||
self._callback_add("generate,error", func, *args, **kwargs)
|
||||
|
||||
def callback_generate_error_del(self, func):
|
||||
self._callback_del("generate,error", func)
|
||||
|
||||
def callback_load_error_add(self, func, *args, **kwargs):
|
||||
self._callback_add("load,error", func, *args, **kwargs)
|
||||
|
||||
def callback_load_error_del(self, func):
|
||||
self._callback_del("load,error", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_thumb", Thumb)
|
|
@ -0,0 +1,395 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class ToolbarItemState(object):
|
||||
|
||||
cdef Elm_Toolbar_Item_State *obj
|
||||
cdef object params
|
||||
|
||||
def __init__(self, ObjectItem it, icon = None, label = None, callback = None, *args, **kwargs):
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if callback:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kwargs)
|
||||
|
||||
self.obj = elm_toolbar_item_state_add(it.item, _cfruni(icon), _cfruni(label), cb, <void*>self)
|
||||
if self.obj == NULL:
|
||||
Py_DECREF(self)
|
||||
|
||||
|
||||
cdef class ToolbarItem(ObjectItem):
|
||||
|
||||
def __init__(self, evasObject toolbar, icon, label,
|
||||
callback, *args, **kargs):
|
||||
cdef Evas_Object *ic = NULL
|
||||
cdef Evas_Smart_Cb cb = NULL
|
||||
|
||||
if callback:
|
||||
if not callable(callback):
|
||||
raise TypeError("callback is not callable")
|
||||
cb = _object_item_callback
|
||||
|
||||
self.params = (callback, args, kargs)
|
||||
|
||||
item = elm_toolbar_item_append(toolbar.obj, icon, _cfruni(label), cb, <void*>self)
|
||||
|
||||
if item != NULL:
|
||||
self._set_obj(item)
|
||||
else:
|
||||
Py_DECREF(self)
|
||||
|
||||
def next_get(self):
|
||||
return _object_item_to_python(elm_toolbar_item_next_get(self.item))
|
||||
|
||||
property next:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_toolbar_item_next_get(self.item))
|
||||
|
||||
def prev_get(self):
|
||||
return _object_item_to_python(elm_toolbar_item_prev_get(self.item))
|
||||
|
||||
property prev:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_toolbar_item_prev_get(self.item))
|
||||
|
||||
def priority_set(self, priority):
|
||||
elm_toolbar_item_priority_set(self.item, priority)
|
||||
|
||||
def priority_get(self):
|
||||
return elm_toolbar_item_priority_get(self.item)
|
||||
|
||||
property priority:
|
||||
def __get__(self):
|
||||
return elm_toolbar_item_priority_get(self.item)
|
||||
|
||||
def __set__(self, priority):
|
||||
elm_toolbar_item_priority_set(self.item, priority)
|
||||
|
||||
def selected_get(self):
|
||||
return elm_toolbar_item_selected_get(self.item)
|
||||
|
||||
def selected_set(self, selected):
|
||||
elm_toolbar_item_selected_set(self.item, selected)
|
||||
|
||||
property selected:
|
||||
def __set__(self, selected):
|
||||
elm_toolbar_item_selected_set(self.item, selected)
|
||||
|
||||
def __get__(self):
|
||||
return elm_toolbar_item_selected_get(self.item)
|
||||
|
||||
def icon_set(self, ic):
|
||||
elm_toolbar_item_icon_set(self.item, _cfruni(ic))
|
||||
|
||||
def icon_get(self):
|
||||
return _ctouni(elm_toolbar_item_icon_get(self.item))
|
||||
|
||||
property icon:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_toolbar_item_icon_get(self.item))
|
||||
|
||||
def __set__(self, ic):
|
||||
elm_toolbar_item_icon_set(self.item, _cfruni(ic))
|
||||
|
||||
def object_get(self):
|
||||
return object_from_instance(elm_toolbar_item_object_get(self.item))
|
||||
|
||||
property object:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_toolbar_item_object_get(self.item))
|
||||
|
||||
def icon_object_get(self):
|
||||
return object_from_instance(elm_toolbar_item_icon_object_get(self.item))
|
||||
|
||||
property icon_object:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_toolbar_item_icon_object_get(self.item))
|
||||
|
||||
def icon_memfile_set(self, img, size, format, key):
|
||||
return False
|
||||
#TODO: return bool(elm_toolbar_item_icon_memfile_set(self.item, img, size, format, key))
|
||||
|
||||
def icon_file_set(self, file, key):
|
||||
return bool(elm_toolbar_item_icon_file_set(self.item, _cfruni(file), _cfruni(key)))
|
||||
|
||||
property icon_file:
|
||||
def __set__(self, value):
|
||||
if isinstance(value, tuple):
|
||||
file, key = value
|
||||
else:
|
||||
file = value
|
||||
key = None
|
||||
# TODO: check return status
|
||||
elm_toolbar_item_icon_file_set(self.item, _cfruni(file), _cfruni(key))
|
||||
|
||||
def separator_set(self, separator):
|
||||
elm_toolbar_item_separator_set(self.item, separator)
|
||||
|
||||
def separator_get(self):
|
||||
return elm_toolbar_item_separator_get(self.item)
|
||||
|
||||
property separator:
|
||||
def __set__(self, separator):
|
||||
elm_toolbar_item_separator_set(self.item, separator)
|
||||
|
||||
def __get__(self):
|
||||
return elm_toolbar_item_separator_get(self.item)
|
||||
|
||||
def menu_set(self, menu):
|
||||
elm_toolbar_item_menu_set(self.item, menu)
|
||||
|
||||
def menu_get(self):
|
||||
cdef Evas_Object *menu
|
||||
menu = elm_toolbar_item_menu_get(self.item)
|
||||
if menu == NULL:
|
||||
return None
|
||||
else:
|
||||
return Menu(None, <object>menu)
|
||||
|
||||
property menu:
|
||||
def __get__(self):
|
||||
cdef Evas_Object *menu
|
||||
menu = elm_toolbar_item_menu_get(self.item)
|
||||
if menu == NULL:
|
||||
return None
|
||||
else:
|
||||
return Menu(None, <object>menu)
|
||||
|
||||
def __set__(self, menu):
|
||||
elm_toolbar_item_menu_set(self.item, menu)
|
||||
|
||||
def state_add(self, icon = None, label = None, func = None, *args, **kwargs):
|
||||
return ToolbarItemState(self, icon, label, func, *args, **kwargs)
|
||||
|
||||
def state_del(self, ToolbarItemState state):
|
||||
return bool(elm_toolbar_item_state_del(self.item, state.obj))
|
||||
|
||||
property state:
|
||||
def __set__(self, ToolbarItemState state):
|
||||
# TODO: check return value bool for errors
|
||||
elm_toolbar_item_state_set(self.item, state.obj)
|
||||
|
||||
def __del__(self):
|
||||
elm_toolbar_item_state_unset(self.item)
|
||||
|
||||
def __get__(self):
|
||||
return None
|
||||
# TODO: C api doesn't have data_get() for states so we can't get
|
||||
# the py object from there. Store it in the item instead?
|
||||
#elm_toolbar_item_state_get(self.item)
|
||||
|
||||
property state_next:
|
||||
def __get__(self):
|
||||
return None
|
||||
# TODO: keep a list of the states?
|
||||
#return elm_toolbar_item_state_next(self.item)
|
||||
|
||||
property state_prev:
|
||||
def __get__(self):
|
||||
return None
|
||||
# TODO: keep a list of the states?
|
||||
#return elm_toolbar_item_state_prev(self.item)
|
||||
|
||||
|
||||
cdef class Toolbar(Object):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_toolbar_add(parent.obj))
|
||||
|
||||
def icon_size_set(self, icon_size):
|
||||
elm_toolbar_icon_size_set(self.obj, icon_size)
|
||||
|
||||
def icon_size_get(self):
|
||||
return elm_toolbar_icon_size_get(self.obj)
|
||||
|
||||
property icon_size:
|
||||
def __set__(self, icon_size):
|
||||
elm_toolbar_icon_size_set(self.obj, icon_size)
|
||||
|
||||
def __get__(self):
|
||||
return elm_toolbar_icon_size_get(self.obj)
|
||||
|
||||
def icon_order_lookup_set(self, order):
|
||||
elm_toolbar_icon_order_lookup_set(self.obj, order)
|
||||
|
||||
def icon_order_lookup_get(self):
|
||||
return elm_toolbar_icon_order_lookup_get(self.obj)
|
||||
|
||||
property icon_order_lookup:
|
||||
def __set__(self, order):
|
||||
elm_toolbar_icon_order_lookup_set(self.obj, order)
|
||||
|
||||
def __get__(self):
|
||||
return elm_toolbar_icon_order_lookup_get(self.obj)
|
||||
|
||||
def item_append(self, icon, label, callback = None, *args, **kargs):
|
||||
# Everything is done in the ToolbarItem class, because of wrapping the
|
||||
# C structures in python classes
|
||||
return ToolbarItem(self, icon, label, callback, *args, **kargs)
|
||||
|
||||
#TODO: def item_prepend(self, icon, label, callback = None, *args, **kargs):
|
||||
#return ToolbarItem(self, icon, label, callback, *args, **kargs)
|
||||
|
||||
#TODO: def item_insert_before(self, before, icon, label, callback = None, *args, **kargs):
|
||||
#return ToolbarItem(self, icon, label, callback, *args, **kargs)
|
||||
|
||||
#TODO: def item_insert_after(self, after, icon, label, callback = None, *args, **kargs):
|
||||
#return ToolbarItem(self, icon, label, callback, *args, **kargs)
|
||||
|
||||
def first_item_get(self):
|
||||
return _object_item_to_python(elm_toolbar_first_item_get(self.obj))
|
||||
|
||||
property first_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_toolbar_first_item_get(self.obj))
|
||||
|
||||
def last_item_get(self):
|
||||
return _object_item_to_python(elm_toolbar_last_item_get(self.obj))
|
||||
|
||||
property last_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_toolbar_last_item_get(self.obj))
|
||||
|
||||
def item_find_by_label(self, label):
|
||||
return _object_item_to_python(elm_toolbar_item_find_by_label(self.obj, _cfruni(label)))
|
||||
|
||||
def selected_item_get(self):
|
||||
return _object_item_to_python(elm_toolbar_selected_item_get(self.obj))
|
||||
|
||||
property selected_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_toolbar_selected_item_get(self.obj))
|
||||
|
||||
def more_item_get(self):
|
||||
return _object_item_to_python(elm_toolbar_more_item_get(self.obj))
|
||||
|
||||
property more_item:
|
||||
def __get__(self):
|
||||
return _object_item_to_python(elm_toolbar_more_item_get(self.obj))
|
||||
|
||||
def shrink_mode_set(self, mode):
|
||||
elm_toolbar_shrink_mode_set(self.obj, mode)
|
||||
|
||||
def shrink_mode_get(self):
|
||||
return elm_toolbar_shrink_mode_get(self.obj)
|
||||
|
||||
property shrink_mode:
|
||||
def __get__(self):
|
||||
return elm_toolbar_shrink_mode_get(self.obj)
|
||||
|
||||
def __set__(self, mode):
|
||||
elm_toolbar_shrink_mode_set(self.obj, mode)
|
||||
|
||||
def homogeneous_set(self, homogeneous):
|
||||
elm_toolbar_homogeneous_set(self.obj, homogeneous)
|
||||
|
||||
def homogeneous_get(self):
|
||||
return elm_toolbar_homogeneous_get(self.obj)
|
||||
|
||||
property homogeneous:
|
||||
def __set__(self, homogeneous):
|
||||
elm_toolbar_homogeneous_set(self.obj, homogeneous)
|
||||
|
||||
def __get__(self):
|
||||
return elm_toolbar_homogeneous_get(self.obj)
|
||||
|
||||
def menu_parent_set(self, evasObject parent):
|
||||
elm_toolbar_menu_parent_set(self.obj, parent.obj)
|
||||
|
||||
def menu_parent_get(self):
|
||||
return object_from_instance(elm_toolbar_menu_parent_get(self.obj))
|
||||
|
||||
property menu_parent:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_toolbar_menu_parent_get(self.obj))
|
||||
|
||||
def __set__(self, evasObject parent):
|
||||
elm_toolbar_menu_parent_set(self.obj, parent.obj)
|
||||
|
||||
def align_set(self, align):
|
||||
elm_toolbar_align_set(self.obj, align)
|
||||
|
||||
def align_get(self):
|
||||
return elm_toolbar_align_get(self.obj)
|
||||
|
||||
property align:
|
||||
def __set__(self, align):
|
||||
elm_toolbar_align_set(self.obj, align)
|
||||
|
||||
def __get__(self):
|
||||
return elm_toolbar_align_get(self.obj)
|
||||
|
||||
def horizontal_set(self, horizontal):
|
||||
elm_toolbar_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def horizontal_get(self):
|
||||
return elm_toolbar_horizontal_get(self.obj)
|
||||
|
||||
property horizontal:
|
||||
def __set__(self, horizontal):
|
||||
elm_toolbar_horizontal_set(self.obj, horizontal)
|
||||
|
||||
def __get__(self):
|
||||
return elm_toolbar_horizontal_get(self.obj)
|
||||
|
||||
def items_count(self):
|
||||
return elm_toolbar_items_count(self.obj)
|
||||
|
||||
property standard_priority:
|
||||
def __set__(self, priority):
|
||||
elm_toolbar_standard_priority_set(self.obj, priority)
|
||||
def __get__(self):
|
||||
return elm_toolbar_standard_priority_get(self.obj)
|
||||
|
||||
def select_mode_set(self, mode):
|
||||
elm_toolbar_select_mode_set(self.obj, mode)
|
||||
|
||||
def select_mode_get(self):
|
||||
return elm_toolbar_select_mode_get(self.obj)
|
||||
|
||||
property select_mode:
|
||||
def __get__(self):
|
||||
return elm_toolbar_select_mode_get(self.obj)
|
||||
|
||||
def __set__(self, mode):
|
||||
elm_toolbar_select_mode_set(self.obj, mode)
|
||||
|
||||
def callback_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add("clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_clicked_del(self, func):
|
||||
self._callback_del("clicked", func)
|
||||
|
||||
def callback_longpressed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("longpressed", func, *args, **kwargs)
|
||||
|
||||
def callback_longpressed_del(self, func):
|
||||
self._callback_del("longpressed", func)
|
||||
|
||||
def callback_language_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add("language,changed", func, *args, **kwargs)
|
||||
|
||||
def callback_language_changed_del(self, func):
|
||||
self._callback_del("language,changed", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_toolbar", Toolbar)
|
|
@ -0,0 +1,155 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
cdef class Transit(object):
|
||||
|
||||
cdef Elm_Transit* obj
|
||||
|
||||
def __cinit__(self, *a, **ka):
|
||||
self.obj = NULL
|
||||
|
||||
def __init__(self):
|
||||
self.obj = elm_transit_add()
|
||||
|
||||
def delete(self):
|
||||
elm_transit_del(self.obj)
|
||||
|
||||
#def effect_add(self, Elm_Transit_Effect_Transition_Cb transition_cb, effect, Elm_Transit_Effect_End_Cb end_cb):
|
||||
#elm_transit_effect_add(self.obj, transition_cb, effect, end_cb)
|
||||
|
||||
#def effect_del(self, Elm_Transit_Effect_Transition_Cb transition_cb, effect):
|
||||
#elm_transit_effect_del(self.obj, transition_cb, effect)
|
||||
|
||||
def object_add(self, evasObject obj):
|
||||
elm_transit_object_add(self.obj, obj.obj)
|
||||
|
||||
def object_remove(self, evasObject obj):
|
||||
elm_transit_object_remove(self.obj, obj.obj)
|
||||
|
||||
property objects:
|
||||
def __get__(self):
|
||||
return _object_list_to_python(elm_transit_objects_get(self.obj))
|
||||
|
||||
property objects_final_state_keep:
|
||||
def __set__(self, state_keep):
|
||||
elm_transit_objects_final_state_keep_set(self.obj, state_keep)
|
||||
|
||||
def __get__(self):
|
||||
return bool(elm_transit_objects_final_state_keep_get(self.obj))
|
||||
|
||||
property event_enabled:
|
||||
def __set__(self, enabled):
|
||||
elm_transit_event_enabled_set(self.obj, enabled)
|
||||
def __get__(self):
|
||||
return bool(elm_transit_event_enabled_get(self.obj))
|
||||
|
||||
def del_cb_set(self, cb, *args, **kwargs):
|
||||
pass
|
||||
#elm_transit_del_cb_set(self.obj, cb, data)
|
||||
|
||||
property auto_reverse:
|
||||
def __set__(self, reverse):
|
||||
elm_transit_auto_reverse_set(self.obj, reverse)
|
||||
def __get__(self):
|
||||
return bool(elm_transit_auto_reverse_get(self.obj))
|
||||
|
||||
property repeat_times:
|
||||
def __set__(self, repeat):
|
||||
elm_transit_repeat_times_set(self.obj, repeat)
|
||||
def __get__(self):
|
||||
return elm_transit_repeat_times_get(self.obj)
|
||||
|
||||
property tween_mode:
|
||||
def __set__(self, tween_mode):
|
||||
elm_transit_tween_mode_set(self.obj, tween_mode)
|
||||
def __get__(self):
|
||||
return elm_transit_tween_mode_get(self.obj)
|
||||
|
||||
property duration:
|
||||
def __set__(self, duration):
|
||||
elm_transit_duration_set(self.obj, duration)
|
||||
def __get__(self):
|
||||
return elm_transit_duration_get(self.obj)
|
||||
|
||||
def go(self):
|
||||
elm_transit_go(self.obj)
|
||||
|
||||
property paused:
|
||||
def __set__(self, paused):
|
||||
elm_transit_paused_set(self.obj, paused)
|
||||
def __get__(self):
|
||||
return bool(elm_transit_paused_get(self.obj))
|
||||
|
||||
property progress_value:
|
||||
def __get__(self):
|
||||
return elm_transit_progress_value_get(self.obj)
|
||||
|
||||
def chain_transit_add(self, Transit chain_transit):
|
||||
elm_transit_chain_transit_add(self.obj, chain_transit.obj)
|
||||
|
||||
def chain_transit_del(self, Transit chain_transit):
|
||||
elm_transit_chain_transit_del(self.obj, chain_transit.obj)
|
||||
|
||||
property chain_transits:
|
||||
def __get__(self):
|
||||
return _object_list_to_python(elm_transit_chain_transits_get(self.obj))
|
||||
|
||||
def effect_resizing_add(self, Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_resizing_add(self.obj, from_w, from_h, to_w, to_h)
|
||||
|
||||
def effect_translation_add(self, Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_translation_add(self.obj, from_dx, from_dy, to_dx, to_dy)
|
||||
|
||||
def effect_zoom_add(self, float from_rate, float to_rate):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_zoom_add(self.obj, from_rate, to_rate)
|
||||
|
||||
def effect_flip_add(self, Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_flip_add(self.obj, axis, cw)
|
||||
|
||||
def effect_resizable_flip_add(self, Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_resizable_flip_add(self.obj, axis, cw)
|
||||
|
||||
def effect_wipe_add(self, Elm_Transit_Effect_Wipe_Type type, Elm_Transit_Effect_Wipe_Dir dir):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_wipe_add(self.obj, type, dir)
|
||||
|
||||
def effect_color_add(self, unsigned int from_r, unsigned int from_g, unsigned int from_b, unsigned int from_a, unsigned int to_r, unsigned int to_g, unsigned int to_b, unsigned int to_a):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_color_add(self.obj, from_r, from_g, from_b, from_a, to_r, to_g, to_b, to_a)
|
||||
|
||||
def effect_fade_add(self):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_fade_add(self.obj)
|
||||
|
||||
def effect_blend_add(self):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_blend_add(self.obj)
|
||||
|
||||
def effect_rotation_add(self, float from_degree, float to_degree):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_rotation_add(self.obj, from_degree, to_degree)
|
||||
|
||||
def effect_image_animation_add(self, images):
|
||||
#TODO: can the return value Elm_Transit_Effect be used somehow?
|
||||
elm_transit_effect_image_animation_add(self.obj, _strings_from_python(images))
|
|
@ -0,0 +1,182 @@
|
|||
# Copyright 2012 Kai Huuhko <kai.huuhko@gmail.com>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cdef class Video(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_video_add(parent.obj))
|
||||
|
||||
def file_set(self, filename):
|
||||
return bool(elm_video_file_set(self.obj, _cfruni(filename)))
|
||||
|
||||
property file:
|
||||
def __set__(self, filename):
|
||||
# TODO: check return value
|
||||
elm_video_file_set(self.obj, _cfruni(filename))
|
||||
|
||||
def emotion_get(self):
|
||||
return object_from_instance(elm_video_emotion_get(self.obj))
|
||||
|
||||
property emotion:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_video_emotion_get(self.obj))
|
||||
|
||||
def play(self):
|
||||
elm_video_play(self.obj)
|
||||
|
||||
def pause(self):
|
||||
elm_video_pause(self.obj)
|
||||
|
||||
def stop(self):
|
||||
elm_video_stop(self.obj)
|
||||
|
||||
def is_playing_get(self):
|
||||
return bool(elm_video_is_playing_get(self.obj))
|
||||
|
||||
property is_playing:
|
||||
def __get__(self):
|
||||
return self.is_playing_get()
|
||||
|
||||
def is_seekable_get(self):
|
||||
return bool(elm_video_is_seekable_get(self.obj))
|
||||
|
||||
property is_seekable:
|
||||
def __get__(self):
|
||||
return self.is_seekable_get()
|
||||
|
||||
def audio_mute_get(self):
|
||||
return bool(elm_video_audio_mute_get(self.obj))
|
||||
|
||||
def audio_mute_set(self, mute):
|
||||
elm_video_audio_mute_set(self.obj, mute)
|
||||
|
||||
property audio_mute:
|
||||
def __get__(self):
|
||||
return self.audio_mute_get()
|
||||
def __set__(self, mute):
|
||||
self.audio_mute_set(mute)
|
||||
|
||||
def audio_level_get(self):
|
||||
return elm_video_audio_level_get(self.obj)
|
||||
|
||||
def audio_level_set(self, double volume):
|
||||
elm_video_audio_level_set(self.obj, volume)
|
||||
|
||||
property audio_level:
|
||||
def __get__(self):
|
||||
return self.audio_level_get()
|
||||
def __set__(self, volume):
|
||||
self.audio_level_set(volume)
|
||||
|
||||
def play_position_get(self):
|
||||
return elm_video_play_position_get(self.obj)
|
||||
|
||||
def play_position_set(self, double position):
|
||||
elm_video_play_position_set(self.obj, position)
|
||||
|
||||
property play_position:
|
||||
def __get__(self):
|
||||
return self.play_position_get()
|
||||
def __set__(self, position):
|
||||
self.play_position_set(position)
|
||||
|
||||
def play_length_get(self):
|
||||
return elm_video_play_length_get(self.obj)
|
||||
|
||||
property play_length:
|
||||
def __get__(self):
|
||||
return self.play_length_get()
|
||||
|
||||
def remember_position_set(self, remember):
|
||||
elm_video_remember_position_set(self.obj, remember)
|
||||
|
||||
def remember_position_get(self):
|
||||
return bool(elm_video_remember_position_get(self.obj))
|
||||
|
||||
property remember_position:
|
||||
def __get__(self):
|
||||
return self.remember_position_get()
|
||||
def __set__(self, remember):
|
||||
self.remember_position_set(remember)
|
||||
|
||||
def title_get(self):
|
||||
return _ctouni(elm_video_title_get(self.obj))
|
||||
|
||||
property title:
|
||||
def __get__(self):
|
||||
return self.title_get()
|
||||
|
||||
|
||||
_object_mapping_register("elm_video", Video)
|
||||
|
||||
|
||||
cdef class Player(LayoutClass):
|
||||
|
||||
def __init__(self, evasObject parent):
|
||||
self._set_obj(elm_player_add(parent.obj))
|
||||
|
||||
def callback_forward_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("forward,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_forward_clicked_del(self, func):
|
||||
self._callback_del_full("forward,clicked", func)
|
||||
|
||||
def callback_info_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("info,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_info_clicked_del(self, func):
|
||||
self._callback_del_full("info,clicked", func)
|
||||
|
||||
def callback_next_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("next,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_next_clicked_del(self, func):
|
||||
self._callback_del_full("next,clicked", func)
|
||||
|
||||
def callback_pause_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("pause,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_pause_clicked_del(self, func):
|
||||
self._callback_del_full("pause,clicked", func)
|
||||
|
||||
def callback_play_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("play,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_play_clicked_del(self, func):
|
||||
self._callback_del_full("play,clicked", func)
|
||||
|
||||
def callback_prev_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("prev,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_prev_clicked_del(self, func):
|
||||
self._callback_del_full("prev,clicked", func)
|
||||
|
||||
def callback_rewind_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("rewind,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_rewind_clicked_del(self, func):
|
||||
self._callback_del_full("rewind,clicked", func)
|
||||
|
||||
def callback_stop_clicked_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("stop,clicked", func, *args, **kwargs)
|
||||
|
||||
def callback_stop_clicked_del(self, func):
|
||||
self._callback_del_full("stop,clicked", func)
|
||||
|
||||
|
||||
_object_mapping_register("elm_player", Player)
|
|
@ -0,0 +1,212 @@
|
|||
# Copyright (c) 2012 Joost Albers
|
||||
# Copyright (c) 2012 Gustavo Sverzut Barbieri <barbieri@profusion.mobi>
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
def _web_double_conv(long addr):
|
||||
cdef double *info = <double *>addr
|
||||
if info == NULL:
|
||||
return None
|
||||
return info[0]
|
||||
|
||||
def _web_load_frame_error_conv(long addr):
|
||||
cdef Elm_Web_Frame_Load_Error *err = <Elm_Web_Frame_Load_Error *>addr
|
||||
if err == NULL:
|
||||
return None
|
||||
ret = {
|
||||
"code": err.code,
|
||||
"is_cancellation": bool(err.is_cancellation),
|
||||
}
|
||||
if err.domain:
|
||||
ret["domain"] = err.domain
|
||||
else:
|
||||
ret["domain"] = None
|
||||
|
||||
if err.description:
|
||||
ret["description"] = err.description
|
||||
else:
|
||||
ret["description"] = None
|
||||
|
||||
if err.failing_url:
|
||||
ret["failing_url"] = err.failing_url
|
||||
else:
|
||||
ret["failing_url"] = None
|
||||
|
||||
if err.frame:
|
||||
ret["frame"] = object_from_instance(err.frame)
|
||||
else:
|
||||
ret["frame"] = None
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def _web_link_hover_in_conv(long addr):
|
||||
cdef char **info = <char **>addr
|
||||
if info == NULL:
|
||||
url = title = None
|
||||
else:
|
||||
if info[0] == NULL:
|
||||
url = None
|
||||
else:
|
||||
url = info[0]
|
||||
|
||||
if info[1] == NULL:
|
||||
title = None
|
||||
else:
|
||||
title = info[1]
|
||||
return (url, title)
|
||||
|
||||
|
||||
cdef void _web_console_message_hook(void *data, Evas_Object *obj, const_char_ptr message, unsigned int line_number, const_char_ptr source_id) with gil:
|
||||
cdef Web self = <Web>data
|
||||
|
||||
if message == NULL:
|
||||
m = None
|
||||
else:
|
||||
m = message
|
||||
|
||||
if source_id == NULL:
|
||||
s = None
|
||||
else:
|
||||
s = source_id
|
||||
|
||||
try:
|
||||
self._console_message_hook(self, m, line_number, s)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef class Web(Object):
|
||||
cdef object _console_message_hook
|
||||
|
||||
def __init__(self,evasObject parent):
|
||||
# Object.__init__(self, parent.evas)
|
||||
self._set_obj(elm_web_add(parent.obj))
|
||||
|
||||
# XXX TODO: complete all callbacks from elm_web.h
|
||||
def callback_uri_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("uri,changed", _cb_string_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_uri_changed_del(self, func):
|
||||
self._callback_del_full("uri,changed", _cb_string_conv, func)
|
||||
|
||||
def callback_title_changed_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("title,changed", _cb_string_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_title_changed_del(self, func):
|
||||
self._callback_del_full("title,changed", _cb_string_conv, func)
|
||||
|
||||
def callback_link_hover_in_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("link,hover,in", _web_link_hover_in_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_link_hover_in_del(self, func):
|
||||
self._callback_del_full("link,hover,in", _web_link_hover_in_conv, func)
|
||||
|
||||
def callback_link_hover_out_add(self, func, *args, **kwargs):
|
||||
self._callback_add("link,hover,out", func, *args, **kwargs)
|
||||
|
||||
def callback_link_hover_out_del(self, func):
|
||||
self._callback_del("link,hover,out", func)
|
||||
|
||||
def callback_load_error_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("load,error", _web_load_frame_error_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_load_error_del(self, func):
|
||||
self._callback_del_full("load,error", _web_load_frame_error_conv, func)
|
||||
|
||||
def callback_load_finished_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("load,finished", _web_load_frame_error_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_load_finished_del(self, func):
|
||||
self._callback_del_full("load,finished",
|
||||
_web_load_frame_error_conv, func)
|
||||
|
||||
def callback_load_progress_add(self, func, *args, **kwargs):
|
||||
self._callback_add_full("load,progress", _web_double_conv,
|
||||
func, *args, **kwargs)
|
||||
|
||||
def callback_load_progress_del(self, func):
|
||||
self._callback_del_full("load,progress", _web_double_conv, func)
|
||||
|
||||
def callback_load_provisional_add(self, func, *args, **kwargs):
|
||||
self._callback_add("load,provisional", func, *args, **kwargs)
|
||||
|
||||
def callback_load_provisional_del(self, func):
|
||||
self._callback_del("load,provisional", func)
|
||||
|
||||
def callback_load_started_add(self, func, *args, **kwargs):
|
||||
self._callback_add("load,started", func, *args, **kwargs)
|
||||
|
||||
def callback_load_started_del(self, func):
|
||||
self._callback_del("load,started", func)
|
||||
|
||||
def history_enabled_get(self):
|
||||
return bool(elm_web_history_enabled_get(self.obj))
|
||||
|
||||
def webkit_view_get(self):
|
||||
cdef Evas_Object *obj = elm_web_webkit_view_get(self.obj)
|
||||
return object_from_instance(obj)
|
||||
|
||||
def uri_set(self, uri):
|
||||
return bool(elm_web_uri_set(self.obj, uri))
|
||||
|
||||
def uri_get(self):
|
||||
cdef const_char_ptr l
|
||||
l = elm_web_uri_get(self.obj)
|
||||
if l == NULL:
|
||||
return None
|
||||
return l
|
||||
|
||||
property uri:
|
||||
def __get__(self):
|
||||
return self.uri_get()
|
||||
|
||||
def __set__(self, value):
|
||||
self.uri_set(value)
|
||||
|
||||
def useragent_get(self):
|
||||
cdef const_char_ptr l
|
||||
l = elm_web_useragent_get(self.obj)
|
||||
if l == NULL:
|
||||
return None
|
||||
return l
|
||||
|
||||
def zoom_get(self):
|
||||
return elm_web_zoom_get(self.obj)
|
||||
|
||||
def zoom_mode_get(self):
|
||||
return elm_web_zoom_mode_get(self.obj)
|
||||
|
||||
def back(self):
|
||||
return bool(elm_web_back(self.obj))
|
||||
|
||||
def console_message_hook_set(self, func):
|
||||
self._console_message_hook = func
|
||||
if func:
|
||||
elm_web_console_message_hook_set(self.obj,
|
||||
_web_console_message_hook,
|
||||
<void *>self)
|
||||
else:
|
||||
elm_web_console_message_hook_set(self.obj, NULL, NULL)
|
||||
|
||||
|
||||
_object_mapping_register("elm_web", Web)
|
|
@ -0,0 +1,618 @@
|
|||
# Copyright (c) 2008-2009 Simon Busch
|
||||
#
|
||||
# This file is part of python-elementary.
|
||||
#
|
||||
# python-elementary 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python-elementary 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 python-elementary. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# from efl.eo cimport object_from_instance
|
||||
# from efl.evas cimport Evas
|
||||
# from efl.evas cimport evas_object_evas_get
|
||||
# from efl.evas cimport canvas_from_instance
|
||||
|
||||
cdef class Window(Object):
|
||||
|
||||
def __init__(self, name, type):
|
||||
self._set_obj(elm_win_add(NULL, _cfruni(name), type))
|
||||
# self._add_obj(elm_obj_win_class_get(), NULL)
|
||||
|
||||
# cdef Evas *e
|
||||
# e = evas_object_evas_get(self.obj)
|
||||
# canvas = Canvas_from_instance(e)
|
||||
# evasObject.__init__(self, canvas)
|
||||
|
||||
def resize_object_add(self, evasObject subobj):
|
||||
elm_win_resize_object_add(self.obj, subobj.obj)
|
||||
|
||||
def resize_object_del(self, evasObject subobj):
|
||||
elm_win_resize_object_del(self.obj, subobj.obj)
|
||||
|
||||
def title_set(self, title):
|
||||
elm_win_title_set(self.obj, _cfruni(title))
|
||||
|
||||
def title_get(self):
|
||||
return _ctouni(elm_win_title_get(self.obj))
|
||||
|
||||
property title:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_win_title_get(self.obj))
|
||||
def __set__(self, title):
|
||||
elm_win_title_set(self.obj, _cfruni(title))
|
||||
|
||||
def icon_name_set(self, icon_name):
|
||||
elm_win_icon_name_set(self.obj, _cfruni(icon_name))
|
||||
|
||||
def icon_name_get(self):
|
||||
return _ctouni(elm_win_icon_name_get(self.obj))
|
||||
|
||||
property icon_name:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_win_icon_name_get(self.obj))
|
||||
def __set__(self, icon_name):
|
||||
elm_win_icon_name_set(self.obj, _cfruni(icon_name))
|
||||
|
||||
def role_set(self, role):
|
||||
elm_win_role_set(self.obj, _cfruni(role))
|
||||
|
||||
def role_get(self):
|
||||
return _ctouni(elm_win_role_get(self.obj))
|
||||
|
||||
property role:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_win_role_get(self.obj))
|
||||
def __set__(self, role):
|
||||
elm_win_role_set(self.obj, _cfruni(role))
|
||||
|
||||
def icon_object_set(self, evasObject icon):
|
||||
elm_win_icon_object_set(self.obj, icon.obj)
|
||||
|
||||
def icon_object_get(self):
|
||||
return object_from_instance(elm_win_icon_object_get(self.obj))
|
||||
|
||||
property icon_object:
|
||||
def __get__(self):
|
||||
return object_from_instance(elm_win_icon_object_get(self.obj))
|
||||
def __set__(self, evasObject icon):
|
||||
elm_win_icon_object_set(self.obj, icon.obj)
|
||||
|
||||
def autodel_set(self, autodel):
|
||||
elm_win_autodel_set(self.obj, autodel)
|
||||
|
||||
def autodel_get(self):
|
||||
return elm_win_autodel_get(self.obj)
|
||||
|
||||
property autodel:
|
||||
def __get__(self):
|
||||
return elm_win_autodel_get(self.obj)
|
||||
def __set__(self, autodel):
|
||||
elm_win_autodel_set(self.obj, autodel)
|
||||
|
||||
def activate(self):
|
||||
elm_win_activate(self.obj)
|
||||
|
||||
def lower(self):
|
||||
elm_win_lower(self.obj)
|
||||
|
||||
def _raise(self):
|
||||
elm_win_raise(self.obj)
|
||||
|
||||
def center(self, h, v):
|
||||
elm_win_center(self.obj, h, v)
|
||||
|
||||
def borderless_set(self, borderless):
|
||||
elm_win_borderless_set(self.obj, borderless)
|
||||
|
||||
def borderless_get(self):
|
||||
return bool(elm_win_borderless_get(self.obj))
|
||||
|
||||
property borderless:
|
||||
def __get__(self):
|
||||
return self.borderless_get()
|
||||
def __set__(self, borderless):
|
||||
self.borderless_set(borderless)
|
||||
|
||||
def shaped_set(self,shaped):
|
||||
elm_win_shaped_set(self.obj, shaped)
|
||||
|
||||
def shaped_get(self):
|
||||
return bool(elm_win_shaped_get(self.obj))
|
||||
|
||||
property shaped:
|
||||
def __get__(self):
|
||||
return bool(elm_win_shaped_get(self.obj))
|
||||
def __set__(self, shaped):
|
||||
elm_win_shaped_set(self.obj, shaped)
|
||||
|
||||
def alpha_set(self,alpha):
|
||||
elm_win_alpha_set(self.obj, alpha)
|
||||
|
||||
def alpha_get(self):
|
||||
return bool(elm_win_alpha_get(self.obj))
|
||||
|
||||
property alpha:
|
||||
def __get__(self):
|
||||
return bool(elm_win_alpha_get(self.obj))
|
||||
def __set__(self, alpha):
|
||||
elm_win_alpha_set(self.obj, alpha)
|
||||
|
||||
def override_set(self, override):
|
||||
elm_win_override_set(self.obj, override)
|
||||
|
||||
def override_get(self):
|
||||
return bool(elm_win_override_get(self.obj))
|
||||
|
||||
property override:
|
||||
def __get__(self):
|
||||
return bool(elm_win_override_get(self.obj))
|
||||
def __set__(self, override):
|
||||
elm_win_override_set(self.obj, override)
|
||||
|
||||
def fullscreen_set(self, fullscreen):
|
||||
elm_win_fullscreen_set(self.obj, fullscreen)
|
||||
|
||||
def fullscreen_get(self):
|
||||
return bool(elm_win_fullscreen_get(self.obj))
|
||||
|
||||
property fullscreen:
|
||||
def __get__(self):
|
||||
return bool(elm_win_fullscreen_get(self.obj))
|
||||
def __set__(self, fullscreen):
|
||||
elm_win_fullscreen_set(self.obj, fullscreen)
|
||||
|
||||
def maximized_set(self, maximized):
|
||||
elm_win_maximized_set(self.obj, maximized)
|
||||
|
||||
def maximized_get(self):
|
||||
return bool(elm_win_maximized_get(self.obj))
|
||||
|
||||
property maximized:
|
||||
def __get__(self):
|
||||
return bool(elm_win_maximized_get(self.obj))
|
||||
def __set__(self, maximized):
|
||||
elm_win_maximized_set(self.obj, maximized)
|
||||
|
||||
def iconified_set(self, iconified):
|
||||
elm_win_iconified_set(self.obj, iconified)
|
||||
|
||||
def iconified_get(self):
|
||||
return bool(elm_win_iconified_get(self.obj))
|
||||
|
||||
property iconified:
|
||||
def __get__(self):
|
||||
return bool(elm_win_iconified_get(self.obj))
|
||||
def __set__(self, iconified):
|
||||
elm_win_iconified_set(self.obj, iconified)
|
||||
|
||||
def withdrawn_set(self, withdrawn):
|
||||
elm_win_withdrawn_set(self.obj, withdrawn)
|
||||
|
||||
def withdrawn_get(self):
|
||||
return bool(elm_win_withdrawn_get(self.obj))
|
||||
|
||||
property withdrawn:
|
||||
def __get__(self):
|
||||
return bool(elm_win_withdrawn_get(self.obj))
|
||||
def __set__(self, withdrawn):
|
||||
elm_win_withdrawn_set(self.obj, withdrawn)
|
||||
|
||||
def urgent_set(self, urgent):
|
||||
elm_win_urgent_set(self.obj, urgent)
|
||||
|
||||
def urgent_get(self):
|
||||
return bool(elm_win_urgent_get(self.obj))
|
||||
|
||||
property urgent:
|
||||
def __get__(self):
|
||||
return bool(elm_win_urgent_get(self.obj))
|
||||
def __set__(self, urgent):
|
||||
elm_win_urgent_set(self.obj, urgent)
|
||||
|
||||
def demand_attention_set(self, demand_attention):
|
||||
elm_win_demand_attention_set(self.obj, demand_attention)
|
||||
|
||||
def demand_attention_get(self):
|
||||
return bool(elm_win_demand_attention_get(self.obj))
|
||||
|
||||
property demand_attention:
|
||||
def __get__(self):
|
||||
return bool(elm_win_demand_attention_get(self.obj))
|
||||
def __set__(self, demand_attention):
|
||||
elm_win_demand_attention_set(self.obj, demand_attention)
|
||||
|
||||
def modal_set(self, modal):
|
||||
elm_win_modal_set(self.obj, modal)
|
||||
|
||||
def modal_get(self):
|
||||
return bool(elm_win_modal_get(self.obj))
|
||||
|
||||
property modal:
|
||||
def __get__(self):
|
||||
return bool(elm_win_modal_get(self.obj))
|
||||
def __set__(self, modal):
|
||||
elm_win_modal_set(self.obj, modal)
|
||||
|
||||
def aspect_set(self, aspect):
|
||||
elm_win_aspect_set(self.obj, aspect)
|
||||
|
||||
def aspect_get(self):
|
||||
return elm_win_aspect_get(self.obj)
|
||||
|
||||
property aspect:
|
||||
def __get__(self):
|
||||
return elm_win_aspect_get(self.obj)
|
||||
def __set__(self, aspect):
|
||||
elm_win_aspect_set(self.obj, aspect)
|
||||
|
||||
property size_base:
|
||||
def __set__(self, value):
|
||||
w, h = value
|
||||
elm_win_size_base_set(self.obj, w, h)
|
||||
|
||||
def __get__(self):
|
||||
cdef int w, h
|
||||
elm_win_size_base_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property size_step:
|
||||
def __set__(self, value):
|
||||
w, h = value
|
||||
elm_win_size_step_set(self.obj, w, h)
|
||||
|
||||
def __get__(self):
|
||||
cdef int w, h
|
||||
elm_win_size_step_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
def layer_set(self, layer):
|
||||
elm_win_layer_set(self.obj, layer)
|
||||
|
||||
def layer_get(self):
|
||||
return elm_win_layer_get(self.obj)
|
||||
|
||||
property layer:
|
||||
def __get__(self):
|
||||
return elm_win_layer_get(self.obj)
|
||||
def __set__(self, layer):
|
||||
elm_win_layer_set(self.obj, layer)
|
||||
|
||||
def rotation_set(self, rotation):
|
||||
elm_win_rotation_set(self.obj, rotation)
|
||||
|
||||
def rotation_get(self):
|
||||
return elm_win_rotation_get(self.obj)
|
||||
|
||||
property rotation:
|
||||
def __get__(self):
|
||||
return elm_win_rotation_get(self.obj)
|
||||
def __set__(self, rotation):
|
||||
elm_win_rotation_set(self.obj, rotation)
|
||||
|
||||
def rotation_with_resize_set(self, rotation):
|
||||
elm_win_rotation_set(self.obj, rotation)
|
||||
|
||||
property rotation_with_resize:
|
||||
def __set__(self, rotation):
|
||||
elm_win_rotation_set(self.obj, rotation)
|
||||
|
||||
def sticky_set(self, sticky):
|
||||
elm_win_sticky_set(self.obj, sticky)
|
||||
|
||||
def sticky_get(self):
|
||||
return bool(elm_win_sticky_get(self.obj))
|
||||
|
||||
property sticky:
|
||||
def __get__(self):
|
||||
return bool(elm_win_sticky_get(self.obj))
|
||||
def __set__(self, sticky):
|
||||
elm_win_sticky_set(self.obj, sticky)
|
||||
|
||||
def conformant_set(self, conformant):
|
||||
elm_win_conformant_set(self.obj, conformant)
|
||||
|
||||
def conformant_get(self):
|
||||
return bool(elm_win_conformant_get(self.obj))
|
||||
|
||||
property conformant:
|
||||
def __get__(self):
|
||||
return bool(elm_win_conformant_get(self.obj))
|
||||
def __set__(self, conformant):
|
||||
elm_win_conformant_set(self.obj, conformant)
|
||||
|
||||
def quickpanel_set(self, quickpanel):
|
||||
elm_win_quickpanel_set(self.obj, quickpanel)
|
||||
|
||||
def quickpanel_get(self):
|
||||
return bool(elm_win_quickpanel_get(self.obj))
|
||||
|
||||
property quickpanel:
|
||||
def __get__(self):
|
||||
return bool(elm_win_quickpanel_get(self.obj))
|
||||
def __set__(self, quickpanel):
|
||||
elm_win_quickpanel_set(self.obj, quickpanel)
|
||||
|
||||
def quickpanel_priority_major_set(self, priority):
|
||||
elm_win_quickpanel_priority_major_set(self.obj, priority)
|
||||
|
||||
def quickpanel_priority_major_get(self):
|
||||
return elm_win_quickpanel_priority_major_get(self.obj)
|
||||
|
||||
property quickpanel_priority_major:
|
||||
def __get__(self):
|
||||
return elm_win_quickpanel_priority_major_get(self.obj)
|
||||
def __set__(self, priority):
|
||||
elm_win_quickpanel_priority_major_set(self.obj, priority)
|
||||
|
||||
def quickpanel_priority_minor_set(self, priority):
|
||||
elm_win_quickpanel_priority_minor_set(self.obj, priority)
|
||||
|
||||
def quickpanel_priority_minor_get(self):
|
||||
return elm_win_quickpanel_priority_minor_get(self.obj)
|
||||
|
||||
property quickpanel_priority_minor:
|
||||
def __get__(self):
|
||||
return elm_win_quickpanel_priority_minor_get(self.obj)
|
||||
def __set__(self, priority):
|
||||
elm_win_quickpanel_priority_minor_set(self.obj, priority)
|
||||
|
||||
def quickpanel_zone_set(self, zone):
|
||||
elm_win_quickpanel_zone_set(self.obj, zone)
|
||||
|
||||
def quickpanel_zone_get(self):
|
||||
return elm_win_quickpanel_zone_get(self.obj)
|
||||
|
||||
property quickpanel_zone:
|
||||
def __get__(self):
|
||||
return elm_win_quickpanel_zone_get(self.obj)
|
||||
def __set__(self, zone):
|
||||
elm_win_quickpanel_zone_set(self.obj, zone)
|
||||
|
||||
def prop_focus_skip_set(self, skip):
|
||||
elm_win_prop_focus_skip_set(self.obj, skip)
|
||||
|
||||
property focus_skip_set:
|
||||
def __set__(self, skip):
|
||||
elm_win_prop_focus_skip_set(self.obj, skip)
|
||||
|
||||
def illume_command_send(self, command, *args, **kwargs):
|
||||
params = (args, kwargs)
|
||||
elm_win_illume_command_send(self.obj, command, params)
|
||||
|
||||
# def inlined_image_object_get(self):
|
||||
# cdef evasImage img = evasImage()
|
||||
# cdef Evas_Object *obj = elm_win_inlined_image_object_get(self.obj)
|
||||
# img.obj = obj
|
||||
# return img
|
||||
|
||||
# property inlined_image_object:
|
||||
# def __get__(self):
|
||||
# cdef evasImage img = evasImage()
|
||||
# cdef Evas_Object *obj = elm_win_inlined_image_object_get(self.obj)
|
||||
# img.obj = obj
|
||||
# return img
|
||||
|
||||
def focus_get(self):
|
||||
return bool(elm_win_focus_get(self.obj))
|
||||
|
||||
property focus:
|
||||
def __get__(self):
|
||||
return bool(elm_win_focus_get(self.obj))
|
||||
|
||||
def screen_constrain_set(self, constrain):
|
||||
elm_win_screen_constrain_set(self.obj, constrain)
|
||||
|
||||
def screen_constrain_get(self):
|
||||
return bool(elm_win_screen_constrain_get(self.obj))
|
||||
|
||||
property screen_constrain:
|
||||
def __get__(self):
|
||||
return bool(elm_win_screen_constrain_get(self.obj))
|
||||
def __set__(self, constrain):
|
||||
elm_win_screen_constrain_set(self.obj, constrain)
|
||||
|
||||
def screen_size_get(self):
|
||||
cdef int x, y, w, h
|
||||
elm_win_screen_size_get(self.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
property screen_size:
|
||||
def __get__(self):
|
||||
cdef int x, y, w, h
|
||||
elm_win_screen_size_get(self.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
def focus_highlight_enabled_set(self, enabled):
|
||||
elm_win_focus_highlight_enabled_set(self.obj, enabled)
|
||||
|
||||
def focus_highlight_enabled_get(self):
|
||||
return bool(elm_win_focus_highlight_enabled_get(self.obj))
|
||||
|
||||
property focus_highlight_enabled:
|
||||
def __get__(self):
|
||||
return bool(elm_win_focus_highlight_enabled_get(self.obj))
|
||||
def __set__(self, enabled):
|
||||
elm_win_focus_highlight_enabled_set(self.obj, enabled)
|
||||
|
||||
def focus_highlight_style_set(self, style):
|
||||
elm_win_focus_highlight_style_set(self.obj, _cfruni(style))
|
||||
|
||||
def focus_highlight_style_get(self):
|
||||
return _ctouni(elm_win_focus_highlight_style_get(self.obj))
|
||||
|
||||
property focus_highlight_style:
|
||||
def __get__(self):
|
||||
return _ctouni(elm_win_focus_highlight_style_get(self.obj))
|
||||
def __set__(self, style):
|
||||
elm_win_focus_highlight_style_set(self.obj, _cfruni(style))
|
||||
|
||||
def keyboard_mode_set(self, mode):
|
||||
elm_win_keyboard_mode_set(self.obj, mode)
|
||||
|
||||
def keyboard_mode_get(self):
|
||||
return elm_win_keyboard_mode_get(self.obj)
|
||||
|
||||
property keyboard_mode:
|
||||
def __get__(self):
|
||||
return elm_win_keyboard_mode_get(self.obj)
|
||||
def __set__(self, mode):
|
||||
elm_win_keyboard_mode_set(self.obj, mode)
|
||||
|
||||
def keyboard_win_set(self, is_keyboard):
|
||||
elm_win_keyboard_win_set(self.obj, is_keyboard)
|
||||
|
||||
def keyboard_win_get(self):
|
||||
return bool(elm_win_keyboard_win_get(self.obj))
|
||||
|
||||
property keyboard_win:
|
||||
def __get__(self):
|
||||
return bool(elm_win_keyboard_win_get(self.obj))
|
||||
def __set__(self, is_keyboard):
|
||||
elm_win_keyboard_win_set(self.obj, is_keyboard)
|
||||
|
||||
def indicator_mode_set(self, mode):
|
||||
elm_win_indicator_mode_set(self.obj, mode)
|
||||
|
||||
def indicator_mode_get(self):
|
||||
return elm_win_indicator_mode_get(self.obj)
|
||||
|
||||
property indicator_mode:
|
||||
def __get__(self):
|
||||
return elm_win_indicator_mode_get(self.obj)
|
||||
def __set__(self, mode):
|
||||
elm_win_indicator_mode_set(self.obj, mode)
|
||||
|
||||
def indicator_opacity_set(self, mode):
|
||||
elm_win_indicator_opacity_set(self.obj, mode)
|
||||
|
||||
def indicator_opacity_get(self):
|
||||
return elm_win_indicator_opacity_get(self.obj)
|
||||
|
||||
property indicator_opacity:
|
||||
def __get__(self):
|
||||
return elm_win_indicator_opacity_get(self.obj)
|
||||
def __set__(self, mode):
|
||||
elm_win_indicator_opacity_set(self.obj, mode)
|
||||
|
||||
def screen_position_get(self):
|
||||
cdef int x, y
|
||||
elm_win_screen_position_get(self.obj, &x, &y)
|
||||
return (x, y)
|
||||
|
||||
property screen_position:
|
||||
def __get__(self):
|
||||
cdef int x, y
|
||||
elm_win_screen_position_get(self.obj, &x, &y)
|
||||
return (x, y)
|
||||
|
||||
def socket_listen(self, svcname, svcnum, svcsys):
|
||||
return bool(elm_win_socket_listen(self.obj, _cfruni(svcname), svcnum, svcsys))
|
||||
|
||||
def xwindow_xid_get(self):
|
||||
cdef Ecore_X_Window xwin
|
||||
xwin = elm_win_xwindow_get(self.obj)
|
||||
return xwin
|
||||
|
||||
property xwindow_xid:
|
||||
def __get__(self):
|
||||
cdef Ecore_X_Window xwin
|
||||
xwin = elm_win_xwindow_get(self.obj)
|
||||
return xwin
|
||||
|
||||
def callback_delete_request_add(self, func, *args, **kwargs):
|
||||
self._callback_add("delete,request", func, *args, **kwargs)
|
||||
|
||||
def callback_delete_request_del(self, func):
|
||||
self._callback_del("delete,request", func)
|
||||
|
||||
def callback_focus_in_add(self, func, *args, **kwargs):
|
||||
self._callback_add("focus,in", func, *args, **kwargs)
|
||||
|
||||
def callback_focus_in_del(self, func):
|
||||
self._callback_del("focus,in", func)
|
||||
|
||||
def callback_focus_out_add(self, func, *args, **kwargs):
|
||||
self._callback_add("focus,out", func, *args, **kwargs)
|
||||
|
||||
def callback_focus_out_del(self, func):
|
||||
self._callback_del("focus,out")
|
||||
|
||||
def callback_moved_add(self, func, *args, **kwargs):
|
||||
self._callback_add("moved", func, *args, **kwargs)
|
||||
|
||||
def callback_moved_del(self, func):
|
||||
self._callback_del("moved")
|
||||
|
||||
def callback_withdrawn_add(self, func, *args, **kwargs):
|
||||
self._callback_add("withdrawn", func, *args, **kwargs)
|
||||
|
||||
def callback_withdrawn_del(self, func):
|
||||
self._callback_del("withdrawn")
|
||||
|
||||
def callback_iconified_add(self, func, *args, **kwargs):
|
||||
self._callback_add("iconified", func, *args, **kwargs)
|
||||
|
||||
def callback_iconified_del(self, func):
|
||||
self._callback_del("iconified")
|
||||
|
||||
def callback_normal_add(self, func, *args, **kwargs):
|
||||
self._callback_add("normal", func, *args, **kwargs)
|
||||
|
||||
def callback_normal_del(self, func):
|
||||
self._callback_del("normal")
|
||||
|
||||
def callback_stick_add(self, func, *args, **kwargs):
|
||||
self._callback_add("stick", func, *args, **kwargs)
|
||||
|
||||
def callback_stick_del(self, func):
|
||||
self._callback_del("stick")
|
||||
|
||||
def callback_unstick_add(self, func, *args, **kwargs):
|
||||
self._callback_add("unstick", func, *args, **kwargs)
|
||||
|
||||
def callback_unstick_del(self, func):
|
||||
self._callback_del("unstick")
|
||||
|
||||
def callback_fullscreen_add(self, func, *args, **kwargs):
|
||||
self._callback_add("fullscreen", func, *args, **kwargs)
|
||||
|
||||
def callback_fullscreen_del(self, func):
|
||||
self._callback_del("fullscreen")
|
||||
|
||||
def callback_unfullscreen_add(self, func, *args, **kwargs):
|
||||
self._callback_add("unfullscreen", func, *args, **kwargs)
|
||||
|
||||
def callback_unfullscreen_del(self, func):
|
||||
self._callback_del("unfullscreen")
|
||||
|
||||
def callback_maximized_add(self, func, *args, **kwargs):
|
||||
self._callback_add("maximized", func, *args, **kwargs)
|
||||
|
||||
def callback_maximized_del(self, func):
|
||||
self._callback_del("maximized")
|
||||
|
||||
def callback_unmaximized_add(self, func, *args, **kwargs):
|
||||
self._callback_add("unmaximized", func, *args, **kwargs)
|
||||
|
||||
def callback_unmaximized_del(self, func):
|
||||
self._callback_del("unmaximized")
|
||||
|
||||
_object_mapping_register("elm_win", Window)
|
||||
|
||||
|
||||
cdef class StandardWindow(Window):
|
||||
|
||||
def __init__(self, name, title):
|
||||
self._set_obj(elm_win_util_standard_add(_cfruni(name), _cfruni(title)))
|
||||
|
||||
|
||||
_object_mapping_register("elm_standardwin", StandardWindow)
|
|
@ -0,0 +1,607 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Emotion.
|
||||
#
|
||||
# Python-Emotion 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-Emotion 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-Emotion. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from efl.eo cimport const_char_ptr
|
||||
from efl.eo cimport object_from_instance, _object_mapping_register
|
||||
from efl.evas cimport Evas_Object, Canvas
|
||||
from efl.evas cimport Object as evasObject
|
||||
from efl.evas cimport evas_object_smart_callback_add
|
||||
from efl.evas cimport evas_object_smart_callback_del
|
||||
|
||||
|
||||
__extra_epydoc_fields__ = (
|
||||
("parm", "Parameter", "Parameters"), # epydoc don't support pyrex properly
|
||||
)
|
||||
|
||||
|
||||
EMOTION_EVENT_MENU1 = 0
|
||||
EMOTION_EVENT_MENU2 = 1
|
||||
EMOTION_EVENT_MENU3 = 2
|
||||
EMOTION_EVENT_MENU4 = 3
|
||||
EMOTION_EVENT_MENU5 = 4
|
||||
EMOTION_EVENT_MENU6 = 5
|
||||
EMOTION_EVENT_MENU7 = 6
|
||||
EMOTION_EVENT_UP = 7
|
||||
EMOTION_EVENT_DOWN = 8
|
||||
EMOTION_EVENT_LEFT = 9
|
||||
EMOTION_EVENT_RIGHT = 10
|
||||
EMOTION_EVENT_SELECT = 11
|
||||
EMOTION_EVENT_NEXT = 12
|
||||
EMOTION_EVENT_PREV = 13
|
||||
EMOTION_EVENT_ANGLE_NEXT = 14
|
||||
EMOTION_EVENT_ANGLE_PREV = 15
|
||||
EMOTION_EVENT_FORCE = 16
|
||||
EMOTION_EVENT_0 = 17
|
||||
EMOTION_EVENT_1 = 18
|
||||
EMOTION_EVENT_2 = 19
|
||||
EMOTION_EVENT_3 = 20
|
||||
EMOTION_EVENT_4 = 21
|
||||
EMOTION_EVENT_5 = 22
|
||||
EMOTION_EVENT_6 = 23
|
||||
EMOTION_EVENT_7 = 24
|
||||
EMOTION_EVENT_8 = 25
|
||||
EMOTION_EVENT_9 = 26
|
||||
EMOTION_EVENT_10 = 27
|
||||
|
||||
|
||||
|
||||
cdef void _emotion_callback(void *data, Evas_Object *o, void *ei) with gil:
|
||||
cdef Emotion obj
|
||||
cdef object event
|
||||
obj = object_from_instance(o)
|
||||
event = <object>data
|
||||
lst = tuple(obj._emotion_callbacks[event])
|
||||
for func, args, kargs in lst:
|
||||
try:
|
||||
func(obj, *args, **kargs)
|
||||
except Exception, e:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
class EmotionModuleInitError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def init():
|
||||
return emotion_init()
|
||||
|
||||
|
||||
def shutdown():
|
||||
return emotion_shutdown()
|
||||
|
||||
|
||||
cdef class Emotion(evasObject):
|
||||
def __cinit__(self, *a, **ka):
|
||||
self._emotion_callbacks = {}
|
||||
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
if self.obj == NULL:
|
||||
self._set_obj(emotion_object_add(canvas.obj))
|
||||
# self._add_obj(emotion_object_class_get(), canvas.obj)
|
||||
self._set_common_params(**kargs)
|
||||
|
||||
def _set_common_params(self,
|
||||
char *module_filename="gstreamer",
|
||||
module_params=None, size=None, pos=None,
|
||||
geometry=None, color=None, name=None):
|
||||
evasObject._set_common_params(self, size=size, pos=pos, name=name,
|
||||
geometry=geometry, color=color)
|
||||
if emotion_object_init(self.obj, module_filename) == 0:
|
||||
raise EmotionModuleInitError("failed to initialize module '%s'" %
|
||||
module_filename)
|
||||
|
||||
if isinstance(module_params, (tuple, list)):
|
||||
module_params = dict(module_params)
|
||||
if isinstance(module_params, dict):
|
||||
for opt, val in module_params.iteritems():
|
||||
emotion_object_module_option_set(self.obj, opt, val)
|
||||
|
||||
def __str__(self):
|
||||
x, y, w, h = self.geometry_get()
|
||||
r, g, b, a = self.color_get()
|
||||
name = self.name_get()
|
||||
if name:
|
||||
name_str = "name=%r, "
|
||||
else:
|
||||
name_str = ""
|
||||
return ("%s(%sfile=%r, geometry=(%d, %d, %d, %d), "
|
||||
"color=(%d, %d, %d, %d), layer=%s, clip=%s, visible=%s)") % \
|
||||
(self.__class__.__name__, name_str, self.file_get(), x, y, w, h,
|
||||
r, g, b, a, self.layer_get(), self.clip_get(),
|
||||
self.visible_get())
|
||||
|
||||
def __repr__(self):
|
||||
x, y, w, h = self.geometry_get()
|
||||
r, g, b, a = self.color_get()
|
||||
return ("%s(%#x, type=%r, name=%r, "
|
||||
"file=%r, geometry=(%d, %d, %d, %d), "
|
||||
"color=(%d, %d, %d, %d), layer=%s, clip=%r, visible=%s) %s") % \
|
||||
(self.__class__.__name__, <unsigned long><void *>self,
|
||||
self.type_get(), self.name_get(), self.file_get(),
|
||||
x, y, w, h, r, g, b, a,
|
||||
self.layer_get(), self.clip_get(), self.visible_get(),
|
||||
evasObject.__repr__(self))
|
||||
|
||||
def file_get(self):
|
||||
cdef const_char_ptr f
|
||||
f = emotion_object_file_get(self.obj)
|
||||
if f != NULL:
|
||||
return f
|
||||
|
||||
def file_set(self, char *value):
|
||||
emotion_object_file_set(self.obj, value)
|
||||
|
||||
property file:
|
||||
def __get__(self):
|
||||
return self.file_get()
|
||||
|
||||
def __set__(self, char *value):
|
||||
self.file_set(value)
|
||||
|
||||
def play_get(self):
|
||||
return bool(emotion_object_play_get(self.obj))
|
||||
|
||||
def play_set(self, int value):
|
||||
emotion_object_play_set(self.obj, value)
|
||||
|
||||
property play:
|
||||
def __get__(self):
|
||||
return self.play_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.play_set(value)
|
||||
|
||||
def position_get(self):
|
||||
return emotion_object_position_get(self.obj)
|
||||
|
||||
def position_set(self, double value):
|
||||
emotion_object_position_set(self.obj, value)
|
||||
|
||||
property position:
|
||||
def __get__(self):
|
||||
return self.position_get()
|
||||
|
||||
def __set__(self, double value):
|
||||
self.position_set(value)
|
||||
|
||||
def buffer_size_get(self):
|
||||
return emotion_object_buffer_size_get(self.obj)
|
||||
|
||||
property buffer_size:
|
||||
def __get__(self):
|
||||
return self.buffer_size_get()
|
||||
|
||||
def video_handled_get(self):
|
||||
return bool(emotion_object_video_handled_get(self.obj))
|
||||
|
||||
property video_handled:
|
||||
def __get__(self):
|
||||
return self.video_handled_get()
|
||||
|
||||
def audio_handled_get(self):
|
||||
return bool(emotion_object_audio_handled_get(self.obj))
|
||||
|
||||
property audio_handled:
|
||||
def __get__(self):
|
||||
return self.audio_handled_get()
|
||||
|
||||
def seekable_get(self):
|
||||
return bool(emotion_object_seekable_get(self.obj))
|
||||
|
||||
property seekable:
|
||||
def __get__(self):
|
||||
return self.seekable_get()
|
||||
|
||||
def play_length_get(self):
|
||||
return emotion_object_play_length_get(self.obj)
|
||||
|
||||
property play_length:
|
||||
def __get__(self):
|
||||
return self.play_length_get()
|
||||
|
||||
def image_size_get(self):
|
||||
cdef int w, h
|
||||
emotion_object_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property image_size:
|
||||
def __get__(self):
|
||||
return self.image_size_get()
|
||||
|
||||
def smooth_scale_get(self):
|
||||
return bool(emotion_object_smooth_scale_get(self.obj))
|
||||
|
||||
def smooth_scale_set(self, int value):
|
||||
emotion_object_smooth_scale_set(self.obj, value)
|
||||
|
||||
property smooth_scale:
|
||||
def __get__(self):
|
||||
return self.smooth_scale_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.smooth_scale_set(value)
|
||||
|
||||
def ratio_get(self):
|
||||
return emotion_object_ratio_get(self.obj)
|
||||
|
||||
property ratio:
|
||||
def __get__(self):
|
||||
return self.ratio_get()
|
||||
|
||||
def event_simple_send(self, int event_id):
|
||||
emotion_object_event_simple_send(self.obj, <Emotion_Event>event_id)
|
||||
|
||||
def audio_volume_get(self):
|
||||
return emotion_object_audio_volume_get(self.obj)
|
||||
|
||||
def audio_volume_set(self, double value):
|
||||
emotion_object_audio_volume_set(self.obj, value)
|
||||
|
||||
property audio_volume:
|
||||
def __get__(self):
|
||||
return self.audio_volume_get()
|
||||
|
||||
def __set__(self, double value):
|
||||
self.audio_volume_set(value)
|
||||
|
||||
def audio_mute_get(self):
|
||||
return emotion_object_audio_mute_get(self.obj)
|
||||
|
||||
def audio_mute_set(self, int value):
|
||||
emotion_object_audio_mute_set(self.obj, value)
|
||||
|
||||
property audio_mute:
|
||||
def __get__(self):
|
||||
return self.audio_mute_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.audio_mute_set(value)
|
||||
|
||||
def audio_channel_count(self):
|
||||
return emotion_object_audio_channel_count(self.obj)
|
||||
|
||||
def audio_channel_name_get(self, int channel):
|
||||
cdef const_char_ptr n
|
||||
n = emotion_object_audio_channel_name_get(self.obj, channel)
|
||||
if n != NULL:
|
||||
return n
|
||||
|
||||
def audio_channel_get(self):
|
||||
return emotion_object_audio_channel_get(self.obj)
|
||||
|
||||
def audio_channel_set(self, int channel):
|
||||
emotion_object_audio_channel_set(self.obj, channel)
|
||||
|
||||
property audio_channel:
|
||||
def __get__(self):
|
||||
return self.audio_channel_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.audio_channel_set(value)
|
||||
|
||||
def video_mute_get(self):
|
||||
return emotion_object_video_mute_get(self.obj)
|
||||
|
||||
def video_mute_set(self, int value):
|
||||
emotion_object_video_mute_set(self.obj, value)
|
||||
|
||||
property video_mute:
|
||||
def __get__(self):
|
||||
return self.video_mute_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.video_mute_set(value)
|
||||
|
||||
def video_channel_count(self):
|
||||
return emotion_object_video_channel_count(self.obj)
|
||||
|
||||
def video_channel_name_get(self, int channel):
|
||||
cdef const_char_ptr n
|
||||
n = emotion_object_video_channel_name_get(self.obj, channel)
|
||||
if n != NULL:
|
||||
return n
|
||||
|
||||
def video_channel_get(self):
|
||||
return emotion_object_video_channel_get(self.obj)
|
||||
|
||||
def video_channel_set(self, int value):
|
||||
emotion_object_video_channel_set(self.obj, value)
|
||||
|
||||
property video_channel:
|
||||
def __get__(self):
|
||||
return self.video_channel_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.video_channel_set(value)
|
||||
|
||||
def spu_mute_get(self):
|
||||
return emotion_object_spu_mute_get(self.obj)
|
||||
|
||||
def spu_mute_set(self, int value):
|
||||
emotion_object_spu_mute_set(self.obj, value)
|
||||
|
||||
property spu_mute:
|
||||
def __get__(self):
|
||||
return self.spu_mute_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.spu_mute_set(value)
|
||||
|
||||
def spu_channel_count(self):
|
||||
return emotion_object_spu_channel_count(self.obj)
|
||||
|
||||
def spu_channel_name_get(self, int channel):
|
||||
cdef const_char_ptr n
|
||||
n = emotion_object_spu_channel_name_get(self.obj, channel)
|
||||
if n != NULL:
|
||||
return n
|
||||
|
||||
def spu_channel_get(self):
|
||||
return emotion_object_spu_channel_get(self.obj)
|
||||
|
||||
def spu_channel_set(self, int value):
|
||||
emotion_object_spu_channel_set(self.obj, value)
|
||||
|
||||
def spu_button_count_get(self):
|
||||
return emotion_object_spu_button_count_get(self.obj)
|
||||
|
||||
property spu_button_count:
|
||||
def __get__(self):
|
||||
return self.spu_button_count_get()
|
||||
|
||||
def spu_button_get(self):
|
||||
return emotion_object_spu_button_get(self.obj)
|
||||
|
||||
property spu_button:
|
||||
def __get__(self):
|
||||
return self.spu_button_get()
|
||||
|
||||
property spu_channel:
|
||||
def __get__(self):
|
||||
return self.spu_channel_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.spu_channel_set(value)
|
||||
|
||||
def chapter_count(self):
|
||||
return emotion_object_chapter_count(self.obj)
|
||||
|
||||
def chapter_name_get(self, int channel):
|
||||
cdef const_char_ptr n
|
||||
n = emotion_object_chapter_name_get(self.obj, channel)
|
||||
if n != NULL:
|
||||
return n
|
||||
|
||||
def chapter_get(self):
|
||||
return emotion_object_chapter_get(self.obj)
|
||||
|
||||
def chapter_set(self, int value):
|
||||
emotion_object_chapter_set(self.obj, value)
|
||||
|
||||
property chapter:
|
||||
def __get__(self):
|
||||
return self.chapter_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.chapter_set(value)
|
||||
|
||||
def play_speed_get(self):
|
||||
return emotion_object_play_speed_get(self.obj)
|
||||
|
||||
def play_speed_set(self, double value):
|
||||
emotion_object_play_speed_set(self.obj, value)
|
||||
|
||||
property play_speed:
|
||||
def __get__(self):
|
||||
return self.play_speed_get()
|
||||
|
||||
def __set__(self, double value):
|
||||
self.play_speed_set(value)
|
||||
|
||||
def eject(self):
|
||||
emotion_object_eject(self.obj)
|
||||
|
||||
def title_get(self):
|
||||
cdef const_char_ptr t
|
||||
t = emotion_object_title_get(self.obj)
|
||||
if t != NULL:
|
||||
return t
|
||||
|
||||
property title:
|
||||
def __get__(self):
|
||||
return self.title_get()
|
||||
|
||||
def progress_info_get(self):
|
||||
cdef const_char_ptr s
|
||||
s = emotion_object_progress_info_get(self.obj)
|
||||
if s != NULL:
|
||||
return s
|
||||
|
||||
property progress_info:
|
||||
def __get__(self):
|
||||
return self.progress_info_get()
|
||||
|
||||
def progress_status_get(self):
|
||||
return emotion_object_progress_status_get(self.obj)
|
||||
|
||||
property progress_status:
|
||||
def __get__(self):
|
||||
return self.progress_status_get()
|
||||
|
||||
def ref_file_get(self):
|
||||
cdef const_char_ptr s
|
||||
s = emotion_object_ref_file_get(self.obj)
|
||||
if s != NULL:
|
||||
return s
|
||||
|
||||
property ref_file:
|
||||
def __get__(self):
|
||||
return self.ref_file_get()
|
||||
|
||||
def ref_num_get(self):
|
||||
return emotion_object_ref_num_get(self.obj)
|
||||
|
||||
property ref_num:
|
||||
def __get__(self):
|
||||
return self.ref_num_get()
|
||||
|
||||
def meta_info_get(self, int meta_id):
|
||||
cdef const_char_ptr s
|
||||
s = emotion_object_meta_info_get(self.obj, <Emotion_Meta_Info>meta_id)
|
||||
if s != NULL:
|
||||
return s
|
||||
|
||||
def meta_info_dict_get(self):
|
||||
cdef const_char_ptr info
|
||||
ret = dict()
|
||||
lst = (("title", EMOTION_META_INFO_TRACK_TITLE),
|
||||
("artist", EMOTION_META_INFO_TRACK_ARTIST),
|
||||
("album", EMOTION_META_INFO_TRACK_ALBUM),
|
||||
("year", EMOTION_META_INFO_TRACK_YEAR),
|
||||
("genre", EMOTION_META_INFO_TRACK_GENRE),
|
||||
("comment", EMOTION_META_INFO_TRACK_COMMENT),
|
||||
("disc_id", EMOTION_META_INFO_TRACK_DISC_ID),
|
||||
("track_count", EMOTION_META_INFO_TRACK_COUNT))
|
||||
for n, i in lst:
|
||||
info = emotion_object_meta_info_get(self.obj, i)
|
||||
if info != NULL:
|
||||
ret[n] = info
|
||||
ret[i] = info
|
||||
return ret
|
||||
|
||||
property meta_info_dict:
|
||||
def __get__(self):
|
||||
return self.meta_info_dict_get()
|
||||
|
||||
def callback_add(self, char *event, func, *args, **kargs):
|
||||
"""Add callback to given emotion event.
|
||||
|
||||
Signature: C{function(object, *args, **kargs)}
|
||||
|
||||
@parm: B{event} event to listen, like "frame_decode".
|
||||
@parm: B{func} callable to use.
|
||||
"""
|
||||
e = intern(event)
|
||||
lst = self._emotion_callbacks.setdefault(e, [])
|
||||
if not lst:
|
||||
evas_object_smart_callback_add(self.obj, event,
|
||||
_emotion_callback, <void *>e)
|
||||
lst.append((func, args, kargs))
|
||||
|
||||
def callback_del(self, char *event, func):
|
||||
"""Remove previously connected callback.
|
||||
|
||||
@parm: B{event}
|
||||
@parm: B{func}
|
||||
"""
|
||||
try:
|
||||
lst = self._emotion_callbacks[event]
|
||||
except KeyError, e:
|
||||
raise ValueError("function %s not associated with event %r" %
|
||||
(func, event))
|
||||
|
||||
i = -1
|
||||
for i, (f, a, k) in enumerate(lst):
|
||||
if func == f:
|
||||
break
|
||||
else:
|
||||
raise ValueError("function %s not associated with event %r" %
|
||||
(func, event))
|
||||
lst.pop(i)
|
||||
if lst:
|
||||
return
|
||||
self._emotion_callbacks.pop(event)
|
||||
evas_object_smart_callback_del(self.obj, event, _emotion_callback)
|
||||
|
||||
def on_frame_decode_add(self, func, *args, **kargs):
|
||||
self.callback_add("frame_decode", func, *args, **kargs)
|
||||
|
||||
def on_frame_decode_del(self, func):
|
||||
self.callback_del("frame_decode", func)
|
||||
|
||||
def on_frame_resize_add(self, func, *args, **kargs):
|
||||
self.callback_add("frame_resize", func, *args, **kargs)
|
||||
|
||||
def on_frame_resize_del(self, func):
|
||||
self.callback_del("frame_resize", func)
|
||||
|
||||
def on_length_change_add(self, func, *args, **kargs):
|
||||
self.callback_add("length_change", func, *args, **kargs)
|
||||
|
||||
def on_length_change_del(self, func):
|
||||
self.callback_del("length_change", func)
|
||||
|
||||
def on_decode_stop_add(self, func, *args, **kargs):
|
||||
self.callback_add("decode_stop", func, *args, **kargs)
|
||||
|
||||
def on_decode_stop_del(self, func):
|
||||
self.callback_del("decode_stop", func)
|
||||
|
||||
def on_channels_change_add(self, func, *args, **kargs):
|
||||
self.callback_add("channels_change", func, *args, **kargs)
|
||||
|
||||
def on_channels_change_del(self, func):
|
||||
self.callback_del("channels_change", func)
|
||||
|
||||
def on_title_change_add(self, func, *args, **kargs):
|
||||
self.callback_add("title_change", func, *args, **kargs)
|
||||
|
||||
def on_title_change_del(self, func):
|
||||
self.callback_del("title_change", func)
|
||||
|
||||
def on_progress_change_add(self, func, *args, **kargs):
|
||||
self.callback_add("progress_change", func, *args, **kargs)
|
||||
|
||||
def on_progress_change_del(self, func):
|
||||
self.callback_del("progress_change", func)
|
||||
|
||||
def on_ref_change_add(self, func, *args, **kargs):
|
||||
self.callback_add("ref_change", func, *args, **kargs)
|
||||
|
||||
def on_ref_change_del(self, func):
|
||||
self.callback_del("ref_change", func)
|
||||
|
||||
def on_button_num_change_add(self, func, *args, **kargs):
|
||||
self.callback_add("button_num_change", func, *args, **kargs)
|
||||
|
||||
def on_button_num_change_del(self, func):
|
||||
self.callback_del("button_num_change", func)
|
||||
|
||||
def on_button_change_add(self, func, *args, **kargs):
|
||||
self.callback_add("button_change", func, *args, **kargs)
|
||||
|
||||
def on_button_change_del(self, func):
|
||||
self.callback_del("button_change", func)
|
||||
|
||||
def on_playback_finished_add(self, func, *args, **kargs):
|
||||
self.callback_add("playback_finished", func, *args, **kargs)
|
||||
|
||||
def on_playback_finished_del(self, func):
|
||||
self.callback_del("playback_finished", func)
|
||||
|
||||
def on_audio_level_change_add(self, func, *args, **kargs):
|
||||
self.callback_add("audio_level_change", func, *args, **kargs)
|
||||
|
||||
def on_audio_level_change_del(self, func):
|
||||
self.callback_del("audio_level_change", func)
|
||||
|
||||
|
||||
_object_mapping_register("Emotion_Object", Emotion)
|
||||
|
||||
init()
|
|
@ -0,0 +1,279 @@
|
|||
# Copyright (C) 2007-2013 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from cpython cimport PyObject, Py_INCREF, Py_DECREF
|
||||
from efl cimport Eina_Bool, const_Eina_List, eina_list_append
|
||||
from efl.c_eo cimport Eo as cEo
|
||||
from efl.c_eo cimport eo_init, eo_shutdown, eo_del, eo_unref, eo_wref_add, eo_add, Eo_Class
|
||||
from efl.c_eo cimport eo_do, eo_class_name_get, eo_class_get
|
||||
from efl.c_eo cimport eo_base_data_set, eo_base_data_get, eo_base_data_del
|
||||
from efl.c_eo cimport eo_event_callback_add, eo_event_callback_del, Eo_Event_Description
|
||||
from efl.c_eo cimport eo_parent_get
|
||||
from efl.c_eo cimport EO_EV_DEL
|
||||
|
||||
|
||||
######################################################################
|
||||
|
||||
cdef int PY_REFCOUNT(object o):
|
||||
cdef PyObject *obj = <PyObject *>o
|
||||
return obj.ob_refcnt
|
||||
|
||||
|
||||
cdef inline unicode _touni(char* s):
|
||||
return s.decode('UTF-8', 'strict') if s else None
|
||||
|
||||
|
||||
cdef inline unicode _ctouni(const_char_ptr s):
|
||||
return s.decode('UTF-8', 'strict') if s else None
|
||||
|
||||
|
||||
cdef inline char *_fruni(s):
|
||||
cdef char *c_string
|
||||
if s is None:
|
||||
return NULL
|
||||
if isinstance(s, unicode):
|
||||
string = s.encode('UTF-8')
|
||||
c_string = string
|
||||
elif isinstance(s, str):
|
||||
c_string = s
|
||||
else:
|
||||
raise TypeError("Expected str or unicode object, got %s" % (type(s).__name__))
|
||||
return c_string
|
||||
|
||||
|
||||
cdef inline const_char_ptr _cfruni(s):
|
||||
cdef const_char_ptr c_string
|
||||
if s is None:
|
||||
return NULL
|
||||
if isinstance(s, unicode):
|
||||
string = s.encode('UTF-8')
|
||||
c_string = string
|
||||
elif isinstance(s, str):
|
||||
c_string = s
|
||||
else:
|
||||
raise TypeError("Expected str or unicode object, got %s" % (type(s).__name__))
|
||||
return c_string
|
||||
|
||||
|
||||
cdef _strings_to_python(const_Eina_List *lst):
|
||||
cdef const_char_ptr s
|
||||
ret = []
|
||||
while lst:
|
||||
s = <const_char_ptr>lst.data
|
||||
if s != NULL:
|
||||
ret.append(_ctouni(s))
|
||||
lst = lst.next
|
||||
return ret
|
||||
|
||||
|
||||
cdef Eina_List * _strings_from_python(strings):
|
||||
cdef Eina_List *lst = NULL
|
||||
for s in strings:
|
||||
lst = eina_list_append(lst, _cfruni(s))
|
||||
return lst
|
||||
|
||||
|
||||
cdef inline _object_list_to_python(const_Eina_List *lst):
|
||||
ret = []
|
||||
while lst:
|
||||
ret.append(object_from_instance(<cEo *>lst.data))
|
||||
lst = lst.next
|
||||
return ret
|
||||
|
||||
|
||||
######################################################################
|
||||
|
||||
|
||||
cdef object object_mapping
|
||||
"""Object mapping is a dictionary into which object type names can be
|
||||
registered. These can be used to find a bindings class for an object using
|
||||
the object_from_instance function."""
|
||||
object_mapping = dict()
|
||||
|
||||
|
||||
cdef _object_mapping_register(char *name, cls):
|
||||
# print("REGISTER: %s => %s" % (name, cls))
|
||||
if name in object_mapping:
|
||||
raise ValueError("object type name '%s' already registered." % name)
|
||||
object_mapping[name] = cls
|
||||
|
||||
|
||||
cdef _object_mapping_unregister(char *name):
|
||||
object_mapping.pop(name)
|
||||
|
||||
|
||||
cdef object object_from_instance(cEo *obj):
|
||||
""" Create a python object from a C Eo object pointer. """
|
||||
cdef void *data
|
||||
cdef Eo o
|
||||
|
||||
if obj == NULL:
|
||||
return None
|
||||
|
||||
eo_do(obj, eo_base_data_get("python-eo", &data))
|
||||
if data != NULL:
|
||||
# print("Found: %s" % Eo.__repr__(<Eo>data))
|
||||
return <Eo>data
|
||||
|
||||
klass_name = eo_class_name_get(eo_class_get(obj))
|
||||
if klass_name == NULL:
|
||||
raise ValueError("Eo object %#x does not have a type!" % <long>obj)
|
||||
|
||||
klass = object_mapping.get(klass_name, None)
|
||||
if klass == None:
|
||||
raise ValueError("Eo object %#x of type %s does not have a mapping!" %
|
||||
(<long>obj, klass_name))
|
||||
|
||||
# print "MAPPING OBJECT:", klass_name, "=>", klass
|
||||
o = klass.__new__(klass)
|
||||
o._set_obj(obj)
|
||||
return o
|
||||
#
|
||||
# TODO extended object mapping (for SmartObject, EdjeExternal, etc)
|
||||
#
|
||||
# t = evas_object_type_get(obj)
|
||||
# if t == NULL:
|
||||
# raise ValueError("Evas object %#x does not have a type!" %
|
||||
# <long>obj)
|
||||
# ot = _ctouni(t)
|
||||
# c = Canvas_from_instance(evas_object_evas_get(obj))
|
||||
# cls = object_mapping.get(ot, None)
|
||||
# if cls is None:
|
||||
# cls_resolver = extended_object_mapping.get(ot, None)
|
||||
# if cls_resolver is None:
|
||||
# warnings.warn(
|
||||
# ("Evas_Object %#x of type %s has no direct or "
|
||||
# "extended mapping! Using generic wrapper.") %
|
||||
# (<unsigned long>obj, ot))
|
||||
# cls = Object
|
||||
# else:
|
||||
# cls = cls_resolver(<unsigned long>obj)
|
||||
# o = cls.__new__(cls)
|
||||
# o._set_evas(c)
|
||||
|
||||
|
||||
######################################################################
|
||||
|
||||
|
||||
EO_CALLBACK_STOP = 0
|
||||
EO_CALLBACK_CONTINUE = 1
|
||||
|
||||
|
||||
######################################################################
|
||||
|
||||
|
||||
cdef Eina_Bool _eo_event_del_cb(void *data, cEo *obj, Eo_Event_Description *desc, void *event_info) with gil:
|
||||
cdef Eo self = <Eo>data
|
||||
|
||||
# print("DEL CB: %s" % Eo.__repr__(self))
|
||||
|
||||
eo_do(self.obj, eo_event_callback_del(EO_EV_DEL, _eo_event_del_cb, <void *>self))
|
||||
eo_do(self.obj, eo_base_data_del("python-eo"))
|
||||
self.obj = NULL
|
||||
Py_DECREF(self)
|
||||
|
||||
return EO_CALLBACK_STOP
|
||||
|
||||
|
||||
cdef class Eo(object):
|
||||
"""
|
||||
Base class used by all the Eo object in the bindings, its not meant to be
|
||||
used by users, but only by internal classes.
|
||||
"""
|
||||
|
||||
# c globals declared in eo.pxd (to make the class available to others)
|
||||
|
||||
def __cinit__(self):
|
||||
self.obj = NULL
|
||||
self.data = dict()
|
||||
|
||||
def __init__(self):
|
||||
# print("Eo __init__()")
|
||||
pass
|
||||
|
||||
def __dealloc__(self):
|
||||
# print("Eo __dealloc__(): %s" % Eo.__repr__(self))
|
||||
pass
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return ("Eo(class=%s, obj=%#x, parent=%#x, refcount=%d)") % \
|
||||
(self.__class__.__name__, <unsigned long>self.obj,
|
||||
<unsigned long>eo_parent_get(self.obj) if self.obj else 0,
|
||||
PY_REFCOUNT(self))
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return ("Eo(class=%s, obj=%#x, parent=%#x, refcount=%d)") % \
|
||||
(self.__class__.__name__, <unsigned long>self.obj,
|
||||
<unsigned long>eo_parent_get(self.obj) if self.obj else 0,
|
||||
PY_REFCOUNT(self))
|
||||
|
||||
# cdef _add_obj(self, Eo_Class *klass, cEo *parent):
|
||||
# cdef cEo *obj
|
||||
# assert self.obj == NULL, "Object must be clean"
|
||||
# obj = eo_add(klass, parent)
|
||||
# self._set_obj(obj)
|
||||
# eo_unref(obj)
|
||||
|
||||
cdef _set_obj(self, cEo *obj):
|
||||
assert self.obj == NULL, "Object must be clean"
|
||||
assert obj != NULL, "Cannot set a NULL object"
|
||||
|
||||
self.obj = obj
|
||||
eo_do(self.obj, eo_base_data_set("python-eo", <void *>self, NULL))
|
||||
eo_do(self.obj, eo_event_callback_add(EO_EV_DEL, _eo_event_del_cb, <void *>self))
|
||||
Py_INCREF(self)
|
||||
|
||||
# cdef _unset_obj(self): # __UNUSED__
|
||||
# if self.obj != NULL:
|
||||
# self.obj = NULL
|
||||
# Py_DECREF(self) ????????????????????'
|
||||
# TODO evas_object_data_del("python-eo") ??
|
||||
|
||||
# def delete(self):
|
||||
# """
|
||||
# Delete object and free it's internal (wrapped) resources.
|
||||
#
|
||||
# @note: after this operation the object will be still alive in
|
||||
# Python, but it will be shallow and every operation
|
||||
# will have no effect (and may raise exceptions).
|
||||
# @raise ValueError: if object already deleted.
|
||||
# """
|
||||
# if self.obj == NULL:
|
||||
# raise ValueError("Object already deleted")
|
||||
# print("Eo delete: %s" % Eo.__repr__(self))
|
||||
# eo_del(self.obj)
|
||||
|
||||
def is_deleted(self):
|
||||
"""
|
||||
Check if the Eo object associated with this python object has been
|
||||
deleted, thus leaving the object as shallow.
|
||||
"""
|
||||
return bool(self.obj == NULL)
|
||||
|
||||
|
||||
def init():
|
||||
return eo_init()
|
||||
|
||||
|
||||
def shutdown():
|
||||
return eo_shutdown()
|
||||
|
||||
|
||||
init()
|
|
@ -0,0 +1,304 @@
|
|||
# Copyright (C) 2007-2013 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import traceback
|
||||
from cpython cimport bool
|
||||
from efl cimport *
|
||||
from efl.eo cimport Eo, object_from_instance, _object_mapping_register
|
||||
from efl.eo cimport _ctouni, _cfruni, _touni, _fruni
|
||||
|
||||
|
||||
EVAS_LAYER_MIN = -32768
|
||||
EVAS_LAYER_MAX = 32767
|
||||
|
||||
EVAS_HINT_EXPAND = 1.0
|
||||
EVAS_HINT_FILL = -1.0
|
||||
|
||||
EVAS_CALLBACK_MOUSE_IN = 0
|
||||
EVAS_CALLBACK_MOUSE_OUT = 1
|
||||
EVAS_CALLBACK_MOUSE_DOWN = 2
|
||||
EVAS_CALLBACK_MOUSE_UP = 3
|
||||
EVAS_CALLBACK_MOUSE_MOVE = 4
|
||||
EVAS_CALLBACK_MOUSE_WHEEL = 5
|
||||
EVAS_CALLBACK_MULTI_DOWN = 6
|
||||
EVAS_CALLBACK_MULTI_UP = 7
|
||||
EVAS_CALLBACK_MULTI_MOVE = 8
|
||||
EVAS_CALLBACK_FREE = 9
|
||||
EVAS_CALLBACK_KEY_DOWN = 10
|
||||
EVAS_CALLBACK_KEY_UP = 11
|
||||
EVAS_CALLBACK_FOCUS_IN = 12
|
||||
EVAS_CALLBACK_FOCUS_OUT = 13
|
||||
EVAS_CALLBACK_SHOW = 14
|
||||
EVAS_CALLBACK_HIDE = 15
|
||||
EVAS_CALLBACK_MOVE = 16
|
||||
EVAS_CALLBACK_RESIZE = 17
|
||||
EVAS_CALLBACK_RESTACK = 18
|
||||
EVAS_CALLBACK_DEL = 19
|
||||
EVAS_CALLBACK_HOLD = 20
|
||||
EVAS_CALLBACK_CHANGED_SIZE_HINTS = 21
|
||||
EVAS_CALLBACK_IMAGE_PRELOADED = 22
|
||||
EVAS_CALLBACK_CANVAS_FOCUS_IN = 23
|
||||
EVAS_CALLBACK_CANVAS_FOCUS_OUT = 24
|
||||
EVAS_CALLBACK_RENDER_FLUSH_PRE = 25
|
||||
EVAS_CALLBACK_RENDER_FLUSH_POST = 26
|
||||
EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN = 27
|
||||
EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT = 28
|
||||
EVAS_CALLBACK_IMAGE_UNLOADED = 29
|
||||
EVAS_CALLBACK_RENDER_PRE = 30
|
||||
EVAS_CALLBACK_RENDER_POST = 31
|
||||
EVAS_CALLBACK_IMAGE_RESIZE = 32
|
||||
EVAS_CALLBACK_DEVICE_CHANGED = 33
|
||||
EVAS_CALLBACK_LAST = 34
|
||||
|
||||
EVAS_BUTTON_NONE = 0
|
||||
EVAS_BUTTON_DOUBLE_CLICK = 1
|
||||
EVAS_BUTTON_TRIPLE_CLICK = 2
|
||||
|
||||
EVAS_EVENT_FLAG_NONE = 0
|
||||
EVAS_EVENT_FLAG_ON_HOLD = 1 << 0
|
||||
|
||||
EVAS_RENDER_BLEND = 0
|
||||
EVAS_RENDER_BLEND_REL = 1
|
||||
EVAS_RENDER_COPY = 2
|
||||
EVAS_RENDER_COPY_REL = 3
|
||||
EVAS_RENDER_ADD = 4
|
||||
EVAS_RENDER_ADD_REL = 5
|
||||
EVAS_RENDER_SUB = 6
|
||||
EVAS_RENDER_SUB_REL = 7
|
||||
EVAS_RENDER_TINT = 8
|
||||
EVAS_RENDER_TINT_REL = 9
|
||||
EVAS_RENDER_MASK = 10
|
||||
EVAS_RENDER_MUL = 11
|
||||
|
||||
EVAS_TEXTURE_REFLECT = 0
|
||||
EVAS_TEXTURE_REPEAT = 1
|
||||
EVAS_TEXTURE_RESTRICT = 2
|
||||
EVAS_TEXTURE_RESTRICT_REFLECT = 3
|
||||
EVAS_TEXTURE_RESTRICT_REPEAT = 4
|
||||
EVAS_TEXTURE_PAD = 5
|
||||
|
||||
EVAS_ALLOC_ERROR_NONE = 0
|
||||
EVAS_ALLOC_ERROR_FATAL = 1
|
||||
EVAS_ALLOC_ERROR_RECOVERED = 2
|
||||
|
||||
EVAS_LOAD_ERROR_NONE = 0
|
||||
EVAS_LOAD_ERROR_GENERIC = 1
|
||||
EVAS_LOAD_ERROR_DOES_NOT_EXIST = 2
|
||||
EVAS_LOAD_ERROR_PERMISSION_DENIED = 3
|
||||
EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4
|
||||
EVAS_LOAD_ERROR_CORRUPT_FILE = 5
|
||||
EVAS_LOAD_ERROR_UNKNOWN_FORMAT = 6
|
||||
|
||||
EVAS_COLOR_SPACE_ARGB = 0
|
||||
EVAS_COLOR_SPACE_AHSV = 1
|
||||
|
||||
EVAS_COLORSPACE_ARGB8888 = 0
|
||||
EVAS_COLORSPACE_YCBCR422P601_PL = 1
|
||||
EVAS_COLORSPACE_YCBCR422P709_PL = 2
|
||||
EVAS_COLORSPACE_RGB565_A5P = 3
|
||||
|
||||
EVAS_PIXEL_FORMAT_NONE = 0
|
||||
EVAS_PIXEL_FORMAT_ARGB32 = 1
|
||||
EVAS_PIXEL_FORMAT_YUV420P_601 = 2
|
||||
|
||||
EVAS_FONT_HINTING_NONE = 0
|
||||
EVAS_FONT_HINTING_AUTO = 1
|
||||
EVAS_FONT_HINTING_BYTECODE = 2
|
||||
|
||||
EVAS_TEXT_STYLE_PLAIN = 0
|
||||
EVAS_TEXT_STYLE_SHADOW = 1
|
||||
EVAS_TEXT_STYLE_OUTLINE = 2
|
||||
EVAS_TEXT_STYLE_SOFT_OUTLINE = 3
|
||||
EVAS_TEXT_STYLE_GLOW = 4
|
||||
EVAS_TEXT_STYLE_OUTLINE_SHADOW = 5
|
||||
EVAS_TEXT_STYLE_FAR_SHADOW = 6
|
||||
EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW = 7
|
||||
EVAS_TEXT_STYLE_SOFT_SHADOW = 8
|
||||
EVAS_TEXT_STYLE_FAR_SOFT_SHADOW = 9
|
||||
|
||||
EVAS_TEXT_INVALID = -1
|
||||
EVAS_TEXT_SPECIAL = -2
|
||||
|
||||
EVAS_TEXTBLOCK_TEXT_RAW = 0
|
||||
EVAS_TEXTBLOCK_TEXT_PLAIN = 1
|
||||
|
||||
EVAS_OBJECT_POINTER_MODE_AUTOGRAB = 0
|
||||
EVAS_OBJECT_POINTER_MODE_NOGRAB = 1
|
||||
|
||||
EVAS_IMAGE_ROTATE_NONE = 0
|
||||
EVAS_IMAGE_ROTATE_90 = 1
|
||||
EVAS_IMAGE_ROTATE_180 = 2
|
||||
EVAS_IMAGE_ROTATE_270 = 3
|
||||
|
||||
EVAS_ASPECT_CONTROL_NONE = 0
|
||||
EVAS_ASPECT_CONTROL_NEITHER = 1
|
||||
EVAS_ASPECT_CONTROL_HORIZONTAL = 2
|
||||
EVAS_ASPECT_CONTROL_VERTICAL = 3
|
||||
EVAS_ASPECT_CONTROL_BOTH = 4
|
||||
|
||||
|
||||
def init():
|
||||
# when changing these, also change __init__.py!
|
||||
# if evas_object_event_callbacks_len != EVAS_CALLBACK_LAST:
|
||||
# raise SystemError("Number of object callbacks changed from %d to %d." %
|
||||
# (evas_object_event_callbacks_len, EVAS_CALLBACK_LAST))
|
||||
# if evas_canvas_event_callbacks_len != EVAS_CALLBACK_LAST:
|
||||
# raise SystemError("Number of canvas callbacks changed from %d to %d." %
|
||||
# (evas_canvas_event_callbacks_len, EVAS_CALLBACK_LAST))
|
||||
return evas_init()
|
||||
|
||||
|
||||
def shutdown():
|
||||
return evas_shutdown()
|
||||
|
||||
|
||||
def render_method_lookup(name):
|
||||
return evas_render_method_lookup(_cfruni(name))
|
||||
|
||||
|
||||
def render_method_list():
|
||||
cdef Eina_List *lst
|
||||
|
||||
ret = []
|
||||
lst = evas_render_method_list()
|
||||
while lst != NULL:
|
||||
ret.append(<char*> lst.data)
|
||||
lst = lst.next
|
||||
|
||||
evas_render_method_list_free(lst)
|
||||
return ret
|
||||
|
||||
|
||||
def color_parse(desc, is_premul=None):
|
||||
cdef unsigned long c, desc_len
|
||||
cdef int r, g, b, a
|
||||
|
||||
r = 0
|
||||
g = 0
|
||||
b = 0
|
||||
a = 0
|
||||
|
||||
if isinstance(desc, str):
|
||||
if not desc or desc[0] != "#":
|
||||
raise ValueError("Invalid color description")
|
||||
desc_len = len(desc)
|
||||
c = int(desc[1:], 16)
|
||||
r = (c >> 16) & 0xff
|
||||
g = (c >> 8) & 0xff
|
||||
b = c & 0xff
|
||||
|
||||
if is_premul is None:
|
||||
is_premul = False
|
||||
|
||||
if desc_len == 9:
|
||||
a = (c >> 24) & 0xff
|
||||
elif desc_len == 7:
|
||||
a = 255
|
||||
else:
|
||||
raise ValueError("Invalid color description")
|
||||
|
||||
elif isinstance(desc, (int, long)):
|
||||
c = desc
|
||||
a = (c >> 24) & 0xff
|
||||
r = (c >> 16) & 0xff
|
||||
g = (c >> 8) & 0xff
|
||||
b = c & 0xff
|
||||
|
||||
if is_premul is None:
|
||||
is_premul = False
|
||||
|
||||
elif isinstance(desc, (list, tuple)):
|
||||
if is_premul is None:
|
||||
is_premul = True
|
||||
|
||||
if len(desc) == 3:
|
||||
a = 255
|
||||
r, g, b = desc
|
||||
else:
|
||||
r, g, b, a = desc
|
||||
else:
|
||||
raise TypeError("Unsupported type %s for color description." %
|
||||
type(desc))
|
||||
|
||||
if is_premul is False:
|
||||
evas_color_argb_premul(a, &r, &g, &b)
|
||||
|
||||
return (r, g, b, a)
|
||||
|
||||
|
||||
def color_argb_premul(int r, int g, int b, int a):
|
||||
evas_color_argb_premul(a, &r, &g, &b)
|
||||
return (r, g, b, a)
|
||||
|
||||
|
||||
def color_argb_unpremul(int r, int g, int b, int a):
|
||||
evas_color_argb_unpremul(a, &r, &g, &b)
|
||||
return (r, g, b, a)
|
||||
|
||||
|
||||
def color_hsv_to_rgb(float h, float s, float v):
|
||||
cdef int r, g, b
|
||||
evas_color_hsv_to_rgb(h, s, v, &r, &g, &b)
|
||||
return (r, g, b)
|
||||
|
||||
|
||||
def color_rgb_to_hsv(int r, int g, int b):
|
||||
cdef float h, s, v
|
||||
evas_color_rgb_to_hsv(r, g, b, &h, &s, &v)
|
||||
return (h, s, v)
|
||||
|
||||
|
||||
class EvasLoadError(Exception):
|
||||
def __init__(self, int code, filename, key):
|
||||
if code == EVAS_LOAD_ERROR_NONE:
|
||||
msg = "No error on load"
|
||||
elif code == EVAS_LOAD_ERROR_GENERIC:
|
||||
msg = "A non-specific error occurred"
|
||||
elif code == EVAS_LOAD_ERROR_DOES_NOT_EXIST:
|
||||
msg = "File (or file path) does not exist"
|
||||
elif code == EVAS_LOAD_ERROR_PERMISSION_DENIED:
|
||||
msg = "Permission deinied to an existing file (or path)"
|
||||
elif code == EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
|
||||
msg = "Allocation of resources failure prevented load"
|
||||
elif code == EVAS_LOAD_ERROR_CORRUPT_FILE:
|
||||
msg = "File corrupt (but was detected as a known format)"
|
||||
elif code == EVAS_LOAD_ERROR_UNKNOWN_FORMAT:
|
||||
msg = "File is not a known format"
|
||||
self.code = code
|
||||
self.file = filename
|
||||
self.key = key
|
||||
Exception.__init__(self, "%s (file=%s, key=%s)" % (msg, filename, key))
|
||||
|
||||
|
||||
include "efl.evas_rect.pxi"
|
||||
include "efl.evas_map.pxi"
|
||||
include "efl.evas_canvas_callbacks.pxi"
|
||||
include "efl.evas_canvas.pxi"
|
||||
include "efl.evas_object_events.pxi"
|
||||
include "efl.evas_object_callbacks.pxi"
|
||||
include "efl.evas_object.pxi"
|
||||
include "efl.evas_object_smart.pxi"
|
||||
include "efl.evas_object_image.pxi"
|
||||
include "efl.evas_object_line.pxi"
|
||||
include "efl.evas_object_rectangle.pxi"
|
||||
include "efl.evas_object_polygon.pxi"
|
||||
include "efl.evas_object_text.pxi"
|
||||
include "efl.evas_object_textblock.pxi"
|
||||
include "efl.evas_object_box.pxi"
|
||||
|
||||
|
||||
init()
|
|
@ -0,0 +1,564 @@
|
|||
# Copyright (C) 2007-2013 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Ecore.
|
||||
#
|
||||
# Python-Ecore 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-Ecore 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-Ecore. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by efl.evas.pyx
|
||||
|
||||
|
||||
# cdef int _canvas_free_wrapper_resources(Canvas canvas) except 0:
|
||||
# cdef int i
|
||||
# for i from 0 <= i < evas_canvas_event_callbacks_len:
|
||||
# canvas._callbacks[i] = None
|
||||
# return 1
|
||||
#
|
||||
#
|
||||
cdef int _canvas_unregister_callbacks(Canvas canvas) except 0:
|
||||
cdef Evas *e
|
||||
cdef Evas_Event_Cb cb
|
||||
e = canvas.obj
|
||||
if e != NULL:
|
||||
for i, lst in enumerate(canvas._callbacks):
|
||||
if lst is not None:
|
||||
cb = evas_canvas_event_callbacks[i]
|
||||
evas_event_callback_del(e, i, cb)
|
||||
return 1
|
||||
|
||||
|
||||
cdef _canvas_add_callback_to_list(Canvas canvas, int type, func, args, kargs):
|
||||
if type < 0 or type >= evas_canvas_event_callbacks_len:
|
||||
raise ValueError("Invalid callback type")
|
||||
|
||||
r = (func, args, kargs)
|
||||
lst = canvas._callbacks[type]
|
||||
if lst is not None:
|
||||
lst.append(r)
|
||||
return False
|
||||
else:
|
||||
canvas._callbacks[type] = [r]
|
||||
return True
|
||||
|
||||
|
||||
cdef _canvas_del_callback_from_list(Canvas canvas, int type, func):
|
||||
if type < 0 or type >= evas_canvas_event_callbacks_len:
|
||||
raise ValueError("Invalid callback type")
|
||||
|
||||
lst = canvas._callbacks[type]
|
||||
if not lst:
|
||||
raise ValueError("Callback %s was not registered with type %d" %
|
||||
(func, type))
|
||||
|
||||
i = None
|
||||
for i, r in enumerate(lst):
|
||||
if func == r[0]:
|
||||
break
|
||||
else:
|
||||
raise ValueError("Callback %s was not registered with type %d" %
|
||||
(func, type))
|
||||
|
||||
lst.pop(i)
|
||||
if len(lst) == 0:
|
||||
canvas._callbacks[type] = None
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
cdef class Canvas(Eo):
|
||||
|
||||
def __cinit__(self, *a, **ka):
|
||||
self._callbacks = [None] * evas_canvas_event_callbacks_len
|
||||
|
||||
def __init__(self, method=None, size=None, viewport=None):
|
||||
self._set_obj(evas_new())
|
||||
|
||||
if method:
|
||||
self.output_method_set(method)
|
||||
if size:
|
||||
self.size_set(*size)
|
||||
if viewport:
|
||||
self.viewport_set(*viewport)
|
||||
|
||||
def __dealloc__(self):
|
||||
if self.obj != NULL:
|
||||
_canvas_unregister_callbacks(self)
|
||||
self._callbacks = None
|
||||
|
||||
def __str__(self):
|
||||
return ("%s Canvas(size=%s, method=%r)") % (Eo.__repr__(self),
|
||||
self.size_get(), self.output_method_get())
|
||||
|
||||
def __repr__(self):
|
||||
return ("%s Canvas(size=%s, method=%r)") % (Eo.__repr__(self),
|
||||
self.size_get(), self.output_method_get())
|
||||
|
||||
def delete(self):
|
||||
evas_free(self.obj)
|
||||
|
||||
def output_method_set(self, method):
|
||||
cdef int engine_id
|
||||
|
||||
if isinstance(method, (int, long)):
|
||||
engine_id = method
|
||||
elif isinstance(method, str):
|
||||
engine_id = evas_render_method_lookup(_cfruni(method))
|
||||
else:
|
||||
raise TypeError("method must be integer or string")
|
||||
|
||||
evas_output_method_set(self.obj, engine_id)
|
||||
|
||||
def output_method_get(self):
|
||||
return evas_output_method_get(self.obj)
|
||||
|
||||
property output_method:
|
||||
def __set__(self, method):
|
||||
self.output_method_set(method)
|
||||
|
||||
def __get__(self):
|
||||
return self.output_method_get()
|
||||
|
||||
def engine_info_set(self, unsigned long ptr):
|
||||
evas_engine_info_set(self.obj, <void *>ptr)
|
||||
|
||||
def engine_info_get(self):
|
||||
return <unsigned long><void *>evas_engine_info_get(self.obj)
|
||||
|
||||
property engine_info:
|
||||
def __set__(self, ptr):
|
||||
self.engine_info_set(ptr)
|
||||
|
||||
def __get__(self):
|
||||
return self.engine_info_get()
|
||||
|
||||
def size_set(self, int w, int h):
|
||||
evas_output_size_set(self.obj, w, h)
|
||||
|
||||
def size_get(self):
|
||||
cdef int w, h
|
||||
evas_output_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
property size:
|
||||
def __set__(self, spec):
|
||||
self.size_set(*spec)
|
||||
|
||||
def __get__(self):
|
||||
return self.size_get()
|
||||
|
||||
property rect:
|
||||
def __set__(self, spec):
|
||||
cdef Rect r
|
||||
r = Rect(spec)
|
||||
self.size_set(r.w, r.h)
|
||||
|
||||
def __get__(self):
|
||||
cdef int w, h
|
||||
w, h = self.size_get()
|
||||
return Rect(0, 0, w, h)
|
||||
|
||||
def viewport_set(self, int x, int y, int w, int h):
|
||||
evas_output_viewport_set(self.obj, x, y, w, h)
|
||||
|
||||
def viewport_get(self):
|
||||
cdef int x, y, w, h
|
||||
evas_output_viewport_get(self.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
property viewport:
|
||||
def __set__(self, spec):
|
||||
self.viewport_set(*spec)
|
||||
|
||||
def __get__(self):
|
||||
return self.viewport_get()
|
||||
|
||||
def coord_screen_x_to_world(self, int x):
|
||||
return evas_coord_screen_x_to_world(self.obj, x)
|
||||
|
||||
def coord_screen_y_to_world(self, int y):
|
||||
return evas_coord_screen_y_to_world(self.obj, y)
|
||||
|
||||
def coord_world_x_to_screen(self, int x):
|
||||
return evas_coord_world_x_to_screen(self.obj, x)
|
||||
|
||||
def coord_world_y_to_screen(self, int y):
|
||||
return evas_coord_world_y_to_screen(self.obj, y)
|
||||
|
||||
def pointer_output_xy_get(self):
|
||||
cdef int x, y
|
||||
evas_pointer_output_xy_get(self.obj, &x, &y)
|
||||
return (x, y)
|
||||
|
||||
property pointer_output_xy:
|
||||
def __get__(self):
|
||||
return self.pointer_output_xy_get()
|
||||
|
||||
def pointer_canvas_xy_get(self):
|
||||
cdef int x, y
|
||||
evas_pointer_canvas_xy_get(self.obj, &x, &y)
|
||||
return (x, y)
|
||||
|
||||
property pointer_canvas_xy:
|
||||
def __get__(self):
|
||||
return self.pointer_canvas_xy_get()
|
||||
|
||||
def pointer_button_down_mask_get(self):
|
||||
return evas_pointer_button_down_mask_get(self.obj)
|
||||
|
||||
property pointer_button_down_mask:
|
||||
def __get__(self):
|
||||
return self.pointer_button_down_mask_get()
|
||||
|
||||
def pointer_inside_get(self):
|
||||
return bool(evas_pointer_inside_get(self.obj))
|
||||
|
||||
property pointer_inside:
|
||||
def __get__(self):
|
||||
return self.pointer_inside_get()
|
||||
|
||||
def top_at_xy_get(self, int x, int y,
|
||||
include_pass_events_objects=False,
|
||||
include_hidden_objects=False):
|
||||
cdef int ip, ih
|
||||
cdef Evas_Object *o
|
||||
ip = include_pass_events_objects
|
||||
ih = include_hidden_objects
|
||||
o = evas_object_top_at_xy_get(self.obj, x, y, ip, ih)
|
||||
return object_from_instance(o)
|
||||
|
||||
def top_at_pointer_get(self):
|
||||
cdef Evas_Object *o
|
||||
o = evas_object_top_at_pointer_get(self.obj)
|
||||
return object_from_instance(o)
|
||||
|
||||
def top_in_rectangle_get(self, int x, int y, int w, int h,
|
||||
include_pass_events_objects=False,
|
||||
include_hidden_objects=False):
|
||||
cdef int ip, ih
|
||||
cdef Evas_Object *o
|
||||
ip = include_pass_events_objects
|
||||
ih = include_hidden_objects
|
||||
o = evas_object_top_in_rectangle_get(self.obj, x, y, w, h, ip, ih)
|
||||
return object_from_instance(o)
|
||||
|
||||
def objects_at_xy_get(self, int x, int y,
|
||||
include_pass_events_objects=False,
|
||||
include_hidden_objects=False):
|
||||
cdef Eina_List *objs, *itr
|
||||
cdef int ip, ih
|
||||
cdef Evas_Object *o
|
||||
ip = include_pass_events_objects
|
||||
ih = include_hidden_objects
|
||||
objs = evas_objects_at_xy_get(self.obj, x, y, ip, ih)
|
||||
lst = []
|
||||
itr = objs
|
||||
while itr != NULL:
|
||||
o = <Evas_Object*>itr.data
|
||||
lst.append(object_from_instance(o))
|
||||
itr = itr.next
|
||||
eina_list_free(objs)
|
||||
return lst
|
||||
|
||||
def objects_in_rectangle_get(self, int x, int y, int w, int h,
|
||||
include_pass_events_objects=False,
|
||||
include_hidden_objects=False):
|
||||
cdef Eina_List *objs, *itr
|
||||
cdef int ip, ih
|
||||
cdef Evas_Object *o
|
||||
ip = include_pass_events_objects
|
||||
ih = include_hidden_objects
|
||||
objs = evas_objects_in_rectangle_get(self.obj, x, y, w, h, ip, ih)
|
||||
lst = []
|
||||
itr = objs
|
||||
while itr != NULL:
|
||||
o = <Evas_Object*>itr.data
|
||||
lst.append(object_from_instance(o))
|
||||
itr = itr.next
|
||||
eina_list_free(objs)
|
||||
return lst
|
||||
|
||||
def damage_rectangle_add(self, int x, int y, int w, int h):
|
||||
evas_damage_rectangle_add(self.obj, x, y, w, h)
|
||||
|
||||
def obscured_rectangle_add(self, int x, int y, int w, int h):
|
||||
evas_obscured_rectangle_add(self.obj, x, y, w, h)
|
||||
|
||||
def obscured_clear(self):
|
||||
evas_obscured_clear(self.obj)
|
||||
|
||||
def render_updates(self):
|
||||
cdef Eina_List *lst
|
||||
lst = evas_render_updates(self.obj)
|
||||
evas_render_updates_free(lst)
|
||||
|
||||
def render(self):
|
||||
evas_render(self.obj)
|
||||
|
||||
def norender(self):
|
||||
evas_norender(self.obj)
|
||||
|
||||
def top_get(self):
|
||||
return object_from_instance(evas_object_top_get(self.obj))
|
||||
|
||||
property top:
|
||||
def __get__(self):
|
||||
return object_from_instance(evas_object_top_get(self.obj))
|
||||
|
||||
def bottom_get(self):
|
||||
return object_from_instance(evas_object_bottom_get(self.obj))
|
||||
|
||||
property bottom:
|
||||
def __get__(self):
|
||||
return object_from_instance(evas_object_bottom_get(self.obj))
|
||||
|
||||
def focus_get(self):
|
||||
return object_from_instance(evas_focus_get(self.obj))
|
||||
|
||||
property focus:
|
||||
def __get__(self):
|
||||
return object_from_instance(evas_focus_get(self.obj))
|
||||
|
||||
def object_name_find(self, name):
|
||||
return object_from_instance(evas_object_name_find(self.obj, _cfruni(name)))
|
||||
|
||||
def image_cache_flush(self):
|
||||
evas_image_cache_flush(self.obj)
|
||||
|
||||
def image_cache_reload(self):
|
||||
evas_image_cache_reload(self.obj)
|
||||
|
||||
def image_cache_set(self, int size):
|
||||
evas_image_cache_set(self.obj, size)
|
||||
|
||||
def image_cache_get(self):
|
||||
return evas_image_cache_get(self.obj)
|
||||
|
||||
property image_cache:
|
||||
def __get__(self):
|
||||
return self.image_cache_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.image_cache_set(value)
|
||||
|
||||
def font_cache_flush(self):
|
||||
evas_font_cache_flush(self.obj)
|
||||
|
||||
def font_cache_get(self):
|
||||
return evas_font_cache_get(self.obj)
|
||||
|
||||
def font_cache_set(self, int value):
|
||||
evas_font_cache_set(self.obj, value)
|
||||
|
||||
property font_cache:
|
||||
def __get__(self):
|
||||
return self.font_cache_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.font_cache_set(value)
|
||||
|
||||
def font_path_clear(self):
|
||||
evas_font_path_clear(self.obj)
|
||||
|
||||
def font_path_append(self, path):
|
||||
evas_font_path_append(self.obj, _cfruni(path))
|
||||
|
||||
def font_path_prepend(self, path):
|
||||
evas_font_path_prepend(self.obj, _cfruni(path))
|
||||
|
||||
def font_path_list(self):
|
||||
cdef const_Eina_List *itr
|
||||
lst = []
|
||||
itr = evas_font_path_list(self.obj)
|
||||
while itr != NULL:
|
||||
lst.append(<char*>itr.data)
|
||||
itr = itr.next
|
||||
return lst
|
||||
|
||||
def font_available_list(self):
|
||||
cdef void *p
|
||||
cdef Eina_List *itr, *head
|
||||
lst = []
|
||||
p = <void*>evas_font_available_list(self.obj) # avoid warning
|
||||
head = <Eina_List*>p
|
||||
itr = head
|
||||
while itr != NULL:
|
||||
lst.append(<char*>itr.data)
|
||||
itr = itr.next
|
||||
evas_font_available_list_free(self.obj, head)
|
||||
return lst
|
||||
|
||||
def font_hinting_can_hint(self, int flags):
|
||||
return bool(evas_font_hinting_can_hint(self.obj,
|
||||
<Evas_Font_Hinting_Flags>flags))
|
||||
|
||||
def font_hinting_set(self, int flags):
|
||||
evas_font_hinting_set(self.obj, <Evas_Font_Hinting_Flags>flags)
|
||||
|
||||
def font_hinting_get(self):
|
||||
return <int>evas_font_hinting_get(self.obj)
|
||||
|
||||
property font_hinting:
|
||||
def __get__(self):
|
||||
return self.font_hinting_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.font_hinting_set(value)
|
||||
|
||||
def freeze(self):
|
||||
evas_event_freeze(self.obj)
|
||||
|
||||
def thaw(self):
|
||||
evas_event_thaw(self.obj)
|
||||
|
||||
def freeze_get(self):
|
||||
return evas_event_freeze_get(self.obj)
|
||||
|
||||
def key_modifier_is_set(self, modifier):
|
||||
return bool(evas_key_modifier_is_set(evas_key_modifier_get(self.obj),
|
||||
modifier))
|
||||
|
||||
def event_callback_add(self, Evas_Callback_Type type, func, *args, **kargs):
|
||||
cdef Evas_Event_Cb cb
|
||||
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
|
||||
if _canvas_add_callback_to_list(self, type, func, args, kargs):
|
||||
cb = evas_canvas_event_callbacks[<int>type]
|
||||
evas_event_callback_add(self.obj, type, cb, <void*>self)
|
||||
|
||||
def event_callback_del(self, Evas_Callback_Type type, func):
|
||||
cdef Evas_Event_Cb cb
|
||||
if _canvas_del_callback_from_list(self, type, func):
|
||||
cb = evas_canvas_event_callbacks[<int>type]
|
||||
evas_event_callback_del(self.obj, type, cb)
|
||||
|
||||
def on_canvas_focus_in_add(self, func, *a, **k):
|
||||
self.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_IN, func, *a, **k)
|
||||
|
||||
def on_canvas_focus_in_del(self, func):
|
||||
self.event_callback_del(EVAS_CALLBACK_CANVAS_FOCUS_IN, func)
|
||||
|
||||
def on_canvas_focus_out_add(self, func, *a, **k):
|
||||
self.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_OUT, func, *a, **k)
|
||||
|
||||
def on_canvas_focus_out_del(self, func):
|
||||
self.event_callback_del(EVAS_CALLBACK_CANVAS_FOCUS_OUT, func)
|
||||
|
||||
def on_render_flush_pre_add(self, func, *a, **k):
|
||||
self.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_PRE, func, *a, **k)
|
||||
|
||||
def on_render_flush_pre_del(self, func):
|
||||
self.event_callback_del(EVAS_CALLBACK_RENDER_FLUSH_PRE, func)
|
||||
|
||||
def on_render_flush_post_add(self, func, *a, **k):
|
||||
self.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_POST, func, *a, **k)
|
||||
|
||||
def on_render_flush_post_del(self, func):
|
||||
self.event_callback_del(EVAS_CALLBACK_RENDER_FLUSH_POST, func)
|
||||
|
||||
# Event feeding
|
||||
# def feed_mouse_down(self, int b, Evas_Button_Flags flags,
|
||||
# unsigned int timestamp):
|
||||
# """ Emit a mouse_down event in the canvas """
|
||||
# evas_event_feed_mouse_down(self.obj, b, flags, timestamp, NULL)
|
||||
#
|
||||
# def feed_mouse_up(self, int b, Evas_Button_Flags flags,
|
||||
# unsigned int timestamp):
|
||||
# """ Emit a mouse_up event in the canvas """
|
||||
# evas_event_feed_mouse_up(self.obj, b, flags, timestamp, NULL)
|
||||
|
||||
def feed_mouse_cancel(self, unsigned int timestamp):
|
||||
evas_event_feed_mouse_cancel(self.obj, timestamp, NULL)
|
||||
|
||||
def feed_mouse_wheel(self, int direction, int z, unsigned int timestamp):
|
||||
evas_event_feed_mouse_wheel(self.obj, direction, z, timestamp, NULL)
|
||||
|
||||
def feed_mouse_move(self, int x, int y, unsigned int timestamp):
|
||||
evas_event_feed_mouse_move(self.obj, x, y, timestamp, NULL)
|
||||
|
||||
def feed_mouse_in(self, unsigned int timestamp):
|
||||
evas_event_feed_mouse_in(self.obj, timestamp, NULL)
|
||||
|
||||
def feed_mouse_out(self, unsigned int timestamp):
|
||||
evas_event_feed_mouse_out(self.obj, timestamp, NULL)
|
||||
|
||||
# def feed_multi_down(self, int d, int x, int y,
|
||||
# double rad, double radx, double rady,
|
||||
# double pres, double ang,
|
||||
# double fx, double fy,
|
||||
# Evas_Button_Flags flags,
|
||||
# unsigned int timestamp):
|
||||
# """ Emit a multi_down event in the canvas """
|
||||
# evas_event_feed_multi_down(self.obj, d, x, y, rad, radx, rady, pres,
|
||||
# ang, fx, fy, flags, timestamp, NULL)
|
||||
|
||||
# def feed_multi_up(self, int d, int x, int y,
|
||||
# double rad, double radx, double rady,
|
||||
# double pres, double ang,
|
||||
# double fx, double fy,
|
||||
# Evas_Button_Flags flags,
|
||||
# unsigned int timestamp):
|
||||
# """ Emit a multi_up event in the canvas """
|
||||
# evas_event_feed_multi_up(self.obj, d, x, y, rad, radx, rady, pres,
|
||||
# ang, fx, fy, flags, timestamp, NULL)
|
||||
|
||||
def feed_multi_move(self, int d, int x, int y,
|
||||
double rad, double radx, double rady,
|
||||
double pres, double ang,
|
||||
double fx, double fy,
|
||||
unsigned int timestamp):
|
||||
evas_event_feed_multi_move(self.obj, d, x, y, rad, radx, rady, pres,
|
||||
ang, fx, fy, timestamp, NULL)
|
||||
|
||||
def feed_key_down(self, char *keyname, char *key, char *string,
|
||||
char *compose, int timestamp):
|
||||
evas_event_feed_key_down(self.obj, keyname, key, string,
|
||||
compose, timestamp, NULL)
|
||||
|
||||
def feed_key_up(self, char *keyname, char *key, char *string,
|
||||
char *compose, int timestamp):
|
||||
evas_event_feed_key_up(self.obj, keyname, key, string,
|
||||
compose, timestamp, NULL)
|
||||
|
||||
def feed_hold(self, int hold, unsigned int timestamp):
|
||||
evas_event_feed_hold(self.obj, hold, timestamp, NULL)
|
||||
|
||||
# Factory
|
||||
def Rectangle(self, **kargs):
|
||||
return Rectangle(self, **kargs)
|
||||
|
||||
def Line(self, **kargs):
|
||||
return Line(self, **kargs)
|
||||
|
||||
def Image(self, **kargs):
|
||||
return Image(self, **kargs)
|
||||
|
||||
def FilledImage(self, **kargs):
|
||||
return FilledImage(self, **kargs)
|
||||
|
||||
def Polygon(self, **kargs):
|
||||
return Polygon(self, **kargs)
|
||||
|
||||
def Text(self, **kargs):
|
||||
return Text(self, **kargs)
|
||||
|
||||
def Textblock(self, **kargs):
|
||||
return Textblock(self, **kargs)
|
||||
|
||||
def Box(self, **kargs):
|
||||
return Box(self, **kargs)
|
||||
|
||||
|
||||
_object_mapping_register("Evas", Canvas)
|
|
@ -0,0 +1,220 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Caio Marcelo de Oliveira Filho, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Evas.
|
||||
#
|
||||
# Python-Evas 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-Evas 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-Evas. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_evas.pyx
|
||||
|
||||
|
||||
cdef int cb_canvas_dispatcher(Canvas self, event, int type) except 0:
|
||||
# iterate over copy since users may delete callback from callback
|
||||
lst = tuple(self._callbacks[type])
|
||||
for func, args, kargs in lst:
|
||||
try:
|
||||
func(self, event, *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
return 1
|
||||
|
||||
|
||||
cdef int cb_canvas_dispatcher2(Canvas self, int type) except 0:
|
||||
# iterate over copy since users may delete callback from callback
|
||||
lst = tuple(self._callbacks[type])
|
||||
for func, args, kargs in lst:
|
||||
try:
|
||||
func(self, *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
return 1
|
||||
|
||||
|
||||
cdef void cb_canvas_mouse_in(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_MOUSE_IN is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_mouse_out(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_MOUSE_OUT is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_mouse_down(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_MOUSE_DOWN is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_mouse_up(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_MOUSE_UP is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_mouse_move(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_MOUSE_MOVE is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_multi_down(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_MULTI_DOWN is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_multi_up(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_MULTI_UP is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_multi_move(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_MULTI_MOVE is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_mouse_wheel(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_MOUSE_WHEEL is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_free(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_FREE is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_key_down(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_KEY_DOWN is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_key_up(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_KEY_UP is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_focus_in(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_FOCUS_IN is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_focus_out(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_FOCUS_OUT is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_show(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_SHOW is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_hide(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_HIDE is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_move(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_MOVE is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_resize(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_RESIZE is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_restack(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_RESTACK is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_del(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_DEL is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_hold(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_HOLD is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_changed_size_hints(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_CHANGED_SIZE_HINTS is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_image_preloaded(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_IMAGE_PRELOADED is not supported by canvas."
|
||||
|
||||
cdef void cb_canvas_image_resize(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_IMAGE_RESIZE is not supported by canvas."
|
||||
|
||||
cdef void cb_canvas_device_changed(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_DEVICE_CHANGED is not supported by canvas."
|
||||
|
||||
cdef void cb_canvas_canvas_focus_in(void *data, Evas *e, void *e_inf) with gil:
|
||||
cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_CANVAS_FOCUS_IN)
|
||||
|
||||
|
||||
cdef void cb_canvas_canvas_focus_out(void *data, Evas *e, void *e_inf) with gil:
|
||||
cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_CANVAS_FOCUS_OUT)
|
||||
|
||||
|
||||
cdef void cb_canvas_render_flush_pre(void *data, Evas *e, void *e_inf) with gil:
|
||||
cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_RENDER_FLUSH_PRE)
|
||||
|
||||
|
||||
cdef void cb_canvas_render_flush_post(void *data, Evas *e, void *e_inf) with gil:
|
||||
cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_RENDER_FLUSH_POST)
|
||||
|
||||
|
||||
cdef void cb_canvas_canvas_object_focus_in(void *data, Evas *e, void *e_inf) with gil:
|
||||
cdef Evas_Object *obj = <Evas_Object*>e_inf
|
||||
o = object_from_instance(obj)
|
||||
cb_canvas_dispatcher(<Canvas>data, o, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN)
|
||||
|
||||
|
||||
cdef void cb_canvas_canvas_object_focus_out(void *data, Evas *e, void *e_inf) with gil:
|
||||
cdef Evas_Object *obj = <Evas_Object*>e_inf
|
||||
o = object_from_instance(obj)
|
||||
cb_canvas_dispatcher(<Canvas>data, o, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT)
|
||||
|
||||
|
||||
cdef void cb_canvas_image_unloaded(void *data, Evas *e, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_IMAGE_UNLOADED is not supported by canvas."
|
||||
|
||||
|
||||
cdef void cb_canvas_render_pre(void *data, Evas *e, void *e_inf) with gil:
|
||||
cdef Evas_Object *obj = <Evas_Object*>e_inf
|
||||
o = object_from_instance(obj)
|
||||
cb_canvas_dispatcher(<Canvas>data, o, EVAS_CALLBACK_RENDER_PRE)
|
||||
|
||||
|
||||
cdef void cb_canvas_render_post(void *data, Evas *e, void *e_inf) with gil:
|
||||
cdef Evas_Object *obj = <Evas_Object*>e_inf
|
||||
o = object_from_instance(obj)
|
||||
cb_canvas_dispatcher(<Canvas>data, o, EVAS_CALLBACK_RENDER_POST)
|
||||
|
||||
|
||||
cdef int evas_canvas_event_callbacks_len
|
||||
cdef Evas_Event_Cb evas_canvas_event_callbacks[34]
|
||||
evas_canvas_event_callbacks_len = 34
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_MOUSE_IN] = cb_canvas_mouse_in
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_MOUSE_OUT] = cb_canvas_mouse_out
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_MOUSE_DOWN] = cb_canvas_mouse_down
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_MOUSE_UP] = cb_canvas_mouse_up
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_MOUSE_MOVE] = cb_canvas_mouse_move
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_MOUSE_WHEEL] = cb_canvas_mouse_wheel
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_MULTI_DOWN] = cb_canvas_multi_down
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_MULTI_UP] = cb_canvas_multi_up
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_MULTI_MOVE] = cb_canvas_multi_move
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_FREE] = cb_canvas_free
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_KEY_DOWN] = cb_canvas_key_down
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_KEY_UP] = cb_canvas_key_up
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_FOCUS_IN] = cb_canvas_focus_in
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_FOCUS_OUT] = cb_canvas_focus_out
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_SHOW] = cb_canvas_show
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_HIDE] = cb_canvas_hide
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_MOVE] = cb_canvas_move
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_RESIZE] = cb_canvas_resize
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_RESTACK] = cb_canvas_restack
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_DEL] = cb_canvas_del
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_HOLD] = cb_canvas_hold
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_CHANGED_SIZE_HINTS] = cb_canvas_changed_size_hints
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_IMAGE_PRELOADED] = cb_canvas_image_preloaded
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_CANVAS_FOCUS_IN] = cb_canvas_canvas_focus_in
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_CANVAS_FOCUS_OUT] = cb_canvas_canvas_focus_out
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_RENDER_FLUSH_PRE] = cb_canvas_render_flush_pre
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_RENDER_FLUSH_POST] = cb_canvas_render_flush_post
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN] = cb_canvas_canvas_object_focus_in
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT] = cb_canvas_canvas_object_focus_out
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_IMAGE_UNLOADED] = cb_canvas_image_unloaded
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_RENDER_PRE] = cb_canvas_render_pre
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_RENDER_POST] = cb_canvas_render_post
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_IMAGE_RESIZE] = cb_canvas_image_resize
|
||||
evas_canvas_event_callbacks[EVAS_CALLBACK_DEVICE_CHANGED] = cb_canvas_device_changed
|
|
@ -0,0 +1,141 @@
|
|||
# Copyright (C) 2012 Davide Andreoli <dave@gurumeditation.it>
|
||||
#
|
||||
# This file is part of Python-Evas.
|
||||
#
|
||||
# Python-Evas 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-Evas 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-Evas. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_evas.pyx
|
||||
|
||||
|
||||
cdef class Map(object):
|
||||
|
||||
cdef Evas_Map *map
|
||||
|
||||
def __cinit__(self, *a, **ka):
|
||||
self.map = NULL
|
||||
|
||||
def __init__(self, int count):
|
||||
self.map = evas_map_new(count)
|
||||
|
||||
def delete(self):
|
||||
evas_map_free(self.map)
|
||||
self.map = NULL
|
||||
|
||||
def util_points_populate_from_object_full(self, Object obj, Evas_Coord z):
|
||||
evas_map_util_points_populate_from_object_full(self.map, obj.obj, z)
|
||||
|
||||
def util_points_populate_from_object(self, Object obj):
|
||||
evas_map_util_points_populate_from_object(self.map, obj.obj)
|
||||
|
||||
def util_points_populate_from_geometry(self, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Evas_Coord z):
|
||||
evas_map_util_points_populate_from_geometry(self.map, x, y, w, h, z)
|
||||
|
||||
def util_points_color_set(self, int r, int g, int b, int a):
|
||||
evas_map_util_points_color_set(self.map, r, g, b, a)
|
||||
|
||||
def util_rotate(self, double degrees, Evas_Coord cx, Evas_Coord cy):
|
||||
evas_map_util_rotate(self.map, degrees, cx, cy)
|
||||
|
||||
def util_zoom(self, double zoomx, double zoomy, Evas_Coord cx, Evas_Coord cy):
|
||||
evas_map_util_zoom(self.map, zoomx, zoomy, cx, cy)
|
||||
|
||||
def util_3d_rotate(self, double dx, double dy, double dz, Evas_Coord cx, Evas_Coord cy, Evas_Coord cz):
|
||||
evas_map_util_3d_rotate(self.map, dx, dy, dz, cx, cy, cz)
|
||||
|
||||
def util_3d_lighting(self, Evas_Coord lx, Evas_Coord ly, Evas_Coord lz, int lr, int lg, int lb, int ar, int ag, int ab):
|
||||
evas_map_util_3d_lighting(self.map, lx, ly, lz, lr, lg, lb, ar, ag, ab)
|
||||
|
||||
def util_3d_perspective(self, Evas_Coord px, Evas_Coord py, Evas_Coord z0, Evas_Coord foc):
|
||||
evas_map_util_3d_perspective(self.map, px, py, z0, foc)
|
||||
|
||||
def util_clockwise_get(self):
|
||||
return bool(evas_map_util_clockwise_get(self.map))
|
||||
|
||||
property util_clockwise:
|
||||
def __get__(self):
|
||||
return self.util_clockwise_get()
|
||||
|
||||
def smooth_set(self, bool smooth):
|
||||
evas_map_smooth_set(self.map, smooth)
|
||||
|
||||
def smooth_get(self):
|
||||
return bool(evas_map_smooth_get(self.map))
|
||||
|
||||
property smooth:
|
||||
def __get__(self):
|
||||
return self.smooth_get()
|
||||
def __set__(self, value):
|
||||
self.smooth_set(value)
|
||||
|
||||
def alpha_set(self, bool alpha):
|
||||
evas_map_alpha_set(self.map, alpha)
|
||||
|
||||
def alpha_get(self):
|
||||
return bool(evas_map_alpha_get(self.map))
|
||||
|
||||
property alpha:
|
||||
def __get__(self):
|
||||
return self.alpha_get()
|
||||
def __set__(self, value):
|
||||
self.alpha_set(value)
|
||||
|
||||
def count_get(self):
|
||||
return evas_map_count_get(self.map)
|
||||
|
||||
property count:
|
||||
def __get__(self):
|
||||
return self.count_get()
|
||||
|
||||
def point_coord_set(self, int idx, Evas_Coord x, Evas_Coord y, Evas_Coord z):
|
||||
evas_map_point_coord_set(self.map, idx, x, y, z)
|
||||
|
||||
def point_coord_get(self, int idx):
|
||||
cdef int x, y, z
|
||||
evas_map_point_coord_get(self.map, idx, &x, &y, &z)
|
||||
return (x, y, z)
|
||||
|
||||
property point_coord:
|
||||
def __get__(self):
|
||||
return self.point_coord_get()
|
||||
def __set__(self, value):
|
||||
self.point_coord_set(*value)
|
||||
|
||||
def point_image_uv_set(self, int idx, double u, double v):
|
||||
evas_map_point_image_uv_set(self.map, idx, u, v)
|
||||
|
||||
def point_image_uv_get(self, int idx):
|
||||
cdef double u, v
|
||||
evas_map_point_image_uv_get(self.map, idx, &u, &v)
|
||||
return (u, v)
|
||||
|
||||
property point_image_uv:
|
||||
def __get__(self):
|
||||
return self.point_image_uv_get()
|
||||
def __set__(self, value):
|
||||
self.point_image_uv_set(*value)
|
||||
|
||||
def point_color_set(self, int idx, int r, int g, int b, int a):
|
||||
evas_map_point_color_set(self.map, idx, r, g, b, a)
|
||||
|
||||
def point_color_get(self, int idx):
|
||||
cdef int r, g, b, a
|
||||
evas_map_point_color_get(self.map, idx, &r, &g, &b, &a)
|
||||
return (r, g, b, a)
|
||||
|
||||
property point_color:
|
||||
def __get__(self):
|
||||
return self.point_color_get()
|
||||
def __set__(self, value):
|
||||
self.point_color_set(*value)
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,83 @@
|
|||
# Copyright (C) 2010 Boris Faure
|
||||
#
|
||||
# This file is part of Python-Evas.
|
||||
#
|
||||
# Python-Evas 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-Evas 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-Evas. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
cdef class Box(Object):
|
||||
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
self._set_obj(evas_object_box_add(canvas.obj))
|
||||
self._set_common_params(**kargs)
|
||||
|
||||
def align_get(self):
|
||||
cdef double horizontal, vertical
|
||||
evas_object_box_align_get(self.obj, &horizontal, &vertical)
|
||||
return (horizontal, vertical)
|
||||
|
||||
def align_set(self, double horizontal, double vertical):
|
||||
evas_object_box_align_set(self.obj, horizontal, vertical)
|
||||
|
||||
property align:
|
||||
def __get__(self):
|
||||
return self.align_get()
|
||||
|
||||
def __set__(self, v):
|
||||
(horizontal, vertical) = v
|
||||
self.align_set(horizontal, vertical)
|
||||
|
||||
def padding_get(self):
|
||||
cdef Evas_Coord horizontal, vertical
|
||||
evas_object_box_padding_get(self.obj, &horizontal, &vertical)
|
||||
return (horizontal, vertical)
|
||||
|
||||
def padding_set(self, Evas_Coord horizontal, Evas_Coord vertical):
|
||||
evas_object_box_padding_set(self.obj, horizontal, vertical)
|
||||
|
||||
property padding:
|
||||
def __get__(self):
|
||||
return self.padding_get()
|
||||
|
||||
def __set__(self, v):
|
||||
(horizontal, vertical) = v
|
||||
self.padding_set(horizontal, vertical)
|
||||
|
||||
def append(self, Object child):
|
||||
evas_object_box_append(self.obj, child.obj)
|
||||
|
||||
def prepend(self, Object child):
|
||||
evas_object_box_prepend(self.obj, child.obj)
|
||||
|
||||
def insert_before(self, Object child, Object reference):
|
||||
evas_object_box_insert_before(self.obj, child.obj, reference.obj)
|
||||
|
||||
def insert_after(self, Object child, Object reference):
|
||||
evas_object_box_insert_after(self.obj, child.obj, reference.obj)
|
||||
|
||||
def insert_at(self, Object child, unsigned int pos):
|
||||
evas_object_box_insert_at(self.obj, child.obj, pos)
|
||||
|
||||
def remove(self, Object child):
|
||||
return evas_object_box_remove(self.obj, child.obj)
|
||||
|
||||
def remove_at(self, unsigned int pos):
|
||||
return evas_object_box_remove_at(self.obj, pos)
|
||||
|
||||
def remove_all(self, Eina_Bool clear):
|
||||
return evas_object_box_remove_all(self.obj, clear)
|
||||
|
||||
|
||||
_object_mapping_register("Evas_Object_Box", Box)
|
|
@ -0,0 +1,288 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Caio Marcelo de Oliveira Filho, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Evas.
|
||||
#
|
||||
# Python-Evas 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-Evas 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-Evas. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_evas.pyx
|
||||
|
||||
|
||||
cdef int cb_object_dispatcher(Object self, event, int type) except 0:
|
||||
# iterate over copy since users may delete callback from callback
|
||||
lst = tuple(self._callbacks[type])
|
||||
for func, args, kargs in lst:
|
||||
try:
|
||||
func(self, event, *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
return 1
|
||||
|
||||
|
||||
cdef int cb_object_dispatcher2(Object self, int type) except 0:
|
||||
# iterate over copy since users may delete callback from callback
|
||||
lst = tuple(self._callbacks[type])
|
||||
for func, args, kargs in lst:
|
||||
try:
|
||||
func(self, *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
return 1
|
||||
|
||||
|
||||
cdef void cb_object_mouse_in(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventMouseIn event
|
||||
event = EventMouseIn()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_MOUSE_IN)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_mouse_out(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventMouseOut event
|
||||
event = EventMouseOut()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_MOUSE_OUT)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_mouse_down(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventMouseDown event
|
||||
event = EventMouseDown()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_MOUSE_DOWN)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_mouse_up(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventMouseUp event
|
||||
event = EventMouseUp()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_MOUSE_UP)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_mouse_move(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventMouseMove event
|
||||
event = EventMouseMove()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_MOUSE_MOVE)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_multi_down(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventMultiDown event
|
||||
event = EventMultiDown()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_MULTI_DOWN)
|
||||
event._unset_obj()
|
||||
|
||||
cdef void cb_object_multi_up(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventMultiUp event
|
||||
event = EventMultiUp()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_MULTI_UP)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_multi_move(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventMultiMove event
|
||||
event = EventMultiMove()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_MULTI_MOVE)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_mouse_wheel(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventMouseWheel event
|
||||
event = EventMouseWheel()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_MOUSE_WHEEL)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_free(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_FREE)
|
||||
|
||||
|
||||
cdef void cb_object_key_down(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventKeyDown event
|
||||
event = EventKeyDown()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_KEY_DOWN)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_key_up(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventKeyUp event
|
||||
event = EventKeyUp()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_KEY_UP)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_focus_in(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_FOCUS_IN)
|
||||
|
||||
|
||||
cdef void cb_object_focus_out(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_FOCUS_OUT)
|
||||
|
||||
|
||||
cdef void cb_object_show(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_SHOW)
|
||||
|
||||
|
||||
cdef void cb_object_hide(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_HIDE)
|
||||
|
||||
|
||||
cdef void cb_object_move(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_MOVE)
|
||||
|
||||
|
||||
cdef void cb_object_resize(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_RESIZE)
|
||||
|
||||
|
||||
cdef void cb_object_restack(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_RESTACK)
|
||||
|
||||
|
||||
cdef void cb_object_del(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_DEL)
|
||||
|
||||
|
||||
cdef void cb_object_hold(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cdef EventHold event
|
||||
event = EventHold()
|
||||
event._set_obj(e_inf)
|
||||
cb_object_dispatcher(<Object>data, event, EVAS_CALLBACK_HOLD)
|
||||
event._unset_obj()
|
||||
|
||||
|
||||
cdef void cb_object_changed_size_hints(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_CHANGED_SIZE_HINTS)
|
||||
|
||||
|
||||
cdef void cb_object_image_preloaded(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_IMAGE_PRELOADED)
|
||||
|
||||
cdef void cb_object_image_resize(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_IMAGE_RESIZE)
|
||||
|
||||
cdef void cb_object_device_changed(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_DEVICE_CHANGED)
|
||||
|
||||
cdef void cb_object_canvas_focus_in(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_FOCUS_IN is not supported by object."
|
||||
|
||||
|
||||
cdef void cb_object_canvas_focus_out(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_FOCUS_OUT is not supported by object."
|
||||
|
||||
|
||||
cdef void cb_object_render_flush_pre(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_RENDER_FLUSH_PRE is not supported by object."
|
||||
|
||||
|
||||
cdef void cb_object_render_flush_post(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_RENDER_FLUSH_POST is not supported by object."
|
||||
|
||||
cdef void cb_object_canvas_object_focus_in(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN is not supported by object."
|
||||
|
||||
cdef void cb_object_canvas_object_focus_out(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT is not supported by object."
|
||||
|
||||
cdef void cb_object_image_unloaded(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
cb_object_dispatcher2(<Object>data, EVAS_CALLBACK_IMAGE_UNLOADED)
|
||||
|
||||
cdef void cb_object_canvas_render_pre(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_RENDER_PRE is not supported by object."
|
||||
|
||||
cdef void cb_object_canvas_render_post(void *data, Evas *e,
|
||||
Evas_Object *obj, void *e_inf) with gil:
|
||||
print "EVAS_CALLBACK_RENDER_POST is not supported by object."
|
||||
|
||||
|
||||
cdef int evas_object_event_callbacks_len
|
||||
cdef Evas_Object_Event_Cb evas_object_event_callbacks[34]
|
||||
evas_object_event_callbacks_len = 34
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_MOUSE_IN] = cb_object_mouse_in
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_MOUSE_OUT] = cb_object_mouse_out
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_MOUSE_DOWN] = cb_object_mouse_down
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_MOUSE_UP] = cb_object_mouse_up
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_MOUSE_MOVE] = cb_object_mouse_move
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_MOUSE_WHEEL] = cb_object_mouse_wheel
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_MULTI_DOWN] = cb_object_multi_down
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_MULTI_UP] = cb_object_multi_up
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_MULTI_MOVE] = cb_object_multi_move
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_FREE] = cb_object_free
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_KEY_DOWN] = cb_object_key_down
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_KEY_UP] = cb_object_key_up
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_FOCUS_IN] = cb_object_focus_in
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_FOCUS_OUT] = cb_object_focus_out
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_SHOW] = cb_object_show
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_HIDE] = cb_object_hide
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_MOVE] = cb_object_move
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_RESIZE] = cb_object_resize
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_RESTACK] = cb_object_restack
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_DEL] = cb_object_del
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_HOLD] = cb_object_hold
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_CHANGED_SIZE_HINTS] = cb_object_changed_size_hints
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_IMAGE_PRELOADED] = cb_object_image_preloaded
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_CANVAS_FOCUS_IN] = cb_object_canvas_focus_in
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_CANVAS_FOCUS_OUT] = cb_object_canvas_focus_out
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_RENDER_FLUSH_PRE] = cb_object_render_flush_pre
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_RENDER_FLUSH_POST] = cb_object_render_flush_post
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN] = cb_object_canvas_object_focus_in
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT] = cb_object_canvas_object_focus_out
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_IMAGE_UNLOADED] = cb_object_image_unloaded
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_RENDER_PRE] = cb_object_canvas_render_pre
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_RENDER_POST] = cb_object_canvas_render_post
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_IMAGE_RESIZE] = cb_object_image_resize
|
||||
evas_object_event_callbacks[EVAS_CALLBACK_DEVICE_CHANGED] = cb_object_device_changed
|
|
@ -0,0 +1,926 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Caio Marcelo de Oliveira Filho
|
||||
#
|
||||
# This file is part of Python-Evas.
|
||||
#
|
||||
# Python-Evas 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-Evas 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-Evas. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_evas.pyx
|
||||
|
||||
|
||||
cdef class EventPoint:
|
||||
cdef void _set_obj(self, Evas_Point *obj):
|
||||
self.obj = obj
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return "%s(%d, %d)" % (self.__class__.__name__, self.obj.x, self.obj.y)
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventPoint object is invalid.")
|
||||
|
||||
property x:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.x
|
||||
|
||||
property y:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.y
|
||||
|
||||
property xy:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return (self.obj.x, self.obj.y)
|
||||
|
||||
def __len__(self):
|
||||
self._check_validity()
|
||||
return 2
|
||||
|
||||
def __getitem__(self, int index):
|
||||
self._check_validity()
|
||||
if index == 0:
|
||||
return self.obj.x
|
||||
elif index == 1:
|
||||
return self.obj.y
|
||||
else:
|
||||
raise IndexError("list index out of range")
|
||||
|
||||
|
||||
cdef class EventCoordPoint:
|
||||
cdef void _set_obj(self, Evas_Coord_Point *obj):
|
||||
self.obj = obj
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return "%s(%d, %d)" % (self.__class__.__name__, self.obj.x, self.obj.y)
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventPoint object is invalid.")
|
||||
|
||||
property x:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.x
|
||||
|
||||
property y:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.y
|
||||
|
||||
property xy:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return (self.obj.x, self.obj.y)
|
||||
|
||||
def __len__(self):
|
||||
self._check_validity()
|
||||
return 2
|
||||
|
||||
def __getitem__(self, int index):
|
||||
self._check_validity()
|
||||
if index == 0:
|
||||
return self.obj.x
|
||||
elif index == 1:
|
||||
return self.obj.y
|
||||
else:
|
||||
raise IndexError("list index out of range")
|
||||
|
||||
|
||||
cdef class EventPrecisionPoint:
|
||||
cdef void _set_obj(self, Evas_Coord_Precision_Point *obj):
|
||||
self.obj = obj
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return "%s(x=%d, y=%d, xsub=%f, ysub=%f)" % \
|
||||
(self.__class__.__name__, self.obj.x, self.obj.y,
|
||||
self.obj.xsub, self.obj.ysub)
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventPoint object is invalid.")
|
||||
|
||||
property x:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.x
|
||||
|
||||
property y:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.y
|
||||
|
||||
property xsub:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.xsub
|
||||
|
||||
property ysub:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.ysub
|
||||
|
||||
property xy:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return (self.obj.x, self.obj.y)
|
||||
|
||||
property xysub:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return (self.obj.xsub, self.obj.ysub)
|
||||
|
||||
def __len__(self):
|
||||
self._check_validity()
|
||||
return 4
|
||||
|
||||
def __getitem__(self, int index):
|
||||
self._check_validity()
|
||||
if index == 0:
|
||||
return self.obj.x
|
||||
elif index == 1:
|
||||
return self.obj.y
|
||||
elif index == 2:
|
||||
return self.obj.xsub
|
||||
elif index == 3:
|
||||
return self.obj.ysub
|
||||
else:
|
||||
raise IndexError("list index out of range")
|
||||
|
||||
|
||||
cdef class EventPosition:
|
||||
cdef void _set_objs(self, Evas_Point *output, Evas_Coord_Point *canvas):
|
||||
self.output = EventPoint()
|
||||
self.output._set_obj(output)
|
||||
self.canvas = EventCoordPoint()
|
||||
self.canvas._set_obj(canvas)
|
||||
|
||||
cdef void _unset_objs(self):
|
||||
self.output._unset_obj()
|
||||
self.canvas._unset_obj()
|
||||
|
||||
def __str__(self):
|
||||
return "%s(output=(%d, %d), canvas=(%d, %d))" % \
|
||||
(self.__class__.__name__, self.output.x, self.output.y,
|
||||
self.canvas.x, self.canvas.y)
|
||||
|
||||
|
||||
cdef class EventPrecisionPosition:
|
||||
cdef void _set_objs(self, Evas_Point *output, Evas_Coord_Precision_Point *canvas):
|
||||
self.output = EventPoint()
|
||||
self.output._set_obj(output)
|
||||
self.canvas = EventPrecisionPoint()
|
||||
self.canvas._set_obj(canvas)
|
||||
|
||||
cdef void _unset_objs(self):
|
||||
self.output._unset_obj()
|
||||
self.canvas._unset_obj()
|
||||
|
||||
def __str__(self):
|
||||
return "%s(output=(%d, %d), canvas=(x=%d, y=%d, xsub=%f, ysub=%f))" % \
|
||||
(self.__class__.__name__, self.output.x, self.output.y,
|
||||
self.canvas.x, self.canvas.y,
|
||||
self.canvas.xsub, self.canvas.ysub)
|
||||
|
||||
|
||||
cdef class EventMouseIn:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Mouse_In*>ptr
|
||||
self.position = EventPosition()
|
||||
self.position._set_objs(&self.obj.output, &self.obj.canvas)
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
self.position._unset_objs()
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventMouseIn object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(buttons=%d, output=(%d, %d), canvas=(%d, %d), "
|
||||
"timestamp=%d, event_flags=%#x)") % \
|
||||
(self.__class__.__name__, self.obj.buttons,
|
||||
self.obj.output.x, self.obj.output.y,
|
||||
self.obj.canvas.x, self.obj.canvas.y,
|
||||
self.obj.timestamp, self.event_flags)
|
||||
|
||||
property buttons:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.buttons
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
cdef class EventMouseOut:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Mouse_Out*>ptr
|
||||
self.position = EventPosition()
|
||||
self.position._set_objs(&self.obj.output, &self.obj.canvas)
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
self.position._unset_objs()
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventMouseOut object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(buttons=%d, output=(%d, %d), canvas=(%d, %d), "
|
||||
"timestamp=%d, event_flags=%#x)") % \
|
||||
(self.__class__.__name__, self.obj.buttons,
|
||||
self.obj.output.x, self.obj.output.y,
|
||||
self.obj.canvas.x, self.obj.canvas.y,
|
||||
self.obj.timestamp, self.event_flags)
|
||||
|
||||
property buttons:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.buttons
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
cdef class EventMouseDown:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Mouse_Down*>ptr
|
||||
self.position = EventPosition()
|
||||
self.position._set_objs(&self.obj.output, &self.obj.canvas)
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
self.position._unset_objs()
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventMouseDown object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(button=%d, output=(%d, %d), canvas=(%d, %d), "
|
||||
"timestamp=%d, event_flags=%#x, flags=%#x)") % \
|
||||
(self.__class__.__name__, self.obj.button,
|
||||
self.obj.output.x, self.obj.output.y,
|
||||
self.obj.canvas.x, self.obj.canvas.y,
|
||||
self.obj.timestamp, self.event_flags, self.flags)
|
||||
|
||||
property button:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.button
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
property flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
cdef class EventMouseUp:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Mouse_Up*>ptr
|
||||
self.position = EventPosition()
|
||||
self.position._set_objs(&self.obj.output, &self.obj.canvas)
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
self.position._unset_objs()
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventMouseUp object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(button=%d, output=(%d, %d), canvas=(%d, %d), "
|
||||
"timestamp=%d, event_flags=%#x, flags=%#x)") % \
|
||||
(self.__class__.__name__, self.obj.button,
|
||||
self.obj.output.x, self.obj.output.y,
|
||||
self.obj.canvas.x, self.obj.canvas.y,
|
||||
self.obj.timestamp, self.event_flags, self.flags)
|
||||
|
||||
property button:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.button
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
property flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
cdef class EventMouseMove:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Mouse_Move*>ptr
|
||||
self.position = EventPosition()
|
||||
self.position._set_objs(&self.obj.cur.output, &self.obj.cur.canvas)
|
||||
self.prev_position = EventPosition()
|
||||
self.prev_position._set_objs(&self.obj.prev.output,
|
||||
&self.obj.prev.canvas)
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
self.position._unset_objs()
|
||||
self.prev_position._unset_objs()
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventMouseMove object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(buttons=%d, output=(%d, %d), canvas=(%d, %d), "
|
||||
"prev_output=(%d, %d), prev_canvas=(%d, %d), timestamp=%d, "
|
||||
"event_flags=%#x)") %\
|
||||
(self.__class__.__name__, self.obj.buttons,
|
||||
self.obj.cur.output.x, self.obj.cur.output.y,
|
||||
self.obj.cur.canvas.x, self.obj.cur.canvas.y,
|
||||
self.obj.prev.output.x, self.obj.prev.output.y,
|
||||
self.obj.prev.canvas.x, self.obj.prev.canvas.y,
|
||||
self.obj.timestamp, self.event_flags)
|
||||
|
||||
property buttons:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.buttons
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
cdef class EventMultiDown:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Multi_Down*>ptr
|
||||
self.position = EventPrecisionPosition()
|
||||
self.position._set_objs(&self.obj.output, &self.obj.canvas)
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
self.position._unset_objs()
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventMultiDown object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(device=%d, radius=(%f, x=%f, y=%f), pressure=%f, angle=%f, "
|
||||
"output=(%d, %d), canvas=(%d, %d, xsub=%f, ysub=%f), "
|
||||
"timestamp=%d, event_flags=%#x, flags=%#x)") % \
|
||||
(self.__class__.__name__, self.obj.device,
|
||||
self.radius, self.radius_x, self.radius_y,
|
||||
self.pressure, self.angle,
|
||||
self.obj.output.x, self.obj.output.y,
|
||||
self.obj.canvas.x, self.obj.canvas.y,
|
||||
self.obj.canvas.xsub, self.obj.canvas.ysub,
|
||||
self.obj.timestamp, self.event_flags, self.flags)
|
||||
|
||||
property device:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.device
|
||||
|
||||
property radius:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.radius
|
||||
|
||||
property radius_x:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.radius_x
|
||||
|
||||
property radius_y:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.radius_y
|
||||
|
||||
property pressure:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.pressure
|
||||
|
||||
property angle:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.angle
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
property flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
cdef class EventMultiUp:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Multi_Up*>ptr
|
||||
self.position = EventPrecisionPosition()
|
||||
self.position._set_objs(&self.obj.output, &self.obj.canvas)
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
self.position._unset_objs()
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventMultiUp object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(device=%d, radius=(%f, x=%f, y=%f), pressure=%f, angle=%f, "
|
||||
"output=(%d, %d), canvas=(%d, %d, xsub=%f, ysub=%f), "
|
||||
"timestamp=%d, event_flags=%#x, flags=%#x)") % \
|
||||
(self.__class__.__name__, self.obj.device,
|
||||
self.radius, self.radius_x, self.radius_y,
|
||||
self.pressure, self.angle,
|
||||
self.obj.output.x, self.obj.output.y,
|
||||
self.obj.canvas.x, self.obj.canvas.y,
|
||||
self.obj.canvas.xsub, self.obj.canvas.ysub,
|
||||
self.obj.timestamp, self.event_flags, self.flags)
|
||||
|
||||
property device:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.device
|
||||
|
||||
property radius:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.radius
|
||||
|
||||
property radius_x:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.radius_x
|
||||
|
||||
property radius_y:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.radius_y
|
||||
|
||||
property pressure:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.pressure
|
||||
|
||||
property angle:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.angle
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
property flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
cdef class EventMultiMove:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Multi_Move*>ptr
|
||||
self.position = EventPrecisionPosition()
|
||||
self.position._set_objs(&self.obj.cur.output, &self.obj.cur.canvas)
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
self.position._unset_objs()
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventMultiMove object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(radius=(%f, x=%f, y=%f), pressure=%f, angle=%f, "
|
||||
"output=(%d, %d), canvas=(%d, %d, xsub=%f, ysub=%f), "
|
||||
"timestamp=%d, event_flags=%#x)") % \
|
||||
(self.__class__.__name__,
|
||||
self.radius, self.radius_x, self.radius_y,
|
||||
self.pressure, self.angle,
|
||||
self.obj.cur.output.x, self.obj.cur.output.y,
|
||||
self.obj.cur.canvas.x, self.obj.cur.canvas.y,
|
||||
self.obj.cur.canvas.xsub, self.obj.cur.canvas.ysub,
|
||||
self.obj.timestamp, self.event_flags)
|
||||
|
||||
property radius:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.radius
|
||||
|
||||
property radius_x:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.radius_x
|
||||
|
||||
property radius_y:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.radius_y
|
||||
|
||||
property pressure:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.pressure
|
||||
|
||||
property angle:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.angle
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
cdef class EventMouseWheel:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Mouse_Wheel*>ptr
|
||||
self.position = EventPosition()
|
||||
self.position._set_objs(&self.obj.output, &self.obj.canvas)
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
self.position._unset_objs()
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventMouseWheel object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(direction=%d, z=%d, output=(%d, %d), "
|
||||
"canvas=(%d, %d), timestamp=%d, event_flags=%#x)") % \
|
||||
(self.__class__.__name__, self.obj.direction, self.obj.z,
|
||||
self.obj.output.x, self.obj.output.y,
|
||||
self.obj.canvas.x, self.obj.canvas.y,
|
||||
self.obj.timestamp, self.event_flags)
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property direction:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.direction
|
||||
|
||||
property z:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.z
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
cdef class EventKeyDown:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Key_Down*>ptr
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventKeyDown object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(keyname=%r, key=%r, string=%r, compose=%r, "
|
||||
"timestamp=%d, event_flags=%#x)") % \
|
||||
(self.__class__.__name__, self.keyname,
|
||||
self.key, self.string, self.compose,
|
||||
self.obj.timestamp, self.event_flags)
|
||||
|
||||
property keyname:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
if self.obj.keyname == NULL:
|
||||
return None
|
||||
else:
|
||||
return self.obj.keyname
|
||||
|
||||
property key:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
if self.obj.key == NULL:
|
||||
return None
|
||||
else:
|
||||
return self.obj.key
|
||||
|
||||
property string:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
if self.obj.string == NULL:
|
||||
return None
|
||||
else:
|
||||
return self.obj.string
|
||||
|
||||
property compose:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
if self.obj.compose == NULL:
|
||||
return None
|
||||
else:
|
||||
return self.obj.compose
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
|
||||
cdef class EventKeyUp:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Key_Up*>ptr
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventKeyUp object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(keyname=%r, key=%r, string=%r, compose=%r, "
|
||||
"timestamp=%d, event_flags=%#x)") % \
|
||||
(self.__class__.__name__, self.keyname,
|
||||
self.key, self.string, self.compose,
|
||||
self.obj.timestamp, self.event_flags)
|
||||
|
||||
property keyname:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
if self.obj.keyname == NULL:
|
||||
return None
|
||||
else:
|
||||
return self.obj.keyname
|
||||
|
||||
property key:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
if self.obj.key == NULL:
|
||||
return None
|
||||
else:
|
||||
return self.obj.key
|
||||
|
||||
property string:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
if self.obj.string == NULL:
|
||||
return None
|
||||
else:
|
||||
return self.obj.string
|
||||
|
||||
property compose:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
if self.obj.compose == NULL:
|
||||
return None
|
||||
else:
|
||||
return self.obj.compose
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
||||
|
||||
def modifier_is_set(self, modifier):
|
||||
self._check_validity()
|
||||
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
|
||||
|
||||
cdef class EventHold:
|
||||
cdef void _set_obj(self, void *ptr):
|
||||
self.obj = <Evas_Event_Hold*>ptr
|
||||
|
||||
cdef void _unset_obj(self):
|
||||
self.obj = NULL
|
||||
|
||||
cdef void _check_validity(self) except *:
|
||||
if self.obj == NULL:
|
||||
raise ValueError("EventHold object is invalid.")
|
||||
|
||||
def __str__(self):
|
||||
self._check_validity()
|
||||
return ("%s(hold=%d, timestamp=%d, event_flags=%#x)") % \
|
||||
(self.__class__.__name__, self.hold,
|
||||
self.obj.timestamp, self.event_flags)
|
||||
|
||||
property hold:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.hold
|
||||
|
||||
property timestamp:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return self.obj.timestamp
|
||||
|
||||
property event_flags:
|
||||
def __get__(self):
|
||||
self._check_validity()
|
||||
return <int>self.obj.event_flags
|
||||
|
||||
def __set__(self, flags):
|
||||
self._check_validity()
|
||||
self.obj.event_flags = flags
|
|
@ -0,0 +1,369 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Caio Marcelo de Oliveira Filho, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Evas.
|
||||
#
|
||||
# Python-Evas 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-Evas 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-Evas. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_evas.pyx
|
||||
|
||||
# TODO: remove me after usage is update to new buffer api
|
||||
cdef extern from "Python.h":
|
||||
int PyObject_AsReadBuffer(obj, void **buffer, Py_ssize_t *buffer_len) except -1
|
||||
|
||||
|
||||
# TODO needed? neem like the frong place to define fill/rotation stuff...
|
||||
# def image_mask_fill(Image source, Image mask, Image surface, int x_mask, int y_mask, int x_surface, int y_surface):
|
||||
# evas_object_image_mask_fill(source.obj, mask.obj, surface.obj,
|
||||
# x_mask, y_mask, x_surface, y_surface)
|
||||
|
||||
cdef int _data_size_get(Evas_Object *obj):
|
||||
cdef int stride, h, bpp, cspace, have_alpha
|
||||
stride = evas_object_image_stride_get(obj)
|
||||
evas_object_image_size_get(obj, NULL, &h)
|
||||
cspace = evas_object_image_colorspace_get(obj)
|
||||
have_alpha = evas_object_image_alpha_get(obj)
|
||||
if cspace == EVAS_COLORSPACE_ARGB8888:
|
||||
bpp = 4
|
||||
elif cspace == EVAS_COLORSPACE_RGB565_A5P:
|
||||
if have_alpha == 0:
|
||||
bpp = 2
|
||||
else:
|
||||
bpp = 3
|
||||
else:
|
||||
return 0 # XXX not supported.
|
||||
|
||||
return stride * h * bpp
|
||||
|
||||
|
||||
cdef class Image(Object):
|
||||
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
self._set_obj(evas_object_image_add(canvas.obj))
|
||||
self._set_common_params(**kargs)
|
||||
|
||||
def _set_common_params(self, file=None, **kargs):
|
||||
if file:
|
||||
if isinstance(file, str):
|
||||
file = (file, None)
|
||||
self.file_set(*file)
|
||||
Object._set_common_params(self, **kargs)
|
||||
|
||||
def file_set(self, filename, key=None):
|
||||
cdef int err
|
||||
evas_object_image_file_set(self.obj, _cfruni(filename), _cfruni(key))
|
||||
err = evas_object_image_load_error_get(self.obj)
|
||||
if err != EVAS_LOAD_ERROR_NONE:
|
||||
raise EvasLoadError(err, filename, key)
|
||||
|
||||
def file_get(self):
|
||||
cdef const_char_ptr file, key
|
||||
evas_object_image_file_get(self.obj, &file, &key)
|
||||
return (_ctouni(file), _ctouni(key))
|
||||
|
||||
property file:
|
||||
def __get__(self):
|
||||
return self.file_get()
|
||||
|
||||
def __set__(self, value):
|
||||
if isinstance(value, str):
|
||||
value = (value, None)
|
||||
self.file_set(*value)
|
||||
|
||||
def load_error_get(self):
|
||||
return evas_object_image_load_error_get(self.obj)
|
||||
|
||||
property load_error:
|
||||
def __get__(self):
|
||||
return self.load_error_get()
|
||||
|
||||
def border_get(self):
|
||||
cdef int left, right, top, bottom
|
||||
evas_object_image_border_get(self.obj, &left, &right, &top, &bottom)
|
||||
return (left, right, top, bottom)
|
||||
|
||||
def border_set(self, int left, int right, int top, int bottom):
|
||||
evas_object_image_border_set(self.obj, left, right, top, bottom)
|
||||
|
||||
property border:
|
||||
def __get__(self):
|
||||
return self.border_get()
|
||||
|
||||
def __set__(self, spec):
|
||||
self.border_set(*spec)
|
||||
|
||||
def border_center_fill_get(self):
|
||||
return bool(evas_object_image_border_center_fill_get(self.obj))
|
||||
|
||||
def border_center_fill_set(self, int value):
|
||||
evas_object_image_border_center_fill_set(self.obj, value)
|
||||
|
||||
property border_center_fill:
|
||||
def __get__(self):
|
||||
return self.border_center_fill_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.border_center_fill_set(value)
|
||||
|
||||
def fill_get(self):
|
||||
cdef int x, y, w, h
|
||||
evas_object_image_fill_get(self.obj, &x, &y, &w, &h)
|
||||
return (x, y, w, h)
|
||||
|
||||
def fill_set(self, int x, int y, int w, int h):
|
||||
evas_object_image_fill_set(self.obj, x, y, w, h)
|
||||
|
||||
property fill:
|
||||
def __get__(self):
|
||||
return self.fill_get()
|
||||
|
||||
def __set__(self, spec):
|
||||
self.fill_set(*spec)
|
||||
|
||||
def image_size_get(self):
|
||||
cdef int w, h
|
||||
evas_object_image_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
def image_size_set(self, int w, int h):
|
||||
evas_object_image_size_set(self.obj, w, h)
|
||||
|
||||
property image_size:
|
||||
def __get__(self):
|
||||
return self.image_size_get()
|
||||
|
||||
def __set__(self, spec):
|
||||
self.image_size_set(*spec)
|
||||
|
||||
def stride_get(self):
|
||||
return evas_object_image_stride_get(self.obj)
|
||||
|
||||
property stride:
|
||||
def __get__(self):
|
||||
return self.stride_get()
|
||||
|
||||
def alpha_get(self):
|
||||
return bool(evas_object_image_alpha_get(self.obj))
|
||||
|
||||
def alpha_set(self, value):
|
||||
evas_object_image_alpha_set(self.obj, value)
|
||||
|
||||
property alpha:
|
||||
def __get__(self):
|
||||
return self.alpha_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.alpha_set(value)
|
||||
|
||||
def smooth_scale_get(self):
|
||||
return bool(evas_object_image_smooth_scale_get(self.obj))
|
||||
|
||||
def smooth_scale_set(self, value):
|
||||
evas_object_image_smooth_scale_set(self.obj, value)
|
||||
|
||||
property smooth_scale:
|
||||
def __get__(self):
|
||||
return self.smooth_scale_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.smooth_scale_set(value)
|
||||
|
||||
def pixels_dirty_get(self):
|
||||
return bool(evas_object_image_pixels_dirty_get(self.obj))
|
||||
|
||||
def pixels_dirty_set(self, value):
|
||||
evas_object_image_pixels_dirty_set(self.obj, value)
|
||||
|
||||
property pixels_dirty:
|
||||
def __get__(self):
|
||||
return self.pixels_dirty_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.pixels_dirty_set(value)
|
||||
|
||||
def load_dpi_get(self):
|
||||
return evas_object_image_load_dpi_get(self.obj)
|
||||
|
||||
def load_dpi_set(self, double value):
|
||||
evas_object_image_load_dpi_set(self.obj, value)
|
||||
|
||||
property load_dpi:
|
||||
def __get__(self):
|
||||
return self.load_dpi_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.load_dpi_set(value)
|
||||
|
||||
def load_size_get(self):
|
||||
cdef int w, h
|
||||
evas_object_image_load_size_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
||||
def load_size_set(self, int w, int h):
|
||||
evas_object_image_load_size_set(self.obj, w, h)
|
||||
|
||||
property load_size:
|
||||
def __get__(self):
|
||||
return self.load_size_get()
|
||||
|
||||
def __set__(self, spec):
|
||||
self.load_size_set(*spec)
|
||||
|
||||
def load_scale_down_get(self):
|
||||
return evas_object_image_load_scale_down_get(self.obj)
|
||||
|
||||
def load_scale_down_set(self, int value):
|
||||
evas_object_image_load_scale_down_set(self.obj, value)
|
||||
|
||||
property load_scale_down:
|
||||
def __get__(self):
|
||||
return self.load_scale_down_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.load_scale_down_set(value)
|
||||
|
||||
def colorspace_get(self):
|
||||
return evas_object_image_colorspace_get(self.obj)
|
||||
|
||||
def colorspace_set(self, int value):
|
||||
evas_object_image_colorspace_set(self.obj, <Evas_Colorspace>value)
|
||||
|
||||
property colorspace:
|
||||
def __get__(self):
|
||||
return self.colorspace_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.colorspace_set(value)
|
||||
|
||||
def preload(self, int cancel=0):
|
||||
evas_object_image_preload(self.obj, cancel)
|
||||
|
||||
|
||||
def reload(self):
|
||||
evas_object_image_reload(self.obj)
|
||||
|
||||
def save(self, const_char_ptr filename, key=None, flags=None):
|
||||
cdef const_char_ptr k, f
|
||||
if key:
|
||||
k = key
|
||||
else:
|
||||
k = NULL
|
||||
|
||||
if flags:
|
||||
f = flags
|
||||
else:
|
||||
f = NULL
|
||||
evas_object_image_save(self.obj, filename, k, f)
|
||||
|
||||
def __getsegcount__(self, Py_ssize_t *p_len):
|
||||
if p_len == NULL:
|
||||
return 1
|
||||
|
||||
p_len[0] = _data_size_get(self.obj)
|
||||
return 1
|
||||
|
||||
def __getreadbuffer__(self, int segment, void **ptr):
|
||||
ptr[0] = evas_object_image_data_get(self.obj, 0)
|
||||
if ptr[0] == NULL:
|
||||
raise SystemError("image has no allocated buffer.")
|
||||
# XXX: keep Evas pixels_checked_out counter to 0 and allow
|
||||
# XXX: image to reload and unload its data.
|
||||
# XXX: may cause problems if buffer is used after these
|
||||
# XXX: functions are called, but buffers aren't expected to
|
||||
# XXX: live much.
|
||||
evas_object_image_data_set(self.obj, ptr[0])
|
||||
return _data_size_get(self.obj)
|
||||
|
||||
def __getwritebuffer__(self, int segment, void **ptr):
|
||||
ptr[0] = evas_object_image_data_get(self.obj, 1)
|
||||
if ptr[0] == NULL:
|
||||
raise SystemError("image has no allocated buffer.")
|
||||
# XXX: keep Evas pixels_checked_out counter to 0 and allow
|
||||
# XXX: image to reload and unload its data.
|
||||
# XXX: may cause problems if buffer is used after these
|
||||
# XXX: functions are called, but buffers aren't expected to
|
||||
# XXX: live much.
|
||||
evas_object_image_data_set(self.obj, ptr[0])
|
||||
return _data_size_get(self.obj)
|
||||
|
||||
def __getcharbuffer__(self, int segment, char **ptr):
|
||||
ptr[0] = <char *>evas_object_image_data_get(self.obj, 0)
|
||||
if ptr[0] == NULL:
|
||||
raise SystemError("image has no allocated buffer.")
|
||||
# XXX: keep Evas pixels_checked_out counter to 0 and allow
|
||||
# XXX: image to reload and unload its data.
|
||||
# XXX: may cause problems if buffer is used after these
|
||||
# XXX: functions are called, but buffers aren't expected to
|
||||
# XXX: live much.
|
||||
evas_object_image_data_set(self.obj, ptr[0])
|
||||
return _data_size_get(self.obj)
|
||||
|
||||
def image_data_set(self, buf):
|
||||
cdef const_void *p_data
|
||||
cdef Py_ssize_t size, expected_size
|
||||
|
||||
if buf is None:
|
||||
evas_object_image_data_set(self.obj, NULL)
|
||||
return
|
||||
|
||||
# TODO: update to new buffer api
|
||||
PyObject_AsReadBuffer(buf, &p_data, &size)
|
||||
if p_data != NULL:
|
||||
expected_size = _data_size_get(self.obj)
|
||||
if size < expected_size:
|
||||
raise ValueError(("buffer size (%d) is smalled than expected "
|
||||
"(%d)!") % (size, expected_size))
|
||||
evas_object_image_data_set(self.obj,<void *> p_data)
|
||||
|
||||
def image_data_update_add(self, x, y, w, h):
|
||||
evas_object_image_data_update_add(self.obj, x, y, w, h)
|
||||
|
||||
def on_image_preloaded_add(self, func, *a, **k):
|
||||
self.event_callback_add(EVAS_CALLBACK_IMAGE_PRELOADED, func, *a, **k)
|
||||
|
||||
def on_image_preloaded_del(self, func):
|
||||
self.event_callback_del(EVAS_CALLBACK_IMAGE_PRELOADED, func)
|
||||
|
||||
def on_image_unloaded_add(self, func, *a, **k):
|
||||
self.event_callback_add(EVAS_CALLBACK_IMAGE_UNLOADED, func, *a, **k)
|
||||
|
||||
def on_image_unloaded_del(self, func):
|
||||
self.event_callback_del(EVAS_CALLBACK_IMAGE_UNLOADED, func)
|
||||
|
||||
|
||||
_object_mapping_register("Evas_Object_Image", Image)
|
||||
|
||||
|
||||
cdef void _cb_on_filled_image_resize(void *data, Evas *e,
|
||||
Evas_Object *obj,
|
||||
void *event_info) with gil:
|
||||
cdef int w, h
|
||||
evas_object_geometry_get(obj, NULL, NULL, &w, &h)
|
||||
evas_object_image_fill_set(obj, 0, 0, w, h)
|
||||
|
||||
|
||||
cdef class FilledImage(Image):
|
||||
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
Image.__init__(self, canvas, **kargs)
|
||||
w, h = self.size_get()
|
||||
Image.fill_set(self, 0, 0, w, h)
|
||||
evas_object_event_callback_add(self.obj, EVAS_CALLBACK_RESIZE,
|
||||
_cb_on_filled_image_resize, NULL)
|
||||
|
||||
def fill_set(self, int x, int y, int w, int h):
|
||||
raise NotImplementedError("FilledImage doesn't support fill_set()")
|
||||
|
||||
|
||||
_object_mapping_register("Evas_Object_FilledImage", FilledImage)
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Evas.
|
||||
#
|
||||
# Python-Evas 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-Evas 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-Evas. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_evas.pyx
|
||||
|
||||
|
||||
cdef class Line(Object):
|
||||
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
self._set_obj(evas_object_line_add(canvas.obj))
|
||||
self._set_common_params(**kargs)
|
||||
|
||||
def _set_common_params(self, start=None, end=None, geometry=None,
|
||||
size=None, pos=None, **kargs):
|
||||
if start and end:
|
||||
x1 = start[0]
|
||||
y1 = start[1]
|
||||
x2 = end[0]
|
||||
y2 = end[1]
|
||||
|
||||
w = x2 - x1
|
||||
h = y2 - y1
|
||||
if w < 0:
|
||||
w = -w
|
||||
x = x2
|
||||
else:
|
||||
x = x1
|
||||
|
||||
if h < 0:
|
||||
h = -h
|
||||
y = y2
|
||||
else:
|
||||
y = y1
|
||||
|
||||
self.xy_set(x1, y1, x2, y2)
|
||||
|
||||
if not geometry:
|
||||
if not size:
|
||||
self.size_set(w, h)
|
||||
if not pos:
|
||||
self.pos_set(x, y)
|
||||
|
||||
elif start:
|
||||
self.start_set(*start)
|
||||
elif end:
|
||||
self.end_set(*end)
|
||||
Object._set_common_params(self, geometry=geometry, size=size,
|
||||
pos=pos, **kargs)
|
||||
|
||||
def xy_set(self, int x1, int y1, int x2, int y2):
|
||||
evas_object_line_xy_set(self.obj, x1, y1, x2, y2)
|
||||
|
||||
def xy_get(self):
|
||||
cdef int x1, y1, x2, y2
|
||||
evas_object_line_xy_get(self.obj, &x1, &y1, &x2, &y2)
|
||||
return (x1, y1, x2, y2)
|
||||
|
||||
def start_set(self, x1, y1):
|
||||
cdef int x2, y2
|
||||
evas_object_line_xy_get(self.obj, NULL, NULL, &x2, &y2)
|
||||
evas_object_line_xy_set(self.obj, x1, y1, x2, y2)
|
||||
|
||||
def start_get(self):
|
||||
cdef int x1, y1
|
||||
evas_object_line_xy_get(self.obj, &x1, &y1, NULL, NULL)
|
||||
return (x1, y1)
|
||||
|
||||
property start:
|
||||
def __set__(self, spec):
|
||||
cdef int x1, y1, x2, y2
|
||||
x1, y1 = spec
|
||||
evas_object_line_xy_get(self.obj, NULL, NULL, &x2, &y2)
|
||||
evas_object_line_xy_set(self.obj, x1, y1, x2, y2)
|
||||
|
||||
def __get__(self):
|
||||
cdef int x1, y1
|
||||
evas_object_line_xy_get(self.obj, &x1, &y1, NULL, NULL)
|
||||
return (x1, y1)
|
||||
|
||||
def end_set(self, x2, y2):
|
||||
cdef int x1, y1
|
||||
evas_object_line_xy_get(self.obj, &x1, &y1, NULL, NULL)
|
||||
evas_object_line_xy_set(self.obj, x1, y1, x2, y2)
|
||||
|
||||
def end_get(self):
|
||||
cdef int x2, y2
|
||||
evas_object_line_xy_get(self.obj, NULL, NULL, &x2, &y2)
|
||||
return (x2, y2)
|
||||
|
||||
property end:
|
||||
def __set__(self, spec):
|
||||
cdef int x1, y1, x2, y2
|
||||
x2, y2 = spec
|
||||
evas_object_line_xy_get(self.obj, &x1, &y1, NULL, NULL)
|
||||
evas_object_line_xy_set(self.obj, x1, y1, x2, y2)
|
||||
|
||||
def __get__(self):
|
||||
cdef int x2, y2
|
||||
evas_object_line_xy_get(self.obj, NULL, NULL, &x2, &y2)
|
||||
return (x2, y2)
|
||||
|
||||
|
||||
_object_mapping_register("Evas_Object_Line", Line)
|
|
@ -0,0 +1,40 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Evas.
|
||||
#
|
||||
# Python-Evas 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-Evas 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-Evas. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_evas.pyx
|
||||
|
||||
|
||||
cdef class Polygon(Object):
|
||||
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
self._set_obj(evas_object_polygon_add(canvas.obj))
|
||||
self._set_common_params(**kargs)
|
||||
|
||||
def _set_common_params(self, points=None, **kargs):
|
||||
Object._set_common_params(self, **kargs)
|
||||
if points:
|
||||
for x, y in points:
|
||||
self.point_add(x, y)
|
||||
|
||||
def point_add(self, int x, int y):
|
||||
evas_object_polygon_point_add(self.obj, x, y)
|
||||
|
||||
def points_clear(self):
|
||||
evas_object_polygon_points_clear(self.obj)
|
||||
|
||||
|
||||
_object_mapping_register("Evas_Object_Polygon", Polygon)
|
|
@ -0,0 +1,28 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Evas.
|
||||
#
|
||||
# Python-Evas 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-Evas 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-Evas. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_evas.pyx
|
||||
|
||||
|
||||
cdef class Rectangle(Object):
|
||||
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
self._set_obj(evas_object_rectangle_add(canvas.obj))
|
||||
self._set_common_params(**kargs)
|
||||
|
||||
|
||||
_object_mapping_register("Evas_Object_Rectangle", Rectangle)
|
|
@ -0,0 +1,796 @@
|
|||
# Copyright (C) 2007-2008 Gustavo Sverzut Barbieri, Ulisses Furquim
|
||||
#
|
||||
# This file is part of Python-Evas.
|
||||
#
|
||||
# Python-Evas 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-Evas 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-Evas. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is included verbatim by c_evas.pyx
|
||||
|
||||
cdef object _smart_classes
|
||||
_smart_classes = list()
|
||||
|
||||
from cpython cimport PyMem_Malloc, PyMethod_New
|
||||
import types
|
||||
|
||||
cdef void _smart_object_delete(Evas_Object *o) with gil:
|
||||
cdef SmartObject obj
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
|
||||
try:
|
||||
obj._m_delete(obj)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
if type(obj.delete) is types.MethodType:
|
||||
try:
|
||||
del obj.delete
|
||||
except AttributeError, e:
|
||||
pass
|
||||
if type(obj.move) is types.MethodType:
|
||||
try:
|
||||
del obj.move
|
||||
except AttributeError, e:
|
||||
pass
|
||||
if type(obj.resize) is types.MethodType:
|
||||
try:
|
||||
del obj.resize
|
||||
except AttributeError, e:
|
||||
pass
|
||||
if type(obj.show) is types.MethodType:
|
||||
try:
|
||||
del obj.show
|
||||
except AttributeError, e:
|
||||
pass
|
||||
if type(obj.hide) is types.MethodType:
|
||||
try:
|
||||
del obj.hide
|
||||
except AttributeError, e:
|
||||
pass
|
||||
if type(obj.color_set) is types.MethodType:
|
||||
try:
|
||||
del obj.color_set
|
||||
except AttributeError, e:
|
||||
pass
|
||||
if type(obj.clip_set) is types.MethodType:
|
||||
try:
|
||||
del obj.clip_set
|
||||
except AttributeError, e:
|
||||
pass
|
||||
if type(obj.clip_unset) is types.MethodType:
|
||||
try:
|
||||
del obj.clip_unset
|
||||
except AttributeError, e:
|
||||
pass
|
||||
if type(obj.calculate) is types.MethodType:
|
||||
try:
|
||||
del obj.calculate
|
||||
except AttributeError, e:
|
||||
pass
|
||||
if type(obj.member_add) is types.MethodType:
|
||||
try:
|
||||
del obj.member_add
|
||||
except AttributeError, e:
|
||||
pass
|
||||
if type(obj.member_del) is types.MethodType:
|
||||
try:
|
||||
del obj.member_del
|
||||
except AttributeError, e:
|
||||
pass
|
||||
|
||||
obj._smart_callbacks = None
|
||||
obj._m_delete = None
|
||||
obj._m_move = None
|
||||
obj._m_resize = None
|
||||
obj._m_show = None
|
||||
obj._m_hide = None
|
||||
obj._m_color_set = None
|
||||
obj._m_clip_set = None
|
||||
obj._m_clip_unset = None
|
||||
obj._m_calculate = None
|
||||
obj._m_member_add = None
|
||||
obj._m_member_del = None
|
||||
|
||||
|
||||
cdef void _smart_object_move(Evas_Object *o,
|
||||
Evas_Coord x, Evas_Coord y) with gil:
|
||||
cdef SmartObject obj
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
if obj._m_move is not None:
|
||||
try:
|
||||
obj._m_move(obj, x, y)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void _smart_object_resize(Evas_Object *o,
|
||||
Evas_Coord w, Evas_Coord h) with gil:
|
||||
cdef SmartObject obj
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
if obj._m_resize is not None:
|
||||
try:
|
||||
obj._m_resize(obj, w, h)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void _smart_object_show(Evas_Object *o) with gil:
|
||||
cdef SmartObject obj
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
if obj._m_show is not None:
|
||||
try:
|
||||
obj._m_show(obj)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void _smart_object_hide(Evas_Object *o) with gil:
|
||||
cdef SmartObject obj
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
if obj._m_hide is not None:
|
||||
try:
|
||||
obj._m_hide(obj)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void _smart_object_color_set(Evas_Object *o,
|
||||
int r, int g, int b, int a) with gil:
|
||||
cdef SmartObject obj
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
if obj._m_color_set is not None:
|
||||
try:
|
||||
obj._m_color_set(obj, r, g, b, a)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void _smart_object_clip_set(Evas_Object *o, Evas_Object *clip) with gil:
|
||||
cdef SmartObject obj
|
||||
cdef Object other
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
other = object_from_instance(clip)
|
||||
if obj._m_clip_set is not None:
|
||||
try:
|
||||
obj._m_clip_set(obj, other)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void _smart_object_clip_unset(Evas_Object *o) with gil:
|
||||
cdef SmartObject obj
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
if obj._m_clip_unset is not None:
|
||||
try:
|
||||
obj._m_clip_unset(obj)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void _smart_object_calculate(Evas_Object *o) with gil:
|
||||
cdef SmartObject obj
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
if obj._m_calculate is not None:
|
||||
try:
|
||||
obj._m_calculate(obj)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void _smart_object_member_add(Evas_Object *o, Evas_Object *clip) with gil:
|
||||
cdef SmartObject obj
|
||||
cdef Object other
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
other = object_from_instance(clip)
|
||||
if obj._m_member_add is not None:
|
||||
try:
|
||||
obj._m_member_add(obj, other)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void _smart_object_member_del(Evas_Object *o, Evas_Object *clip) with gil:
|
||||
cdef SmartObject obj
|
||||
cdef Object other
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
other = object_from_instance(clip)
|
||||
if obj._m_member_del is not None:
|
||||
try:
|
||||
obj._m_member_del(obj, other)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef void _smart_callback(void *data,
|
||||
Evas_Object *o, void *event_info) with gil:
|
||||
cdef SmartObject obj
|
||||
cdef object event, ei
|
||||
obj = <SmartObject>evas_object_data_get(o, "python-evas")
|
||||
event = <object>data
|
||||
ei = <object>event_info
|
||||
lst = tuple(obj._smart_callbacks[event])
|
||||
for func, args, kargs in lst:
|
||||
try:
|
||||
func(obj, ei, *args, **kargs)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
cdef long _smart_object_class_new(char *name) except 0:
|
||||
cdef Evas_Smart_Class *cls_def
|
||||
cdef Evas_Smart *cls
|
||||
|
||||
cls_def = <Evas_Smart_Class*>PyMem_Malloc(sizeof(Evas_Smart_Class))
|
||||
if cls_def == NULL:
|
||||
return 0
|
||||
|
||||
_smart_classes.append(<long>cls_def)
|
||||
cls_def.name = name
|
||||
cls_def.version = EVAS_SMART_CLASS_VERSION
|
||||
cls_def.add = NULL # use python constructor
|
||||
cls_def.delete = _smart_object_delete
|
||||
cls_def.move = _smart_object_move
|
||||
cls_def.resize = _smart_object_resize
|
||||
cls_def.show = _smart_object_show
|
||||
cls_def.hide = _smart_object_hide
|
||||
cls_def.color_set = _smart_object_color_set
|
||||
cls_def.clip_set = _smart_object_clip_set
|
||||
cls_def.clip_unset = _smart_object_clip_unset
|
||||
cls_def.calculate = _smart_object_calculate
|
||||
cls_def.member_add = _smart_object_member_add
|
||||
cls_def.member_del = _smart_object_member_del
|
||||
cls_def.parent = NULL
|
||||
cls_def.callbacks = NULL
|
||||
cls_def.interfaces = NULL
|
||||
cls_def.data = NULL
|
||||
|
||||
cls = evas_smart_class_new(cls_def);
|
||||
return <long>cls
|
||||
|
||||
|
||||
# class EvasSmartObjectMeta(EvasObjectMeta):
|
||||
# def __init__(cls, name, bases, dict_):
|
||||
# EvasObjectMeta.__init__(cls, name, bases, dict_)
|
||||
# cls._setup_smart_class()
|
||||
#
|
||||
# def _setup_smart_class(cls):
|
||||
# if "__evas_smart_class__" in cls.__dict__:
|
||||
# return
|
||||
#
|
||||
# cdef long addr
|
||||
# addr = _smart_object_class_new(cls.__name__)
|
||||
# cls.__evas_smart_class__ = addr
|
||||
|
||||
|
||||
cdef object _smart_class_get_impl_method(object cls, char *name):
|
||||
meth = getattr(cls, name)
|
||||
orig = getattr(Object, name)
|
||||
if meth is orig:
|
||||
return None
|
||||
else:
|
||||
return meth
|
||||
|
||||
|
||||
cdef object _smart_class_get_impl_method_cls(object cls, object parent_cls,
|
||||
char *name):
|
||||
meth = getattr(cls, name)
|
||||
orig = getattr(parent_cls, name)
|
||||
if meth is orig:
|
||||
return None
|
||||
else:
|
||||
return meth
|
||||
|
||||
|
||||
cdef class SmartObject(Object):
|
||||
"""Smart Evas Objects.
|
||||
|
||||
Smart objects are user-defined Evas components, often used to group
|
||||
multiple basic elements, associate an object with a clip and deal with
|
||||
them as an unit. See evas documentation for more details.
|
||||
|
||||
Recommended use is to create an B{clipper} object and clip every other
|
||||
member to it, then you can have all your other members to be always
|
||||
visible and implement L{hide()}, L{show()}, L{color_set()}, L{clip_set()}
|
||||
and L{clip_unset()} to just affect the B{clipper}. See
|
||||
L{ClippedSmartObject}.
|
||||
|
||||
B{Pay attention that just creating an object within the SmartObject
|
||||
doesn't make it a member!} You must do L{member_add()} or use one of
|
||||
the provided factories to ensure that. Failing to do so will leave
|
||||
created objects on different layer and no stacking will be done for you.
|
||||
|
||||
Behavior is defined by defining the following methods:
|
||||
- L{delete()}: called in order to remove object from canvas and
|
||||
deallocate its resources. Usually you delete object's children
|
||||
here. I{Default implementation delete all registered children.}
|
||||
- L{move()}: called in order to move object to given position.
|
||||
Usually you move children here. I{Default implementation
|
||||
calculates offset and move registered children by it.}
|
||||
- L{resize()}: called in order to resize object. I{No default
|
||||
implementation.}
|
||||
- L{show()}: called in order to show the given element. Usually you
|
||||
call the same function on children. I{No default implementation.}
|
||||
- L{hide()}: called in order to hide the given element. Usually you
|
||||
call the same function on children. I{No default implementation.}
|
||||
- L{color_set()}: called in order to change object color. I{No default
|
||||
implementation.}
|
||||
- L{clip_set()}: called in order to limit object's visible area.
|
||||
I{No default implementation.}
|
||||
- L{clip_unset()}: called in order to unlimit object's visible area.
|
||||
I{No default implementation.}
|
||||
- L{calculate()}: called before object is used for rendering and it
|
||||
is marked as dirty/changed with L{changed()}. I{Default
|
||||
implementation does nothing.}
|
||||
- L{member_add()}: called when children is added to object. I{Default
|
||||
implementation does nothing.}
|
||||
- L{member_del()}: called when children is removed from object.
|
||||
I{Default implementation does nothing.}
|
||||
|
||||
@note: You should never instantiate the SmartObject base class directly,
|
||||
but inherit and implement methods, then instantiate this new subclass.
|
||||
@note: If you redefine object's __init__(), you MUST call your parent!
|
||||
Failing to do so will result in objects that just work from
|
||||
Python and not from C, for instance, adding your object to Edje
|
||||
swallow that clips or set color it will not behave as expected.
|
||||
@note: Do not call your parent on methods you want to replace the behavior
|
||||
instead of extending it. For example, some methods have default
|
||||
implementation, you may want to remove and replace it with something
|
||||
else.
|
||||
|
||||
@group Children manipulation: member_add, member_del, members_get,
|
||||
members
|
||||
@group Factories: Rectangle, Line, Image, FilledImage,
|
||||
Polygon, Text
|
||||
@group Default implementations: delete, move, calculate, member_add,
|
||||
member_del
|
||||
@group Missing implementations: resize, show, hide, color_set,
|
||||
clip_set, clip_unset
|
||||
@group Event system: callback_add, callback_del, callback_call
|
||||
|
||||
@see: L{ClippedSmartObject}
|
||||
|
||||
@param canvas: Evas canvas for this object
|
||||
@type canvas: Canvas
|
||||
@keyword size: Width and height
|
||||
@type size: tuple of ints
|
||||
@keyword pos: X and Y
|
||||
@type pos: tuple of ints
|
||||
@keyword geometry: X, Y, width, height
|
||||
@type geometry: tuple of ints
|
||||
@keyword color: R, G, B, A
|
||||
@type color: tuple of ints
|
||||
@keyword name: Object name
|
||||
@type name: string
|
||||
|
||||
"""
|
||||
def __cinit__(self, *a, **ka):
|
||||
self._smart_callbacks = dict()
|
||||
cls = self.__class__
|
||||
self._m_delete = _smart_class_get_impl_method(cls, "delete")
|
||||
if self._m_delete is not None:
|
||||
self.delete = PyMethod_New(Object.delete, self, cls)
|
||||
self._m_move = _smart_class_get_impl_method(cls, "move")
|
||||
if self._m_move is not None:
|
||||
self.move = PyMethod_New(Object.move, self, cls)
|
||||
self._m_resize = _smart_class_get_impl_method(cls, "resize")
|
||||
if self._m_resize is not None:
|
||||
self.resize = PyMethod_New(Object.resize, self, cls)
|
||||
self._m_show = _smart_class_get_impl_method(cls, "show")
|
||||
if self._m_show is not None:
|
||||
self.show = PyMethod_New(Object.show, self, cls)
|
||||
self._m_hide = _smart_class_get_impl_method(cls, "hide")
|
||||
if self._m_hide is not None:
|
||||
self.hide = PyMethod_New(Object.hide, self, cls)
|
||||
self._m_color_set = _smart_class_get_impl_method(cls, "color_set")
|
||||
if self._m_color_set is not None:
|
||||
self.color_set = PyMethod_New(Object.color_set, self, cls)
|
||||
self._m_clip_set = _smart_class_get_impl_method(cls, "clip_set")
|
||||
if self._m_clip_set is not None:
|
||||
self.clip_set = PyMethod_New(Object.clip_set, self, cls)
|
||||
self._m_clip_unset = _smart_class_get_impl_method(cls, "clip_unset")
|
||||
if self._m_clip_unset is not None:
|
||||
self.clip_unset = PyMethod_New(Object.clip_unset, self, cls)
|
||||
self._m_calculate = _smart_class_get_impl_method_cls(
|
||||
cls, SmartObject, "calculate")
|
||||
if self._m_calculate is not None:
|
||||
self.calculate = PyMethod_New(
|
||||
SmartObject.calculate, self, cls)
|
||||
self._m_member_add = _smart_class_get_impl_method_cls(
|
||||
cls, SmartObject, "member_add")
|
||||
if self._m_member_add is not None:
|
||||
self.member_add = PyMethod_New(
|
||||
SmartObject.member_add, self, cls)
|
||||
self._m_member_del = _smart_class_get_impl_method_cls(
|
||||
cls, SmartObject, "member_del")
|
||||
if self._m_member_del is not None:
|
||||
self.member_del = PyMethod_New(
|
||||
SmartObject.member_del, self, cls)
|
||||
|
||||
def __dealloc__(self):
|
||||
self._smart_callbacks = None
|
||||
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
cdef long addr
|
||||
if type(self) is SmartObject:
|
||||
raise TypeError("Must not instantiate SmartObject, but subclasses")
|
||||
if self.obj == NULL:
|
||||
addr = self.__evas_smart_class__
|
||||
# self._add_obj(evas_object_smart_class_get(), self.evas.obj)
|
||||
self._set_obj(evas_object_smart_add(canvas.obj, <Evas_Smart*>addr))
|
||||
self._set_common_params(**kargs)
|
||||
|
||||
def member_add(self, Object child):
|
||||
"""Set an evas object as a member of this object.
|
||||
|
||||
Members will automatically be stacked and layered with the smart
|
||||
object. The various stacking function will operate on members relative
|
||||
to the other members instead of the entire canvas.
|
||||
|
||||
Non-member objects can not interleave a smart object's members.
|
||||
|
||||
@note: if B{child} is already member of another SmartObject, it
|
||||
will be deleted from that membership and added to this object.
|
||||
"""
|
||||
evas_object_smart_member_add(child.obj, self.obj)
|
||||
|
||||
def member_del(self, Object child):
|
||||
"""Removes a member object from a smart object.
|
||||
|
||||
@attention: this will actually map to C API as
|
||||
C{evas_object_smart_member_del(child)}, so the object will loose
|
||||
it's parent B{event if the object is not part of this object}.
|
||||
"""
|
||||
evas_object_smart_member_del(child.obj)
|
||||
|
||||
def members_get(self):
|
||||
"""@rtype: tuple of L{Object}"""
|
||||
cdef Eina_List *lst, *itr
|
||||
cdef Object o
|
||||
ret = []
|
||||
lst = evas_object_smart_members_get(self.obj)
|
||||
itr = lst
|
||||
while itr:
|
||||
o = object_from_instance(<Evas_Object*>itr.data)
|
||||
ret.append(o)
|
||||
itr = itr.next
|
||||
eina_list_free(lst)
|
||||
return tuple(ret)
|
||||
|
||||
property members:
|
||||
def __get__(self):
|
||||
return self.members_get()
|
||||
|
||||
def callback_add(self, char *event, func, *args, **kargs):
|
||||
"""Add a callback for the smart event specified by event.
|
||||
|
||||
@param event: event name
|
||||
@param func: what to callback. Should have the signature:
|
||||
C{function(object, event_info, *args, **kargs)}
|
||||
|
||||
@raise TypeError: if B{func} is not callable.
|
||||
@warning: B{event_info} will always be a python object, if the
|
||||
signal is provided by a C-only class, it will crash.
|
||||
"""
|
||||
if not callable(func):
|
||||
raise TypeError("func must be callable")
|
||||
|
||||
e = intern(event)
|
||||
lst = self._smart_callbacks.setdefault(e, [])
|
||||
if not lst:
|
||||
evas_object_smart_callback_add(self.obj, event, _smart_callback,
|
||||
<void *>e)
|
||||
lst.append((func, args, kargs))
|
||||
|
||||
def callback_del(self, char *event, func):
|
||||
"""Remove a smart callback.
|
||||
|
||||
Removes a callback that was added by L{callback_add()}.
|
||||
|
||||
@param event: event name
|
||||
@param func: what to callback, should have be previously registered.
|
||||
@precond: B{event} and B{func} must be used as parameter for
|
||||
L{callback_add()}.
|
||||
|
||||
@raise ValueError: if there was no B{func} connected with this event.
|
||||
"""
|
||||
try:
|
||||
lst = self._smart_callbacks[event]
|
||||
except KeyError, e:
|
||||
raise ValueError("Unknown event %r" % event)
|
||||
|
||||
i = -1
|
||||
f = None
|
||||
for i, (f, a, k) in enumerate(lst):
|
||||
if func == f:
|
||||
break
|
||||
|
||||
if f != func:
|
||||
raise ValueError("Callback %s was not registered with event %r" %
|
||||
(func, event))
|
||||
lst.pop(i)
|
||||
if lst:
|
||||
return
|
||||
self._smart_callbacks.pop(event)
|
||||
evas_object_smart_callback_del(self.obj, event, _smart_callback)
|
||||
|
||||
def callback_call(self, char *event, event_info=None):
|
||||
"""Call any smart callbacks for event.
|
||||
|
||||
@param event: the event name
|
||||
@param event_info: an event specific info to pass to the callback.
|
||||
|
||||
This should be called internally in the smart object when some
|
||||
specific event has occurred. The documentation for the smart object
|
||||
should include a list of possible events and what type of B{event_info}
|
||||
to expect.
|
||||
|
||||
@attention: B{event_info} will always be a python object.
|
||||
"""
|
||||
evas_object_smart_callback_call(self.obj, event, <void*>event_info)
|
||||
|
||||
def delete(self):
|
||||
"""Default implementation to delete all children."""
|
||||
cdef Eina_List *lst, *itr
|
||||
lst = evas_object_smart_members_get(self.obj)
|
||||
itr = lst
|
||||
while itr:
|
||||
evas_object_del(<Evas_Object*>itr.data)
|
||||
itr = itr.next
|
||||
eina_list_free(lst)
|
||||
|
||||
def move_children_relative(self, int dx, int dy):
|
||||
"""Move all children relatively."""
|
||||
evas_object_smart_move_children_relative(self.obj, dx, dy)
|
||||
|
||||
def move(self, int x, int y):
|
||||
"""Default implementation to move all children."""
|
||||
cdef int orig_x, orig_y, dx, dy
|
||||
evas_object_geometry_get(self.obj, &orig_x, &orig_y, NULL, NULL)
|
||||
dx = x - orig_x
|
||||
dy = y - orig_y
|
||||
self.move_children_relative(dx, dy)
|
||||
|
||||
def resize(self, int w, int h):
|
||||
"""Virtual method resize(w, h) of SmartObject"""
|
||||
print "%s.resize(w, h) not implemented." % self.__class__.__name__
|
||||
|
||||
def show(self):
|
||||
"""Virtual method show() of SmartObject"""
|
||||
print "%s.show() not implemented." % self.__class__.__name__
|
||||
|
||||
def hide(self):
|
||||
"""Virtual method hide() of SmartObject"""
|
||||
print "%s.hide() not implemented." % self.__class__.__name__
|
||||
|
||||
def color_set(self, int r, int g, int b, int a):
|
||||
"""Virtual method color_set(r, g, b, a) of SmartObject"""
|
||||
print "%s.color_set(r, g, b, a) not implemented." % \
|
||||
self.__class__.__name__
|
||||
|
||||
def clip_set(self, Object clip):
|
||||
"""Virtual method clip(object) of SmartObject"""
|
||||
print "%s.clip_set(object) not implemented." % self.__class__.__name__
|
||||
|
||||
def clip_unset(self):
|
||||
"""Virtual method clip_unset() of SmartObject"""
|
||||
print "%s.clip_unset() not implemented." % self.__class__.__name__
|
||||
|
||||
def calculate(self):
|
||||
"""Request object to recalculate it's internal state."""
|
||||
evas_object_smart_calculate(self.obj)
|
||||
|
||||
def changed(self):
|
||||
"""Mark object as changed, so it's L{calculate()} will be called.
|
||||
|
||||
If an object is changed and it provides a calculate() method,
|
||||
it will be called from L{Canvas.render()}, what we call pre-render
|
||||
calculate.
|
||||
|
||||
This can be used to postpone heavy calculations until you need to
|
||||
display the object, example: layout calculations.
|
||||
"""
|
||||
evas_object_smart_changed(self.obj)
|
||||
|
||||
def need_recalculate_set(self, unsigned int value):
|
||||
"""Set need_recalculate flag.
|
||||
|
||||
Set the need_recalculate flag of given smart object.
|
||||
|
||||
If this flag is set then calculate() callback (method) of the
|
||||
given smart object will be called, if one is provided, during
|
||||
render phase usually evas_render(). After this step, this flag
|
||||
will be automatically unset.
|
||||
|
||||
If no calculate() is provided, this flag will be left unchanged.
|
||||
|
||||
@note: just setting this flag will not make scene dirty and
|
||||
evas_render() will have no effect. To do that, use
|
||||
evas_object_smart_changed(), that will automatically call this
|
||||
function with 1 as parameter.
|
||||
|
||||
"""
|
||||
evas_object_smart_need_recalculate_set(self.obj, value)
|
||||
|
||||
def need_recalculate_get(self):
|
||||
"""Get the current value of need_recalculate flag.
|
||||
|
||||
@note: this flag will be unset during the render phase, after
|
||||
calculate() is called if one is provided. If no calculate()
|
||||
is provided, then the flag will be left unchanged after render
|
||||
phase.
|
||||
"""
|
||||
return evas_object_smart_need_recalculate_get(self.obj)
|
||||
|
||||
property need_recalculate:
|
||||
def __set__(self, value):
|
||||
self.need_recalculate_set(value)
|
||||
|
||||
def __get__(self):
|
||||
self.need_recalculate_get()
|
||||
|
||||
# Factory
|
||||
def Rectangle(self, **kargs):
|
||||
"""Factory of children L{evas.Rectangle}.
|
||||
@rtype: L{Rectangle<evas.Rectangle>}
|
||||
"""
|
||||
obj = Rectangle(self.evas, **kargs)
|
||||
self.member_add(obj)
|
||||
return obj
|
||||
|
||||
def Line(self, **kargs):
|
||||
"""Factory of children L{evas.Line}.
|
||||
@rtype: L{Line<evas.Line>}
|
||||
"""
|
||||
obj = Line(self.evas, **kargs)
|
||||
self.member_add(obj)
|
||||
return obj
|
||||
|
||||
# def Image(self, **kargs):
|
||||
# """Factory of children L{evas.Image}.
|
||||
# @rtype: L{Image<evas.Image>}
|
||||
# """
|
||||
# obj = Image(self.evas, **kargs)
|
||||
# self.member_add(obj)
|
||||
# return obj
|
||||
|
||||
# def FilledImage(self, **kargs):
|
||||
# """Factory of L{evas.FilledImage} associated with this canvas.
|
||||
# @rtype: L{FilledImage<evas.FilledImage>}
|
||||
# """
|
||||
# obj = FilledImage(self.evas, **kargs)
|
||||
# self.member_add(obj)
|
||||
# return obj
|
||||
#
|
||||
# def Polygon(self, **kargs):
|
||||
# """Factory of children L{evas.Polygon}.
|
||||
# @rtype: L{Polygon<evas.Polygon>}
|
||||
# """
|
||||
# obj = Polygon(self.evas, **kargs)
|
||||
# self.member_add(obj)
|
||||
# return obj
|
||||
#
|
||||
# def Text(self, **kargs):
|
||||
# """Factory of children L{evas.Text}.
|
||||
# @rtype: L{Text<evas.Text>}
|
||||
# """
|
||||
# obj = Text(self.evas, **kargs)
|
||||
# self.member_add(obj)
|
||||
# return obj
|
||||
#
|
||||
# def Textblock(self, **kargs):
|
||||
# """Factory of children L{evas.Textblock}.
|
||||
# @rtype: L{Textblock<evas.Textblock>}
|
||||
# """
|
||||
# obj = Textblock(self.evas, **kargs)
|
||||
# self.member_add(obj)
|
||||
# return obj
|
||||
|
||||
_object_mapping_register("Evas_Object_Smart", SmartObject)
|
||||
|
||||
# cdef extern from "Evas.h": # hack to force type to be known
|
||||
# cdef PyTypeObject PyEvasSmartObject_Type # hack to install metaclass
|
||||
# _install_metaclass(&PyEvasSmartObject_Type, EvasSmartObjectMeta)
|
||||
|
||||
|
||||
cdef class ClippedSmartObject(SmartObject):
|
||||
"""SmartObject subclass that automatically handles an internal clipper.
|
||||
|
||||
This class is optimized for the recommended SmartObject usage of
|
||||
having an internal clipper, with all member objects clipped to it and
|
||||
operations like L{hide()}, L{show()}, L{color_set()}, L{clip_set()} and
|
||||
L{clip_unset()} operating on it.
|
||||
|
||||
This internal clipper size is huge by default (and not the same as the
|
||||
object size), this means that you should clip this object to another
|
||||
object clipper to get its contents restricted. This is the default
|
||||
because many times what we want are contents that can overflow SmartObject
|
||||
boudaries (ie: members with animations coming in from outside).
|
||||
|
||||
@group Children manipulation: member_add, member_del
|
||||
@group Default implementations: delete, move, show, hide, color_set,
|
||||
clip_set, clip_unset, calculate
|
||||
@ivar clipper: the internal object used for clipping. You shouldn't
|
||||
mess with it.
|
||||
|
||||
@todo: remove current code and wrap C version (now it's in evas).
|
||||
|
||||
@param canvas: Evas canvas for this object
|
||||
@type canvas: Canvas
|
||||
@keyword size: Width and height
|
||||
@type size: tuple of ints
|
||||
@keyword pos: X and Y
|
||||
@type pos: tuple of ints
|
||||
@keyword geometry: X, Y, width, height
|
||||
@type geometry: tuple of ints
|
||||
@keyword color: R, G, B, A
|
||||
@type color: tuple of ints
|
||||
@keyword name: Object name
|
||||
@type name: string
|
||||
@keyword file: File name
|
||||
@type file: string
|
||||
|
||||
"""
|
||||
def __init__(self, Canvas canvas not None, **kargs):
|
||||
if type(self) is ClippedSmartObject:
|
||||
raise TypeError("Must not instantiate ClippedSmartObject, but "
|
||||
"subclasses")
|
||||
SmartObject.__init__(self, canvas, **kargs)
|
||||
if self.clipper is None:
|
||||
self.clipper = Rectangle(canvas)
|
||||
evas_object_move(self.clipper.obj, -100000, -100000);
|
||||
evas_object_resize(self.clipper.obj, 200000, 200000);
|
||||
evas_object_static_clip_set(self.clipper.obj, 1);
|
||||
evas_object_pass_events_set(self.clipper.obj, 1);
|
||||
evas_object_smart_member_add(self.clipper.obj, self.obj)
|
||||
|
||||
def member_add(self, Object child):
|
||||
"""Set an evas object as a member of this object, already clipping."""
|
||||
if self.clipper is None or self.clipper is child:
|
||||
return
|
||||
evas_object_clip_set(child.obj, self.clipper.obj)
|
||||
if evas_object_visible_get(self.obj):
|
||||
evas_object_show(self.clipper.obj)
|
||||
|
||||
def member_del(self, Object child):
|
||||
"""Removes a member object from a smart object, already unsets its clip."""
|
||||
if self.clipper is child:
|
||||
return
|
||||
evas_object_clip_unset(child.obj)
|
||||
if evas_object_clipees_get(self.clipper.obj) == NULL:
|
||||
evas_object_hide(self.clipper.obj)
|
||||
|
||||
def show(self):
|
||||
"""Default implementation that acts on the the clipper."""
|
||||
if evas_object_clipees_get(self.clipper.obj) != NULL:
|
||||
evas_object_show(self.clipper.obj)
|
||||
|
||||
def hide(self):
|
||||
"""Default implementation that acts on the the clipper."""
|
||||
evas_object_hide(self.clipper.obj)
|
||||
|
||||
def color_set(self, int r, int g, int b, int a):
|
||||
"""Default implementation that acts on the the clipper."""
|
||||
evas_object_color_set(self.clipper.obj, r, g, b, a)
|
||||
|
||||
def clip_set(self, Object clip):
|
||||
"""Default implementation that acts on the the clipper."""
|
||||
evas_object_clip_set(self.clipper.obj, clip.obj)
|
||||
|
||||
def clip_unset(self):
|
||||
"""Default implementation that acts on the the clipper."""
|
||||
evas_object_clip_unset(self.clipper.obj)
|
||||
|
||||
|
||||
# cdef extern from "Evas.h": # hack to force type to be known
|
||||
# cdef PyTypeObject PyEvasClippedSmartObject_Type # hack to install metaclass
|
||||
# _install_metaclass(&PyEvasClippedSmartObject_Type, EvasSmartObjectMeta)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue