Question

I am using a wxGenericDirCtrl, and I would like to know if there is a way to hide directories, I'd especially like to hide siblings of parent nodes.

For example if my directory structure looks like this:

+-a
  |
  +-b
  | |
  | +-whatever
  |
  +-c
  | |
  | +-d
  |   |
  |   +-e
  |   |
  |   +-f
  |   
  +-g
    |
    +-whatever

If my currently selected directory is /a/c/d is there any way to hide b and g, so that the tree looks like this in my ctrl:

+-a
  |
  +-c
    |
    +-[d]
      |
      +-e
      |
      +-f

I'm currently working with a directory structure that has lots and lots directories that are irrelevant to most users, so it would be nice to be able to clean it up.

Edit: If it makes a difference, I am using wxPython, and so far, I have only tested my code on linux using the GTK backend, but I do plan to make it multi-platform and using it on Windows and Mac using the native backends.

Was it helpful?

Solution

Listing/walking directories in Python is very easy, so I would recommend trying to "roll your own" using one of the simple tree controls (such as TreeCtrl or CustomTreeCtrl). It should really be quite easy to call the directory listing code when some directory is expanded and return the result.

OTHER TIPS

I don't think that's possible.

It would be relatively easy to add this functionality to the underlying C++ wxWidgets control, but since you're using wxPython, you'd then have to rebuild that as well which is a tremendous issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top