From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Fri Apr 10 2009 - 10:13:57 CDT

On Fri, 2009-04-10 at 15:00 +0000, Steve Massard wrote:
> Hello,
>
> thank you for your answer.
>
> In fact i have got some tcl scripts: tool1.tcl, tool2.tcl, tool3.tcl
> and
> the GUI tool1GUI.tcl, tool2GUI.tcl, tool3GUI.tcl
> I made a package of this three tools "myplugin" (every file has got
> his
> package provide myplugin 1.0 line)

won't work. each package has to have a unique name.
this is a tcl issue, please see the tcl documentation.

> If i am testing this package from VMD and the Tk console everything
> is
> working fine (also the GUIs)
>
> Now i would like to install an register my plugin under the menu
> "extension" and a sub-menu "myplugin" (for example
> "extension/myplugin/tool1" ;"extension/myplugin/tool2"; ...)
> As shown on several sites
> (http://www.ks.uiuc.edu/Research/vmd/plugins/doxygen/tcltkplugins.html)
> i added to my vmd.rc file this line:
> vmd_install_extension myplugin tool1GUI "myplugin/tool1"
>
> This seems to work: the package seems to be found and load, and the
> menu/sub menu created...i can even start the GUI for my tool1 from
> the
> menu "ext./myplugin/tool1".
>
> To register and install also my second and thirt plugin tool from my
> package i also added this lines:
> vmd_install_extension myplugin tool2GUI "myplugin/tool2"
> vmd_install_extension myplugin tool3GUI "myplugin/tool3"
>
> Now i'm getting an error:
> ERROR : menu myplugin already exists
> the myplugin window could not be created: unable to add menu

the error message already tells you what happened. you can have
only one "myplugin" command added to the menu command. each GUI
window can be toggled on/off with "menu myplugin on" or "menu myplugin
off" (they will not be destroyed, but rather mapped or hidden).

please see the definition of the vmd_install_extension proc in
$vmddir/scripts/vmd/loadplugins.tcl

the first argument is the package name, the second the callback
proc the third the "path" in the extensions menu and the optional
fourth argument is the "window name" which will also be used in
the menu command. this defaults to the package name. so the
error message you see is a result of the "menu tk register ..."
command that will fail due to myplugin already being registered.

cheers,
   axel.

>
> I hope you can give my some tips or hints how to install my plugin in
> VMD.
>
> Thank you very much again for your answers.
>
> Greetings.
>
>
>
>
>
> Axel Kohlmeyer schrieb:
> > On Fri, 2009-04-10 at 09:35 +0000, Steve Massard wrote:
> >
> >> Hello,
> >>
> >> unfortunatly i'm having problems installing my TCL plugin (with
> GUI).
> >> I readed the explications in the programmers guide an the example
> >> here:
> >>
> http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/cpmd-vmd/part7.html
> >> But i am still having problems with the vmd.rc file
> >>
> >> In fact i have created a package of my tcl scripts (pkg_mkIndex)
> >> which
> >> contains all the needed files for the calculations and the scripts
> >> for
> >> the GUI. (package provide myplugin 1.0)
> >>
> >> As my plugin is divided in 3 main "tools" i have created 3
> interfaces.
> >> So i would like to have an extra menu for every function under the
> >>
> "extensions" ("extension/myplugin/tool1","extension/myplugin/tool2",...)
> >>
> >> I have tried things like that:
> >> vmd_install_extension myplugin tool1GUI "myplugin/Tool1"
> >> vmd_install_extension myplugin tool2GUI "myplugin/Tool2"
> >> vmd_install_extension myplugin tool3GUI "myplugin/Tool3"
> >>
> >> But it doesn't work.
> >>
> >
> > steve,
> >
> > it is very difficult to give any advice based on "it does not work".
> >
> > please explain in more detail what you did and where exactly your
> > problem is. with the amount of information you provide one can
> > only guess.
> >
> > one common problem when trying to add items to the extensions
> > menu is dependency handling, i.e. packages don't properly
> > "require" what they need to work. this is best tested by running
> > the scripts interactively and making certain they do work as
> > advertised.
> >
> > the second frequent problem is when adding stuff to .vmdrc
> > (or vmd.rc) the fact that this script is sources _before_
> > some of the other features of vmd have been initialized.
> > this is alleviated by putting your initialization code into
> > an "after idle { ... }" block.
> >
> > cheers,
> > axel.
> >
> >
> >
> >
> >
> >> I hope that somebody can give some more explainations on "how to
> >> register/install" my plugin (or that somebody knows a good
> turtorial
> >> site)
> >>
> >> Thank you very much for your answers.
> >>
> >>
> >>
> >>
> ______________________________________________________________________
> >> Mehr Sicherheit und Datenschutz - der neue Internet Explorer 8 für
> MSN
> >> Jetzt sofort kostenlos downloaden!
> >>
> >
> >
>
>
>
>
> ______________________________________________________________________
> Posteingang immer voll? Der erste Speicher, der mitwächst:
> Unbegrenzter Speicher bei Windows Live Hotmail!

-- 
=======================================================================
Dr. Axel Kohlmeyer akohlmey_at_cmm.chem.upenn.edu http://www.cmm.upenn.edu
Associate Director - Center for Molecular Modeling - U. of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
  tel: 1-215-898-1582,   fax: 1-215-573-6233,   cell: 1-215-520-7732
=======================================================================