def notify_clicked(obj, it): win = elementary.Window("notify", elementary.ELM_WIN_BASIC) win.callback_destroy_add(destroy) win.title_set("Notify test") win.autodel_set(True) win.size_hint_min_set(160, 160) win.size_hint_max_set(320, 320) win.resize(320, 320) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() tb = elementary.Table(win) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(tb) tb.show() bt = elementary.Button(win) bt.label_set("Show notify without sleep") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_CENTER) tb.pack(bt, 0, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.label_set("Show notify with sleep (5 seconds)") bt.callback_clicked_add(notify_show_sleep, win, elementary.ELM_NOTIFY_ORIENT_CENTER) tb.pack(bt, 0, 1, 1, 1) bt.show() win.show()
def table_clicked(obj): win = elementary.Window("table", elementary.ELM_WIN_BASIC) win.title_set("Table") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() tb = elementary.Table(win) win.resize_object_add(tb) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) tb.show() bt = elementary.Button(win) bt.text_set("Button 1") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 0, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 2") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 1, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 3") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 2, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 4") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 0, 1, 2, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 5") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 2, 1, 1, 3) bt.show() bt = elementary.Button(win) bt.text_set("Button 6") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 0, 2, 2, 2) bt.show() win.show()
def photo_clicked(obj): win = elementary.Window("photo", elementary.ELM_WIN_BASIC) win.title_set("Photo test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() sc = elementary.Scroller(win) sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(sc) sc.show() elementary.need_ethumb() tb = elementary.Table(win) tb.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) sc.content = tb tb.show() n = 0 for j in range(12): for i in range(12): ph = elementary.Photo(win) name = "images/%s" % (images[n]) n += 1 if n >= 9: n = 0 ph.aspect_fixed = False ph.size = 80 if n == 8: ph.thumb = name else: ph.file = name ph.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ph.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) ph.editable = True if n in [2, 3]: ph.fill_inside = True ph.style = "shadow" tb.pack(ph, i, j, 1, 1) ph.show() win.resize(300, 300) win.show()
def video_clicked(obj): win = elementary.Window("video", elementary.ELM_WIN_BASIC) win.title = "video" win.autodel = True win.alpha = True # Needed to turn video fast path on bg = elementary.Background(win) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(bg) bg.show() video = elementary.Video(win) video.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(video) video.show() notify = elementary.Notify(win) notify.orient = elementary.ELM_NOTIFY_ORIENT_BOTTOM notify.timeout = 3.0 player = elementary.Player(win) player.content = video notify.content = player player.show() tb = elementary.Table(win) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(tb) bt = elementary.FileselectorButton(win) bt.text = "Select Video" bt.callback_file_chosen_add(my_bt_open, video) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.5, 0.1) tb.pack(bt, 0, 0, 1, 1) bt.show() tb.show() video.event_callback_add(evas.EVAS_CALLBACK_MOUSE_MOVE, notify_show, notify) video.event_callback_add(evas.EVAS_CALLBACK_MOUSE_IN, notify_block, notify) video.event_callback_add(evas.EVAS_CALLBACK_MOUSE_OUT, notify_unblock, notify) win.resize(800, 600) win.show()
def thumb_clicked(obj): if not elementary.need_ethumb(): print("Ethumb not available!") return images = ("panel_01.jpg", "plant_01.jpg", "rock_01.jpg", "rock_02.jpg", "sky_01.jpg", "sky_02.jpg", "sky_03.jpg", "sky_04.jpg", "wood_01.jpg", "mystrale.jpg", "mystrale_2.jpg") win = elementary.StandardWindow("thumb", "Thumb") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) tb = elementary.Table(win) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) n = 0 for j in range(12): for i in range(12): th = elementary.Thumb(win) n = (n + 1) % 11 th.file = "images/%s" % (images[n]) th.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) th.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(th, i, j, 1, 1) th.editable = True th.show() sc = elementary.Scroller(win) sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(sc) sc.content_set(tb) tb.show() sc.show() win.resize(600, 600) win.show()
elementary.init() win = elementary.Window("image", elementary.ELM_WIN_BASIC) win.callback_destroy_add(destroy) win.title_set("Image") win.autodel_set(True) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() frame = elementary.Frame(win) frame.label_set("Test") frame.show() table = elementary.Table(win) table.show() table.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) # frame.content_set(table) bx = elementary.Box(win) win.resize_object_add(bx) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.show() frame.content_set(bx) image = elementary.Image(win) # #image.size_set(300, 500) # image.resize(600, 400) image.file_set("/tmp/ca_par_jour.png") # #image.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_BOTH, 1, 1)
def scroller_clicked(obj): win = elementary.Window("scroller", elementary.ELM_WIN_BASIC) win.title_set("Scroller") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() tb = elementary.Table(win) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) img = [ "images/panel_01.jpg", "images/plant_01.jpg", "images/rock_01.jpg", "images/rock_02.jpg", "images/sky_01.jpg", "images/sky_02.jpg", "images/sky_03.jpg", "images/sky_04.jpg", "images/wood_01.jpg" ] n = 0 for j in range(12): for i in range(12): bg2 = elementary.Background(win) bg2.file_set(img[n]) n = n + 1 if n >= 9: n = 0 bg2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bg2.size_hint_min_set(318, 318) tb.pack(bg2, i, j, 1, 1) bg2.show() sc = elementary.Scroller(win) sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) sc.callback_edge_top_add(cb_edges, "top") sc.callback_edge_bottom_add(cb_edges, "bottom") sc.callback_edge_left_add(cb_edges, "left") sc.callback_edge_right_add(cb_edges, "right") sc.callback_scroll_drag_start_add(cb_drags, "start") sc.callback_scroll_drag_stop_add(cb_drags, "stop") sc.callback_scroll_anim_start_add(cb_anims, "start") sc.callback_scroll_anim_stop_add(cb_anims, "stop") win.resize_object_add(sc) sc.content_set(tb) tb.show() sc.page_relative_set(1.0, 1.0) sc.show() tb2 = elementary.Table(win) tb2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(tb2) bt = elementary.Button(win) bt.text_set("to 300 300") bt.callback_clicked_add(my_scroller_go_300_300, sc) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.1, 0.1) tb2.pack(bt, 0, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("to 900 300") bt.callback_clicked_add(my_scroller_go_900_300, sc) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.1) tb2.pack(bt, 1, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("to 300 900") bt.callback_clicked_add(my_scroller_go_300_900, sc) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.1, 0.9) tb2.pack(bt, 0, 1, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("to 900 900") bt.callback_clicked_add(my_scroller_go_900_900, sc) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.9) tb2.pack(bt, 1, 1, 1, 1) bt.show() tb2.show() win.resize(320, 320) win.show()
def toolbar_clicked(obj): win = elementary.Window("toolbar", elementary.ELM_WIN_BASIC) win.title_set("Toolbar") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() bx = elementary.Box(win) win.resize_object_add(bx) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.show() tb = elementary.Toolbar(win) tb.homogeneous = False tb.size_hint_weight_set(0.0, 0.0) tb.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) ph1 = elementary.Photo(win) ph2 = elementary.Photo(win) ph3 = elementary.Photo(win) ph4 = elementary.Photo(win) item = tb.item_append("document-print", "Hello", tb_1) item.disabled = True item = tb.item_append("clock", "World,", tb_2, ph2) item.selected_set(True) tb.item_append("folder-new", "here", tb_3, ph4) tb.item_append("clock", "comes", tb_4, ph4) tb.item_append("folder-new", "python-elementary!", tb_5, ph4) item = tb.item_append("clock", "Menu", tb_5, ph4) item.menu_set(True) tb.menu_parent_set(win) menu = item.menu_get() menu.item_add(None, "Here", "clock", tb_3, ph4) menu_item = menu.item_add(None, "Comes", "refresh", tb_4, ph4) menu.item_add(menu_item, "hey ho", "folder-new", tb_4, ph4) menu.item_add(None, "python-elementary", "document-print", tb_5, ph4) bx.pack_end(tb) tb.show() tb = elementary.Table(win) tb.size_hint_weight_set(0.0, evas.EVAS_HINT_EXPAND) tb.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) ph1.size_set(40) ph1.file_set("images/plant_01.jpg") ph1.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ph1.size_hint_align_set(0.5, 0.5) tb.pack(ph1, 0, 0, 1, 1) ph1.show() ph2.size_set(80) ph2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ph2.size_hint_align_set(0.5, 0.5) tb.pack(ph2, 1, 0, 1, 1) ph2.show() ph3.size_set(40) ph3.file_set("images/sky_01.jpg") ph3.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ph3.size_hint_align_set(0.5, 0.5) tb.pack(ph3, 0, 1, 1, 1) ph3.show() ph4.size_set(60) ph4.file_set("images/sky_02.jpg") ph4.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ph4.size_hint_align_set(0.5, 0.5) tb.pack(ph4, 1, 1, 1, 1) ph4.show() bx.pack_end(tb) tb.show() win.resize(320, 300) win.show()
def gengrid_clicked(obj): global item_count item_count = 25 # window win = elementary.Window("gengrid", elementary.ELM_WIN_BASIC) win.title_set("Gengrid") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) # background bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() # main table tb = elementary.Table(win) win.resize_object_add(tb) tb.homogeneous_set(0) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) tb.show() # gengrid itc = elementary.GengridItemClass(item_style="default", text_get_func=gg_text_get, content_get_func=gg_content_get, state_get_func=gg_state_get, del_func=gg_del) gg = elementary.Gengrid(win) gg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) gg.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) gg.horizontal_set(False) gg.bounce_set(False, True) gg.item_size_set(80, 80) gg.align_set(0.5, 0.0) tb.pack(gg, 0, 0, 6, 1) gg.callback_selected_add(gg_sel) gg.callback_unselected_add(gg_unsel) gg.callback_clicked_double_add(gg_clicked_double) gg.show() # add the first items for i in range(item_count): gg.item_append(itc, i, None) # multi select def multi_select_changed(bt, gg): gg.multi_select_set(bt.state) print((gg.multi_select_get())) bt = elementary.Check(win) bt.text = "MultiSelect" bt.state = gg.multi_select_get() bt.callback_changed_add(multi_select_changed, gg) tb.pack(bt, 0, 1, 1, 1) bt.show() # horizontal def horizontal_changed(bt, gg): gg.horizontal_set(bt.state) bt = elementary.Check(win) bt.text_set("Horizontal") bt.callback_changed_add(horizontal_changed, gg) tb.pack(bt, 1, 1, 1, 1) bt.show() # bounce h def bounce_h_changed(bt, gg): (h_bounce, v_bounce) = gg.bounce_get() gg.bounce_set(bt.state, v_bounce) print((gg.bounce_get())) bt = elementary.Check(win) bt.text_set("BounceH") (h_bounce, v_bounce) = gg.bounce_get() bt.state = h_bounce bt.callback_changed_add(bounce_h_changed, gg) tb.pack(bt, 4, 1, 1, 1) bt.show() # bounce v def bounce_v_changed(bt, gg): (h_bounce, v_bounce) = gg.bounce_get() gg.bounce_set(h_bounce, bt.state) print((gg.bounce_get())) bt = elementary.Check(win) bt.text_set("BounceV") (h_bounce, v_bounce) = gg.bounce_get() bt.state = v_bounce bt.callback_changed_add(bounce_v_changed, gg) tb.pack(bt, 5, 1, 1, 1) bt.show() # item size def item_size_w_changed(sl, gg): (w, h) = gg.item_size_get() gg.item_size_set(sl.value, h) print((gg.item_size_get())) def item_size_h_changed(sl, gg): (w, h) = gg.item_size_get() gg.item_size_set(w, sl.value) print((gg.item_size_get())) sl = elementary.Slider(win) sl.text_set("ItemSizeW") sl.min_max_set(0, 500) sl.indicator_format_set("%.0f") sl.unit_format_set("%.0f") sl.span_size_set(100) (w, h) = gg.item_size_get() sl.value = w sl.callback_changed_add(item_size_w_changed, gg) tb.pack(sl, 0, 2, 2, 1) sl.show() sl = elementary.Slider(win) sl.text_set("ItemSizeH") sl.min_max_set(0, 500) sl.indicator_format_set("%.0f") sl.unit_format_set("%.0f") sl.span_size_set(100) (w, h) = gg.item_size_get() sl.value = h sl.callback_changed_add(item_size_h_changed, gg) tb.pack(sl, 0, 3, 2, 1) sl.show() # align def alignx_changed(sl, gg): (ax, ay) = gg.align_get() gg.align_set(sl.value, ay) print((gg.align_get())) def aligny_changed(sl, gg): (ax, ay) = gg.align_get() gg.align_set(ax, sl.value) print((gg.align_get())) sl = elementary.Slider(win) sl.text_set("AlignX") sl.min_max_set(0.0, 1.0) sl.indicator_format_set("%.2f") sl.unit_format_set("%.2f") sl.span_size_set(100) (ax, ay) = gg.align_get() sl.value = ax sl.callback_changed_add(alignx_changed, gg) tb.pack(sl, 0, 4, 2, 1) sl.show() sl = elementary.Slider(win) sl.text_set("AlignY") sl.min_max_set(0.0, 1.0) sl.indicator_format_set("%.2f") sl.unit_format_set("%.2f") sl.span_size_set(100) (ax, ay) = gg.align_get() sl.value = ax sl.callback_changed_add(aligny_changed, gg) tb.pack(sl, 0, 5, 2, 1) sl.show() # select first def select_first_clicked(bt, gg): ggi = gg.first_item ggi.selected = not ggi.selected bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Select first") bt.callback_clicked_add(select_first_clicked, gg) tb.pack(bt, 2, 2, 1, 1) bt.show() # select last def select_last_clicked(bt, gg): ggi = gg.last_item ggi.selected = not ggi.selected bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Select last") bt.callback_clicked_add(select_last_clicked, gg) tb.pack(bt, 3, 2, 1, 1) bt.show() # selection del def seldel_clicked(bt, gg): for ggi in gg.selected_items_get(): ggi.delete() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Sel del") bt.callback_clicked_add(seldel_clicked, gg) tb.pack(bt, 4, 2, 1, 1) bt.show() # clear def clear_clicked(bt, gg): global item_count item_count = 0 gg.clear() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Clear") bt.callback_clicked_add(clear_clicked, gg) tb.pack(bt, 5, 2, 1, 1) bt.show() # show first/last def show_clicked(bt, gg, first): ggi = gg.first_item if first else gg.last_item ggi.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Show first") bt.callback_clicked_add(show_clicked, gg, True) tb.pack(bt, 2, 3, 1, 1) bt.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Show last") bt.callback_clicked_add(show_clicked, gg, False) tb.pack(bt, 3, 3, 1, 1) bt.show() # bring-in first/last def bring_in_clicked(bt, gg, first): ggi = gg.first_item if first else gg.last_item ggi.bring_in() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("BringIn first") bt.callback_clicked_add(bring_in_clicked, gg, True) tb.pack(bt, 4, 3, 1, 1) bt.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("BringIn last") bt.callback_clicked_add(bring_in_clicked, gg, False) tb.pack(bt, 5, 3, 1, 1) bt.show() # append def append_clicked(bt, gg, n): global item_count while n: item_count += 1 gg.item_append(itc, item_count, None) n -= 1 bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Append 1") bt.callback_clicked_add(append_clicked, gg, 1) tb.pack(bt, 2, 4, 1, 1) bt.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Append 100") bt.callback_clicked_add(append_clicked, gg, 100) tb.pack(bt, 3, 4, 1, 1) bt.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Append 1000") bt.callback_clicked_add(append_clicked, gg, 1000) tb.pack(bt, 4, 4, 1, 1) bt.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Append 10000 :)") bt.callback_clicked_add(append_clicked, gg, 10000) tb.pack(bt, 5, 4, 1, 1) bt.show() # prepend def prepend_clicked(bt, gg): global item_count item_count += 1 gg.item_prepend(itc, item_count) bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Prepend") bt.callback_clicked_add(prepend_clicked, gg) tb.pack(bt, 2, 5, 1, 1) bt.show() # insert_before def ins_before_clicked(bt, gg): global item_count item_count += 1 before = gg.selected_item_get() if before: gg.item_insert_before(itc, item_count, before) else: print("nothing selected") bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Ins before") bt.callback_clicked_add(ins_before_clicked, gg) tb.pack(bt, 3, 5, 1, 1) bt.show() # insert_after def ins_after_clicked(bt, gg): global item_count item_count += 1 after = gg.selected_item_get() if after: gg.item_insert_after(itc, item_count, after) else: print("nothing selected") bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Ins after") bt.callback_clicked_add(ins_after_clicked, gg) tb.pack(bt, 4, 5, 1, 1) bt.show() win.resize(480, 800) win.show()
def list_clicked(obj, item=None): win = elementary.Window("list", elementary.ELM_WIN_BASIC) win.title_set("List") win.autodel_set(True) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() li = elementary.List(win) win.resize_object_add(li) li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(1, 1) it1 = li.item_append("Hello", ic) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) li.item_append("Hello", ic) ic = elementary.Icon(win) ic.standard_set("edit") ic.resizable_set(0, 0) ic2 = elementary.Icon(win) ic2.standard_set("clock") ic2.resizable_set(0, 0) li.item_append(".", ic, ic2) ic = elementary.Icon(win) ic.standard_set("delete") ic.resizable_set(0, 0) ic2 = elementary.Icon(win) ic2.standard_set("clock") ic2.resizable_set(0, 0) it2 = li.item_append("How", ic, ic2) bx = elementary.Box(win) bx.horizontal_set(True) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.5, 0.5) bx.pack_end(ic) ic.show() ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.5, 0.0) bx.pack_end(ic) ic.show() ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.0, evas.EVAS_HINT_EXPAND) bx.pack_end(ic) ic.show() li.item_append("are") li.item_append("you") it3 = li.item_append("doing") li.item_append("out") li.item_append("there") li.item_append("today") li.item_append("?") it4 = li.item_append("Here") li.item_append("are") li.item_append("some") li.item_append("more") li.item_append("items") li.item_append("Is this label long enough?") it5 = li.item_append( "Maybe this one is even longer so we can test long long items.") li.go() li.show() tb2 = elementary.Table(win) tb2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(tb2) bt = elementary.Button(win) bt.text_set("Hello") bt.callback_clicked_add(my_list_show_it, it1) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.5) tb2.pack(bt, 0, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("How") bt.callback_clicked_add(my_list_show_it, it2) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.5) tb2.pack(bt, 0, 1, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("doing") bt.callback_clicked_add(my_list_show_it, it3) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.5) tb2.pack(bt, 0, 2, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Here") bt.callback_clicked_add(my_list_show_it, it4) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.5) tb2.pack(bt, 0, 3, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Maybe this...") bt.callback_clicked_add(my_list_show_it, it5) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.5) tb2.pack(bt, 0, 4, 1, 1) bt.show() tb2.show() win.resize(320, 320) win.show()
def notify_show(bt, win, orient): notify = elementary.Notify(win) notify.repeat_events_set(False) notify.orient_set(elementary.ELM_NOTIFY_ORIENT_CENTER) frame = elementary.Frame(win) frame.label_set("Graphiques") frame.show() notify.content_set(frame) # tb = elementary.Table(win) #tb.homogenous_set(True) # tb.show() # frame.content_set(tb) vbox = elementary.Box(win) vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) vbox.show() frame.content_set(vbox) hbox = elementary.Box(win) hbox.horizontal_set(True) hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) hbox.show() frame_data = elementary.Frame(win) frame_data.label_set("Données") frame_data.show() table_data = elementary.Table(win) table_data.show() frame_data.content_set(table_data) x_1 = 0 y_1 = 0 for log in LogType.objects.filter(id__gt=8).exclude(nom="maj_stats"): check = elementary.Check(win) check.label_set(log.description) check.callback_changed_add(add_check) check.show() table_data.pack(check, x_1, y_1, 1, 1) if x_1 > 2: x_1 = 0 y_1 += 1 else: x_1 += 1 frame_type = elementary.Frame(win) frame_type.label_set("Type") frame_type.show() table_type = elementary.Table(win) table_type.show() frame_type.content_set(table_type) rd = elementary.Radio(win) rd.state_value_set(0) rd.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) rd.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) rd.label_set("entier") table_type.pack(rd, 0, 0, 1, 1) rd.show() rdg = rd rd = elementary.Radio(win) rd.state_value_set(1) rd.label_set("par mois") rd.group_add(rdg) table_type.pack(rd, 0, 1, 1, 1) rd.show() rd = elementary.Radio(win) rd.state_value_set(2) rd.group_add(rdg) rd.label_set("par semaine") table_type.pack(rd, 1, 0, 1, 1) rd.show() rd = elementary.Radio(win) rd.state_value_set(3) rd.group_add(rdg) rd.label_set("par année") table_type.pack(rd, 1, 1, 1, 1) rd.show() toggle = elementary.Toggle(win) toggle.label_set("Légende") toggle.states_labels_set("avec", "sans") toggle.show() toggle.state_set(True) table_type.pack(toggle, 0, 2, 2, 1) frame_interval = elementary.Frame(win) frame_interval.label_set("Interval") frame_interval.show() table_interval = elementary.Table(win) table_interval.show() frame_interval.content_set(table_interval) label = elementary.Label(win) label.label_set("Début:") label.show() table_interval.pack(label, 0, 0, 1, 1) button = elementary.Button(win) button.label_set("31") button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) button.show() table_interval.pack(button, 1, 0, 1, 1) button = elementary.Button(win) button.label_set("Janvier") button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) button.show() table_interval.pack(button, 2, 0, 1, 1) button = elementary.Button(win) button.label_set("2011") button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) button.show() table_interval.pack(button, 3, 0, 1, 1) label = elementary.Label(win) label.label_set("Fin:") label.show() table_interval.pack(label, 0, 1, 1, 1) button = elementary.Button(win) button.label_set("31") button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) button.show() table_interval.pack(button, 1, 1, 1, 1) button = elementary.Button(win) button.label_set("Décembre") button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) button.show() table_interval.pack(button, 2, 1, 1, 1) button = elementary.Button(win) button.label_set("2011") button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) button.show() table_interval.pack(button, 3, 1, 1, 1) bt = elementary.Button(win) bt.label_set("Afficher") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.show() table_interval.pack(bt, 0, 2, 4, 1) hbox.pack_end(frame_data) hbox.pack_end(frame_type) hbox.pack_end(frame_interval) #tb.pack(frame_data, 0, 0, 3, 3) #tb.pack(frame_type, 3, 0, 2, 3) #tb.pack(frame_interval, 5, 0, 2, 3) vbox.pack_end(hbox) # frame_image = elementary.Frame(win) # frame_image.label_set("Interval") # frame_image.show() # table_interval = elementary.Table(win) # table_interval.show() # frame_interval.content_set(table_interval) # box_image = elementary.Box(win) # box_image.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) # box_image.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) #win.resize_object_add(box0) # box_image.show() # frame_image.content_set(box_image) # bg = elementary.Background(win) # #frame_image.resize_object_add(bg) # bg.file_set("/tmp/ca_par_jour.png") # bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) # bg.show() # frame_image.content_set(bg) image = elementary.Image(win) # #image.size_set(300, 500) #image.resize(600, 400) image.file_set("ca_par_jour.png") # #image.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_BOTH, 1, 1) image.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) image.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) # #icon.scale_set(0, 0) # #win.resize_object_add(icon) # tb.pack(image, 0, 3, 7, 3) image.show() vbox.pack_end(image) # box_image.pack_end(image) #tb.pack(box_image, 0, 3, 7, 3) sp = elementary.Separator(win) sp.horizontal_set(True) sp.show() #tb.pack(sp, 0, 6, 7, 1) vbox.pack_end(sp) bt = elementary.Button(win) bt.label_set("Retour") bt.callback_clicked_add(notify_close, notify) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.show() #tb.pack(bt, 0, 7, 7, 1) vbox.pack_end(bt) notify.show()
def notify_clicked(obj): win = elementary.Window("notify", elementary.ELM_WIN_BASIC) win.title_set("Notify test") win.autodel_set(True) win.size_hint_min_set(160, 160) win.size_hint_max_set(320, 320) win.resize(320, 320) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() tb = elementary.Table(win) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(tb) tb.show() bt = elementary.Button(win) bt.text_set("Top") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP) tb.pack(bt, 1, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Center") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_CENTER) tb.pack(bt, 1, 1, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Bottom") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM) tb.pack(bt, 1, 2, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Left") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_LEFT) tb.pack(bt, 0, 1, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Top Left") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP_LEFT) tb.pack(bt, 0, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Bottom Left") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM_LEFT) tb.pack(bt, 0, 2, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Right") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_RIGHT) tb.pack(bt, 2, 1, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Top Right") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP_RIGHT) tb.pack(bt, 2, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Bottom Right") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM_RIGHT) tb.pack(bt, 2, 2, 1, 1) bt.show() win.show()
def mapbuf_clicked(obj, item=None): global mb_list win = elementary.Window("mapbuf", elementary.ELM_WIN_BASIC) win.title_set("Mapbuf test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) bg.file = "images/sky_04.jpg" win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() vbox = elementary.Box(win) vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) win.resize_object_add(vbox) vbox.show() # launcher sc = elementary.Scroller(win) sc.bounce = (True, False) sc.policy = (elementary.ELM_SCROLLER_POLICY_OFF, elementary.ELM_SCROLLER_POLICY_OFF) sc.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) vbox.pack_end(sc) bx = elementary.Box(win) bx.horizontal = True bx.homogeneous = True bx.show() for k in range(8): tb = elementary.Table(win) tb.size_hint_align = (0.5, 0.5) tb.size_hint_weight = (0.0, 0.0) tb.show() pad = evas.Rectangle(win.evas) pad.color = (255, 255, 0, 255) pad.size_hint_min = (464, 4) pad.size_hint_weight = (0.0, 0.0) pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) pad.show() tb.pack(pad, 1, 0, 5, 1) pad = evas.Rectangle(win.evas) pad.color = (255, 255, 0, 255) pad.size_hint_min = (464, 4) pad.size_hint_weight = (0.0, 0.0) pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) pad.show() tb.pack(pad, 1, 11, 5, 1) pad = evas.Rectangle(win.evas) pad.color = (255, 255, 0, 255) pad.size_hint_min = (4, 4) pad.size_hint_weight = (0.0, 0.0) pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) pad.show() tb.pack(pad, 0, 1, 1, 10) pad = evas.Rectangle(win.evas) pad.color = (255, 255, 0, 255) pad.size_hint_min = (4, 4) pad.size_hint_weight = (0.0, 0.0) pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) pad.show() tb.pack(pad, 6, 1, 1, 10) mb = elementary.Mapbuf(win) mb_list.append(mb) mb.content = tb bx.pack_end(mb) mb.show() n = m = 0 for j in range(5): for i in range(5): ic = elementary.Icon(win) ic.scale_set(0.5) ic.file_set("images/icon_%02d.png" % (n)) ic.resizable_set(0, 0) ic.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ic.size_hint_align_set(0.5, 0.5) tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1) ic.show() lb = elementary.Label(win) lb.style = "marker" lb.text = names[m] tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1) lb.show() n = n + 1 if n < 23 else 0 m = m + 1 if m < 15 else 0 sc.content = bx sc.page_relative_set(1.0, 1.0) sc.show() # controls hbox = elementary.Box(win) hbox.horizontal = True hbox.homogeneous = True hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0) hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0) vbox.pack_start(hbox) hbox.show() ck = elementary.Check(win) ck.text = "Map" ck.state = False ck.callback_changed_add(cb_ck_map) hbox.pack_end(ck) ck.show() ck = elementary.Check(win) ck.callback_changed_add(cb_ck_alpha) ck.text = "Alpha" ck.state = True hbox.pack_end(ck) ck.show() ck = elementary.Check(win) ck.callback_changed_add(cb_ck_smooth) ck.text = "Smooth" ck.state = True hbox.pack_end(ck) ck.show() ck = elementary.Check(win) ck.callback_changed_add(cb_ck_fs, win) ck.text = "FS" ck.state = False hbox.pack_end(ck) ck.show() bt = elementary.Button(win) bt.text = "Close" bt.callback_clicked_add(cb_btn_close, win) bt.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0) hbox.pack_end(bt) bt.show() win.resize(480, 800) win.show()