Re: [PyMOL] Autosave

2019-11-28 Thread Thomas Holder
It looks like strftime('%s') is not valid on Windows (it works fine for me on 
Linux and macOS). Here is an equivalent alternative that works on all platforms:

filename = '~/pymol-auto-save-{}.pse'.format(int(time.time()))
filename = os.path.expanduser(filename)

Binding a key is also easy. Here is an example which binds saving and rendering 
to the F1 key:

python
@cmd.set_key('F1')
def autosave_and_render():
filename = os.path.expanduser('~/pymol-auto-save.pse')
cmd.set('pse_binary_dump')
cmd.save(filename, quiet=0)
cmd.ray()
python end


Hope that helps.

Cheers,
  Thomas


> On Nov 22, 2019, at 11:48 PM, Junsu Park aka. Jason Mosier 
>  wrote:
> 
> Hello, I'm fairly new to pymol and python in general, but I honestly don't 
> have to self control to save by myself very well and so I was trying to use 
> the proof of concept code for autosaving. However, it was written for a way 
> old version of pymol and so I was wondering if I could get some help with 
> fixing this code up? If that would be too difficult, is there a way that I 
> could bind a key to saving AND then rendering? Or even just clicking on the 
> render button causes it to save before ray tracing? I keep rendering on a 
> weak computer thinking it can handle it and then it crashes and I lose all my 
> progress.
> 
> Link to code: https://pastebin.com/EJJQWc00  
> Link to output:  https://pastebin.com/TNSuA0fH
> 
> Thanks,
> -Jason
> ___
> PyMOL-users mailing list
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
> Unsubscribe: 
> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

--
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.



___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Re: [PyMOL] Autosave

2019-11-22 Thread Pedro Lacerda
I would rather create a QTimer to autosave and autorender. It would report
correct CPU usage.

After then you may of course create a plugin:
https://pymolwiki.org/index.php/Plugins_Tutorial.

Em sex, 22 de nov de 2019 22:41, Pedro Lacerda 
escreveu:

> Only now I see your code. I'm not very versed with PyMOL code but maybe
> you want to wait for the pymol lock. Grep for the lock and wait for it. Can
> you imagine the last auto rendering be a wrong image after a long and hard
> session.
>
> Em sex, 22 de nov de 2019 22:36, Pedro Lacerda 
> escreveu:
>
>> Hi Jason,
>>
>> You can save with Ctrl-S, as you might know. Auto rendering would be
>> complicated because there is a lot of options. For instance, you may have
>> to choose low DPI for quick inspection or high for final rendering.
>>
>> Best regards,
>> Pedro Lacerda
>>
>> Em sex, 22 de nov de 2019 19:49, Junsu Park aka. Jason Mosier <
>> parksinj...@gmail.com> escreveu:
>>
>>> Hello, I'm fairly new to pymol and python in general, but I honestly
>>> don't have to self control to save by myself very well and so I was trying
>>> to use the proof of concept code for autosaving. However, it was written
>>> for a way old version of pymol and so I was wondering if I could get some
>>> help with fixing this code up? If that would be too difficult, is there a
>>> way that I could bind a key to saving AND then rendering? Or even just
>>> clicking on the render button causes it to save before ray tracing? I keep
>>> rendering on a weak computer thinking it can handle it and then it crashes
>>> and I lose all my progress.
>>>
>>> Link to code: https://pastebin.com/EJJQWc00
>>> 
>>>
>>> Link to output:  https://pastebin.com/TNSuA0fH
>>> 
>>>
>>> Thanks,
>>> -Jason
>>> ___
>>> PyMOL-users mailing list
>>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>>> Unsubscribe:
>>> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
>>
>>
___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Re: [PyMOL] Autosave

2019-11-22 Thread Pedro Lacerda
Only now I see your code. I'm not very versed with PyMOL code but maybe you
want to wait for the pymol lock. Grep for the lock and wait for it. Can you
imagine the last auto rendering be a wrong image after a long and hard
session.

Em sex, 22 de nov de 2019 22:36, Pedro Lacerda 
escreveu:

