home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-gnome2 / examples / vfs / pygvfsmethod / README < prev   
Encoding:
Text File  |  2009-03-14  |  1.5 KB  |  36 lines

  1. This a Gnome VFS module written in python that lets you browse python modules and objects.
  2.  
  3. How to test:
  4. ------------
  5.  cp pyfs.conf ~/.gnome2/vfs/modules/
  6.  export PYTHONPATH=$(pwd):$PYTHONPATH
  7.  mkdir /tmp/testing
  8.  export TMPDIR=/tmp/testing
  9.  nautilus --no-desktop pyfs:///
  10.  
  11.  You will be presented with a list of modules and you can navigate
  12. modules/objects.  Notice that only currently imported modules appear
  13. initially, but if you hit Ctr-L you can force browsing of particular
  14. modules by entering pyfs:///<module> as URL.  For example,
  15. pyfs:///gtk/gdk will let you browse the module gtk.gdk.
  16.  
  17. How does GnomeVFS decide to use your module:
  18. --------------------------------------------
  19.  
  20. Suppose you want to register some code to handle 'pyfs://'.  You put
  21. "pyfs: pythonmethod" in a gnome-vfs configuration file[1].  Therefore,
  22. when a pyfs:// URI is requested, gnome-vfs loads libpythonmethod.so,
  23. which receives the 'pyfs' method name and then tries to import the
  24. python module 'pyfs'.  The standard python path, plus
  25. $(libdir)/gnome-vfs-2.0/modules, is searched for the module.  In this
  26. module, it looks for a class called 'pyfs_method'.  It then creates a
  27. new instance of this class, and tries to get the vfs_xxxx methods,
  28. which are then used to implement the VFS operations.
  29.  
  30. Caveat: currently the class has to be an old-style class, so don't
  31. subclass object.
  32.  
  33. [1] As you are asked to do in the "How to test" section; but notice
  34. that to install it system-wide you have to copy the file to
  35. /etc/gnome-vfs-2.0/modules/ instead of ~/.gnome2/vfs/modules/.
  36.