summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-01-19 15:31:07 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-01-19 15:31:07 +0000
commit967a480df51db3ef67bae9e888062baf70f1d8cd (patch)
treeaa2b098509ca4f8890a73365ca2a2bd2137c8664
parent2e51c345285fb0146e390b917dd960cfcf469e18 (diff)
python-ecore: remove deprecated api __getslice__()
SVN revision: 67349
-rw-r--r--ecore/evas/ecore.evas.c_ecore_evas_buffer.pxi14
1 files changed, 12 insertions, 2 deletions
diff --git a/ecore/evas/ecore.evas.c_ecore_evas_buffer.pxi b/ecore/evas/ecore.evas.c_ecore_evas_buffer.pxi
index c554c41..4b5e8a7 100644
--- a/ecore/evas/ecore.evas.c_ecore_evas_buffer.pxi
+++ b/ecore/evas/ecore.evas.c_ecore_evas_buffer.pxi
@@ -17,6 +17,8 @@
17 17
18# This file is included verbatim by c_ecore_evas.pyx 18# This file is included verbatim by c_ecore_evas.pyx
19 19
20import types
21
20cdef class Buffer(EcoreEvas): 22cdef class Buffer(EcoreEvas):
21 "Buffer render." 23 "Buffer render."
22 def __init__(self, int w=320, int h=240): 24 def __init__(self, int w=320, int h=240):
@@ -45,7 +47,7 @@ cdef class Buffer(EcoreEvas):
45 lenp[0] = self._get_buf_size() 47 lenp[0] = self._get_buf_size()
46 return 1 48 return 1
47 49
48 def __getitem__(self, int i): 50 def _getitem(self, int i):
49 cdef char *buf 51 cdef char *buf
50 cdef int ln 52 cdef int ln
51 ln = self._get_buf_size() 53 ln = self._get_buf_size()
@@ -65,7 +67,7 @@ cdef class Buffer(EcoreEvas):
65 def __len__(self): 67 def __len__(self):
66 return self._get_buf_size() 68 return self._get_buf_size()
67 69
68 def __getslice__(self, int i, int j): 70 def _getslice(self, int i, int j):
69 cdef int ln 71 cdef int ln
70 ln = self._get_buf_size() 72 ln = self._get_buf_size()
71 if ln == 0: 73 if ln == 0:
@@ -86,3 +88,11 @@ cdef class Buffer(EcoreEvas):
86 return [] 88 return []
87 89
88 return PyBuffer_FromObject(self, i, j - i) 90 return PyBuffer_FromObject(self, i, j - i)
91
92 def __getitem__(self, what):
93 if isinstance(what, types.SliceType):
94 if what.step:
95 raise ValueError("slices with step are not supported!")
96 return self._getslice(what.start, what.end)
97 else:
98 return self._getitem(what)