davemds pushed a commit to branch master. http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=b71a0af896a51dd9bfa85cce94c5b8969e7281ef
commit b71a0af896a51dd9bfa85cce94c5b8969e7281ef Author: Dave Andreoli <d...@gurumeditation.it> Date: Fri Jan 23 20:37:04 2015 +0100 Add a new example for win main_menu --- examples/elementary/test.py | 1 + examples/elementary/test_main_menu.py | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/examples/elementary/test.py b/examples/elementary/test.py index 19fdf25..e8ef6af 100755 --- a/examples/elementary/test.py +++ b/examples/elementary/test.py @@ -216,6 +216,7 @@ items = [ ("Flip Selector", "test_flipselector", "flipselector_clicked"), ("Hoversel", "test_hoversel", "hoversel_clicked"), ("Index", "test_index", "index_clicked"), + ("Main Menu", "test_main_menu", "main_menu_clicked"), ("Menu", "test_menu", "menu_clicked"), ("Radios", "test_radio", "radio_clicked"), ("Segment Control", "test_segment_control", "segment_control_clicked"), diff --git a/examples/elementary/test_main_menu.py b/examples/elementary/test_main_menu.py new file mode 100644 index 0000000..01628f5 --- /dev/null +++ b/examples/elementary/test_main_menu.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# encoding: utf-8 + +from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH +from efl import elementary +from efl.elementary.window import StandardWindow +from efl.elementary.menu import Menu +from efl.elementary.label import Label + + +def _click_me_cb(menu, item, menu_it1): + menu_it1.disabled = not menu_it1.disabled + print("The first item is now %s" % ( + "disabled" if menu_it1.disabled else "enabled")) + +def main_menu_clicked(obj): + win = StandardWindow("window-mainmenu", "Main Menu", + autodel=True, size=(250, 350)) + if obj is None: + win.callback_delete_request_add(lambda o: elementary.exit()) + + lb = Label(win, size_hint_weight=EXPAND_BOTH, + text="Note: the D-Bus menu example requires support from the " + "desktop environment to display the application menu") + win.resize_object_add(lb) + lb.show() + + menu = win.main_menu_get() + + menu_it = menu.item_add(None, "first item", "home") + menu.item_add(menu_it, "first item", "elementary") + menu_it1 = menu.item_add(menu_it, "submenu") + menu.item_add(menu_it1, "first item") + menu.item_add(menu_it1, "second item", "gimp") + + menu_it = menu.item_add(None, "second item") + menu_it1 = menu.item_add(menu_it, "disabled item") + menu_it1.disabled = True + + menu.item_separator_add(menu_it) + menu.item_add(menu_it, "click me :-)", None, _click_me_cb, menu_it1) + menu.item_add(menu_it, "third item", "applications-email-panel", ) + menu_it1 = menu.item_add(menu_it, "sub menu") + menu.item_add(menu_it1, "first sub item") + + win.show() + + +if __name__ == "__main__": + elementary.init() + + main_menu_clicked(None) + + elementary.run() + elementary.shutdown() + --