Hej Matthew,
1. The advantage of using the plugin manager is that it will
automatically import all the plugin in the 'plugins' folder of the
'pymol-script-repo'. This should re-load you plugin if it is located
in a folder managed by the plugin manager. The loading of plugins
located therein occurs automatically.
You can add paths to the plugin manager either manually or using
scripts during startup as described in the link. This is the way I
prefer to do it. Check the examples and linked pages:
http://www.pymolwiki.org/index.php/Plugin_manager
Note that deliberate import of these plugins changes:
e.g. to import colorama.py post startup use:
import pmg_tk.startup.colorama
# this is shown in the info dialog of the Plugin manager
A simple restart of PyMOL should re-load your updated plugin with
the changes made, provided the path is added to its list. It may
require a __init__.py file if it is a module.
2. if you are testing a plugin you can always have it in a separate
folder that you add yourself.
I sometime use the following to test scripts (added in the
run_on_startup.py):
#########################
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.environ['PYMOL_PATH'],
'plugins_private'))) # contains a folder called private with a
(empty) __init__.py file
import private
#########################
3. Another (maybe deprecated?) way of running your code would be to
use 'execfile'. This would correspond to running the python code in
PyMOL.
#########################
import os
PYMOLPATH=os.environ['PYMOL_PATH']
#Append 'plugin' folder # Change to 'Pymol-script-repo' if required
PLUGINPATH=os.path.realpath(os.path.join(PYMOLPATH, 'plugins'))
# Run every script in the folder and max. one sub-folder that is '.py'
PLUGINPATH_LIST=[os.path.realpath(os.path.join(PLUGINPATH, name))
for name in os.listdir(PLUGINPATH) if
os.path.isdir(os.path.join(PLUGINPATH, name))]
PLUGINPATH_LIST=[PLUGINPATH]+PLUGINPATH_LIST
print 'paths for plugins: '
for p in PLUGINPATH_LIST: print p
print
'#-------------------------------------------------------------------------------'
for d in PLUGINPATH_LIST:
print 'Initiating (sub)-directory: '+d
for f in os.listdir(d):
if f=='__init__.py': continue
if f.endswith('.py'):
print "Executing plugin: "+f
execfile(os.path.realpath(os.path.join(d, f)))
else:
if not os.path.isdir(os.path.join(d,f)):print 'skipping
non .py file: '+f
#########################
The drawback in 2 or 3 is that this will not work for true plugins
that add menus to PyMOL.
4. For simple script or short chunks of code I often copy-paste:
python
#code here
python end
into the pymol mini shell. This is great for testing part of the code.
In conclusion I recommend using option. 1 and restart PyMOL after
making changes to the script: The plugin manager is a very practical
addition to PyMOL and I love it. It just needs to be configured
correctly, which is something that changed in comparison to other
PyMOL versions (cf. the link).
Just beware: removing a installed plugin may physically delete the
file. So be sure to backup your script should you decide to remove
scripts or paths that were added to the Plugin Manager.
Hope this will relieve some of the frustration.
Cheers,
Andreas
On Fri, Jul 18, 2014 at 5:41 PM, Matthew Baumgartner <mp...@pitt.edu
<mailto:mp...@pitt.edu>> wrote:
Hi,
So i am working on a pymol plugin (shameless plug
<https://sourceforge.net/projects/clustermolspy/>) and I have
been annoyed how difficult it is to reinstall my plugin so I can
see the effect of the changes I have made.
Currently, the process is:
Plugin Menu > Plugin Manager > Install New Plugin tab > Choose
File... > Navigate to script file (could be 5-8 clicks plus some
scrolling) > Select plugin directory > Ok > Hit Ok to confirm
reinstall > Hit OK to acknowledge the reinstall > Close the
Plugin Manager > Go to the Plugin Menu > Open my Plugin at the
bottom.
It's a super long process that really hampers rapid development,
which is super annoying when trying to tweak GUI elements.
So to my question, is there a faster method for getting the
plugin to use the new code? I am open to basically any solution.
In my frustration, I've looked into reverse engineering the
Plugin Manager and making my own little script. But I figured I
should ask here before doing this.
Thanks,
Matt
I'm using Pymol 1.7.1.7 and Ubuntu 13.10.
--
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise?
Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net
<mailto:PyMOL-users@lists.sourceforge.net>)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives:
http://www.mail-archive.com/pymol-users@lists.sourceforge.net