Code cleanup: Single-quoted docstrings
Triple double-quotes should be used for docstrings
This commit is contained in:
parent
8109cd62b4
commit
286fd64489
|
@ -62,11 +62,11 @@ cdef class Animator(Eo):
|
|||
return self.func(*self.args, **self.kargs)
|
||||
|
||||
def delete(self):
|
||||
"Stop callback emission and free internal resources."
|
||||
"""Stop callback emission and free internal resources."""
|
||||
ecore_animator_del(self.obj)
|
||||
|
||||
def stop(self):
|
||||
"Alias for delete()."
|
||||
"""Alias for delete()."""
|
||||
self.delete()
|
||||
|
||||
cdef Eina_Bool _ecore_timeline_cb(void *data, double pos) with gil:
|
||||
|
|
|
@ -68,7 +68,7 @@ cdef class Event(object):
|
|||
|
||||
cdef class EventHandler(object):
|
||||
def __init__(self, int type, func, *args, **kargs):
|
||||
":parm type: event type, as registered with ecore_event_type_new()."
|
||||
""":parm 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)
|
||||
|
|
|
@ -375,7 +375,7 @@ cdef class Exe(object):
|
|||
ecore_exe_free(self.exe)
|
||||
|
||||
def free(self):
|
||||
"Alias for :py:meth:`delete` to keep compatibility with C-api."
|
||||
"""Alias for :py:meth:`delete` to keep compatibility with C-api."""
|
||||
self.delete()
|
||||
|
||||
def send(self, buf, long size=0):
|
||||
|
|
|
@ -140,14 +140,14 @@ cdef class FdHandler(object):
|
|||
return self.func(self, *self.args, **self.kargs)
|
||||
|
||||
def delete(self):
|
||||
"Stop callback emission and free internal resources."
|
||||
"""Stop callback emission and free internal resources."""
|
||||
if self.obj != NULL:
|
||||
ecore_main_fd_handler_del(self.obj)
|
||||
self.obj = NULL
|
||||
Py_DECREF(self)
|
||||
|
||||
def stop(self):
|
||||
"Alias for ``delete``."
|
||||
"""Alias for ``delete``."""
|
||||
self.delete()
|
||||
|
||||
def fd_get(self):
|
||||
|
@ -187,15 +187,15 @@ cdef class FdHandler(object):
|
|||
ecore_main_fd_handler_active_set(self.obj, v)
|
||||
|
||||
def can_read(self):
|
||||
":rtype: bool"
|
||||
""":rtype: bool"""
|
||||
return bool(ecore_main_fd_handler_active_get(self.obj, ECORE_FD_READ))
|
||||
|
||||
def can_write(self):
|
||||
":rtype: bool"
|
||||
""":rtype: bool"""
|
||||
return bool(ecore_main_fd_handler_active_get(self.obj, ECORE_FD_WRITE))
|
||||
|
||||
def has_error(self):
|
||||
":rtype: bool"
|
||||
""":rtype: bool"""
|
||||
return bool(ecore_main_fd_handler_active_get(self.obj, ECORE_FD_ERROR))
|
||||
|
||||
def prepare_callback_set(self, func, *args, **kargs):
|
||||
|
|
|
@ -63,11 +63,11 @@ cdef class Idler(Eo):
|
|||
return self.func(*self.args, **self.kargs)
|
||||
|
||||
def delete(self):
|
||||
"Stop callback emission and free internal resources."
|
||||
"""Stop callback emission and free internal resources."""
|
||||
ecore_idler_del(self.obj)
|
||||
|
||||
def stop(self):
|
||||
"Alias for stop()."
|
||||
"""Alias for stop()."""
|
||||
self.delete()
|
||||
|
||||
|
||||
|
@ -107,7 +107,7 @@ cdef class IdleEnterer(Idler):
|
|||
self._set_obj(ecore_idle_enterer_add(_ecore_task_cb, <void *>self))
|
||||
|
||||
def delete(self):
|
||||
"Stop callback emission and free internal resources."
|
||||
"""Stop callback emission and free internal resources."""
|
||||
ecore_idle_enterer_del(self.obj)
|
||||
|
||||
|
||||
|
|
|
@ -66,19 +66,19 @@ cdef class Timer(Eo):
|
|||
return self.func(*self.args, **self.kargs)
|
||||
|
||||
def delete(self):
|
||||
"Stop callback emission and free internal resources."
|
||||
"""Stop callback emission and free internal resources."""
|
||||
ecore_timer_del(self.obj)
|
||||
|
||||
def stop(self):
|
||||
"Alias for ``delete()``"
|
||||
"""Alias for ``delete()``"""
|
||||
self.delete()
|
||||
|
||||
def freeze(self):
|
||||
"Pauses a running timer."
|
||||
"""Pauses a running timer."""
|
||||
ecore_timer_freeze(self.obj)
|
||||
|
||||
def thaw(self):
|
||||
"Resumes a frozen (paused) timer."
|
||||
"""Resumes a frozen (paused) timer."""
|
||||
ecore_timer_thaw(self.obj)
|
||||
|
||||
def delay(self, double add):
|
||||
|
|
|
@ -477,7 +477,7 @@ cdef class ExternalIterator:
|
|||
eina_iterator_free(self.obj)
|
||||
|
||||
def external_type_get(char *type_name):
|
||||
"Gets the instance that represents an ExternalType of the given 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:
|
||||
|
|
|
@ -220,11 +220,11 @@ cdef class Edje(Object):
|
|||
return (_ctouni(file), _ctouni(group))
|
||||
|
||||
def load_error_get(self):
|
||||
":rtype: int"
|
||||
""":rtype: int"""
|
||||
return edje_object_load_error_get(self.obj)
|
||||
|
||||
def play_get(self):
|
||||
":rtype: bool"
|
||||
""":rtype: bool"""
|
||||
return bool(edje_object_play_get(self.obj))
|
||||
|
||||
def play_set(self, int value):
|
||||
|
@ -244,11 +244,11 @@ cdef class Edje(Object):
|
|||
self.play_set(value)
|
||||
|
||||
def animation_get(self):
|
||||
":rtype: bool"
|
||||
""":rtype: bool"""
|
||||
return bool(edje_object_animation_get(self.obj))
|
||||
|
||||
def animation_set(self, int value):
|
||||
"Set animation state."
|
||||
"""Set animation state."""
|
||||
edje_object_animation_set(self.obj, value)
|
||||
|
||||
property animation:
|
||||
|
@ -268,7 +268,7 @@ cdef class Edje(Object):
|
|||
return edje_object_freeze(self.obj)
|
||||
|
||||
def thaw(self):
|
||||
"Thaw (unfreeze) the object."
|
||||
"""Thaw (unfreeze) the object."""
|
||||
return edje_object_thaw(self.obj)
|
||||
|
||||
def preload(self, int cancel):
|
||||
|
@ -335,7 +335,7 @@ cdef class Edje(Object):
|
|||
return (r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
|
||||
|
||||
def color_class_del(self, color_class):
|
||||
"Delete a specific color class."
|
||||
"""Delete a specific color class."""
|
||||
if isinstance(color_class, unicode):
|
||||
color_class = PyUnicode_AsUTF8String(color_class)
|
||||
edje_object_color_class_del(self.obj,
|
||||
|
@ -396,7 +396,7 @@ cdef class Edje(Object):
|
|||
return bool(edje_object_mirrored_get(self.obj))
|
||||
|
||||
def size_min_get(self):
|
||||
":rtype: tuple of int"
|
||||
""":rtype: tuple of int"""
|
||||
cdef int w, h
|
||||
edje_object_size_min_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
@ -406,7 +406,7 @@ cdef class Edje(Object):
|
|||
return self.size_min_get()
|
||||
|
||||
def size_max_get(self):
|
||||
":rtype: tuple of int"
|
||||
""":rtype: tuple of int"""
|
||||
cdef int w, h
|
||||
edje_object_size_max_get(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
@ -416,11 +416,11 @@ cdef class Edje(Object):
|
|||
return self.size_max_get()
|
||||
|
||||
def calc_force(self):
|
||||
"Force recalculation of parts state (geometry, position, ...)"
|
||||
"""Force recalculation of parts state (geometry, position, ...)"""
|
||||
edje_object_calc_force(self.obj)
|
||||
|
||||
def size_min_calc(self):
|
||||
"Request object to calculate minimum size."
|
||||
"""Request object to calculate minimum size."""
|
||||
cdef int w, h
|
||||
edje_object_size_min_calc(self.obj, &w, &h)
|
||||
return (w, h)
|
||||
|
@ -484,7 +484,7 @@ cdef class Edje(Object):
|
|||
edje_object_update_hints_set(self.obj, update)
|
||||
|
||||
def part_exists(self, part):
|
||||
":rtype: bool"
|
||||
""":rtype: bool"""
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
return bool(edje_object_part_exists(self.obj,
|
||||
<const char *>part if part is not None else NULL))
|
||||
|
@ -506,7 +506,7 @@ cdef class Edje(Object):
|
|||
return object_from_instance(obj)
|
||||
|
||||
def part_geometry_get(self, part):
|
||||
":rtype: tuple of int"
|
||||
""":rtype: tuple of int"""
|
||||
cdef int x, y, w, h
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
edje_object_part_geometry_get(self.obj,
|
||||
|
@ -515,7 +515,7 @@ cdef class Edje(Object):
|
|||
return (x, y, w, h)
|
||||
|
||||
def part_size_get(self, part):
|
||||
":rtype: tuple of int"
|
||||
""":rtype: tuple of int"""
|
||||
cdef int w, h
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
edje_object_part_geometry_get(self.obj,
|
||||
|
@ -524,7 +524,7 @@ cdef class Edje(Object):
|
|||
return (w, h)
|
||||
|
||||
def part_pos_get(self, part):
|
||||
":rtype: tuple of int"
|
||||
""":rtype: tuple of int"""
|
||||
cdef int x, y
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
edje_object_part_geometry_get(self.obj,
|
||||
|
@ -577,13 +577,13 @@ cdef class Edje(Object):
|
|||
<const char *>part if part is not None else NULL))
|
||||
|
||||
def part_text_select_all(self, part):
|
||||
"Select all the text of the given TEXT or TEXTBLOCK part"
|
||||
"""Select all the text of the given TEXT or TEXTBLOCK part"""
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
edje_object_part_text_select_all(self.obj,
|
||||
<const char *>part if part is not None else NULL)
|
||||
|
||||
def part_text_select_none(self, part):
|
||||
"Deselect all the text of the given TEXT or TEXTBLOCK part"
|
||||
"""Deselect all the text of the given TEXT or TEXTBLOCK part"""
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
edje_object_part_text_select_none(self.obj,
|
||||
<const char *>part if part is not None else NULL)
|
||||
|
@ -646,17 +646,17 @@ cdef class Edje(Object):
|
|||
<const char *>part if part is not None else NULL, obj.obj)
|
||||
|
||||
def part_unswallow(self, Object obj):
|
||||
"Unswallow the given object from the edje"
|
||||
"""Unswallow the given object from the edje"""
|
||||
edje_object_part_unswallow(self.obj, obj.obj)
|
||||
|
||||
def part_swallow_get(self, part):
|
||||
":rtype: efl.evas.Object"
|
||||
""":rtype: efl.evas.Object"""
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
return object_from_instance(edje_object_part_swallow_get(
|
||||
self.obj, <const char *>part if part is not None else NULL))
|
||||
|
||||
def part_external_object_get(self, part):
|
||||
":rtype: efl.evas.Object"
|
||||
""":rtype: efl.evas.Object"""
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
return object_from_instance(edje_object_part_external_object_get(
|
||||
self.obj, <const char *>part if part is not None else NULL))
|
||||
|
@ -934,7 +934,7 @@ cdef class Edje(Object):
|
|||
<const char *>part if part is not None else NULL, row, column))
|
||||
|
||||
def part_state_get(self, part):
|
||||
":rtype: (name, value)"
|
||||
""":rtype: (name, value)"""
|
||||
cdef double sv
|
||||
cdef const char *sn
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
|
@ -943,7 +943,7 @@ cdef class Edje(Object):
|
|||
return (_ctouni(sn), sv)
|
||||
|
||||
def part_drag_dir_get(self, part):
|
||||
":rtype: int"
|
||||
""":rtype: int"""
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
return edje_object_part_drag_dir_get(self.obj,
|
||||
<const char *>part if part is not None else NULL)
|
||||
|
@ -958,7 +958,7 @@ cdef class Edje(Object):
|
|||
<const char *>part if part is not None else NULL, dx, dy)
|
||||
|
||||
def part_drag_value_get(self, part):
|
||||
":rtype: tuple of float"
|
||||
""":rtype: tuple of float"""
|
||||
cdef double dx, dy
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
edje_object_part_drag_value_get(self.obj,
|
||||
|
@ -975,7 +975,7 @@ cdef class Edje(Object):
|
|||
<const char *>part if part is not None else NULL, dw, dh)
|
||||
|
||||
def part_drag_size_get(self, part):
|
||||
":rtype: tuple of float"
|
||||
""":rtype: tuple of float"""
|
||||
cdef double dw, dh
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
edje_object_part_drag_size_get(self.obj,
|
||||
|
@ -992,7 +992,7 @@ cdef class Edje(Object):
|
|||
<const char *>part if part is not None else NULL, dx, dy)
|
||||
|
||||
def part_drag_step_get(self, part):
|
||||
":rtype: tuple of float"
|
||||
""":rtype: tuple of float"""
|
||||
cdef double dx, dy
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
edje_object_part_drag_step_get(self.obj,
|
||||
|
@ -1010,7 +1010,7 @@ cdef class Edje(Object):
|
|||
<const char *>part if part is not None else NULL, dx, dy)
|
||||
|
||||
def part_drag_page_get(self, part):
|
||||
":rtype: tuple of float"
|
||||
""":rtype: tuple of float"""
|
||||
cdef double dx, dy
|
||||
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
|
||||
edje_object_part_drag_page_get(self.obj,
|
||||
|
@ -1233,7 +1233,7 @@ cdef class Edje(Object):
|
|||
raise TypeError("func must be callable or None")
|
||||
|
||||
def message_signal_process(self):
|
||||
"Manually iterate message signal system."
|
||||
"""Manually iterate message signal system."""
|
||||
edje_object_message_signal_process(self.obj)
|
||||
|
||||
def signal_callback_add(self, emission, source, func,
|
||||
|
@ -1270,7 +1270,7 @@ cdef class Edje(Object):
|
|||
lst.append((func, args, kargs))
|
||||
|
||||
def signal_callback_del(self, emission, source, func):
|
||||
"Remove the callable associated with given emission and source."
|
||||
"""Remove the callable associated with given emission and source."""
|
||||
try:
|
||||
d = self._signal_callbacks[emission]
|
||||
lst = d[source]
|
||||
|
@ -1302,7 +1302,7 @@ cdef class Edje(Object):
|
|||
signal_cb)
|
||||
|
||||
def signal_emit(self, emission, source):
|
||||
"Emit signal with ``emission`` and ``source``"
|
||||
"""Emit signal with ``emission`` and ``source``"""
|
||||
if isinstance(emission, unicode): emission = PyUnicode_AsUTF8String(emission)
|
||||
if isinstance(source, unicode): source = PyUnicode_AsUTF8String(source)
|
||||
edje_object_signal_emit(self.obj,
|
||||
|
|
|
@ -1157,99 +1157,99 @@ cdef class Emotion(evasObject):
|
|||
_emotion_callback)
|
||||
|
||||
def on_frame_decode_add(self, func, *args, **kargs):
|
||||
"Same as calling: callback_add('frame_decode', func, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""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, ...)"
|
||||
"""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)"
|
||||
"""Same as calling: callback_del('audio_level_change', func)"""
|
||||
self.callback_del("audio_level_change", func)
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ cdef class Map(object):
|
|||
self.map = evas_map_new(count)
|
||||
|
||||
def delete(self):
|
||||
"delete the map object"
|
||||
"""delete the map object"""
|
||||
evas_map_free(self.map)
|
||||
self.map = NULL
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ cdef class Polygon(Object):
|
|||
evas_object_polygon_point_add(self.obj, x, y)
|
||||
|
||||
def points_clear(self):
|
||||
"Remove all the points from the polygon"
|
||||
"""Remove all the points from the polygon"""
|
||||
evas_object_polygon_points_clear(self.obj)
|
||||
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ cdef class Rect(object):
|
|||
(self.__class__.__name__, self.x0, self.y0, self._w, self._h)
|
||||
|
||||
property x:
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self.x0
|
||||
|
||||
|
@ -141,7 +141,7 @@ cdef class Rect(object):
|
|||
self.cx = x + self._w/2
|
||||
|
||||
property left: # same as "x"
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self.x0
|
||||
|
||||
|
@ -151,7 +151,7 @@ cdef class Rect(object):
|
|||
self.cx = x + self._w/2
|
||||
|
||||
property right:
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self.x1
|
||||
|
||||
|
@ -161,7 +161,7 @@ cdef class Rect(object):
|
|||
self.cx = self.x0 + self._w/2
|
||||
|
||||
property center_x:
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self.cx
|
||||
|
||||
|
@ -171,7 +171,7 @@ cdef class Rect(object):
|
|||
self.cx = cx
|
||||
|
||||
property y:
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self.y0
|
||||
|
||||
|
@ -181,7 +181,7 @@ cdef class Rect(object):
|
|||
self.cy = y + self._h/2
|
||||
|
||||
property top: # same as "y"
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self.y0
|
||||
|
||||
|
@ -191,7 +191,7 @@ cdef class Rect(object):
|
|||
self.cy = y + self._h/2
|
||||
|
||||
property bottom:
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self.y1
|
||||
|
||||
|
@ -201,7 +201,7 @@ cdef class Rect(object):
|
|||
self.cy = self.y0 + self._h/2
|
||||
|
||||
property center_y:
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self.cy
|
||||
|
||||
|
@ -211,7 +211,7 @@ cdef class Rect(object):
|
|||
self.cy = cy
|
||||
|
||||
property w:
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self._w
|
||||
|
||||
|
@ -221,7 +221,7 @@ cdef class Rect(object):
|
|||
self.cx = self.x0 + w/2
|
||||
|
||||
property width:
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self._w
|
||||
|
||||
|
@ -231,7 +231,7 @@ cdef class Rect(object):
|
|||
self.cx = self.x0 + w/2
|
||||
|
||||
property h:
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self._h
|
||||
|
||||
|
@ -241,7 +241,7 @@ cdef class Rect(object):
|
|||
self.cy = self.y0 + h/2
|
||||
|
||||
property height:
|
||||
":type: int"
|
||||
""":type: int"""
|
||||
def __get__(self):
|
||||
return self._h
|
||||
|
||||
|
@ -251,7 +251,7 @@ cdef class Rect(object):
|
|||
self.cy = self.y0 + h/2
|
||||
|
||||
property center:
|
||||
":type: (int **x**, int **y**)"
|
||||
""":type: (int **x**, int **y**)"""
|
||||
def __get__(self):
|
||||
return (self.cx, self.cy)
|
||||
|
||||
|
@ -269,7 +269,7 @@ cdef class Rect(object):
|
|||
self.cy = cy
|
||||
|
||||
property top_left:
|
||||
":type: (int **x**, int **y**)"
|
||||
""":type: (int **x**, int **y**)"""
|
||||
def __get__(self):
|
||||
return (self.x0, self.y0)
|
||||
|
||||
|
@ -286,7 +286,7 @@ cdef class Rect(object):
|
|||
self.cy = y + self._h/2
|
||||
|
||||
property top_right:
|
||||
":type: (int **x**, int **y**)"
|
||||
""":type: (int **x**, int **y**)"""
|
||||
def __get__(self):
|
||||
return (self.x1, self.y0)
|
||||
|
||||
|
@ -303,7 +303,7 @@ cdef class Rect(object):
|
|||
self.cy = y + self._h/2
|
||||
|
||||
property bottom_left:
|
||||
":type: (int **x**, int **y**)"
|
||||
""":type: (int **x**, int **y**)"""
|
||||
def __get__(self):
|
||||
return (self.x0, self.y1)
|
||||
|
||||
|
@ -320,7 +320,7 @@ cdef class Rect(object):
|
|||
self.cy = self.y0 + self._h/2
|
||||
|
||||
property bottom_right:
|
||||
":type: (int **x**, int **y**)"
|
||||
""":type: (int **x**, int **y**)"""
|
||||
def __get__(self):
|
||||
return (self.x1, self.y1)
|
||||
|
||||
|
@ -337,7 +337,7 @@ cdef class Rect(object):
|
|||
self.cy = self.y0 + self._h/2
|
||||
|
||||
property pos:
|
||||
":type: (int **x**, int **y**)"
|
||||
""":type: (int **x**, int **y**)"""
|
||||
def __get__(self):
|
||||
return (self.x0, self.y0)
|
||||
|
||||
|
@ -354,7 +354,7 @@ cdef class Rect(object):
|
|||
self.cy = y + self._h/2
|
||||
|
||||
property size:
|
||||
":type: (int **w**, int **h**)"
|
||||
""":type: (int **w**, int **h**)"""
|
||||
def __get__(self):
|
||||
return (self._w, self._h)
|
||||
|
||||
|
@ -371,12 +371,12 @@ cdef class Rect(object):
|
|||
self.cy = self.y0 + h/2
|
||||
|
||||
property area:
|
||||
":type: (int **w**, int **h**)"
|
||||
""":type: (int **w**, int **h**)"""
|
||||
def __get__(self):
|
||||
return self._w * self._h
|
||||
|
||||
def normalize(self):
|
||||
"Normalize coordinates so both width and height are positive."
|
||||
"""Normalize coordinates so both width and height are positive."""
|
||||
cdef int tmp
|
||||
if self._w < 0:
|
||||
tmp = self.x0
|
||||
|
@ -391,7 +391,7 @@ cdef class Rect(object):
|
|||
self._h = -self._h
|
||||
|
||||
def __richcmp__(a, b, int op):
|
||||
"Compares two rectangles for (in)equality"
|
||||
"""Compares two rectangles for (in)equality"""
|
||||
cdef Rect o1, o2
|
||||
cdef int res
|
||||
if isinstance(a, Rect):
|
||||
|
@ -417,12 +417,12 @@ cdef class Rect(object):
|
|||
raise TypeError("unsupported comparison operation")
|
||||
|
||||
def __nonzero__(self):
|
||||
"Checks if all coordinates are not zero."
|
||||
"""Checks if all coordinates are not zero."""
|
||||
return bool(self.x0 != 0 and self._w != 0 and \
|
||||
self.y0 != 0 and self._h != 0)
|
||||
|
||||
def __contains__(self, obj):
|
||||
"Checks if contains given rectangle."
|
||||
"""Checks if contains given rectangle."""
|
||||
cdef Rect o
|
||||
if isinstance(obj, Rect):
|
||||
o = obj
|
||||
|
|
Loading…
Reference in New Issue