Package screenlets :: Module menu
[hide private]
[frames] | no frames]

Module menu

source code

Classes [hide private]
  ApplicationMenu
A utility-class to simplify the creation of gtk.Menus from directories with desktop-files.
  DefaultMenuItem
A container with constants for the default menuitems
  ImageMenuItem
A menuitem with a custom image and label.
Functions [hide private]
 
_(s) source code
 
add_menuitem(menu, label, callback=None, cb_data=None)
Convenience function to create a menuitem, connect a callback, and add the menuitem to menu.
source code
 
add_image_menuitem(menu, stock, label=None, callback=None, cb_data=None)
Convenience function to create an ImageMenuItem, connect a callback, and add the menuitem to menu.
source code
 
add_submenuitem(root_menu, label, lst, images=None, image_size=(22, 22), callback=None, prefix=None)
Convenience function to add submenuitems to a right-click menu through a list.
source code
 
add_menuitem_with_item(menu, item, callback=None, cb_data=None)
Convenience function to add a menuitem to a menu and connect a callback.
source code
 
create_menu_from_file(filename, callback)
Creates a menu from an XML-file and returns None if something went wrong
source code
 
create_menu_from_xml(node, callback, icon_size=22)
Create a gtk.Menu by an XML-Node
source code
 
fill_menu_from_directory(dirname, menu, callback, filter='*', id_prefix='', id_suffix='', search=[], replace=[], skip=[])
Create MenuItems from a directory.
source code
 
imageitem_from_name(filename, label, icon_size=32)
Creates a new gtk.ImageMenuItem from a given icon/filename.
source code
 
read_desktop_file(filename)
Read ".desktop"-file into a dict NOTE: Should use utils.IniReader ...
source code
Variables [hide private]
  __package__ = 'screenlets'
Function Details [hide private]

add_submenuitem(root_menu, label, lst, images=None, image_size=(22, 22), callback=None, prefix=None)

source code 

Convenience function to add submenuitems to a right-click menu through a list.

images is an optional list of filenames to be used as an image in each menuitem. Each item in the list should either be a string or None. (If an item is None, gtk's no-image icon will be used.)

If callback is not None, each menuitem will be connected to callback with it's label as callback data. If prefix exists, prefix will be prefixed to the label's name in the callback data.

Returns the new submenu.

fill_menu_from_directory(dirname, menu, callback, filter='*', id_prefix='', id_suffix='', search=[], replace=[], skip=[])

source code 

Create MenuItems from a directory. TODO: use regular expressions

imageitem_from_name(filename, label, icon_size=32)

source code 

Creates a new gtk.ImageMenuItem from a given icon/filename. If an absolute path is not given, the function checks for the name of the icon within the current gtk-theme.