views:

241

answers:

2

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.

A: 

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 pain in the ass.

Gareth Simpson
I have no problem rebuilding anything, this is for an in-house app.
Moe
+1  A: 

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.

Eli Bendersky
Thanks, but it's not worth the effort for me at this point.
Moe
I'm gonna say this is the only solution to the problem, since it doesn't seem like there's a way to do it with what exists
Moe