Hi Matt -
Does your plugin require a GUI, or can you rely on scripted commands and output
files for your tests?
For any tests that don’t need the GUI, you might consider running them with
something like `pymol -ckq my_test.pml`.
http://www.pymolwiki.org/index.php/Command_Line_Options
Cheers,
Jared
--
Jared Sampson
Xiangpeng Kong Lab
NYU Langone Medical Center
http://kong.med.nyu.edu/
On Jul 18, 2014, at 1:47 PM, Matthew Baumgartner
<mp...@pitt.edu<mailto:mp...@pitt.edu>> wrote:
Hi,
Thank you for you suggestions.
However, I was looking for a way to do it without restarting pymol if possible.
Currently, restarting is the fastest solution, but it still takes up about
10-15 seconds to close pymol, restart it, and have it load the structures I
need to test my script.
One question that I have is that when pymol starts up, does it load the scripts
in the plugin menu into memory? Or when you click on the plugin in the menu,
does that read from a file on the disk somewhere?
My testing indicates the former, because launching pymol and then editing the
script in the ~/.pymol/startup folder does not change the plugin.
Ideally, what I would like to be able to do is launch pymol once, then open my
plugin. Then if I make some changes to the code in the appropriate folder, if I
simply close the tk window and open the plugin from the menu again, it would
reopen the plugin with the new changes.
Short of that, running some commands in the command line window would also be
acceptable. I tried using the execfile command you suggested, but that doesn't
seem to do what I want. Did I do something wrong?
Thanks again for your help,
Matt
On 07/18/2014 01:23 PM, Andreas Warnecke wrote:
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
------------------------------------------------------------------------------
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)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
------------------------------------------------------------
This email message, including any attachments, is for the sole use of the
intended recipient(s) and may contain information that is proprietary,
confidential, and exempt from disclosure under applicable law. Any unauthorized
review, use, disclosure, or distribution is prohibited. If you have received
this email in error please notify the sender by return email and delete the
original message. Please note, the recipient should check this email and any
attachments for the presence of viruses. The organization accepts no liability
for any damage caused by any virus transmitted by this email.
=================================
------------------------------------------------------------------------------
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)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net