def genlist_clicked(obj, item=None): win = StandardWindow("Genlist", "Genlist test", autodel=True) bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) gl.callback_selected_add(_gl_selected, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2") gl.callback_clicked_double_add(_gl_clicked_double, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2") gl.callback_longpressed_add(_gl_longpressed, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2") bx.pack_end(gl) gl.show() over = Rectangle(win.evas_get()) over.color_set(0, 0, 0, 0) over.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, _gl_over_click, gl) over.repeat_events_set(True) over.show() over.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(over) vbx = Box(win, horizontal=True) bx.pack_end(vbx) vbx.show() itc1 = GenlistItemClass(item_style="default", text_get_func=gl_text_get, content_get_func=gl_content_get, state_get_func=gl_state_get) bt_50 = Button(win, text="Go to 50") vbx.pack_end(bt_50) bt_50.show() bt_1500 = Button(win, text="Go to 1500") vbx.pack_end(bt_1500) bt_1500.show() for i in range(0, 2000): gli = gl.item_append(itc1, i, func=gl_item_sel) if i == 50: bt_50._callback_add("clicked", lambda bt, it: it.bring_in(), gli) elif i == 1500: bt_1500._callback_add("clicked", lambda bt, it: it.bring_in(), gli) win.resize(480, 800) win.show()
def menu_clicked(obj): win = StandardWindow("menu", "Menu test", autodel=True, size=(350, 200)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) rect = Rectangle(win.evas_get(), color=(0, 0, 0, 0)) win.resize_object_add(rect) rect.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND rect.show() menu = Menu(win) item = menu.item_add(None, "first item", "clock") item = menu.item_add(None, "second item", "mail-send") menu_populate_1(menu, item) menu.item_add(item, "sub menu", "refresh") rect.event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, menu_show, menu) win.show()
def core_evas_object_callbacks_clicked(obj, item=None): win = StandardWindow("evas3d", "Evas object callbacks", autodel=True, size=(320, 320)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) text = Text(win.evas, text="Events printed on console", size=(300, 30), color=(0, 0, 0, 255)) text.font_set("Sans", 12) text.pos = (10, 10) text.show() r = Rectangle(win.evas, size=(100, 100), color=(100, 0, 0, 200), pos=(50, 50)) r.event_callback_add(EVAS_CALLBACK_MOUSE_IN, events_cb2, "EVAS_CALLBACK_MOUSE_IN") r.event_callback_add(EVAS_CALLBACK_MOUSE_OUT, events_cb2, "EVAS_CALLBACK_MOUSE_OUT") r.event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, events_cb2, "EVAS_CALLBACK_MOUSE_DOWN") r.event_callback_add(EVAS_CALLBACK_MOUSE_UP, events_cb2, "EVAS_CALLBACK_MOUSE_UP") r.event_callback_add(EVAS_CALLBACK_MOUSE_MOVE, events_cb2, "EVAS_CALLBACK_MOUSE_MOVE") r.event_callback_add(EVAS_CALLBACK_MOUSE_WHEEL, events_cb2, "EVAS_CALLBACK_MOUSE_WHEEL") r.event_callback_add(EVAS_CALLBACK_MULTI_DOWN, events_cb2, "EVAS_CALLBACK_MULTI_DOWN") r.event_callback_add(EVAS_CALLBACK_MULTI_UP, events_cb2, "EVAS_CALLBACK_MULTI_UP") r.event_callback_add(EVAS_CALLBACK_MULTI_MOVE, events_cb2, "EVAS_CALLBACK_MULTI_MOVE") r.event_callback_add(EVAS_CALLBACK_FREE, events_cb1, "EVAS_CALLBACK_FREE") r.event_callback_add(EVAS_CALLBACK_KEY_DOWN, events_cb2, "EVAS_CALLBACK_KEY_DOWN") r.event_callback_add(EVAS_CALLBACK_KEY_UP, events_cb2, "EVAS_CALLBACK_KEY_UP") r.event_callback_add(EVAS_CALLBACK_FOCUS_IN, events_cb2, "EVAS_CALLBACK_FOCUS_IN") r.event_callback_add(EVAS_CALLBACK_FOCUS_OUT, events_cb2, "EVAS_CALLBACK_FOCUS_OUT") r.event_callback_add(EVAS_CALLBACK_SHOW, events_cb1, "EVAS_CALLBACK_SHOW") r.event_callback_add(EVAS_CALLBACK_HIDE, events_cb1, "EVAS_CALLBACK_HIDE") r.event_callback_add(EVAS_CALLBACK_MOVE, events_cb1, "EVAS_CALLBACK_MOVE") r.event_callback_add(EVAS_CALLBACK_RESIZE, events_cb1, "EVAS_CALLBACK_RESIZE") r.event_callback_add(EVAS_CALLBACK_RESTACK, events_cb1, "EVAS_CALLBACK_RESTACK") r.event_callback_add(EVAS_CALLBACK_DEL, events_cb1, "EVAS_CALLBACK_DEL") r.event_callback_add(EVAS_CALLBACK_HOLD, events_cb1, "EVAS_CALLBACK_HOLD") r.event_callback_add(EVAS_CALLBACK_CHANGED_SIZE_HINTS, events_cb1, "EVAS_CALLBACK_CHANGED_SIZE_HINTS") r.event_callback_add(EVAS_CALLBACK_IMAGE_PRELOADED, events_cb1, "EVAS_CALLBACK_IMAGE_PRELOADED") r.event_callback_add(EVAS_CALLBACK_IMAGE_UNLOADED, events_cb1, "EVAS_CALLBACK_IMAGE_UNLOADED") ## r.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_IN, events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_IN") ## r.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_OUT, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_PRE, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_POST, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_RENDER_PRE, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_RENDER_POST, events_cb1, "") #? r.event_callback_add(EVAS_CALLBACK_IMAGE_RESIZE, events_cb1, "") #? r.event_callback_add(EVAS_CALLBACK_DEVICE_CHANGED, events_cb1, "") r.show() r2 = Rectangle(win.evas, size=(120, 70), color=(0, 100, 0, 100), pos=(70, 70)) r2.show() hbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, horizontal=True) win.resize_object_add(hbox) hbox.show() b = Button(win, text="show / hide", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, r: r.hide() if r.visible else r.show(), r) b.show() b = Button(win, text="move", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, t: r.pos_set(r.pos[0] + 1, r.pos[1]), r) b.show() b = Button(win, text="resize", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add( lambda b, r: r.size_set(r.size[0] + 1, r.size[1] + 1), r) b.show() b = Button(win, text="delete", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, r: r.delete(), r) b.show() b = Button(win, text="raise", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, r: r.raise_(), r) b.show() b = Button(win, text="hints", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, r: r.size_hint_align_set(0.0, 0.0), r) b.show() b = Button(win, text="del cbs", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(btn_del_cbs_cb, r) b.show() win.show()
def core_evas_object_callbacks_clicked(obj, item=None): win = StandardWindow("evas3d", "Evas object callbacks", autodel=True, size=(320,320)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) text = Text(win.evas, text="Events printed on console", size=(300, 30), color=(0,0,0,255)) text.font_set("Sans", 12) text.pos = (10, 10) text.show() r = Rectangle(win.evas, size=(100,100), color=(100,0,0,200), pos=(50,50)) r.event_callback_add(EVAS_CALLBACK_MOUSE_IN, events_cb2, "EVAS_CALLBACK_MOUSE_IN") r.event_callback_add(EVAS_CALLBACK_MOUSE_OUT, events_cb2, "EVAS_CALLBACK_MOUSE_OUT") r.event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, events_cb2, "EVAS_CALLBACK_MOUSE_DOWN") r.event_callback_add(EVAS_CALLBACK_MOUSE_UP, events_cb2, "EVAS_CALLBACK_MOUSE_UP") r.event_callback_add(EVAS_CALLBACK_MOUSE_MOVE, events_cb2, "EVAS_CALLBACK_MOUSE_MOVE") r.event_callback_add(EVAS_CALLBACK_MOUSE_WHEEL, events_cb2, "EVAS_CALLBACK_MOUSE_WHEEL") r.event_callback_add(EVAS_CALLBACK_MULTI_DOWN, events_cb2, "EVAS_CALLBACK_MULTI_DOWN") r.event_callback_add(EVAS_CALLBACK_MULTI_UP, events_cb2, "EVAS_CALLBACK_MULTI_UP") r.event_callback_add(EVAS_CALLBACK_MULTI_MOVE, events_cb2, "EVAS_CALLBACK_MULTI_MOVE") r.event_callback_add(EVAS_CALLBACK_FREE, events_cb1, "EVAS_CALLBACK_FREE") r.event_callback_add(EVAS_CALLBACK_KEY_DOWN, events_cb2, "EVAS_CALLBACK_KEY_DOWN") r.event_callback_add(EVAS_CALLBACK_KEY_UP, events_cb2, "EVAS_CALLBACK_KEY_UP") r.event_callback_add(EVAS_CALLBACK_FOCUS_IN, events_cb2, "EVAS_CALLBACK_FOCUS_IN") r.event_callback_add(EVAS_CALLBACK_FOCUS_OUT, events_cb2, "EVAS_CALLBACK_FOCUS_OUT") r.event_callback_add(EVAS_CALLBACK_SHOW, events_cb1, "EVAS_CALLBACK_SHOW") r.event_callback_add(EVAS_CALLBACK_HIDE, events_cb1, "EVAS_CALLBACK_HIDE") r.event_callback_add(EVAS_CALLBACK_MOVE, events_cb1, "EVAS_CALLBACK_MOVE") r.event_callback_add(EVAS_CALLBACK_RESIZE, events_cb1, "EVAS_CALLBACK_RESIZE") r.event_callback_add(EVAS_CALLBACK_RESTACK, events_cb1, "EVAS_CALLBACK_RESTACK") r.event_callback_add(EVAS_CALLBACK_DEL, events_cb1, "EVAS_CALLBACK_DEL") r.event_callback_add(EVAS_CALLBACK_HOLD, events_cb1, "EVAS_CALLBACK_HOLD") r.event_callback_add(EVAS_CALLBACK_CHANGED_SIZE_HINTS, events_cb1, "EVAS_CALLBACK_CHANGED_SIZE_HINTS") r.event_callback_add(EVAS_CALLBACK_IMAGE_PRELOADED, events_cb1, "EVAS_CALLBACK_IMAGE_PRELOADED") r.event_callback_add(EVAS_CALLBACK_IMAGE_UNLOADED, events_cb1, "EVAS_CALLBACK_IMAGE_UNLOADED") ## r.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_IN, events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_IN") ## r.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_OUT, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_PRE, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_POST, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_RENDER_PRE, events_cb1, "") ## r.event_callback_add(EVAS_CALLBACK_RENDER_POST, events_cb1, "") #? r.event_callback_add(EVAS_CALLBACK_IMAGE_RESIZE, events_cb1, "") #? r.event_callback_add(EVAS_CALLBACK_DEVICE_CHANGED, events_cb1, "") r.show() r2 = Rectangle(win.evas, size=(120,70), color=(0,100,0,100), pos=(70,70)) r2.show() hbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, horizontal=True) win.resize_object_add(hbox) hbox.show() b = Button(win, text="show / hide", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, r: r.hide() if r.visible else r.show(), r) b.show() b = Button(win, text="move", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, t: r.pos_set(r.pos[0] + 1, r.pos[1]), r) b.show() b = Button(win, text="resize", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, r: r.size_set(r.size[0] + 1, r.size[1] + 1), r) b.show() b = Button(win, text="delete", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, r: r.delete(), r) b.show() b = Button(win, text="raise", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, r: r.raise_(), r) b.show() b = Button(win, text="hints", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(lambda b, r: r.size_hint_align_set(0.0, 0.0), r) b.show() b = Button(win, text="del cbs", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(btn_del_cbs_cb, r) b.show() win.show()