Using the map_molecule_chooser_gui(args) is probably the preferred choice here (thanks for mentioning it). Then you stay in the scripting (python) world and everything is fine. This however requires the use of pygtk which can be avoided when using the show_select_map_dialog() [*]

B

[*] Note that the previous post using idle_add and sleep requires gobject.... so not much better in that way.

(Python scripting option verendus est)

In python script, it appears that show_select_map_dialog simply shows
the dialog and quits.  I am trying to set up a method that would do
certain things depending on the choice of map.  So I use
show_select_map_dialog, but it appears that it does not wait until user
makes a choice there.  I tried to put a sleep cycle for 10 seconds that
would keep checking if map selection changed, but the dialog does not
show until the cycle is over.  Is there any way to show the dialog and
then wait for user to make selection?

Here is the version of the code that shows the dialog but then proceeds
further without waiting for selection

---
    show_select_map_dialog()
    imodel = (imol_refinement_map() - shknum)/2
    highlight_model(imodel)
---

Her is the code with sleep-cycle.  This one only shows the map selection
dialog after 10 seconds (something equivalent to yield function in wx is
needed)

---
    from time import sleep
    imap = imol_refinement_map()
    show_select_map_dialog()
    for i in range(10):
        if imap != imol_refinement_map():
            break
        sleep(1)
    imodel = (imol_refinement_map() - shknum)/2
    highlight_model(imodel)

---



Not sure what you'd like to achieve, but perhaps the
map_molecule_chooser_gui is what you are looking for.

Something along the lines:

map_molecule_chooser_gui("This is what I'll do to your map",
       lambda imol: my_map_manipulation_function(imol))

This brings up a map selector gui, the user selects the map, and you
do whatever you want with the imol picked up.

Other useful little widgets here:
http://www.biop.ox.ac.uk/coot/doc/coot.html#coot_002dgui


--
Coot verendus est


Indeed.


--
***************************************************

Dr. Bernhard Lohkamp
Assistant Professor
Div. Molecular Structural Biology
Dept. of Medical Biochemistry and Biophysics (MBB)
Karolinska Institutet
S-17177 Stockholm
Sweden

phone: (+46) 08-52487651
fax:   (+46) 08-327626
email: bernhard.lohk...@ki.se

Reply via email to