Can you set the "root" directory for wx.GenericDirCtrl?

Hi guys,

I'm trying to create a "file browser" as part of the application I'm
writing, which lets the user browse through the contents of a
particular directory (including sub-directories). On the face of it,
the wx.GenericDirCtrl looks perfect, as it lets me include a directory
tree browser directly into my frame -- but it seems that there's no
way of setting the "root" directory (the top-most directory shown in
the control). As far as I can see, wx.GenericDirCtrl always defaults
to giving the user a complete list of all the drives/mount points, and
can browse to anywhere on the hard disk.

Has anyone been able to get wx.GenericDirCtrl (or some other
file-browser like control) working so that only the contents of a
particular directory (and the sub-directories within it) are shown? I
definitely don't want to clutter up my directory browser with a
complete list of the entire hard disk, when all I want to show is one
small part of it.

Any suggestions?

Thanks,

- Erik.

Erik Westra wrote:

Hi guys,

I'm trying to create a "file browser" as part of the application I'm
writing, which lets the user browse through the contents of a
particular directory (including sub-directories). On the face of it,
the wx.GenericDirCtrl looks perfect, as it lets me include a directory
tree browser directly into my frame -- but it seems that there's no
way of setting the "root" directory (the top-most directory shown in
the control). As far as I can see, wx.GenericDirCtrl always defaults
to giving the user a complete list of all the drives/mount points, and
can browse to anywhere on the hard disk.

Looks that way to me too.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi Robin,

> I'm trying to create a "file browser" as part of the application I'm
> writing, which lets the user browse through the contents of a
> particular directory (including sub-directories). On the face of it,
> the wx.GenericDirCtrl looks perfect, as it lets me include a directory
> tree browser directly into my frame -- but it seems that there's no
> way of setting the "root" directory (the top-most directory shown in
> the control). As far as I can see, wx.GenericDirCtrl always defaults
> to giving the user a complete list of all the drives/mount points, and
> can browse to anywhere on the hard disk.

Looks that way to me too.

That's what I thought. I've now created my own "FileBrowser" class
which does what I want -- do you think people would be interested in
such a beast? I'd be happy to pull it out, tidy it up a bit, and
submit it as an addition to the library...

Cheers,

- Erik.

Erik Westra wrote:

Hi Robin,

I'm trying to create a "file browser" as part of the application I'm
writing, which lets the user browse through the contents of a
particular directory (including sub-directories). On the face of it,
the wx.GenericDirCtrl looks perfect, as it lets me include a directory
tree browser directly into my frame -- but it seems that there's no
way of setting the "root" directory (the top-most directory shown in
the control). As far as I can see, wx.GenericDirCtrl always defaults
to giving the user a complete list of all the drives/mount points, and
can browse to anywhere on the hard disk.

Looks that way to me too.

That's what I thought. I've now created my own "FileBrowser" class
which does what I want -- do you think people would be interested in
such a beast? I'd be happy to pull it out, tidy it up a bit, and
submit it as an addition to the library...

At the very least it would be a good example to have in the wiki.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!