***************** wx.GenericDirCtrl ***************** Inheritance diagram for `wx.GenericDirCtrl`: | .. inheritance-diagram:: wx.GenericDirCtrl | Description =========== This control can be used to place a directory listing (with optional files) on an arbitrary window. The control contains a `wx.TreeCtrl `_ window representing the directory hierarchy, and optionally, a `wx.Choice `_ window containing a list of filters. Derived From ^^^^^^^^^^^^^ * `wx.Control `_ * `wx.Window `_ * `wx.EvtHandler `_ * `wx.Object `_ Window Styles ^^^^^^^^^^^^^ ================================================== ================================================== Window Style Description ================================================== ================================================== ``wx.DIRCTRL_DIR_ONLY`` Only show directories, and not files. ``wx.DIRCTRL_3D_INTERNAL`` Use 3D borders for internal controls. ``wx.DIRCTRL_SELECT_FIRST`` When setting the default path, select the first file in the directory. ``wx.DIRCTRL_SHOW_FILTERS`` Show the drop-down filter list. ``wx.DIRCTRL_EDIT_LABELS`` Allow the folder and file labels to be editable. ================================================== ================================================== | Control Appearance ^^^^^^^^^^^^^^^^^^ | .. figure:: ../images/wxWidgets/wxmsw/genericdirctrl.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: ../images/wxWidgets/wxmac/genericdirctrl.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: ../images/wxWidgets/wxgtk/genericdirctrl.png :alt: wxGTK :figclass: floatcenter **wxGTK** | Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `CollapsePath <#CollapsePath>`_ * `DoResize <#DoResize>`_ * `ExpandPath <#ExpandPath>`_ * `FindChild <#FindChild>`_ * `GetDefaultPath <#GetDefaultPath>`_ * `GetDirItemData <#GetDirItemData>`_ * `GetFilePath <#GetFilePath>`_ * `GetFilter <#GetFilter>`_ * `GetFilterIndex <#GetFilterIndex>`_ * `GetFilterListCtrl <#GetFilterListCtrl>`_ * `GetPath <#GetPath>`_ * `GetRootId <#GetRootId>`_ * `GetShowHidden <#GetShowHidden>`_ * `GetTreeCtrl <#GetTreeCtrl>`_ * `ReCreateTree <#ReCreateTree>`_ * `SetDefaultPath <#SetDefaultPath>`_ * `SetFilter <#SetFilter>`_ * `SetFilterIndex <#SetFilterIndex>`_ * `SetPath <#SetPath>`_ * `ShowHidden <#ShowHidden>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `DefaultPath <#DefaultPath>`_ * `FilePath <#FilePath>`_ * `Filter <#Filter>`_ * `FilterIndex <#FilterIndex>`_ * `FilterListCtrl <#FilterListCtrl>`_ * `Path <#Path>`_ * `RootId <#RootId>`_ * `TreeCtrl <#TreeCtrl>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(parent, id=-1, dir=wx.DirDialogDefaultFolderStr, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DIRCTRL_3D_INTERNAL|wx.SUNKEN_BORDER, filter="", defaultFilter=0, name=wx.TreeCtrlNameStr) Constructor. **Parameters:** * `parent` (`wx.Window `_) * `id` (int) * `dir` (string) * `pos` (`wx.Point `_) * `size` (`wx.Size `_) * `style` (long) * `filter` (string) * `defaultFilter` (int) * `name` (string) | **Returns:** `wx.GenericDirCtrl `_ -------- .. method:: CollapsePath(path) Collapse the given path. **Parameters:** * `path` (string) | **Returns:** `bool` -------- .. method:: DoResize() `No docstrings available for this method.` -------- .. method:: ExpandPath(path) Tries to expand as much of the given path as possible, so that the filename or directory is visible in the tree control. **Parameters:** * `path` (string) | **Returns:** `bool` -------- .. method:: FindChild(parentId, path) Find the child that matches the first part of `path`. E.g. if a child path is "/usr" and `path` is "/usr/include" then the child for "/usr" is returned. If the path string has been used (we're at the leaf), `done` is set to ``True``. **Parameters:** * `parentId` (`wx.TreeItemId `_) * `path` (string) | **Returns:** `(item, done)` -------- .. method:: GetDefaultPath() Gets the default path. | **Returns:** `string` -------- .. method:: GetDirItemData(id) | **Parameters:** * `id` (`wx.TreeItemId `_) | **Returns:** `wx.DirItemData `_ -------- .. method:: GetFilePath() Gets selected filename path only (else empty string). This function doesn't count a directory as a selection. | **Returns:** `string` -------- .. method:: GetFilter() Returns the filter string. | **Returns:** `string` -------- .. method:: GetFilterIndex() Returns the current filter index (zero-based). | **Returns:** `int` -------- .. method:: GetFilterListCtrl() Returns a pointer to the filter list control (if present). | **Returns:** `wx.DirFilterListCtrl` -------- .. method:: GetPath() Gets the currently-selected directory or filename. | **Returns:** `string` -------- .. method:: GetRootId() Returns the root id for the tree control. | **Returns:** `wx.TreeItemId `_ -------- .. method:: GetShowHidden() `No docstrings available for this method.` -------- .. method:: GetTreeCtrl() Returns a pointer to the tree control. | **Returns:** `wx.TreeCtrl `_ -------- .. method:: ReCreateTree() Collapse and expand the tree, thus re-creating it from scratch. May be used to update the displayed directory content. -------- .. method:: SetDefaultPath(path) Sets the default path. **Parameters:** * `path` (string) -------- .. method:: SetFilter(filter) Sets the filter string. **Parameters:** * `filter` (string) -------- .. method:: SetFilterIndex(n) Sets the current filter index (zero-based). **Parameters:** * `n` (int) -------- .. method:: SetPath(path) Sets the current path. **Parameters:** * `path` (string) -------- .. method:: ShowHidden(show=True) **Parameters:** * `show` (bool) -------- Properties ^^^^^^^^^^ .. attribute:: DefaultPath See `GetDefaultPath <#GetDefaultPath>`_ and `SetDefaultPath <#SetDefaultPath>`_ .. attribute:: FilePath See `GetFilePath <#GetFilePath>`_ .. attribute:: Filter See `GetFilter <#GetFilter>`_ and `SetFilter <#SetFilter>`_ .. attribute:: FilterIndex See `GetFilterIndex <#GetFilterIndex>`_ and `SetFilterIndex <#SetFilterIndex>`_ .. attribute:: FilterListCtrl See `GetFilterListCtrl <#GetFilterListCtrl>`_ .. attribute:: Path See `GetPath <#GetPath>`_ and `SetPath <#SetPath>`_ .. attribute:: RootId See `GetRootId <#GetRootId>`_ .. attribute:: TreeCtrl See `GetTreeCtrl <#GetTreeCtrl>`_