summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2016-01-21 21:33:23 +0100
committerDave Andreoli <dave@gurumeditation.it>2016-01-21 21:33:23 +0100
commit926c325de8cbd2544d916c26a9fb57706cc48275 (patch)
treea35c933cc46b9a9360d3be6fa58f67496916ad96
parent005dd26f73f0a634d16286362b80ce98e2e277a8 (diff)
New 1.17 API: edje size_class family functions
-rw-r--r--efl/edje/efl.edje.pyx91
-rw-r--r--efl/edje/efl.edje_object.pxi70
2 files changed, 155 insertions, 6 deletions
diff --git a/efl/edje/efl.edje.pyx b/efl/edje/efl.edje.pyx
index dad8ff4..97b3c25 100644
--- a/efl/edje/efl.edje.pyx
+++ b/efl/edje/efl.edje.pyx
@@ -149,6 +149,7 @@ def password_show_last_set(int show_last):
149def password_show_last_timeout_set(double timeout): 149def password_show_last_timeout_set(double timeout):
150 edje_password_show_last_timeout_set(timeout) 150 edje_password_show_last_timeout_set(timeout)
151 151
152
152def color_class_set(color_class, 153def color_class_set(color_class,
153 int r, int g, int b, int a, 154 int r, int g, int b, int a,
154 int r2, int g2, int b2, int a2, 155 int r2, int g2, int b2, int a2,
@@ -159,7 +160,6 @@ def color_class_set(color_class,
159 <const char *>color_class if color_class is not None else NULL, 160 <const char *>color_class if color_class is not None else NULL,
160 r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3) 161 r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
161 162
162
163def color_class_get(color_class): 163def color_class_get(color_class):
164 cdef int r, g, b, a 164 cdef int r, g, b, a
165 cdef int r2, g2, b2, a2 165 cdef int r2, g2, b2, a2
@@ -171,14 +171,12 @@ def color_class_get(color_class):
171 &r, &g, &b, &a, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3) 171 &r, &g, &b, &a, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3)
172 return (r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3) 172 return (r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
173 173
174
175def color_class_del(color_class): 174def color_class_del(color_class):
176 if isinstance(color_class, unicode): 175 if isinstance(color_class, unicode):
177 color_class = PyUnicode_AsUTF8String(color_class) 176 color_class = PyUnicode_AsUTF8String(color_class)
178 edje_color_class_del( 177 edje_color_class_del(
179 <const char *>color_class if color_class is not None else NULL) 178 <const char *>color_class if color_class is not None else NULL)
180 179
181
182def color_class_list(): 180def color_class_list():
183 cdef: 181 cdef:
184 Eina_List *lst 182 Eina_List *lst
@@ -204,7 +202,6 @@ def text_class_set(text_class, font, int size):
204 <const char *>font if font is not None else NULL, 202 <const char *>font if font is not None else NULL,
205 size) 203 size)
206 204
207
208def text_class_get(text_class): 205def text_class_get(text_class):
209 """ Get the font and the font size from Edje text class. 206 """ Get the font and the font size from Edje text class.
210 207
@@ -233,7 +230,6 @@ def text_class_del(text_class):
233 edje_text_class_del( 230 edje_text_class_del(
234 <const char *>text_class if text_class is not None else NULL) 231 <const char *>text_class if text_class is not None else NULL)
235 232
236
237def text_class_list(): 233def text_class_list():
238 cdef: 234 cdef:
239 Eina_List *lst 235 Eina_List *lst
@@ -249,6 +245,91 @@ def text_class_list():
249 return ret 245 return ret
250 246
251 247
248def size_class_set(size_class, int minw, int minh, int maxw, int maxh):
249 """Set the Edje size class.
250
251 :param str size_class: The size class name
252 :param int minw: The min width
253 :param int minh: The min height
254 :param int maxw: The max width
255 :param int maxh: The max height
256
257 :return: True on success or False on error
258 :rtype: bool
259
260 .. versionadded:: 1.17
261
262 """
263 if isinstance(size_class, unicode):
264 size_class = PyUnicode_AsUTF8String(size_class)
265 return bool(edje_size_class_set(
266 <const char *>size_class if size_class is not None else NULL,
267 minw, minh, maxw, maxh))
268
269def size_class_get(size_class):
270 """Get the Edje size class.
271
272 :param str size_class: The size class name
273
274 :return: (minw, minh, maxw, maxh)
275 :rtype: 4 int's tuple
276
277 .. versionadded:: 1.17
278
279 """
280 cdef int minw, minh, maxw, maxh, ret
281 if isinstance(size_class, unicode):
282 size_class = PyUnicode_AsUTF8String(size_class)
283
284 ret = edje_size_class_get(
285 <const char *>size_class if size_class is not None else NULL,
286 &minw, &minh, &maxw, &maxh)
287 if ret == 0:
288 return None
289 else:
290 return (minw, minh, maxw, maxh)
291
292def size_class_del(size_class):
293 """Delete the size class.
294
295 This function deletes any values at the process level for the specified
296 size class.
297
298 :param str size_class: The size class name
299
300 .. versionadded:: 1.17
301
302 """
303 if isinstance(size_class, unicode):
304 size_class = PyUnicode_AsUTF8String(size_class)
305 edje_color_class_del(
306 <const char *>size_class if size_class is not None else NULL)
307
308def size_class_list():
309 """List size classes.
310
311 This function lists all size classes known about by the current process.
312
313 :return: A list of size class names.
314 :rtype: list of strings
315
316 .. versionadded:: 1.17
317
318 """
319 cdef:
320 Eina_List *lst
321 Eina_List *itr
322 ret = []
323 lst = edje_size_class_list()
324 itr = lst
325 while itr:
326 ret.append(_touni(<char*>itr.data))
327 eina_stringshare_del(<Eina_Stringshare*>itr.data)
328 itr = itr.next
329 eina_list_free(lst)
330 return ret
331
332
252def message_signal_process(): 333def message_signal_process():
253 edje_message_signal_process() 334 edje_message_signal_process()
254 335
diff --git a/efl/edje/efl.edje_object.pxi b/efl/edje/efl.edje_object.pxi
index 0c54f1d..fb9831a 100644
--- a/efl/edje/efl.edje_object.pxi
+++ b/efl/edje/efl.edje_object.pxi
@@ -370,8 +370,76 @@ cdef class Edje(Object):
370 <const char *>text_class if text_class is not None else NULL, 370 <const char *>text_class if text_class is not None else NULL,
371 &font, &size) 371 &font, &size)
372 return (_ctouni(font), size) 372 return (_ctouni(font), size)
373
374 def size_class_set(self, size_class, int minw, int minh, int maxw, int maxh):
375 """Sets the object size class.
376
377 This function sets the min and max values for an object level size
378 class. This will make all edje parts in the specified object that have
379 the specified size class update their min and max size with given
380 values.
381
382 :param str size_class: The size class name
383 :param int minw: The min width
384 :param int minh: The min height
385 :param int maxw: The max width
386 :param int maxh: The max height
387
388 :return: True on success or False on error
389 :rtype: bool
390
391 .. versionadded:: 1.17
373 392
374 393 """
394 if isinstance(size_class, unicode):
395 size_class = PyUnicode_AsUTF8String(size_class)
396 return bool(edje_object_size_class_set(self.obj,
397 <const char *>size_class if size_class is not None else NULL,
398 minw, minh, maxw, maxh))
399
400 def size_class_get(self, size_class):
401 """Gets the object size class.
402
403 This function gets the min and max values for an object level size
404 class. These values will only be valid until the size class is changed
405 or the edje object is deleted.
406
407 :param str size_class: The size class name
408
409 :return: (minw, minh, maxw, maxh)
410 :rtype: 4 int's tuple
411
412 .. versionadded:: 1.17
413
414 """
415 cdef int minw, minh, maxw, maxh
416
417 if isinstance(size_class, unicode):
418 size_class = PyUnicode_AsUTF8String(size_class)
419 edje_object_size_class_get(self.obj,
420 <const char *>size_class if size_class is not None else NULL,
421 &minw, &minh, &maxw, &maxh)
422 return (minw, minh, maxw, maxh)
423
424 def size_class_del(self, size_class):
425 """Delete the object size class.
426
427 This function deletes any values at the object level for the specified
428 object and size class.
429
430 Note: Deleting the size class will revert it to the values defined by
431 edje_size_class_set() or the size class defined in the theme file.
432
433 :param str size_class: The size class name
434
435 .. versionadded:: 1.17
436
437 """
438 if isinstance(size_class, unicode):
439 size_class = PyUnicode_AsUTF8String(size_class)
440 edje_object_size_class_del(self.obj,
441 <const char *>size_class if size_class is not None else NULL)
442
375 property scale: 443 property scale:
376 """The scaling factor for a given Edje object. 444 """The scaling factor for a given Edje object.
377 445