Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new completer for qtconsole. #1851

Merged
merged 7 commits into from Jun 10, 2012
Merged

new completer for qtconsole. #1851

merged 7 commits into from Jun 10, 2012

Conversation

Carreau
Copy link
Member

@Carreau Carreau commented Jun 4, 2012

add a completer to the qtconsole that is navigable by arrows keys and
tab. One need to call it twice to get it on focus and be able to select
completion with Return. looks like zsh completer, not the gui drop down
list of --gui-completer.

This also try to split the completion logic from console_widget, and try
to keep the old completer qui around. The plain completer that never
takes focus back, and the QlistWidget completer.

to switch between the 3, the --gui-completion flag as been changed to
take an argument (plain, droplist, ncurses).

ipython qtconsole --gui-completion=ncurses
In[1]: r <tab> <tab> <tab> <down> <right> <right>

capture

As I'm not 100% sure of how the completion logic in the qtconsole works, i'd like you thought/testing on it.

@fperez
Copy link
Member

fperez commented Jun 4, 2012

My first instinct here is to say awesome! But I'd like the eyes of our Qt gurus, @jdmarch, @epatters, any opinion here?

@punchagan
Copy link
Contributor

It looks like a cool addition. I was just trying it out and --gui-completion=droplist crashes IPython with AttributeError: 'RichIPythonWidget' object has no attribute '_text_edit'. I can send you a full traceback, but it should be easy to reproduce.

@Carreau
Copy link
Member Author

Carreau commented Jun 5, 2012

Thanks, I'll fix that, I also still have to clean some code and deduplicate some other.

@Carreau
Copy link
Member Author

Carreau commented Jun 5, 2012

fix the --gui-completion=droplist ( already exist in master as just --gui-completion).
And also a bug where Ctrl+Gor esc wouldn't worked after invoking the completer.

@ellisonbg
Copy link
Member

I tested this out and functionally this is great. I really like it. The only glitch I saw is the following: when the list of completions is longer than the size of the terminal (from enthought.traits import api; api.<tab>), it works fine for the entries that show at the top. But for entries that you have to scroll down to reach, it doesn't work.

@Carreau
Copy link
Member Author

Carreau commented Jun 8, 2012

I'll take a look, or limit the number of completion.
I have a cleaner version that reuse more code, i'll push later.

@Carreau
Copy link
Member Author

Carreau commented Jun 8, 2012

rebased on top of #1875 to share more code with columnize. and limit the number of completion lines to 9.

@fperez
Copy link
Member

fperez commented Jun 9, 2012

Mmh, it seems to me in the last revision you forgot to add a file, perhaps?

With this branch, it simply doesn't start for me at all:

dreamweaver[junk]> ipython qtconsole
Traceback (most recent call last):
  File "/home/fperez/usr/bin/ipython", line 7, in <module>
    launch_new_instance()
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py", line 365, in launch_new_instance
    app.initialize()
  File "<string>", line 2, in initialize
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/config/application.py", line 84, in catch_config_error
    return method(app, *args, **kwargs)
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py", line 290, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<string>", line 2, in initialize
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/config/application.py", line 84, in catch_config_error
    return method(app, *args, **kwargs)
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/core/application.py", line 325, in initialize
    self.parse_command_line(argv)
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py", line 285, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<string>", line 2, in parse_command_line
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/config/application.py", line 84, in catch_config_error
    return method(app, *args, **kwargs)
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/config/application.py", line 420, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<string>", line 2, in initialize_subcommand
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/config/application.py", line 84, in catch_config_error
    return method(app, *args, **kwargs)
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/config/application.py", line 352, in initialize_subcommand
    subapp = import_item(subapp)
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/utils/importstring.py", line 40, in import_item
    module = __import__(package,fromlist=[obj])
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/frontend/qt/console/qtconsoleapp.py", line 63, in <module>
    from IPython.frontend.qt.console.frontend_widget import FrontendWidget
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py", line 22, in <module>
    from history_console_widget import HistoryConsoleWidget
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py", line 6, in <module>
    from console_widget import ConsoleWidget
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", line 26, in <module>
    from completion_plain import CompletionPlain
  File "/home/fperez/usr/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_plain.py", line 3, in <module>
    import IPython.utils.html_utils as html_utils
ImportError: No module named html_utils

@Carreau
Copy link
Member Author

Carreau commented Jun 9, 2012

Sorry, I think I was tired, I rebased a remote branch that I forgot to push from work, so many things were missing, and the .pyc files still present made it work at home...

Should be fixed now, It also allowed me to simplifie more things.

@fperez
Copy link
Member

fperez commented Jun 9, 2012

When the list of completions doesn't fit in a single group, there's no way to show the rest (and no indication there are more). How about putting at the end a 'more' entry that loads a new page? If a second page is loaded, then there should be a way to go back to the first.

