Python efl: emotion fully documented, no functional changes, but used the elm properties-on-top style
SVN revision: 84389
This commit is contained in:
parent
340c3df330
commit
1ca526c62d
|
@ -1,6 +1,7 @@
|
|||
:mod:`efl.ecore` Module
|
||||
=======================
|
||||
|
||||
.. module:: efl.ecore
|
||||
|
||||
What is Ecore?
|
||||
--------------
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
:mod:`efl.edje` Module
|
||||
=======================
|
||||
|
||||
.. module:: efl.edje
|
||||
|
||||
What is Edje?
|
||||
--------------
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
:mod:`efl.emotion` Module
|
||||
=========================
|
||||
============================
|
||||
|
||||
.. automodule:: efl.emotion
|
||||
.. module:: efl.emotion
|
||||
|
||||
What is Emotion?
|
||||
----------------
|
||||
|
@ -56,14 +56,24 @@ being sent, like "playback_started" or "open_done".
|
|||
.. rubric:: Available signals
|
||||
|
||||
The Evas_Object returned by emotion_object_add() has a number of signals that
|
||||
can be listened to using evas' smart callbacks mechanism. All signals have
|
||||
NULL as event info. The following is a list of interesting signals:
|
||||
can be listened to using evas' smart callbacks mechanism. The following is
|
||||
a list of interesting signals:
|
||||
|
||||
- ``playback_started`` Emitted when the playback starts
|
||||
- ``playback_finished`` Emitted when the playback finishes
|
||||
- ``frame_decode`` Emitted every time a frame is decoded
|
||||
- ``frame_resize`` Emitted when the frame change its size
|
||||
- ``open_done`` Emitted when the media file is opened
|
||||
- ``position_update`` Emitted when emotion_object_position_set is called
|
||||
- ``audio_level_change`` Emitted when the volume change it's value
|
||||
- ``decode_stop`` Emitted after the last frame is decoded
|
||||
- ``length_change`` Emitted if the media change it's size
|
||||
- ``channels_change`` Emitted when the number of channels change
|
||||
- ``title_change`` Emitted when the title change (?)
|
||||
- ``progress_change``
|
||||
- ``ref_change``
|
||||
- ``button_num_change``
|
||||
- ``button_change``
|
||||
|
||||
|
||||
Reference
|
||||
|
@ -82,3 +92,4 @@ Inheritance diagram
|
|||
efl.emotion
|
||||
:parts: 2
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
:mod:`efl.evas` Module
|
||||
======================
|
||||
|
||||
.. module:: efl.evas
|
||||
|
||||
What is Evas?
|
||||
-------------
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from efl.eo cimport const_char_ptr
|
||||
from efl.eo cimport const_char_ptr, _ctouni, _cfruni
|
||||
from efl.eo cimport object_from_instance, _object_mapping_register
|
||||
from efl.evas cimport Evas_Object, Canvas
|
||||
from efl.evas cimport Object as evasObject
|
||||
|
@ -109,18 +109,19 @@ def shutdown():
|
|||
|
||||
|
||||
cdef class Emotion(evasObject):
|
||||
"""
|
||||
""" The emotion object
|
||||
|
||||
:see: :py:mod:`The documentation page<efl.emotion>`
|
||||
|
||||
The emotion object
|
||||
|
||||
:param evas: The canvas where the object will be added to.
|
||||
:return: The emotion object just created.
|
||||
|
||||
The object can be manipulated as any other Evas object, using the
|
||||
default efl.evas.Object manipulation functions.
|
||||
|
||||
The next step is to open the desired file with file_set(), and
|
||||
start playing it with play_set().
|
||||
:type evas: efl.evas.Canvas
|
||||
:param module_name: name of the engien to use (gstreamer, xine, vlc or generic)
|
||||
:param module_params: Extra parameters, module specific
|
||||
:param size: (w, h)
|
||||
:param pos: (x, y)
|
||||
:param geometry: (x, y, w, h)
|
||||
:param color: (r, g, b, a)
|
||||
:return: The emotion object instance just created.
|
||||
|
||||
"""
|
||||
def __cinit__(self, *a, **ka):
|
||||
|
@ -172,336 +173,570 @@ cdef class Emotion(evasObject):
|
|||
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:
|
||||
""" The filename of the file associated with the emotion object.
|
||||
|
||||
The file to be used with this emotion object. If the
|
||||
object already has another file set, this file will be unset and unloaded,
|
||||
and the new file will be loaded to this emotion object. The seek position
|
||||
will be set to 0, and the emotion object will be paused, instead of playing.
|
||||
|
||||
If there was already a filename set, and it's the same as the one being set
|
||||
now, setting the property does nothing
|
||||
|
||||
Set to *None* if you want to unload the current file but don't
|
||||
want to load anything else.
|
||||
|
||||
:type: str
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.file_get()
|
||||
return _ctouni(emotion_object_file_get(self.obj))
|
||||
|
||||
def __set__(self, char *value):
|
||||
self.file_set(value)
|
||||
emotion_object_file_set(self.obj, _cfruni(value))
|
||||
|
||||
def file_get(self):
|
||||
return _ctouni(emotion_object_file_get(self.obj))
|
||||
def file_set(self, char *file_name):
|
||||
emotion_object_file_set(self.obj, _cfruni(file_name))
|
||||
|
||||
property play:
|
||||
""" The play/pause state of the emotion object.
|
||||
|
||||
:type: bool
|
||||
"""
|
||||
def __get__(self):
|
||||
return bool(emotion_object_play_get(self.obj))
|
||||
|
||||
def __set__(self, int value):
|
||||
emotion_object_play_set(self.obj, 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()
|
||||
property position:
|
||||
""" The position in the media file.
|
||||
|
||||
def __set__(self, int value):
|
||||
self.play_set(value)
|
||||
The current position of the media file to *sec*, this
|
||||
only works on seekable streams. Setting the position doesn't change the
|
||||
playing state of the media file.
|
||||
|
||||
:type: float
|
||||
"""
|
||||
def __get__(self):
|
||||
return emotion_object_position_get(self.obj)
|
||||
|
||||
def __set__(self, double value):
|
||||
emotion_object_position_set(self.obj, 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()
|
||||
property buffer_size:
|
||||
""" The percentual size of the buffering cache.
|
||||
|
||||
def __set__(self, double value):
|
||||
self.position_set(value)
|
||||
The buffer size is given as a number between 0.0 and 1.0, 0.0 means
|
||||
the buffer if empty, 1.0 means full.
|
||||
If no buffering is in progress 1.0 is returned. In all other cases (maybe
|
||||
the backend don't support buffering) 1.0 is returned, thus you can always
|
||||
check for buffer_size < 1.0 to know if buffering is in progress.
|
||||
|
||||
:type: float
|
||||
"""
|
||||
def __get__(self):
|
||||
return emotion_object_buffer_size_get(self.obj)
|
||||
|
||||
def buffer_size_get(self):
|
||||
return emotion_object_buffer_size_get(self.obj)
|
||||
|
||||
property buffer_size:
|
||||
property video_handled:
|
||||
""" True if the loaded stream contain at least one video track
|
||||
|
||||
:type: bool
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.buffer_size_get()
|
||||
return bool(emotion_object_video_handled_get(self.obj))
|
||||
|
||||
def video_handled_get(self):
|
||||
return bool(emotion_object_video_handled_get(self.obj))
|
||||
|
||||
property video_handled:
|
||||
property audio_handled:
|
||||
""" True if the loaded stream contain at least one audio track
|
||||
|
||||
:type: bool
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.video_handled_get()
|
||||
return bool(emotion_object_audio_handled_get(self.obj))
|
||||
|
||||
def audio_handled_get(self):
|
||||
return bool(emotion_object_audio_handled_get(self.obj))
|
||||
|
||||
property audio_handled:
|
||||
property seekable:
|
||||
""" Whether the media file is seekable.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.audio_handled_get()
|
||||
return bool(emotion_object_seekable_get(self.obj))
|
||||
|
||||
def seekable_get(self):
|
||||
return bool(emotion_object_seekable_get(self.obj))
|
||||
|
||||
property seekable:
|
||||
property play_length:
|
||||
""" The length of play for the media file.
|
||||
|
||||
The total length of the media file in seconds.
|
||||
|
||||
:type: float
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.seekable_get()
|
||||
return emotion_object_play_length_get(self.obj)
|
||||
|
||||
def play_length_get(self):
|
||||
return emotion_object_play_length_get(self.obj)
|
||||
|
||||
property play_length:
|
||||
property play_speed:
|
||||
""" The play speed of the media file.
|
||||
|
||||
This sets the speed with which the media file will be played. 1.0
|
||||
represents the normal speed, 2 double speed, 0.5 half speed and so on.
|
||||
|
||||
:type: float
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.play_length_get()
|
||||
return emotion_object_play_speed_get(self.obj)
|
||||
|
||||
def __set__(self, double value):
|
||||
emotion_object_play_speed_set(self.obj, 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 image_size:
|
||||
""" The video size of the loaded file.
|
||||
|
||||
This is the reported size of the loaded video file. If a file
|
||||
that doesn't contain a video channel is loaded, then this size can be
|
||||
ignored.
|
||||
The value reported by this function should be consistent with the aspect
|
||||
ratio returned by :py:func:`ratio_get`, but sometimes the information
|
||||
stored in the file is wrong. So use the ratio size reported by
|
||||
py:func:`ratio_get()`, since it is more likely going to be accurate.
|
||||
|
||||
:type: tuple of int (w, h)
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.image_size_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:
|
||||
""" Whether to use of high-quality image scaling algorithm
|
||||
of the given video object.
|
||||
|
||||
When enabled, a higher quality video scaling algorithm is used when
|
||||
scaling videos to sizes other than the source video. This gives
|
||||
better results but is more computationally expensive.
|
||||
|
||||
:type: bool
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.smooth_scale_get()
|
||||
|
||||
def __set__(self, int value):
|
||||
self.smooth_scale_set(value)
|
||||
|
||||
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 ratio:
|
||||
""" The video aspect ratio of the media file loaded.
|
||||
|
||||
This function returns the video aspect ratio (width / height) of the file
|
||||
loaded. It can be used to adapt the size of the emotion object in the canvas,
|
||||
so the aspect won't be changed (by wrongly resizing the object). Or to crop
|
||||
the video correctly, if necessary.
|
||||
|
||||
The described behavior can be applied like following. Consider a given
|
||||
emotion object that we want to position inside an area, which we will
|
||||
represent by *w* and *h*. Since we want to position this object either
|
||||
stretching, or filling the entire area but overflowing the video, or just
|
||||
adjust the video to fit inside the area without keeping the aspect ratio, we
|
||||
must compare the video aspect ratio with the area aspect ratio::
|
||||
|
||||
w = 200; h = 300; # an arbitrary value which represents the area where
|
||||
# the video would be placed
|
||||
obj = Emotion(...)
|
||||
r = w / h
|
||||
vr = obj.ratio
|
||||
|
||||
Now, if we want to make the video fit inside the area, the following code
|
||||
would do it::
|
||||
|
||||
if vr > r: # the video is wider than the area
|
||||
vw = w
|
||||
vh = w / vr
|
||||
else: # the video is taller than the area
|
||||
vh = h
|
||||
vw = h * vr
|
||||
obj.size = (vw, vh)
|
||||
|
||||
And for keeping the aspect ratio but making the video fill the entire area,
|
||||
overflowing the content which can't fit inside it, we would do::
|
||||
|
||||
if vr > r: # the video is wider than the area
|
||||
vh = h
|
||||
vw = h * vr
|
||||
else: # the video is taller than the area
|
||||
vw = w
|
||||
vh = w / vr
|
||||
obj.size = (vw, vh)
|
||||
|
||||
Finally, by just resizing the video to the video area, we would have the
|
||||
video stretched::
|
||||
|
||||
vw = w
|
||||
vh = h
|
||||
obj.size = (vw, vh)
|
||||
|
||||
.. note:: This function returns the aspect ratio that the video *should* be, but
|
||||
sometimes the reported size from emotion_object_size_get() represents a
|
||||
different aspect ratio. You can safely resize the video to respect the aspect
|
||||
ratio returned by *this* function.
|
||||
|
||||
:type: float
|
||||
"""
|
||||
def __get__(self):
|
||||
return emotion_object_ratio_get(self.obj)
|
||||
|
||||
def ratio_get(self):
|
||||
return emotion_object_ratio_get(self.obj)
|
||||
|
||||
property ratio:
|
||||
def __get__(self):
|
||||
return self.ratio_get()
|
||||
property audio_volume:
|
||||
""" The audio volume.
|
||||
|
||||
def event_simple_send(self, int event_id):
|
||||
emotion_object_event_simple_send(self.obj, <Emotion_Event>event_id)
|
||||
The current value for the audio volume level. Range is from 0.0 to 1.0.
|
||||
|
||||
Sets the audio volume of the stream being played. This has nothing to do with
|
||||
the system volume. This volume will be multiplied by the system volume. e.g.:
|
||||
if the current volume level is 0.5, and the system volume is 50%, it will be
|
||||
* 0.5 * 0.5 = 0.25.
|
||||
|
||||
.. note:: The default value depends on the module used. This value
|
||||
doesn't get changed when another file is loaded.
|
||||
|
||||
:type: float
|
||||
"""
|
||||
def __get__(self):
|
||||
return emotion_object_audio_volume_get(self.obj)
|
||||
|
||||
def __set__(self, double value):
|
||||
emotion_object_audio_volume_set(self.obj, value)
|
||||
|
||||
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()
|
||||
property audio_mute:
|
||||
""" The mute audio option for this object.
|
||||
|
||||
def __set__(self, double value):
|
||||
self.audio_volume_set(value)
|
||||
:type: bool
|
||||
"""
|
||||
def __get__(self):
|
||||
return bool(emotion_object_audio_mute_get(self.obj))
|
||||
|
||||
def __set__(self, int value):
|
||||
emotion_object_audio_mute_set(self.obj, bool(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:
|
||||
property video_mute:
|
||||
""" The mute video option for this object.
|
||||
|
||||
:type: bool
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.audio_mute_get()
|
||||
return emotion_object_video_mute_get(self.obj)
|
||||
|
||||
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)
|
||||
emotion_object_video_mute_set(self.obj, 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:
|
||||
property spu_mute:
|
||||
""" The SPU muted state.
|
||||
|
||||
:type: bool
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.video_mute_get()
|
||||
return bool(emotion_object_spu_mute_get(self.obj))
|
||||
|
||||
def __set__(self, int value):
|
||||
self.video_mute_set(value)
|
||||
emotion_object_spu_mute_set(self.obj, bool(value))
|
||||
|
||||
def spu_mute_get(self):
|
||||
return bool(emotion_object_spu_mute_get(self.obj))
|
||||
def spu_mute_set(self, int value):
|
||||
emotion_object_spu_mute_set(self.obj, bool(value))
|
||||
|
||||
def audio_channel_count(self):
|
||||
""" Get the number of audio channels available in the loaded media.
|
||||
|
||||
:return: the number of channels
|
||||
:rtype: int
|
||||
"""
|
||||
return emotion_object_audio_channel_count(self.obj)
|
||||
|
||||
def audio_channel_name_get(self, int channel):
|
||||
""" Get the name of the given channel.
|
||||
|
||||
:return: the name
|
||||
:rtype: str
|
||||
"""
|
||||
return _ctouni(emotion_object_audio_channel_name_get(self.obj, channel))
|
||||
|
||||
property audio_channel:
|
||||
""" The currently selected audio channel.
|
||||
|
||||
:type: int
|
||||
"""
|
||||
def __get__(self):
|
||||
return emotion_object_audio_channel_get(self.obj)
|
||||
|
||||
def __set__(self, int value):
|
||||
emotion_object_audio_channel_set(self.obj, value)
|
||||
|
||||
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)
|
||||
|
||||
def video_channel_count(self):
|
||||
""" Get the number of video channels available in the loaded media.
|
||||
|
||||
:return: the number of channels
|
||||
:rtype: int
|
||||
"""
|
||||
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
|
||||
""" Get the name of the given channel.
|
||||
|
||||
:return: the name
|
||||
:rtype: str
|
||||
"""
|
||||
return _ctouni(emotion_object_video_channel_name_get(self.obj, channel))
|
||||
|
||||
property video_channel:
|
||||
""" The currently selected video channel.
|
||||
|
||||
:type: int
|
||||
"""
|
||||
def __get__(self):
|
||||
return emotion_object_video_channel_get(self.obj)
|
||||
|
||||
def __set__(self, int value):
|
||||
emotion_object_video_channel_set(self.obj, value)
|
||||
|
||||
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):
|
||||
""" Get the number of SPU channels available in the loaded media.
|
||||
|
||||
:return: the number of channels
|
||||
:rtype: int
|
||||
"""
|
||||
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
|
||||
""" Get the name of the given channel.
|
||||
|
||||
:return: the name
|
||||
:rtype: str
|
||||
"""
|
||||
return _ctouni(emotion_object_spu_channel_name_get(self.obj, channel))
|
||||
|
||||
property spu_channel:
|
||||
""" The currently selected SPU channel.
|
||||
|
||||
:type: int
|
||||
"""
|
||||
def __get__(self):
|
||||
return emotion_object_spu_channel_get(self.obj)
|
||||
|
||||
def __set__(self, int value):
|
||||
emotion_object_spu_channel_set(self.obj, value)
|
||||
|
||||
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)
|
||||
|
||||
property spu_button_count:
|
||||
""" SPU button count
|
||||
|
||||
:type: int
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.spu_button_count_get()
|
||||
|
||||
def spu_button_count_get(self):
|
||||
return emotion_object_spu_button_count_get(self.obj)
|
||||
|
||||
property spu_button_count:
|
||||
property spu_button:
|
||||
""" SPU button
|
||||
|
||||
:type: int
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.spu_button_count_get()
|
||||
return self.spu_button_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 the number of chapters in the stream.
|
||||
|
||||
:rtype: int
|
||||
"""
|
||||
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_name_get(self, int chapter):
|
||||
""" Get the name of the given chapter.
|
||||
|
||||
:param chapter: the chapter number
|
||||
:type chapter: int
|
||||
:return: the name of the chapter
|
||||
:rtype: str
|
||||
"""
|
||||
return _ctouni(emotion_object_chapter_name_get(self.obj, chapter))
|
||||
|
||||
property chapter:
|
||||
""" The currently selected chapter.
|
||||
|
||||
:type: int
|
||||
"""
|
||||
def __get__(self):
|
||||
return emotion_object_chapter_get(self.obj)
|
||||
|
||||
def __set__(self, int value):
|
||||
emotion_object_chapter_set(self.obj, value)
|
||||
|
||||
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):
|
||||
""" Eject the media """
|
||||
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()
|
||||
""" The dvd title from this emotion object.
|
||||
|
||||
def progress_info_get(self):
|
||||
cdef const_char_ptr s
|
||||
s = emotion_object_progress_info_get(self.obj)
|
||||
if s != NULL:
|
||||
return s
|
||||
.. note:: This function is only useful when playing a DVD.
|
||||
|
||||
:type: str
|
||||
"""
|
||||
def __get__(self):
|
||||
return _ctouni(emotion_object_title_get(self.obj))
|
||||
|
||||
def title_get(self):
|
||||
return _ctouni(emotion_object_title_get(self.obj))
|
||||
|
||||
property progress_info:
|
||||
""" How much of the file has been played.
|
||||
|
||||
.. warning:: gstreamer xine backends don't implement this(will return None).
|
||||
|
||||
:type: str
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.progress_info_get()
|
||||
return _ctouni(emotion_object_progress_info_get(self.obj))
|
||||
|
||||
def progress_info_get(self):
|
||||
return _ctouni(emotion_object_progress_info_get(self.obj))
|
||||
|
||||
property progress_status:
|
||||
""" How much of the file has been played.
|
||||
|
||||
The progress in playing the file, the value is in the [0, 1] range.
|
||||
|
||||
.. warning:: gstreamer xine backends don't implement this(will return 0).
|
||||
|
||||
:type: float
|
||||
"""
|
||||
def __get__(self):
|
||||
return emotion_object_progress_status_get(self.obj)
|
||||
|
||||
def progress_status_get(self):
|
||||
return emotion_object_progress_status_get(self.obj)
|
||||
|
||||
property progress_status:
|
||||
property ref_file:
|
||||
""" ref file
|
||||
|
||||
:type: str
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.progress_status_get()
|
||||
return _ctouni(emotion_object_ref_file_get(self.obj))
|
||||
|
||||
def ref_file_get(self):
|
||||
cdef const_char_ptr s
|
||||
s = emotion_object_ref_file_get(self.obj)
|
||||
if s != NULL:
|
||||
return s
|
||||
return _ctouni(emotion_object_ref_file_get(self.obj))
|
||||
|
||||
property ref_file:
|
||||
property ref_num:
|
||||
""" ref number
|
||||
|
||||
:type: int
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.ref_file_get()
|
||||
return emotion_object_ref_num_get(self.obj)
|
||||
|
||||
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
|
||||
""" Retrieve meta information from this file being played.
|
||||
|
||||
This function retrieves information about the file loaded. It can retrieve
|
||||
the track title, artist name, album name, etc.
|
||||
|
||||
:param meta_id: The type of meta information that will be extracted.
|
||||
:type meta_id: int
|
||||
:return: The info or None
|
||||
:rtype: str
|
||||
|
||||
:see also: meta_info_dict_get().
|
||||
:see also: Emotion_Meta_Info for all the possibilities.
|
||||
"""
|
||||
return _ctouni(emotion_object_meta_info_get(self.obj, <Emotion_Meta_Info>meta_id))
|
||||
|
||||
def meta_info_dict_get(self):
|
||||
""" Get a python dictionary with all the know info.
|
||||
|
||||
:return: all the know meta info for the media file
|
||||
:rtype: dict
|
||||
"""
|
||||
cdef const_char_ptr info
|
||||
ret = dict()
|
||||
lst = (("title", EMOTION_META_INFO_TRACK_TITLE),
|
||||
|
@ -523,7 +758,36 @@ cdef class Emotion(evasObject):
|
|||
def __get__(self):
|
||||
return self.meta_info_dict_get()
|
||||
|
||||
def event_simple_send(self, int event_id):
|
||||
""" Send a named signal to the object.
|
||||
|
||||
:param event_id: the signal to emit, one of EMOTION_EVENT_MENU1,
|
||||
EMOTION_EVENT_MENU2, EMOTION_EVENT_UP, EMOTION_EVENT_1,
|
||||
or any other EMOTION_EVENT_* definition
|
||||
:type event_id: Emotion_Event
|
||||
"""
|
||||
emotion_object_event_simple_send(self.obj, <Emotion_Event>event_id)
|
||||
|
||||
|
||||
def callback_add(self, char *event, func, *args, **kargs):
|
||||
""" Add a new function (**func**) to be called on the specific **event**.
|
||||
|
||||
The expected signature for **func** is::
|
||||
|
||||
func(object, *args, **kwargs)
|
||||
|
||||
.. note:: Any extra params givento the function (both positional
|
||||
and keyword arguments) will be passed back in the
|
||||
callback function.
|
||||
|
||||
:see also: All the on_*_add() shortcut functions
|
||||
|
||||
:param event: the name of the event
|
||||
:type event: str
|
||||
:param func: the function to call
|
||||
:type func: callable
|
||||
|
||||
"""
|
||||
e = intern(event)
|
||||
lst = self._emotion_callbacks.setdefault(e, [])
|
||||
if not lst:
|
||||
|
@ -532,6 +796,16 @@ cdef class Emotion(evasObject):
|
|||
lst.append((func, args, kargs))
|
||||
|
||||
def callback_del(self, char *event, func):
|
||||
""" Stop the given function **func** to be called on **event**
|
||||
|
||||
:see also: all the on_*_add() shortcut functions
|
||||
|
||||
:param event: the name of the event
|
||||
:type event: str
|
||||
:param func: the function that was previously attached
|
||||
:type func: callable
|
||||
|
||||
"""
|
||||
try:
|
||||
lst = self._emotion_callbacks[event]
|
||||
except KeyError, e:
|
||||
|
@ -552,75 +826,99 @@ cdef class Emotion(evasObject):
|
|||
evas_object_smart_callback_del(self.obj, event, _emotion_callback)
|
||||
|
||||
def on_frame_decode_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('frame_decode', func, ...)"
|
||||
self.callback_add("frame_decode", func, *args, **kargs)
|
||||
|
||||
def on_frame_decode_del(self, func):
|
||||
"Same as calling: callback_del('frame_decode', func)"
|
||||
self.callback_del("frame_decode", func)
|
||||
|
||||
def on_frame_resize_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('frame_resize', func, ...)"
|
||||
self.callback_add("frame_resize", func, *args, **kargs)
|
||||
|
||||
def on_frame_resize_del(self, func):
|
||||
"Same as calling: callback_del('frame_resize', func)"
|
||||
self.callback_del("frame_resize", func)
|
||||
|
||||
def on_length_change_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('length_change', func, ...)"
|
||||
self.callback_add("length_change", func, *args, **kargs)
|
||||
|
||||
def on_length_change_del(self, func):
|
||||
"Same as calling: callback_del('length_change', func)"
|
||||
self.callback_del("length_change", func)
|
||||
|
||||
def on_decode_stop_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('decode_stop', func, ...)"
|
||||
self.callback_add("decode_stop", func, *args, **kargs)
|
||||
|
||||
def on_decode_stop_del(self, func):
|
||||
"Same as calling: callback_del('decode_stop', func)"
|
||||
self.callback_del("decode_stop", func)
|
||||
|
||||
def on_channels_change_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('channels_change', func, ...)"
|
||||
self.callback_add("channels_change", func, *args, **kargs)
|
||||
|
||||
def on_channels_change_del(self, func):
|
||||
"Same as calling: callback_del('channels_change', func)"
|
||||
self.callback_del("channels_change", func)
|
||||
|
||||
def on_title_change_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('title_change', func, ...)"
|
||||
self.callback_add("title_change", func, *args, **kargs)
|
||||
|
||||
def on_title_change_del(self, func):
|
||||
"Same as calling: callback_del('title_change', func)"
|
||||
self.callback_del("title_change", func)
|
||||
|
||||
def on_progress_change_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('progress_change', func, ...)"
|
||||
self.callback_add("progress_change", func, *args, **kargs)
|
||||
|
||||
def on_progress_change_del(self, func):
|
||||
"Same as calling: callback_del('progress_change', func)"
|
||||
self.callback_del("progress_change", func)
|
||||
|
||||
def on_ref_change_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('ref_change', func, ...)"
|
||||
self.callback_add("ref_change", func, *args, **kargs)
|
||||
|
||||
def on_ref_change_del(self, func):
|
||||
"Same as calling: callback_del('ref_change', func)"
|
||||
self.callback_del("ref_change", func)
|
||||
|
||||
def on_button_num_change_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('button_num_change', func, ...)"
|
||||
self.callback_add("button_num_change", func, *args, **kargs)
|
||||
|
||||
def on_button_num_change_del(self, func):
|
||||
"Same as calling: callback_del('button_num_change', func)"
|
||||
self.callback_del("button_num_change", func)
|
||||
|
||||
def on_button_change_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('button_change', func, ...)"
|
||||
self.callback_add("button_change", func, *args, **kargs)
|
||||
|
||||
def on_button_change_del(self, func):
|
||||
"Same as calling: callback_del('button_change', func)"
|
||||
self.callback_del("button_change", func)
|
||||
|
||||
def on_playback_finished_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('playback_finished', func, ...)"
|
||||
self.callback_add("playback_finished", func, *args, **kargs)
|
||||
|
||||
def on_playback_finished_del(self, func):
|
||||
"Same as calling: callback_del('playback_finished', func)"
|
||||
self.callback_del("playback_finished", func)
|
||||
|
||||
def on_audio_level_change_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('audio_level_change', func, ...)"
|
||||
self.callback_add("audio_level_change", func, *args, **kargs)
|
||||
|
||||
def on_audio_level_change_del(self, func):
|
||||
"Same as calling: callback_del('audio_level_change', func)"
|
||||
self.callback_del("audio_level_change", func)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue