Phoenix Logo

phoenix_title wx.lib.agw.persist.persist_handlers.TreeCtrlHandler

Supports saving/restoring a TreeCtrl expansion state, selections and checked items state (meaningful only for lib.agw.customtreectrl.CustomTreeCtrl).

This class handles the following wxPython widgets:

  • TreeCtrl;
  • GenericDirCtrl;
  • lib.agw.customtreectrl.CustomTreeCtrl;
  • lib.agw.hypertreelist.HyperTreeList;

class_hierarchy Class Hierarchy

Inheritance diagram for class TreeCtrlHandler:

method_summary Methods Summary

__init__  
GetCheckedState Returns a list of checked items. Checked items are coded as determined by
GetCheckedStateOfChildren Returns the checked/unchecked state of the children of a tree item.
GetCheckedStateOfItem Returns the checked/unchecked state of a tree item.
GetExpansionState Returns list of expanded items. Expanded items are coded as determined by
GetExpansionStateOfChildren Returns the expansion state of the children of a tree item.
GetExpansionStateOfItem Returns the expansion state of a tree item.
GetIndexOfItem Return the index of item.
GetItemChildren Return the children of item as a list.
GetItemIdentity Return a hashable object that represents the identity of the
GetKind  
GetSelectionState Returns a list of selected items. Selected items are coded as determined by
GetSelectionStateOfChildren Returns the selection state of the children of a tree item.
GetSelectionStateOfItem Returns the selection state of a tree item.
Restore  
Save  
SetCheckedState Checks all tree items whose identity, as determined by TreeCtrlHandler.GetItemIdentity(), is present
SetCheckedStateOfChildren Sets the checked/unchecked state of the children of a tree item.
SetCheckedStateOfItem Sets the checked/unchecked state of a tree item.
SetExpansionState Expands all tree items whose identity, as determined by TreeCtrlHandler.GetItemIdentity(),
SetExpansionStateOfChildren Sets the expansion state of the children of a tree item (expanded or collapsed).
SetExpansionStateOfItem Sets the expansion state of a tree item (expanded or collapsed).
SetSelectedStateOfChildren Sets the selection state of the children of a tree item.
SetSelectedStateOfItem Sets the selection state of a tree item.
SetSelectionState Selects all tree items whose identity, as determined by TreeCtrlHandler.GetItemIdentity(),

api Class API



class TreeCtrlHandler(AbstractHandler)

Supports saving/restoring a TreeCtrl expansion state, selections and checked items state (meaningful only for lib.agw.customtreectrl.CustomTreeCtrl).

This class handles the following wxPython widgets:

  • TreeCtrl;
  • GenericDirCtrl;
  • lib.agw.customtreectrl.CustomTreeCtrl;
  • lib.agw.hypertreelist.HyperTreeList;

Methods



__init__(self, pObject)


GetCheckedState(self)

Returns a list of checked items. Checked items are coded as determined by the result of TreeCtrlHandler.GetItemIdentity().

Note

This is meaningful only for CustomTreeCtrl and HyperTreeList.



GetCheckedStateOfChildren(self, item)

Returns the checked/unchecked state of the children of a tree item.

Parameters:item – a CustomTreeCtrl item.


GetCheckedStateOfItem(self, item)

Returns the checked/unchecked state of a tree item.

Parameters:item – a CustomTreeCtrl item.


GetExpansionState(self)

Returns list of expanded items. Expanded items are coded as determined by the result of TreeCtrlHandler.GetItemIdentity().



GetExpansionStateOfChildren(self, item)

Returns the expansion state of the children of a tree item.

Parameters:item – a TreeCtrl item or a CustomTreeCtrl item.


GetExpansionStateOfItem(self, item)

Returns the expansion state of a tree item.

Parameters:item – a TreeCtrl item or a CustomTreeCtrl item.


GetIndexOfItem(self, item)

Return the index of item.

Parameters:item – a TreeCtrl item or a CustomTreeCtrl item;


GetItemChildren(self, item=None, recursively=False)

Return the children of item as a list.

Parameters:
  • item – a TreeCtrl item or a CustomTreeCtrl item;
  • recursively – whether to recurse into the item hierarchy or not.


GetItemIdentity(self, item)

Return a hashable object that represents the identity of the item. By default this returns the position of the item in the tree. You may want to override this to return the item label (if you know that labels are unique and don’t change), or return something that represents the underlying domain object, e.g. a database key.

Parameters:item – a TreeCtrl item or a CustomTreeCtrl item;


GetKind(self)


GetSelectionState(self)

Returns a list of selected items. Selected items are coded as determined by the result of TreeCtrlHandler.GetItemIdentity().



GetSelectionStateOfChildren(self, item)

Returns the selection state of the children of a tree item.

Parameters:item – a TreeCtrl item or a CustomTreeCtrl item.


GetSelectionStateOfItem(self, item)

Returns the selection state of a tree item.

Parameters:item – a TreeCtrl item or a CustomTreeCtrl item.


Restore(self)


Save(self)


SetCheckedState(self, listOfCheckedItems)

Checks all tree items whose identity, as determined by TreeCtrlHandler.GetItemIdentity(), is present in the list and unchecks all other tree items.

Parameters:listOfCheckedItems – a list of checked CustomTreeCtrl items.

Note

This is meaningful only for CustomTreeCtrl and HyperTreeList.



SetCheckedStateOfChildren(self, listOfCheckedItems, item)

Sets the checked/unchecked state of the children of a tree item.

Parameters:


SetCheckedStateOfItem(self, listOfCheckedItems, item)

Sets the checked/unchecked state of a tree item.

Parameters:


SetExpansionState(self, listOfExpandedItems)

Expands all tree items whose identity, as determined by TreeCtrlHandler.GetItemIdentity(), is present in the list and collapses all other tree items.

Parameters:listOfExpandedItems – a list of expanded TreeCtrl or CustomTreeCtrl items.


SetExpansionStateOfChildren(self, listOfExpandedItems, item)

Sets the expansion state of the children of a tree item (expanded or collapsed).

Parameters:


SetExpansionStateOfItem(self, listOfExpandedItems, item)

Sets the expansion state of a tree item (expanded or collapsed).

Parameters:


SetSelectedStateOfChildren(self, listOfSelectedItems, item)

Sets the selection state of the children of a tree item.

Parameters:


SetSelectedStateOfItem(self, listOfSelectedItems, item)

Sets the selection state of a tree item.

Parameters:


SetSelectionState(self, listOfSelectedItems)

Selects all tree items whose identity, as determined by TreeCtrlHandler.GetItemIdentity(), is present in the list and unselects all other tree items.

Parameters:listOfSelectedItems – a list of selected TreeCtrl or CustomTreeCtrl items.