Question

Well the question says it all.I am trying to create a file transfer application using python, and pygtk for UI.Most of the code is complete,the only problem being the UI for listing remote host's file list.

I really like the Gtk Dialog Chooser widget,and already use it to list the local machine file list.I really would like to use the same widget to list files of the remote destination.Is it possible?

Was it helpful?

Solution

From the paramiko tag, I assume you're using that to work with SSH. The GTK+ file chooser can't be populated manually, so what you're trying to do is not possible.

However, most GTK+ packages come with GIO+GVFS [1]. This is a completely separate framework from Paramiko, but you should be able to use both (or even completely drop Paramiko).

[1] One big caveat is that GVFS still doesn't exist in Windows (and probably won't ever exist). If you need to support Windows, you may be able to use the older GnomeVFS, but I don't know how.

To use GIO with the GTK+ file chooser:

  1. uri = 'sftp://foo.example.org/a/b/c'
  2. Mount the volume (or you can run gvfs-mount to test first). To use the linked code:
    1. f = gio.File(uri)
    2. mount(f)
  3. file_chooser.set_current_folder_uri(uri)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top