> Hi Jason,
>
> You can save with Ctrl-S, as you might know. Auto rendering would be
> complicated because there is a lot of options. For instance, you may have
> to choose low DPI for quick inspection or high for final rendering.
>
> Best regards,
> Pedro Lacerda
>
> Em sex, 22 de nov de 2019 19:49, Junsu Park aka. Jason Mosier <
> parksinj...@gmail.com> escreveu:
>
>> Hello, I'm fairly new to pymol and python in general, but I honestly
>> don't have to self control to save by myself very well and so I was trying
>> to use the proof of concept code for autosaving. However, it was written
>> for a way old version of pymol and so I was wondering if I could get some
>> help with fixing this code up? If that would be too difficult, is there a
>> way that I could bind a key to saving AND then rendering? Or even just
>> clicking on the render button causes it to save before ray tracing? I keep
>> rendering on a weak computer thinking it can handle it and then it crashes
>> and I lose all my progress.
>>
>> Link to code: https://pastebin.com/EJJQWc00
>> 
>>
>> Link to output:  https://pastebin.com/TNSuA0fH
>> 
>>
>> Thanks,
>> -Jason
>> ___
>> PyMOL-users mailing list
>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>> Unsubscribe:
>> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
>
>
___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Re: [PyMOL] Autosave

2019-11-22 Thread Pedro Lacerda
Hi Jason,

You can save with Ctrl-S, as you might know. Auto rendering would be
complicated because there is a lot of options. For instance, you may have
to choose low DPI for quick inspection or high for final rendering.

Best regards,
Pedro Lacerda

Em sex, 22 de nov de 2019 19:49, Junsu Park aka. Jason Mosier <
parksinj...@gmail.com> escreveu:

> Hello, I'm fairly new to pymol and python in general, but I honestly don't
> have to self control to save by myself very well and so I was trying to use
> the proof of concept code for autosaving. However, it was written for a way
> old version of pymol and so I was wondering if I could get some help with
> fixing this code up? If that would be too difficult, is there a way that I
> could bind a key to saving AND then rendering? Or even just clicking on the
> render button causes it to save before ray tracing? I keep rendering on a
> weak computer thinking it can handle it and then it crashes and I lose all
> my progress.
>
> Link to code: https://pastebin.com/EJJQWc00
> 
>
> Link to output:  https://pastebin.com/TNSuA0fH
> 
>
> Thanks,
> -Jason
> ___
> PyMOL-users mailing list
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
> Unsubscribe:
> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Re: [PyMOL] Autosave session Pymol

2016-04-25 Thread Thomas Holder
Hi Matic,

As a proof of concept, the following snippet would save a session file every 30 
seconds. You can put this in your pymolrc file.

python
import os
import threading
import time
from pymol import cmd
def _auto_save():
filename = os.path.expanduser(time.strftime('~/pymol-auto-save-%s.pse'))
while True:
time.sleep(30) # interval in seconds
cmd.save(filename, quiet=0)
_auto_save = threading.Thread(target=_auto_save)
_auto_save.setDaemon(1)
_auto_save.start()
python end

Saving session files is not very fast, so with larger molecules, the 
interruption will be very noticeable. There is a new experimental setting in 
PyMOL 1.8.2 which can improve this: pse_binary_dump

Cheers,
  Thomas

On 22 Apr 2016, at 02:31, Matic Kisovec  wrote:

> Dear PyMOL users,
> 
> I would just like to bump this question again.
> I would be glad to see some replies either from users or developers.
> 
> Best regards,
> Matic
> 
> 
> On 31. 03. 2016 08:02, Matic Kisovec wrote:
>> Dear Pymol users,
>> 
>> a quick google search returned empty regarding the ability of Pymol to
>> autosave the session at a specified time interval.
>> The feature is available in different programs from text to vector
>> editors etc.
>> I would find it useful to have the ability to automatically save a
>> couple of recent checkpoints while I am using Pymol.
>> 
>> My question is if this would be interesting/useful for anybody and a
>> question to the developers if this can be implemented?
>> 
>> Best regards,
>> Matic

-- 
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.


--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
___
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


Re: [PyMOL] Autosave session Pymol

2016-04-22 Thread Matic Kisovec
Dear PyMOL users,

I would just like to bump this question again.
I would be glad to see some replies either from users or developers.

Best regards,
Matic


On 31. 03. 2016 08:02, Matic Kisovec wrote:
> Dear Pymol users,
>
> a quick google search returned empty regarding the ability of Pymol to
> autosave the session at a specified time interval.
> The feature is available in different programs from text to vector
> editors etc.
> I would find it useful to have the ability to automatically save a
> couple of recent checkpoints while I am using Pymol.
>
> My question is if this would be interesting/useful for anybody and a
> question to the developers if this can be implemented?
>
> Best regards,
> Matic
>

<>--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
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