In [29]:
%load_ext autoreload
%autoreload 2


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

In [31]:
cd src/


[Errno 2] No such file or directory: 'src/'
/home/slorg1/workspace/simple_menu/src

In [32]:
from simple_menu.builders.AbstractMenuBuilder import AbstractMenuBuilder
from simple_menu.builders.PropertiesMenuBuilder import PropertiesMenuBuilder
from simple_menu.handlers.MenuHandler import MenuHandler

In [34]:
builder = PropertiesMenuBuilder('../conf/sample.properties')
dynamic_sections = {'section_menu_3':[("This is a dynamic section's label",None)]}
menu = builder.build(dynamic_sections)

In [35]:
def print_my_custom_action():
    print 'It works!'
def print_shutdown():
    print 'SHUT DOWN !'

m_h = MenuHandler(menu,{'FEED':print_my_custom_action,'SHUTDOWN':print_shutdown})

In [ ]:
m_h.get_current_location()

In [27]:
m_h.next()


Out[27]:
'menu 3'

In [26]:
m_h.previous()


Out[26]:
'menu 2'

In [28]:
m_h.forward()


Out[28]:
"This is a dynamic section's label"

In [ ]:
m_h.back()