pemsley/coot

Autocomplete/matching list of functions for python scripting interface

Opened this issue · 12 comments

Hi,

In 0.9x, when typing in the python scripting interface, a list of functions matching the entered strings appeared. It would be useful to have this feature also in 1.x (maybe enhanced to provide info on usage/arguments...?) as it makes on-the-fly scripting significantly easier.

Cheers
Oli

That is what should happen. Sigh. There should be a history too (that displays commands from your ".coot_python" file.

Jakub and I indeed have a plan for a proper python console.

(For some reason) you need to "import coot" first.
Then you should see completions after "coot.".
Use Ctrl-up-arrow to recall previous commands and up-arrow to navigate the completions.

Ah I see, it is there! They all just start with coot.whatever now - that is a change from the old version, got it

Hmm I spoke too soon... it worked the first time I tried it, but then subsequent times in the same session the panel comes up, but remains blank, even after import coot:

image

Another thing on this one - when the list of functions does appear, it is not scrollable (although it looks like it ought to be - there is a scrollbar), and items in the list cannot be clicked (though they can be selected using the arrow keys)

The scripting text entry box also overlaps with the lefthand panels (e.g. the overlaps panel), which is an issue because there doesn't seem to be a way to dismiss the scripting interface once activated.

image

EDIT: @pemsley this also breaks hotkeys... because the scripting interface has focus no matter what I do, hotkeys are registered as text entered in the scripting window...

"Escape" to dismiss the Python interface.

I tried that and it didn't work initially. Escape only works if the text cursor is in the scripting window - so if, for example, I'm manipulating the model, wanting to use hotkeys, and the scripting window is up, escape does nothing. This is not ideal, I think.

Focus is different now in GTK4. I don't know how it works. That's why, for the moment, there is a "Grab Focus" button which puts the focus of the keyboard back into the graphics widget.

Ah, ok, gotcha. Maybe for the meantime it would be better then if the scripting interface was in a separate window like in GTK3 or GTK2? That way it is more clear what has focus...?

FWIW, scrolling works for me with the arrow keys when the completion dialog is show.

To recall a previous command use Shift-Ctrl-UpArrow.

Yes, arrow keys work, but clicking the items in the list does not select them.

Sounds like the Quartz -> GTK events bug again.