Class cerebro.menus.MainMenu

class cerebro.menus.MainMenu[source]

Class providing API to add custom menus to the application main menu.

Methods

A class object can be acquired through the function:

main_menu = cerebro.menus.main_menu()   

Then you can add custom submenu into it:

my_menu = main_menu.add_menu('My Submenu')
my_menu.add_item('my_package.my_module.my_action', 'My menu item')
add_menu(name, icon='')[source]
Parameters:
  • name (string) – submenu name.
  • icon (string) – file path to submenu item.
Returns:

added submenu.

Return type:

cerebro.menus.Menu

Adds a submenu to the application main menu.

main_menu = cerebro.menus.main_menu()   
my_menu = main_menu.add_menu('My Submenu')
my_menu.add_item('my_package.my_module.my_action', 'My menu item')      

See also

insert_menu().

insert_menu(pos, name, icon='')[source]
Parameters:pos (int) – submenu position.
Returns:inserted submenu.
Return type:cerebro.menus.Menu

Inserts a submenu into a certain position of the application main menu.

See also

add_menu().

size()[source]
Returns:the application main menu size.
Return type:int