
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¶
Inheritance diagram for class TreeCtrlHandler:

Known Subclasses¶wx.lib.agw.persist.persist_handlers.TreeListCtrlHandler
Known Superclasses¶wx.lib.agw.persist.persist_handlers.AbstractHandler
Methods Summary¶Default class constructor. |
|
Returns a list of checked items. Checked items are coded as determined by |
|
Returns the checked/unchecked state of the children of a tree item. |
|
Returns the checked/unchecked state of a tree item. |
|
Returns list of expanded items. Expanded items are coded as determined by |
|
Returns the expansion state of the children of a tree item. |
|
Returns the expansion state of a tree item. |
|
Return the index of item. |
|
Return the children of item as a list. |
|
Return a hashable object that represents the identity of the |
|
Returns a short and meaningful string description of your widget. |
|
Returns a list of selected items. Selected items are coded as determined by |
|
Returns the selection state of the children of a tree item. |
|
Returns the selection state of a tree item. |
|
Restores the widget’s settings by calling |
|
Saves the widget’s settings by calling |
|
Checks all tree items whose identity, as determined by |
|
Sets the checked/unchecked state of the children of a tree item. |
|
Sets the checked/unchecked state of a tree item. |
|
Expands all tree items whose identity, as determined by |
|
Sets the expansion state of the children of a tree item (expanded or collapsed). |
|
Sets the expansion state of a tree item (expanded or collapsed). |
|
Sets the selection state of the children of a tree item. |
|
Sets the selection state of a tree item. |
|
Selects all tree items whose identity, as determined by |
Class API¶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;
__init__(self, pObject)¶Default class constructor.
pObject – a PersistentObject containing information about the
persistent widget.
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.
item – a CustomTreeCtrl item.
GetCheckedStateOfItem(self, item)¶Returns the checked/unchecked state of a tree item.
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.
item – a TreeCtrl item or a CustomTreeCtrl item.
GetExpansionStateOfItem(self, item)¶Returns the expansion state of a tree item.
item – a TreeCtrl item or a CustomTreeCtrl item.
GetIndexOfItem(self, item)¶Return the index of item.
item – a TreeCtrl item or a CustomTreeCtrl item;
GetItemChildren(self, item=None, recursively=False)¶Return the children of item as a list.
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.
item – a TreeCtrl item or a CustomTreeCtrl item;
GetKind(self)¶Returns a short and meaningful string description of your widget.
Note
This method must be overridden in derived classes.
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.
item – a TreeCtrl item or a CustomTreeCtrl item.
GetSelectionStateOfItem(self, item)¶Returns the selection state of a tree item.
item – a TreeCtrl item or a CustomTreeCtrl item.
Restore(self)¶Restores the widget’s settings by calling PersistentObject.RestoreValue(), which in
turns calls PersistenceManager.RestoreValue().
Note
This method must be overridden in derived classes.
Save(self)¶Saves the widget’s settings by calling PersistentObject.SaveValue(), which in
turns calls PersistenceManager.SaveValue().
Note
This method must be overridden in derived classes.
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.
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.
listOfCheckedItems – a list of checked CustomTreeCtrl items;
item – a CustomTreeCtrl item.
SetCheckedStateOfItem(self, listOfCheckedItems, item)¶Sets the checked/unchecked state of a tree item.
listOfCheckedItems – a list of checked CustomTreeCtrl items;
item – a CustomTreeCtrl item.
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.
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).
listOfExpandedItems – a list of expanded TreeCtrl or
CustomTreeCtrl items;
item – a TreeCtrl item or a CustomTreeCtrl item.
SetExpansionStateOfItem(self, listOfExpandedItems, item)¶Sets the expansion state of a tree item (expanded or collapsed).
listOfExpandedItems – a list of expanded TreeCtrl or
CustomTreeCtrl items;
item – a TreeCtrl item or a CustomTreeCtrl item.
SetSelectedStateOfChildren(self, listOfSelectedItems, item)¶Sets the selection state of the children of a tree item.
listOfSelectedItems – a list of selected TreeCtrl or
CustomTreeCtrl items;
item – a TreeCtrl item or a CustomTreeCtrl item.
SetSelectedStateOfItem(self, listOfSelectedItems, item)¶Sets the selection state of a tree item.
listOfSelectedItems – a list of selected TreeCtrl or
CustomTreeCtrl items;
item – a TreeCtrl item or a CustomTreeCtrl item.
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.
listOfSelectedItems – a list of selected TreeCtrl or
CustomTreeCtrl items.