Try it with import numpy as np, np.<tab>, you only see the first set...

fix test that where wrong, add some others.

fix ipython#1860
add a completer to the qtconsole that is navigable by arraow keys and
tab. One need to call it twice to get it on focus and be able to select
completion with Return. looks like zsh completer, not the gui drop down
list of --gui-completer.

This also try to split the completion logic from console_widget, and try
to keep the old completer qui around. The plain completer that never
takes focus back, and the QlistWidget completer.

to switch between the 3, the --gui-completion flag as been changed to
take an argument (plain, droplist, ncurses).
add a completer to the qtconsole that is navigable by arrows keys and
tab. One need to call it twice to get it on focus and be able to select
completion with Return. looks like zsh completer, not the gui drop down
list of --gui-completer.

This also try to split the completion logic from console_widget, and try
to keep the old completer qui around. The plain completer that never
takes focus back, and the QlistWidget completer.

to switch between the 3, the --gui-completion flag as been changed to
take an argument (plain, droplist, ncurses)

completer also autoscroll and show `...` when rows are hidden
@Carreau
Copy link
Member Author

Carreau commented Jun 10, 2012

how does this look like ?
cap
If you try to go up or down it scrolls. of course the ... disapears when at top or bottom...

I rebase and squash because the rebased on top of #1875 was painfull.

@ellisonbg
Copy link
Member

I like that alot!

On Sun, Jun 10, 2012 at 11:21 AM, Bussonnier Matthias
reply@reply.github.com
wrote:

how does this look like ?
cap
If you try to go up or down it scrolls. of course the ... disapears when at top or bottom...

I rebase and squash because the rebased on top of #1875 was painfull.


Reply to this email directly or view it on GitHub:
#1851 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@Carreau
Copy link
Member Author

Carreau commented Jun 10, 2012

Thanks, it took me several shot to have it right. If someone want to modifie to add PgUp/PgDown, go ahead, I just need a break from this one for a few days, and i'm not ready to try to make it work 'as you type', but it should be doable.
We can keep this for SciPy sprint.

@fperez
Copy link
Member

fperez commented Jun 10, 2012

Beautiful!! You've done a terrific job here, and I commend you for it. Many thanks for your patience with all my minute requirements.

I'm going to merge this now, as it's really a great improvement, to reduce the chance of conflicts. We can always do another round of improvements on it later from master.

Thanks again for your great work!

fperez added a commit that referenced this pull request Jun 10, 2012
New completer for qtconsole with rich keyboard navigation during completion search.

add a completer to the qtconsole that is navigable by arrows keys and
tab. One need to call it twice to get it on focus and be able to select
completion with Return. looks like zsh completer, not the gui drop down
list of --gui-completer.

This also try to split the completion logic from console_widget, and try to keep the old completer qui around. The plain completer that never takes focus back, and the QlistWidget completer.

To switch between the 3, the --gui-completion flag as been changed to take an argument (plain, droplist, ncurses):

ipython qtconsole --gui-completion=ncurses
@fperez fperez merged commit 45d28c5 into ipython:master Jun 10, 2012
@Carreau
Copy link
Member Author

Carreau commented Jun 10, 2012

It was really bugging me because I'm really used to it in zsh, so it is also really a relief for me to be able to tabs through completion.
I hope that it will be one of the many details that will make IPython aven more impressive at SciPy. BTW, i've been selected for the sponsorship, and I'm now waiting for the detail to prepare my trip. So I'll be there to give you a hand for the presentation :-)

See you there.

@fperez
Copy link
Member

fperez commented Jun 10, 2012

On Sun, Jun 10, 2012 at 1:27 PM, Bussonnier Matthias
reply@reply.github.com
wrote:

It was really bugging me because I'm really used to it in zsh, so it is also really a relief for me to be able to tabs through completion.
I hope that it will be one of the many details that will make IPython aven more impressive at SciPy. BTW, i've been selected for the sponsorship, and I'm now waiting for the detail to prepare my trip.  So I'll be there to give you a hand for the presentation :-)

This is fantastic news!!

See you there.

We look forward to meeting you. It's a bummer that Brian won't make
it this year, but Min will be there, and so will Stefan and several of
the Enthought contributors. I'm sure it will be both fun and
interesting. We'll start making sprint plans soon.

Cheers,

f

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
New completer for qtconsole with rich keyboard navigation during completion search.

add a completer to the qtconsole that is navigable by arrows keys and
tab. One need to call it twice to get it on focus and be able to select
completion with Return. looks like zsh completer, not the gui drop down
list of --gui-completer.

This also try to split the completion logic from console_widget, and try to keep the old completer qui around. The plain completer that never takes focus back, and the QlistWidget completer.

To switch between the 3, the --gui-completion flag as been changed to take an argument (plain, droplist, ncurses):

ipython qtconsole --gui-completion=ncurses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants