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
TreeCtrl
expansion 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
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
andHyperTreeList
.
- 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 aCustomTreeCtrl
item.
- GetExpansionStateOfItem(self, item)¶
Returns the expansion state of a tree item.
- Parameters:
item – a
TreeCtrl
item or aCustomTreeCtrl
item.
- GetIndexOfItem(self, item)¶
Return the index of item.
- Parameters:
item – a
TreeCtrl
item or aCustomTreeCtrl
item;
- GetItemChildren(self, item=None, recursively=False)¶
Return the children of item as a list.
- Parameters:
item – a
TreeCtrl
item or aCustomTreeCtrl
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 aCustomTreeCtrl
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.
- Parameters:
item – a
TreeCtrl
item or aCustomTreeCtrl
item.
- GetSelectionStateOfItem(self, item)¶
Returns the selection state of a tree item.
- Parameters:
item – a
TreeCtrl
item or aCustomTreeCtrl
item.
- 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
CustomTreeCtrl
items.
Note
This is meaningful only for
CustomTreeCtrl
andHyperTreeList
.
- SetCheckedStateOfChildren(self, listOfCheckedItems, item)¶
Sets the checked/unchecked state of the children of a tree item.
- Parameters:
listOfCheckedItems – a list of checked
CustomTreeCtrl
items;item – a
CustomTreeCtrl
item.
- SetCheckedStateOfItem(self, listOfCheckedItems, item)¶
Sets the checked/unchecked state of a tree item.
- Parameters:
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.- Parameters:
listOfExpandedItems – a list of expanded
TreeCtrl
orCustomTreeCtrl
items.
- SetExpansionStateOfChildren(self, listOfExpandedItems, item)¶
Sets the expansion state of the children of a tree item (expanded or collapsed).
- Parameters:
listOfExpandedItems – a list of expanded
TreeCtrl
orCustomTreeCtrl
items;item – a
TreeCtrl
item or aCustomTreeCtrl
item.
- SetExpansionStateOfItem(self, listOfExpandedItems, item)¶
Sets the expansion state of a tree item (expanded or collapsed).
- Parameters:
listOfExpandedItems – a list of expanded
TreeCtrl
orCustomTreeCtrl
items;item – a
TreeCtrl
item or aCustomTreeCtrl
item.
- SetSelectedStateOfChildren(self, listOfSelectedItems, item)¶
Sets the selection state of the children of a tree item.
- Parameters:
listOfSelectedItems – a list of selected
TreeCtrl
orCustomTreeCtrl
items;item – a
TreeCtrl
item or aCustomTreeCtrl
item.
- SetSelectedStateOfItem(self, listOfSelectedItems, item)¶
Sets the selection state of a tree item.
- Parameters:
listOfSelectedItems – a list of selected
TreeCtrl
orCustomTreeCtrl
items;item – a
TreeCtrl
item or aCustomTreeCtrl
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.- Parameters:
listOfSelectedItems – a list of selected
TreeCtrl
orCustomTreeCtrl
items.