[Idle-dev] Small patch to AutoExpand.py

Guido van Rossum guido@python.org
Thu, 02 Mar 2000 10:00:36 -0500


> > [Guido]
> > By the way, there's a different distinction possible here.  Mark seems
> > to be fond of features like call-tips and attribute-tips that pop up
> > little yellow windows without asking.

[Markus Gritsch]

> I do too. Imagine you have an instance of a class which has, say
> about 30 set and corresponding 30 get methods. If you want to go
> thru all this attributes by pressing up to 60 times ALT-/ this would
> be annoying. In a attribute-tips pup up I can scroll thru the
> various attributes with cursor or pg-up and pg-down keys and can
> select on by typing RETURN or something.

What you would typically do is type a 2-3 letters and *then* hit
Alt-/.

...snip...
> and while having the cursor located after the b I press
> CTRL+SPC. Now a pup up is shown with all the possible completions
> for myOb, in this case only 'myObject' would be shown. By pressing
> enter the selected entry in the pup up window is choosen and the pup
> up is closed. By pressing TAB myOb would be comleted as much as
> possible, and the pup up stays.

It should be recomputed to show only the alternatives that are still
relevant.

> Now I type a point:
> 
> myObject.
> 
> The pop up now shows all the properties of the object FooClass, and if FooClass
> would be inherited from some other class, even the properties of the parent(s)
> would be shown. Again I can select and choose on by pressing RETURN (the pop up
> is closed), or I can complete as much as possible by pressing TAB (the pop up
> remains).
> 
> The important thing is, that the pup up only pops up when I explicitly press
> CTRL-SPC, or when I type a point after an object and wait some time. The pop up
> can be closed at any time by pressing ESC.

Aha!  The popup auto-pops *after a delay*.  That's an important user
interface improvement.  I think that that should also be implemented
for call-tips.  If I start typing right away after the (, I apparently
know what the args are.

> And word completion (ALT+/ in Emacs) is available *separately* by another
> key-combination. Word completion completes the word as much as possible, but
> without showing a pop up window.

Aha.  Just as I said.  I suppose it also uses less context?  Different
context?  Word completion should work in comments, in string literals,
and in places where the UI doesn't know the type of variable you are
dealing with.

> There is no difference between attribute-tip and call-tip. The arbument names are
> shown together with the attributes. In the example above something like
> 
> myObject.
>          +-----------------+
>          | barMethod()     |
>          | bazMethod(text) |
>          +-----------------+

But you can show more a detailed call-tip when you have selected a
method (ours shows the first line of the doc string if available).

--Guido van Rossum (home page: http://www.python.org/~guido/)