* Michael Lerner <mglerner@...> [2006-08-21 12:26] wrote:
> I think he means for you to have a "Load" button as part of your
> plugin. That button would first record the path to the file and then
> call through to cmd.load().
Perhaps what Ron needs to do is not use the cmd.load() function but
use his own file reading procedure. The lines containing coordinates
could be extracted from the file (by recognizing them with a regexp) and
passed to the cmd.read_pdbstr() function. The CGO commands could be
read separately. Then there is no need to worry about where cmd.load()
thinks file is.
> On 8/19/06, Ron Jacak <ronj@...> wrote:
> > Peter,
> > >> I'm working on a plugin that reads information appended to the
> > >> end of PDB files to draw CGO objects. Right now, I have the
> > >> user specify the filesystem path to the currently loaded objects
> > >> through the plugin GUI so that I know where to go to find the
> > >> file. For one object, this isn't so bad. But if users load
> > >> multiple objects that are in different directories, I will have
> > >> to change the GUI so that the user has to specify the path to
> > >> each object loaded. This kind of situation would quickly become
> > >> tedious. Does PyMOL store the paths for objects that are loaded
> > >> somewhere? I know I can get the current working directory using
> > >> getcwd(), so I'm hoping there's a way to get the path to the
> > >> loaded objects as well.
> > > I don't know of a way to get file information from a pymol object,
> > > but you could work around this by using a python dictionary (when
> > > the pdb file is loaded, store the full path to the file in a
> > > dictionary using the pymol object name as the key).
> > I'm not sure I fully understand your suggestion. It sounds to
> > me like what you're saying is that I should add code (e.g. a
> > dictionary) to the importing.py load() function which saves the
> > file information of objects as they're loaded. But then instead of
> > just distributing my plugin, I would have to get users to change
> > their PyMOL source, as well (which I'm not willing to do). Am I
> > understanding correctly?
> > Any other ways around this problem?
Robert L. Campbell, Ph.D.
Senior Research Associate/Adjunct Assistant Professor
Department of Biochemistry, Queen's University
Kingston, ON K7L 3N6 Canada
Tel: 613-533-6821 Fax: 613-533-2497