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¶
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¶
- class TreeCtrlHandler(AbstractHandler)¶
Supports saving/restoring a
TreeCtrlexpansion state, selections and checked items state (meaningful only forlib.agw.customtreectrl.CustomTreeCtrl).This class handles the following wxPython widgets:
TreeCtrl;GenericDirCtrl;lib.agw.customtreectrl.CustomTreeCtrl;lib.agw.hypertreelist.HyperTreeList;
Methods¶
- __init__(self, pObject)¶
Default class constructor.
- Parameters:
pObject – a
PersistentObjectcontaining 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
CustomTreeCtrlandHyperTreeList.
- GetCheckedStateOfChildren(self, item)¶
Returns the checked/unchecked state of the children of a tree item.
- Parameters:
item – a
CustomTreeCtrlitem.
- GetCheckedStateOfItem(self, item)¶
Returns the checked/unchecked state of a tree item.
- Parameters:
item – a
CustomTreeCtrlitem.
- 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
TreeCtrlitem or aCustomTreeCtrlitem.
- GetExpansionStateOfItem(self, item)¶
Returns the expansion state of a tree item.
- Parameters:
item – a
TreeCtrlitem or aCustomTreeCtrlitem.
- GetIndexOfItem(self, item)¶
Return the index of item.
- Parameters:
item – a
TreeCtrlitem or aCustomTreeCtrlitem;
- GetItemChildren(self, item=None, recursively=False)¶
Return the children of item as a list.
- Parameters:
item – a
TreeCtrlitem or aCustomTreeCtrlitem;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
TreeCtrlitem or aCustomTreeCtrlitem;
- 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.
- Parameters:
item – a
TreeCtrlitem or aCustomTreeCtrlitem.
- GetSelectionStateOfItem(self, item)¶
Returns the selection state of a tree item.
- Parameters:
item – a
TreeCtrlitem or aCustomTreeCtrlitem.
- Restore(self)¶
Restores the widget’s settings by calling
PersistentObject.RestoreValue(), which in turns callsPersistenceManager.RestoreValue().Note
This method must be overridden in derived classes.
- Save(self)¶
Saves the widget’s settings by calling
PersistentObject.SaveValue(), which in turns callsPersistenceManager.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.- Parameters:
listOfCheckedItems – a list of checked
CustomTreeCtrlitems.
Note
This is meaningful only for
CustomTreeCtrlandHyperTreeList.
- SetCheckedStateOfChildren(self, listOfCheckedItems, item)¶
Sets the checked/unchecked state of the children of a tree item.
- Parameters:
listOfCheckedItems – a list of checked
CustomTreeCtrlitems;item – a
CustomTreeCtrlitem.
- SetCheckedStateOfItem(self, listOfCheckedItems, item)¶
Sets the checked/unchecked state of a tree item.
- Parameters:
listOfCheckedItems – a list of checked
CustomTreeCtrlitems;item – a
CustomTreeCtrlitem.
- 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
TreeCtrlorCustomTreeCtrlitems.
- SetExpansionStateOfChildren(self, listOfExpandedItems, item)¶
Sets the expansion state of the children of a tree item (expanded or collapsed).
- Parameters:
listOfExpandedItems – a list of expanded
TreeCtrlorCustomTreeCtrlitems;item – a
TreeCtrlitem or aCustomTreeCtrlitem.
- SetExpansionStateOfItem(self, listOfExpandedItems, item)¶
Sets the expansion state of a tree item (expanded or collapsed).
- Parameters:
listOfExpandedItems – a list of expanded
TreeCtrlorCustomTreeCtrlitems;item – a
TreeCtrlitem or aCustomTreeCtrlitem.
- SetSelectedStateOfChildren(self, listOfSelectedItems, item)¶
Sets the selection state of the children of a tree item.
- Parameters:
listOfSelectedItems – a list of selected
TreeCtrlorCustomTreeCtrlitems;item – a
TreeCtrlitem or aCustomTreeCtrlitem.
- SetSelectedStateOfItem(self, listOfSelectedItems, item)¶
Sets the selection state of a tree item.
- Parameters:
listOfSelectedItems – a list of selected
TreeCtrlorCustomTreeCtrlitems;item – a
TreeCtrlitem or aCustomTreeCtrlitem.
- 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
TreeCtrlorCustomTreeCtrlitems.