From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Aug 10 2010 - 21:38:07 CDT

jonathan,

On Mon, Aug 9, 2010 at 12:48 PM, jonathan <jkhao_at_ifr88.cnrs-mrs.fr> wrote:
> Hello,
>
> We have been developing some Python scripts, and we would like to add a
> GUI that comes by default in our local vmd. For now, we're tweaking the
> loadplugins.tcl file in the vmd_load_extension_packages, by adding this
> line :
>
> vmd_install_extension dummy [gopython /path/myscript.py]
> "Analysis/pyscript"
>
> But I suppose there is a cleaner way to add a python "plugin". Any
> suggestions ?

the clean way to add plugins without having to modify
any vmd source files is the following:

create a directory: <vmdlibdir>/scripts/init.d
and then place a tcl script to initialize your plugin into
that directory. vmd will check that directory and source
all .tcl files upon startup. here is an example that i am
using to initialize the IED plugin through that mechanism.

# hook up IED into the VMD extensions menu
proc initme {} {
  global env
  set noarchpath [file join $env(VMDDIR) plugins noarch python]

  foreach p [glob -nocomplain -types f "$noarchpath/ied2.02/__init__.py"] {
    if {[catch {gopython $p} msg]} {
      puts "Unable to load IED version 2.02 package:\n$msg"
    }
  }
}
initme
rename initme ""

cheers,
    axel.

> Thanks
>
> --
> KHAO Jonathan
> Ph.D. Student
> Aix-Marseille Université
> Assemblage et dynamique des protéines membranaires
> Laboratoire d'Ingenierie des Systèmes Macromoléculaires
> UPR9027 CNRS
>
>

-- 
Dr. Axel Kohlmeyer    akohlmey_at_gmail.com
http://sites.google.com/site/akohlmey/
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.