Package peppy :: Package actions :: Class OnDemandGlobalListAction
[frames] | no frames]

Class OnDemandGlobalListAction

              object --+    
                       |    
     OnDemandActionMixin --+
                           |
      object --+           |
               |           |
debug.debugmixin --+       |
                   |       |
        SelectAction --+   |
                       |   |
              ListAction --+
                           |
                          OnDemandGlobalListAction
Known Subclasses:

On-demand list that shares its items in all menu bars.

Menu items are shared by using class attributes for the storage. Be aware that you either have to, in your subclass of OnDemandGlobalListAction, have to explicitly name a class attribute 'storage' and it must be a list, or you can call your subclasses class method setStorage and supply it with a list.

Nested Classes

Inherited from ListAction: IdCache

Instance Methods
 
getHash(self)
Simplistic implementation that only keeps track of additions or deletions.
 
getItems(self)
 
updateOnDemand(self)
Hook called before the menu is displayed.

Inherited from ListAction: __init__, dynamic, getIcons, getIndexOfId, getSubIds, insertIntoMenu, showEnable

Inherited from SelectAction: __call__, action, getMenuItemName, getTooltip, initPostHook, initPreHook, insertIntoToolbar, isEnabled

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Methods
 
setStorage(cls, array)
 
trimStorage(cls, num)
 
append(cls, item)
 
remove(cls, item)
 
calcHash(cls)
Hash calculation method to determine if menu items have changed.

Inherited from SelectAction: getHelp, setAcceleratorText, worksWithMajorMode

Inherited from debug.debugmixin: dprint

Class Variables
  globalhash = 0
  storage = None

Inherited from ListAction: abbrev_width, inline, localize_items, menumax

Inherited from SelectAction: alias, default_menu, default_toolbar, global_id, icon, key_bindings, keyboard, name, stock_id, tooltip

Inherited from debug.debugmixin: debuglevel

Properties

Inherited from object: __class__

Method Details

calcHash(cls)
Class Method

 

Hash calculation method to determine if menu items have changed.

The default implementation is a simplistic one that changes every time calcHash is called, guaranteeing that the menu will be updated the next time.

If calcHash sets cls.localhash or cls.globalhash to None, the menu will always be updated.

getHash(self)

 

Simplistic implementation that only keeps track of additions or deletions.

Should more rigorous hashing be needed, override this.

Overrides: ListAction.getHash

getItems(self)

 
Overrides: ListAction.getItems

updateOnDemand(self)

 

Hook called before the menu is displayed.

This method allows the subclass to catch the menu opening event before it anything is added to the menu bar. When used in combination with a list, the list may be reordered and menu items can be inserted or deleted.

Overrides: OnDemandActionMixin.updateOnDemand
(inherited documentation)