Cortex  10.0.0-a4
Public Member Functions | List of all members
IECore.MenuDefinition Class Reference

The MenuDefinition class defines the contents of a hierarchical menu containing MenuItemDefinition instances. More...

Public Member Functions

def __init__
 
def prepend (self, path, item)
 Prepends a menu item to the menu. More...
 
def append (self, path, item)
 Appends a menu item at the end. More...
 
def insertBefore (self, path, item, beforePath)
 Insert a menu item before the specified menu item. More...
 
def insertAfter (self, path, item, afterPath)
 Insert a menu item after the specified menu item. More...
 
def remove
 Removes the named menu item. More...
 
def removeMatching (self, regEx)
 Removes all items whose paths match the given regular expression. More...
 
def clear (self)
 Removes all menu items from the definition. More...
 
def items (self)
 Returns a list of tuples of the form (path, MenuItemDefinition). More...
 
def reRooted (self, root)
 Returns a new MenuDefinition containing only the menu items that reside below the specified root path. More...
 
def __repr__ (self)
 

Detailed Description

The MenuDefinition class defines the contents of a hierarchical menu containing MenuItemDefinition instances.

It does nothing towards actually creating a user interface, but instead defines content for a user interface implementation to realise. This allows menus to be defined in a UI agnostic way and then used with different toolkits.

Member Function Documentation

def IECore.MenuDefinition.append (   self,
  path,
  item 
)

Appends a menu item at the end.

The item will appear after all other items in its respective submenu.

References IECore::StreamIndexedIO.remove(), IECore::IndexedIO.remove(), and IECore.MenuDefinition.remove().

def IECore.MenuDefinition.clear (   self)

Removes all menu items from the definition.

References IECore.MenuDefinition.__items.

def IECore.MenuDefinition.insertAfter (   self,
  path,
  item,
  afterPath 
)

Insert a menu item after the specified menu item.

References IECore.MenuDefinition.__pathIndex(), IECore::StreamIndexedIO.remove(), IECore::IndexedIO.remove(), and IECore.MenuDefinition.remove().

def IECore.MenuDefinition.insertBefore (   self,
  path,
  item,
  beforePath 
)

Insert a menu item before the specified menu item.

References IECore.MenuDefinition.__pathIndex(), IECore::StreamIndexedIO.remove(), IECore::IndexedIO.remove(), and IECore.MenuDefinition.remove().

def IECore.MenuDefinition.items (   self)

Returns a list of tuples of the form (path, MenuItemDefinition).

This can be used in realising the menu in a UI toolkit. This list should be considered read-only - use the other methods to add and remove items.

References IECore.MenuDefinition.__items.

Referenced by IECore.MenuDefinition.reRooted().

def IECore.MenuDefinition.prepend (   self,
  path,
  item 
)

Prepends a menu item to the menu.

The item will appear before all other items in its respective submenu.

References IECore::StreamIndexedIO.remove(), IECore::IndexedIO.remove(), and IECore.MenuDefinition.remove().

def IECore.MenuDefinition.remove (   self,
  path,
  raiseIfMissing = True 
)

Removes the named menu item.

Raises a KeyError if no such item exists and raiseIfMissing is True.

References IECore.MenuDefinition.__items.

Referenced by IECore.MenuDefinition.append(), IECore.MenuDefinition.insertAfter(), IECore.MenuDefinition.insertBefore(), and IECore.MenuDefinition.prepend().

def IECore.MenuDefinition.removeMatching (   self,
  regEx 
)

Removes all items whose paths match the given regular expression.

References IECore.MenuDefinition.__items.

def IECore.MenuDefinition.reRooted (   self,
  root 
)

Returns a new MenuDefinition containing only the menu items that reside below the specified root path.

The paths in this new definition are all adjusted to be relative to the requested root.

References IECore.MenuDefinition.__items, and IECore.MenuDefinition.items().


The documentation for this class was generated from the following file: