diff options
author | Dave Andreoli <dave@gurumeditation.it> | 2016-01-23 13:46:43 +0100 |
---|---|---|
committer | Dave Andreoli <dave@gurumeditation.it> | 2016-01-23 13:46:43 +0100 |
commit | 9809eb2739b64b11f0072a353308106dd5a4ece2 (patch) | |
tree | ca976b1c3c1ef8d045bb25c95bd9d3163f01c926 | |
parent | 4f8dfc195f98bd1a12efe4f1c5d2259e75d2b4c1 (diff) |
New 1.17 API: ELM_GEN[GRID/LIST]_ITEM_SCROLLTO_BOTTOM
The grid enum was a bit messed, it was using the list enums, fixed and leave the old one in place for compatibility
Diffstat (limited to '')
-rw-r--r-- | doc/elementary/gengrid.rst | 6 | ||||
-rw-r--r-- | doc/elementary/genlist.rst | 6 | ||||
-rw-r--r-- | efl/elementary/gengrid.py | 8 | ||||
-rw-r--r-- | efl/elementary/gengrid_cdef.pxi | 10 | ||||
-rw-r--r-- | efl/elementary/gengrid_item.pxi | 10 | ||||
-rw-r--r-- | efl/elementary/genlist.py | 1 | ||||
-rw-r--r-- | efl/elementary/genlist_cdef.pxi | 1 | ||||
-rw-r--r-- | efl/elementary/genlist_item.pxi | 10 | ||||
-rw-r--r-- | examples/elementary/test_gengrid.py | 139 | ||||
-rw-r--r-- | examples/elementary/test_genlist_1.py | 69 |
10 files changed, 163 insertions, 97 deletions
diff --git a/doc/elementary/gengrid.rst b/doc/elementary/gengrid.rst index 9527361..c279329 100644 --- a/doc/elementary/gengrid.rst +++ b/doc/elementary/gengrid.rst | |||
@@ -266,6 +266,12 @@ Items' scroll to types | |||
266 | 266 | ||
267 | Scroll to the middle of viewport | 267 | Scroll to the middle of viewport |
268 | 268 | ||
269 | .. data:: ELM_GENGRID_ITEM_SCROLLTO_BOTTOM | ||
270 | |||
271 | Scroll to the bottom of viewport | ||
272 | |||
273 | .. versionadded:: 1.17 | ||
274 | |||
269 | 275 | ||
270 | .. _Elm_Gengrid_Object_Multi_Select_Mode: | 276 | .. _Elm_Gengrid_Object_Multi_Select_Mode: |
271 | 277 | ||
diff --git a/doc/elementary/genlist.rst b/doc/elementary/genlist.rst index 1d1b482..2218045 100644 --- a/doc/elementary/genlist.rst +++ b/doc/elementary/genlist.rst | |||
@@ -415,6 +415,12 @@ Genlist items' scroll-to types | |||
415 | 415 | ||
416 | Scroll to the middle of viewport | 416 | Scroll to the middle of viewport |
417 | 417 | ||
418 | .. data:: ELM_GENLIST_ITEM_SCROLLTO_BOTTTOM | ||
419 | |||
420 | Scroll to the bottom of viewport | ||
421 | |||
422 | .. versionadded:: 1.17 | ||
423 | |||
418 | 424 | ||
419 | Inheritance diagram | 425 | Inheritance diagram |
420 | =================== | 426 | =================== |
diff --git a/efl/elementary/gengrid.py b/efl/elementary/gengrid.py index 81e57a9..24f33ba 100644 --- a/efl/elementary/gengrid.py +++ b/efl/elementary/gengrid.py | |||
@@ -1,9 +1,17 @@ | |||
1 | from . import Gengrid, GengridItem, GengridItemClass | 1 | from . import Gengrid, GengridItem, GengridItemClass |
2 | 2 | ||
3 | # deprecated | ||
3 | from . import ELM_GENLIST_ITEM_SCROLLTO_NONE | 4 | from . import ELM_GENLIST_ITEM_SCROLLTO_NONE |
4 | from . import ELM_GENLIST_ITEM_SCROLLTO_IN | 5 | from . import ELM_GENLIST_ITEM_SCROLLTO_IN |
5 | from . import ELM_GENLIST_ITEM_SCROLLTO_TOP | 6 | from . import ELM_GENLIST_ITEM_SCROLLTO_TOP |
6 | from . import ELM_GENLIST_ITEM_SCROLLTO_MIDDLE | 7 | from . import ELM_GENLIST_ITEM_SCROLLTO_MIDDLE |
8 | # | ||
9 | |||
10 | from . import ELM_GENGRID_ITEM_SCROLLTO_NONE | ||
11 | from . import ELM_GENGRID_ITEM_SCROLLTO_IN | ||
12 | from . import ELM_GENGRID_ITEM_SCROLLTO_TOP | ||
13 | from . import ELM_GENGRID_ITEM_SCROLLTO_MIDDLE | ||
14 | from . import ELM_GENGRID_ITEM_SCROLLTO_BOTTOM | ||
7 | 15 | ||
8 | from . import ELM_OBJECT_SELECT_MODE_DEFAULT | 16 | from . import ELM_OBJECT_SELECT_MODE_DEFAULT |
9 | from . import ELM_OBJECT_SELECT_MODE_ALWAYS | 17 | from . import ELM_OBJECT_SELECT_MODE_ALWAYS |
diff --git a/efl/elementary/gengrid_cdef.pxi b/efl/elementary/gengrid_cdef.pxi index 922a783..779aa6c 100644 --- a/efl/elementary/gengrid_cdef.pxi +++ b/efl/elementary/gengrid_cdef.pxi | |||
@@ -2,6 +2,7 @@ cdef extern from "Elementary.h": | |||
2 | 2 | ||
3 | ctypedef cEo Elm_Gengrid | 3 | ctypedef cEo Elm_Gengrid |
4 | 4 | ||
5 | # deprecated | ||
5 | cpdef enum Elm_Genlist_Item_Scrollto_Type: | 6 | cpdef enum Elm_Genlist_Item_Scrollto_Type: |
6 | ELM_GENLIST_ITEM_SCROLLTO_NONE | 7 | ELM_GENLIST_ITEM_SCROLLTO_NONE |
7 | ELM_GENLIST_ITEM_SCROLLTO_IN | 8 | ELM_GENLIST_ITEM_SCROLLTO_IN |
@@ -10,6 +11,15 @@ cdef extern from "Elementary.h": | |||
10 | ctypedef enum Elm_Genlist_Item_Scrollto_Type: | 11 | ctypedef enum Elm_Genlist_Item_Scrollto_Type: |
11 | pass | 12 | pass |
12 | 13 | ||
14 | cpdef enum Elm_Gengrid_Item_Scrollto_Type: | ||
15 | ELM_GENGRID_ITEM_SCROLLTO_NONE | ||
16 | ELM_GENGRID_ITEM_SCROLLTO_IN | ||
17 | ELM_GENGRID_ITEM_SCROLLTO_TOP | ||
18 | ELM_GENGRID_ITEM_SCROLLTO_MIDDLE | ||
19 | ELM_GENGRID_ITEM_SCROLLTO_BOTTOM | ||
20 | ctypedef enum Elm_Gengrid_Item_Scrollto_Type: | ||
21 | pass | ||
22 | |||
13 | cpdef enum Elm_Object_Select_Mode: | 23 | cpdef enum Elm_Object_Select_Mode: |
14 | ELM_OBJECT_SELECT_MODE_DEFAULT | 24 | ELM_OBJECT_SELECT_MODE_DEFAULT |
15 | ELM_OBJECT_SELECT_MODE_ALWAYS | 25 | ELM_OBJECT_SELECT_MODE_ALWAYS |
diff --git a/efl/elementary/gengrid_item.pxi b/efl/elementary/gengrid_item.pxi index 54f4bd2..ce4b8f4 100644 --- a/efl/elementary/gengrid_item.pxi +++ b/efl/elementary/gengrid_item.pxi | |||
@@ -261,26 +261,28 @@ cdef class GengridItem(ObjectItem): | |||
261 | def selected_get(self): | 261 | def selected_get(self): |
262 | return bool(elm_gengrid_item_selected_get(self.item)) | 262 | return bool(elm_gengrid_item_selected_get(self.item)) |
263 | 263 | ||
264 | def show(self, scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN): | 264 | def show(self, scrollto_type=ELM_GENGRID_ITEM_SCROLLTO_IN): |
265 | """This causes gengrid to **redraw** its viewport's contents to the | 265 | """This causes gengrid to **redraw** its viewport's contents to the |
266 | region containing the given ``item``, if it is not fully | 266 | region containing the given ``item``, if it is not fully |
267 | visible. | 267 | visible. |
268 | 268 | ||
269 | .. seealso:: :py:func:`bring_in()` | 269 | .. seealso:: :py:func:`bring_in()` |
270 | 270 | ||
271 | :param type: Where to position the item in the viewport. | 271 | :param scrollto_type: Where to position the item in the viewport. |
272 | :type scrollto_type: :ref:`Elm_Gengrid_Item_Scrollto_Type` | ||
272 | 273 | ||
273 | """ | 274 | """ |
274 | elm_gengrid_item_show(self.item, scrollto_type) | 275 | elm_gengrid_item_show(self.item, scrollto_type) |
275 | 276 | ||
276 | def bring_in(self, scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN): | 277 | def bring_in(self, scrollto_type=ELM_GENGRID_ITEM_SCROLLTO_IN): |
277 | """This causes gengrid to jump to the item and show | 278 | """This causes gengrid to jump to the item and show |
278 | it (by scrolling), if it is not fully visible. This will use | 279 | it (by scrolling), if it is not fully visible. This will use |
279 | animation to do so and take a period of time to complete. | 280 | animation to do so and take a period of time to complete. |
280 | 281 | ||
281 | .. seealso:: :py:func:`show()` | 282 | .. seealso:: :py:func:`show()` |
282 | 283 | ||
283 | :param type: Where to position the item in the viewport. | 284 | :param scrollto_type: Where to position the item in the viewport. |
285 | :type scrollto_type: :ref:`Elm_Gengrid_Item_Scrollto_Type` | ||
284 | 286 | ||
285 | """ | 287 | """ |
286 | elm_gengrid_item_bring_in(self.item, scrollto_type) | 288 | elm_gengrid_item_bring_in(self.item, scrollto_type) |
diff --git a/efl/elementary/genlist.py b/efl/elementary/genlist.py index c7b538d..94a8d57 100644 --- a/efl/elementary/genlist.py +++ b/efl/elementary/genlist.py | |||
@@ -14,6 +14,7 @@ from . import ELM_GENLIST_ITEM_SCROLLTO_NONE | |||
14 | from . import ELM_GENLIST_ITEM_SCROLLTO_IN | 14 | from . import ELM_GENLIST_ITEM_SCROLLTO_IN |
15 | from . import ELM_GENLIST_ITEM_SCROLLTO_TOP | 15 | from . import ELM_GENLIST_ITEM_SCROLLTO_TOP |
16 | from . import ELM_GENLIST_ITEM_SCROLLTO_MIDDLE | 16 | from . import ELM_GENLIST_ITEM_SCROLLTO_MIDDLE |
17 | from . import ELM_GENLIST_ITEM_SCROLLTO_BOTTOM | ||
17 | 18 | ||
18 | from . import ELM_LIST_COMPRESS | 19 | from . import ELM_LIST_COMPRESS |
19 | from . import ELM_LIST_SCROLL | 20 | from . import ELM_LIST_SCROLL |
diff --git a/efl/elementary/genlist_cdef.pxi b/efl/elementary/genlist_cdef.pxi index 89779d3..0476ffb 100644 --- a/efl/elementary/genlist_cdef.pxi +++ b/efl/elementary/genlist_cdef.pxi | |||
@@ -21,6 +21,7 @@ cdef extern from "Elementary.h": | |||
21 | ELM_GENLIST_ITEM_SCROLLTO_IN | 21 | ELM_GENLIST_ITEM_SCROLLTO_IN |
22 | ELM_GENLIST_ITEM_SCROLLTO_TOP | 22 | ELM_GENLIST_ITEM_SCROLLTO_TOP |
23 | ELM_GENLIST_ITEM_SCROLLTO_MIDDLE | 23 | ELM_GENLIST_ITEM_SCROLLTO_MIDDLE |
24 | ELM_GENLIST_ITEM_SCROLLTO_BOTTOM | ||
24 | ctypedef enum Elm_Genlist_Item_Scrollto_Type: | 25 | ctypedef enum Elm_Genlist_Item_Scrollto_Type: |
25 | pass | 26 | pass |
26 | 27 | ||
diff --git a/efl/elementary/genlist_item.pxi b/efl/elementary/genlist_item.pxi index c5eb23f..409b52d 100644 --- a/efl/elementary/genlist_item.pxi +++ b/efl/elementary/genlist_item.pxi | |||
@@ -330,23 +330,25 @@ cdef class GenlistItem(ObjectItem): | |||
330 | cdef bint ret = elm_genlist_item_selected_get(self.item) | 330 | cdef bint ret = elm_genlist_item_selected_get(self.item) |
331 | return ret | 331 | return ret |
332 | 332 | ||
333 | def show(self, scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN): | 333 | def show(self, scrollto_type=ELM_GENLIST_ITEM_SCROLLTO_IN): |
334 | """This causes genlist to jump to the item and show it (by | 334 | """This causes genlist to jump to the item and show it (by |
335 | jumping to that position), if it is not fully visible. | 335 | jumping to that position), if it is not fully visible. |
336 | 336 | ||
337 | :type: :ref:`Elm_Genlist_Item_Scrollto_Type` | 337 | :param scrollto_type: Where to position the item in the viewport. |
338 | :type scrollto_type: :ref:`Elm_Genlist_Item_Scrollto_Type` | ||
338 | 339 | ||
339 | .. seealso:: :py:func:`bring_in()` | 340 | .. seealso:: :py:func:`bring_in()` |
340 | 341 | ||
341 | """ | 342 | """ |
342 | elm_genlist_item_show(self.item, scrollto_type) | 343 | elm_genlist_item_show(self.item, scrollto_type) |
343 | 344 | ||
344 | def bring_in(self, scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN): | 345 | def bring_in(self, scrollto_type=ELM_GENLIST_ITEM_SCROLLTO_IN): |
345 | """This causes genlist to jump to the item and show it (by | 346 | """This causes genlist to jump to the item and show it (by |
346 | animatedly scrolling), if it is not fully visible. | 347 | animatedly scrolling), if it is not fully visible. |
347 | This may use animation and take a some time to do so. | 348 | This may use animation and take a some time to do so. |
348 | 349 | ||
349 | :type: :ref:`Elm_Genlist_Item_Scrollto_Type` | 350 | :param scrollto_type: Where to position the item in the viewport. |
351 | :type scrollto_type: :ref:`Elm_Genlist_Item_Scrollto_Type` | ||
350 | 352 | ||
351 | .. seealso:: :py:func:`show()` | 353 | .. seealso:: :py:func:`show()` |
352 | 354 | ||
diff --git a/examples/elementary/test_gengrid.py b/examples/elementary/test_gengrid.py index 4b2ee6d..12eada2 100644 --- a/examples/elementary/test_gengrid.py +++ b/examples/elementary/test_gengrid.py | |||
@@ -6,19 +6,10 @@ import os | |||
6 | 6 | ||
7 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH, \ | 7 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH, \ |
8 | EXPAND_HORIZ, FILL_HORIZ, EVAS_ASPECT_CONTROL_BOTH | 8 | EXPAND_HORIZ, FILL_HORIZ, EVAS_ASPECT_CONTROL_BOTH |
9 | from efl import elementary | 9 | from efl import elementary as elm |
10 | from efl.elementary.window import StandardWindow | 10 | from efl.elementary import StandardWindow, Button, Check, Entry, Image, \ |
11 | from efl.elementary.background import Background | 11 | Label, Gengrid, GengridItemClass, Slider, Radio, Table, Scrollable, \ |
12 | from efl.elementary.button import Button | 12 | ELM_GLOB_MATCH_NOCASE |
13 | from efl.elementary.check import Check | ||
14 | from efl.elementary.entry import Entry | ||
15 | from efl.elementary.image import Image | ||
16 | from efl.elementary.label import Label | ||
17 | from efl.elementary.general import ELM_GLOB_MATCH_NOCASE | ||
18 | from efl.elementary.gengrid import Gengrid, GengridItemClass | ||
19 | from efl.elementary.slider import Slider | ||
20 | from efl.elementary.table import Table | ||
21 | from efl.elementary.scroller import Scrollable | ||
22 | 13 | ||
23 | 14 | ||
24 | script_path = os.path.dirname(os.path.abspath(__file__)) | 15 | script_path = os.path.dirname(os.path.abspath(__file__)) |
@@ -69,7 +60,7 @@ def gengrid_clicked(obj): | |||
69 | 60 | ||
70 | win = StandardWindow("gengrid", "Gengrid", autodel=True, size=(480, 600)) | 61 | win = StandardWindow("gengrid", "Gengrid", autodel=True, size=(480, 600)) |
71 | if obj is None: | 62 | if obj is None: |
72 | win.callback_delete_request_add(lambda o: elementary.exit()) | 63 | win.callback_delete_request_add(lambda o: elm.exit()) |
73 | 64 | ||
74 | tb = Table(win, homogeneous=False, size_hint_weight=EXPAND_BOTH) | 65 | tb = Table(win, homogeneous=False, size_hint_weight=EXPAND_BOTH) |
75 | win.resize_object_add(tb) | 66 | win.resize_object_add(tb) |
@@ -248,38 +239,6 @@ def gengrid_clicked(obj): | |||
248 | tb.pack(bt, 5, 2, 1, 1) | 239 | tb.pack(bt, 5, 2, 1, 1) |
249 | bt.show() | 240 | bt.show() |
250 | 241 | ||
251 | # show first/last | ||
252 | def show_clicked(bt, gg, first): | ||
253 | ggi = gg.first_item if first else gg.last_item | ||
254 | if ggi: | ||
255 | ggi.show() | ||
256 | |||
257 | bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show first") | ||
258 | bt.callback_clicked_add(show_clicked, gg, True) | ||
259 | tb.pack(bt, 2, 3, 1, 1) | ||
260 | bt.show() | ||
261 | |||
262 | bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show last") | ||
263 | bt.callback_clicked_add(show_clicked, gg, False) | ||
264 | tb.pack(bt, 3, 3, 1, 1) | ||
265 | bt.show() | ||
266 | |||
267 | # bring-in first/last | ||
268 | def bring_in_clicked(bt, gg, first): | ||
269 | ggi = gg.first_item if first else gg.last_item | ||
270 | if ggi: | ||
271 | ggi.bring_in() | ||
272 | |||
273 | bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn first") | ||
274 | bt.callback_clicked_add(bring_in_clicked, gg, True) | ||
275 | tb.pack(bt, 4, 3, 1, 1) | ||
276 | bt.show() | ||
277 | |||
278 | bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn last") | ||
279 | bt.callback_clicked_add(bring_in_clicked, gg, False) | ||
280 | tb.pack(bt, 5, 3, 1, 1) | ||
281 | bt.show() | ||
282 | |||
283 | # append | 242 | # append |
284 | def append_clicked(bt, gg, n): | 243 | def append_clicked(bt, gg, n): |
285 | global item_count | 244 | global item_count |
@@ -290,22 +249,22 @@ def gengrid_clicked(obj): | |||
290 | 249 | ||
291 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 1") | 250 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 1") |
292 | bt.callback_clicked_add(append_clicked, gg, 1) | 251 | bt.callback_clicked_add(append_clicked, gg, 1) |
293 | tb.pack(bt, 2, 4, 1, 1) | 252 | tb.pack(bt, 2, 3, 1, 1) |
294 | bt.show() | 253 | bt.show() |
295 | 254 | ||
296 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 100") | 255 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 100") |
297 | bt.callback_clicked_add(append_clicked, gg, 100) | 256 | bt.callback_clicked_add(append_clicked, gg, 100) |
298 | tb.pack(bt, 3, 4, 1, 1) | 257 | tb.pack(bt, 3, 3, 1, 1) |
299 | bt.show() | 258 | bt.show() |
300 | 259 | ||
301 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 1000") | 260 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 1000") |
302 | bt.callback_clicked_add(append_clicked, gg, 1000) | 261 | bt.callback_clicked_add(append_clicked, gg, 1000) |
303 | tb.pack(bt, 4, 4, 1, 1) | 262 | tb.pack(bt, 4, 3, 1, 1) |
304 | bt.show() | 263 | bt.show() |
305 | 264 | ||
306 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 10000 :)") | 265 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 10000 :)") |
307 | bt.callback_clicked_add(append_clicked, gg, 10000) | 266 | bt.callback_clicked_add(append_clicked, gg, 10000) |
308 | tb.pack(bt, 5, 4, 1, 1) | 267 | tb.pack(bt, 5, 3, 1, 1) |
309 | bt.show() | 268 | bt.show() |
310 | 269 | ||
311 | # prepend | 270 | # prepend |
@@ -316,7 +275,7 @@ def gengrid_clicked(obj): | |||
316 | 275 | ||
317 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Prepend") | 276 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Prepend") |
318 | bt.callback_clicked_add(prepend_clicked, gg) | 277 | bt.callback_clicked_add(prepend_clicked, gg) |
319 | tb.pack(bt, 2, 5, 1, 1) | 278 | tb.pack(bt, 2, 4, 1, 1) |
320 | bt.show() | 279 | bt.show() |
321 | 280 | ||
322 | # insert_before | 281 | # insert_before |
@@ -331,7 +290,7 @@ def gengrid_clicked(obj): | |||
331 | 290 | ||
332 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Ins before") | 291 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Ins before") |
333 | bt.callback_clicked_add(ins_before_clicked, gg) | 292 | bt.callback_clicked_add(ins_before_clicked, gg) |
334 | tb.pack(bt, 3, 5, 1, 1) | 293 | tb.pack(bt, 3, 4, 1, 1) |
335 | bt.show() | 294 | bt.show() |
336 | 295 | ||
337 | # insert_after | 296 | # insert_after |
@@ -346,7 +305,75 @@ def gengrid_clicked(obj): | |||
346 | 305 | ||
347 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Ins after") | 306 | bt = Button(win, size_hint_align=FILL_HORIZ, text="Ins after") |
348 | bt.callback_clicked_add(ins_after_clicked, gg) | 307 | bt.callback_clicked_add(ins_after_clicked, gg) |
349 | tb.pack(bt, 4, 5, 1, 1) | 308 | tb.pack(bt, 4, 4, 1, 1) |
309 | bt.show() | ||
310 | |||
311 | # scroll_to methods | ||
312 | rdg = rd = Radio(win, text='SCROLL_IN', | ||
313 | state_value=elm.ELM_GENGRID_ITEM_SCROLLTO_IN) | ||
314 | tb.pack(rd, 2, 5, 1, 1) | ||
315 | rd.show() | ||
316 | |||
317 | rd = Radio(win, text='SCROLL_TOP', | ||
318 | state_value=elm.ELM_GENGRID_ITEM_SCROLLTO_TOP) | ||
319 | rd.group_add(rdg) | ||
320 | tb.pack(rd, 3, 5, 1, 1) | ||
321 | rd.show() | ||
322 | |||
323 | rd = Radio(win, text='SCROLL_MIDDLE', | ||
324 | state_value=elm.ELM_GENGRID_ITEM_SCROLLTO_MIDDLE) | ||
325 | rd.group_add(rdg) | ||
326 | tb.pack(rd, 4, 5, 1, 1) | ||
327 | rd.show() | ||
328 | |||
329 | rd = Radio(win, text='SCROLL_BOTTOM', | ||
330 | state_value=elm.ELM_GENGRID_ITEM_SCROLLTO_BOTTOM) | ||
331 | rd.group_add(rdg) | ||
332 | tb.pack(rd, 5, 5, 1, 1) | ||
333 | rd.show() | ||
334 | |||
335 | rdg.value = elm.ELM_GENGRID_ITEM_SCROLLTO_IN | ||
336 | |||
337 | # show first/last | ||
338 | def show_clicked(bt, gg, rdg, what): | ||
339 | ggi = getattr(gg, what) | ||
340 | if ggi: | ||
341 | ggi.show(rdg.value) | ||
342 | |||
343 | bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show first") | ||
344 | bt.callback_clicked_add(show_clicked, gg, rdg, "first_item") | ||
345 | tb.pack(bt, 2, 6, 1, 1) | ||
346 | bt.show() | ||
347 | |||
348 | bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show last") | ||
349 | bt.callback_clicked_add(show_clicked, gg, rdg, "last_item") | ||
350 | tb.pack(bt, 3, 6, 1, 1) | ||
351 | bt.show() | ||
352 | |||
353 | bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show selected") | ||
354 | bt.callback_clicked_add(show_clicked, gg, rdg, "selected_item") | ||
355 | tb.pack(bt, 2, 7, 2, 1) | ||
356 | bt.show() | ||
357 | |||
358 | # bring-in first/last/selected | ||
359 | def bring_in_clicked(bt, gg, rdg, what): | ||
360 | ggi = getattr(gg, what) | ||
361 | if ggi: | ||
362 | ggi.bring_in(rdg.value) | ||
363 | |||
364 | bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn first") | ||
365 | bt.callback_clicked_add(bring_in_clicked, gg, rdg, "first_item") | ||
366 | tb.pack(bt, 4, 6, 1, 1) | ||
367 | bt.show() | ||
368 | |||
369 | bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn last") | ||
370 | bt.callback_clicked_add(bring_in_clicked, gg, rdg, "last_item") | ||
371 | tb.pack(bt, 5, 6, 1, 1) | ||
372 | bt.show() | ||
373 | |||
374 | bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn selected") | ||
375 | bt.callback_clicked_add(bring_in_clicked, gg, rdg, "selected_item") | ||
376 | tb.pack(bt, 4, 7, 2, 1) | ||
350 | bt.show() | 377 | bt.show() |
351 | 378 | ||
352 | # search_by_text_item_get | 379 | # search_by_text_item_get |
@@ -362,14 +389,14 @@ def gengrid_clicked(obj): | |||
362 | gg.selected_item.selected = False | 389 | gg.selected_item.selected = False |
363 | 390 | ||
364 | lb = Label(win, text="Search:") | 391 | lb = Label(win, text="Search:") |
365 | tb.pack(lb, 2, 6, 1, 1) | 392 | tb.pack(lb, 0, 6, 2, 1) |
366 | lb.show() | 393 | lb.show() |
367 | 394 | ||
368 | en = Entry(win, single_line=True, scrollable=True, | 395 | en = Entry(win, single_line=True, scrollable=True, |
369 | size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) | 396 | size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) |
370 | en.part_text_set("guide", "Type the search query") | 397 | en.part_text_set("guide", "Type the search query") |
371 | en.callback_activated_add(search_cb, gg) | 398 | en.callback_activated_add(search_cb, gg) |
372 | tb.pack(en, 3, 6, 3, 1) | 399 | tb.pack(en, 0, 7, 2, 1) |
373 | en.show() | 400 | en.show() |
374 | en.focus = True | 401 | en.focus = True |
375 | 402 | ||
@@ -383,4 +410,4 @@ if __name__ == "__main__": | |||
383 | 410 | ||
384 | gengrid_clicked(None) | 411 | gengrid_clicked(None) |
385 | 412 | ||
386 | elementary.run() | 413 | elm.run() |
diff --git a/examples/elementary/test_genlist_1.py b/examples/elementary/test_genlist_1.py index 5d9f479..ff67832 100644 --- a/examples/elementary/test_genlist_1.py +++ b/examples/elementary/test_genlist_1.py | |||
@@ -5,7 +5,7 @@ | |||
5 | from efl.evas import Rectangle, EXPAND_BOTH, FILL_BOTH, EVAS_CALLBACK_MOUSE_DOWN | 5 | from efl.evas import Rectangle, EXPAND_BOTH, FILL_BOTH, EVAS_CALLBACK_MOUSE_DOWN |
6 | 6 | ||
7 | from efl import elementary as elm | 7 | from efl import elementary as elm |
8 | from efl.elementary import StandardWindow, Box, Label, Button, Icon, \ | 8 | from efl.elementary import StandardWindow, Box, Label, Button, Radio, Icon, \ |
9 | Genlist, GenlistItemClass, ELM_LIST_COMPRESS | 9 | Genlist, GenlistItemClass, ELM_LIST_COMPRESS |
10 | 10 | ||
11 | 11 | ||
@@ -123,53 +123,58 @@ def test_genlist_1(parent): | |||
123 | if i == 50: it_50 = item | 123 | if i == 50: it_50 = item |
124 | elif i == 1500: it_1500 = item | 124 | elif i == 1500: it_1500 = item |
125 | 125 | ||
126 | # item 50 buttons | 126 | # scroll_to methods |
127 | hbox = Box(win, horizontal=True) | 127 | hbox = Box(win, horizontal=True) |
128 | box.pack_end(hbox) | 128 | box.pack_end(hbox) |
129 | hbox.show() | 129 | hbox.show() |
130 | 130 | ||
131 | bt = Button(win, text="Show 50 (IN)") | 131 | rdg = rd = Radio(win, text='SCROLL_IN', |
132 | bt.callback_clicked_add(lambda bt: it_50.show(elm.ELM_GENLIST_ITEM_SCROLLTO_IN)) | 132 | state_value=elm.ELM_GENLIST_ITEM_SCROLLTO_IN) |
133 | hbox.pack_end(bt) | 133 | hbox.pack_end(rd) |
134 | bt.show() | 134 | rd.show() |
135 | 135 | ||
136 | bt = Button(win, text="Show 50 (TOP)") | 136 | rd = Radio(win, text='SCROLL_TOP', |
137 | bt.callback_clicked_add(lambda bt: it_50.show(elm.ELM_GENLIST_ITEM_SCROLLTO_TOP)) | 137 | state_value=elm.ELM_GENLIST_ITEM_SCROLLTO_TOP) |
138 | hbox.pack_end(bt) | 138 | rd.group_add(rdg) |
139 | bt.show() | 139 | hbox.pack_end(rd) |
140 | rd.show() | ||
140 | 141 | ||
141 | bt = Button(win, text="Show 50 (MID)") | 142 | rd = Radio(win, text='SCROLL_MIDDLE', |
142 | bt.callback_clicked_add(lambda bt: it_50.show(elm.ELM_GENLIST_ITEM_SCROLLTO_MIDDLE)) | 143 | state_value=elm.ELM_GENLIST_ITEM_SCROLLTO_MIDDLE) |
143 | hbox.pack_end(bt) | 144 | rd.group_add(rdg) |
144 | bt.show() | 145 | hbox.pack_end(rd) |
146 | rd.show() | ||
145 | 147 | ||
146 | bt = Button(win, text="Bring 50 (IN)") | 148 | rd = Radio(win, text='SCROLL_BOTTOM', |
147 | bt.callback_clicked_add(lambda bt: it_50.bring_in(elm.ELM_GENLIST_ITEM_SCROLLTO_IN)) | 149 | state_value=elm.ELM_GENLIST_ITEM_SCROLLTO_BOTTOM) |
148 | hbox.pack_end(bt) | 150 | rd.group_add(rdg) |
149 | bt.show() | 151 | hbox.pack_end(rd) |
152 | rd.show() | ||
150 | 153 | ||
151 | bt = Button(win, text="Bring 50 (TOP)") | 154 | rdg.value = elm.ELM_GENLIST_ITEM_SCROLLTO_IN |
152 | bt.callback_clicked_add(lambda bt: it_50.bring_in(elm.ELM_GENLIST_ITEM_SCROLLTO_TOP)) | 155 | |
156 | # item 50/1500 buttons | ||
157 | hbox = Box(win, horizontal=True) | ||
158 | box.pack_end(hbox) | ||
159 | hbox.show() | ||
160 | |||
161 | bt = Button(win, text="Show 50") | ||
162 | bt.callback_clicked_add(lambda bt: it_50.show(rdg.value)) | ||
153 | hbox.pack_end(bt) | 163 | hbox.pack_end(bt) |
154 | bt.show() | 164 | bt.show() |
155 | 165 | ||
156 | bt = Button(win, text="Bring 50 (MID)") | 166 | bt = Button(win, text="BringIn 50") |
157 | bt.callback_clicked_add(lambda bt: it_50.bring_in(elm.ELM_GENLIST_ITEM_SCROLLTO_MIDDLE)) | 167 | bt.callback_clicked_add(lambda bt: it_50.bring_in(rdg.value)) |
158 | hbox.pack_end(bt) | 168 | hbox.pack_end(bt) |
159 | bt.show() | 169 | bt.show() |
160 | 170 | ||
161 | # item 1500 buttons | 171 | bt = Button(win, text="Show 1500") |
162 | hbox = Box(win, horizontal=True) | 172 | bt.callback_clicked_add(lambda bt: it_1500.show(rdg.value)) |
163 | box.pack_end(hbox) | ||
164 | hbox.show() | ||
165 | |||
166 | bt = Button(win, text="Show 1500 (IN)") | ||
167 | bt.callback_clicked_add(lambda bt: it_1500.show()) | ||
168 | hbox.pack_end(bt) | 173 | hbox.pack_end(bt) |
169 | bt.show() | 174 | bt.show() |
170 | 175 | ||
171 | bt = Button(win, text="Bring 1500 (IN)") | 176 | bt = Button(win, text="BringIn 1500") |
172 | bt.callback_clicked_add(lambda bt: it_1500.bring_in()) | 177 | bt.callback_clicked_add(lambda bt: it_1500.bring_in(rdg.value)) |
173 | hbox.pack_end(bt) | 178 | hbox.pack_end(bt) |
174 | bt.show() | 179 | bt.show() |
175 | 180 | ||
@@ -177,8 +182,6 @@ def test_genlist_1(parent): | |||
177 | win.show() | 182 | win.show() |
178 | 183 | ||
179 | 184 | ||
180 | |||
181 | |||
182 | if __name__ == "__main__": | 185 | if __name__ == "__main__": |
183 | elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED) | 186 | elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED) |
184 | test_genlist_1(None) | 187 | test_genlist_1(None) |