[IPython-User] More candidates in qtconsole auto-completion
Matthias BUSSONNIER
bussonniermatthias@gmail....
Fri Sep 21 05:52:02 CDT 2012
Le 21 sept. 2012 à 11:43, klo uo a écrit :
> On Fri, Sep 21, 2012 at 9:31 AM, Matthias BUSSONNIER wrote:
>
> Yes, it is hard coded, not related to the qtconsole size.
> You would have to update the width of the completion_widget when resizing windows for the number of columns.
> This should not be too hard, just to bind the correct signal.
> The number of rows could just be made a Trait to be configurable[*].
>
> One of the reason to keep a "low" number of column is that with ultra wide qtconsole navigation become a pain.
> For example, with 16 completions, with 4 by 4 any item is at Manhattan distance of less than 4 than any other, instead of 8 for 1x16
> But I guess the current behavior could be improved for sure.
>
> I looked in "completion_widget.py" but can't see anything that I can change.
> I expected that maybe number of rows (which is now 8) can be tweaked, as trying with columns sounds complicated.
That would be 'width' parameter of SlidingInterval constructor. In completion_**html**.py , and not 8 but 6 because 8 = 6+2*1 where 6 and 1 should configurable.
6 being always 6 shown rows.
2*1 being potential '…' on top and '…' on bottom that are "allowed" to be completion result when near the edges.
> I assure you that is would not be as you more easily see the differences when items are order vertically.
>
>
> =====================================
> api.getString api.getStrings
> =====================================
>
> vs
> =====================================
> api.getString
> api.getStrings
> =====================================
>
> especially for non native english readers.
>
> It would have been much more easier on implementation side to do so, but common shell like bash or zsh
> came across the same problem and decided to do it by column so I think this is the good choice.
>
> If auto-complete functions were sorted alphabetically by row we would have seen full 3 columns with 24 functions, while currently we see just 2 items in 3rd column (in posted qtconsole example). For me it's easier to read alphabetically sorted table by row in this case when table is clipped
No, because to do so the 3 colums would have been more than 80 characters wide.
Under the hood the colomnizer create the column to be sure it does not get wider than a give width.
and the visible items are not the only one taken into account.
as you can see here it's 86 chars width
====
api.AdaptToWordStr api.AllWordConfidences api.AnalyseLayout
api.Clear api.ClearAdaptiveClassifier api.DeleteBlockList
api.DetectOS api.DumpPGM api.End
api.FindLinesCreateBlockList api.FindRowForBox api.GetBlockTextOrientations
api.GetBoolVariable api.GetBoxText api.GetConnectedComponents
api.GetCubeRecoContext api.GetDawg api.GetDoubleVariable
api.GetFeaturesForBlob api.GetHOCRText api.GetInitLanguagesAsString
api.GetIntVariable api.GetIterator api.GetLoadedLanguagesAsVector
====
by row, colonize would have given you 2 columns.
===
api.AdaptToWordStr api.AllWordConfidences
api.AnalyseLayout api.Clear
api.ClearAdaptiveClassifier api.DeleteBlockList
api.DetectOS api.DumpPGM
api.End api.FindLinesCreateBlockList
api.FindRowForBox api.GetBlockTextOrientations
api.GetBoolVariable api.GetBoxText
api.GetConnectedComponents api.GetCubeRecoContext
api.GetDawg api.GetDoubleVariable
api.GetFeaturesForBlob api.GetHOCRText
api.GetInitLanguagesAsString api.GetIntVariable
api.GetIterator api.GetLoadedLanguagesAsVector
===
it is a tricky problem,
considering this :
====
aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbb ccc
aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbb ccc
aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbb
===
wanting to decrease the number of rows from 5 to 4 to fill the last column will give you this :
===
aaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbb bbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbb ccc
aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbb ccc
aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbb
===
so almost twice as wide.
>
>> as that's how cursor TAB interaction has been made.
>
> [...]
>
> Writing this was much more complicated to do than I first thought, but I'll be happy if you find a better solution than mine.
>
> I get you. I don't speak English too ;)
> It's tricky when you think more about it. If I look for a function I can't remember it's name I usually "know/suspect" the beginning and using TAB to move through available function which aren't alphabetically sorted is unintuitive for sure. But hey, I didn't know that arrow keys work, so that's good thing to know ;)
Yes, and one might want to also bing PgUP, PgDown, and shift tab...
>
>
> If you wan't to give a shot a making things configurable, or write your on completer-gui, take a look at
> ipython/IPython/frontend/qt/console/completion_html.py
> ipython/IPython/frontend/qt/console/console_widget.py : L96
>
>
> Yet another tip. That's great. I also didn't know about it.
> So plain mode is just like auto-completion in terminal console, while there is also drop-down control available!
yes, plain mode is just the old mode, and drop-down has been around for a while.
> Thanks again Matthias for your always insightful support
> Case closed
You can still try to make row number configurable.
And columns which adapt with window width.
And we are not forgetting qtconsole.
We jus want a more feature/protocol 'stable' notebook.
Ultimately it would be great to have a qtconsole that use QtWebkit instead of QRichText Widget
But that would be a huge re-write.
--
Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120921/b760c8c6/attachment-0001.html
More information about the IPython-User
mailing list