Re: Multiline editing in a qtconsole-style app
"Osborn, Raymond" <[email protected]>
| Newsgroups | gmane.comp.python.ipython.devel |
|---|---|
| Message-ID | <[email protected]> |
It occurs to me that I should mention that I’m using the inprocess kernel. I am wondering if the ‘is_complete’ request is trying to be sent to a real socket rather than the dummy socket that the inprocess client is using. Perhaps I have to reassign the blocking client it uses for such requests. Ray On Nov 29, 2015, at 8:47 AM, Ray Osborn <[email protected]<mailto:[email protected]>> wrote: Thanks for your reply. My inheritance chain includes the console_widget, so I have access to the _is_complete function, but it looks like I might have a different problem. I’ve been running this through my debugger again, and if I set ‘execute_on_complete_input’ to False, it doesn’t call the _is_complete function and assumes everything is complete. The shell then works apart from multiline editing. However, if I set ‘execute_on_complete_input’ to True (the default), then it calls the _is_complete function, sends an ‘is_complete’ request to the frontend, but never gets a reply. It calls the get_msg function in jupyiter_client/blocking/channels.py, but this always raises Empty. Sometimes the debugger causes timeout problems, but even when I remove all the breakpoints except for call to self._recv, it is never triggered, and this seems to explain why no lines in the shell are recorded as complete. I’ll see if I can reproduce this chain in the IPython qtconsole. Ray On Nov 29, 2015, at 6:22 AM, Thomas Kluyver <[email protected]<mailto:[email protected]>> wrote: Hi Ray, On 28 November 2015 at 21:08, Osborn, Raymond <[email protected]<mailto:[email protected]>> wrote: However, I only just noticed that we seem to have lost the ability to do multiline editing, without using the Ctrl key modifier. Even with the modifier, the indent is not correctly set, so the behavior has diverged from the ipython qtconsole, where multiline editing is automatic if the code is not complete and a proper indent is set. I think I know what you're running into. In previous versions of the Qt console, the frontend decided whether to prompt for another line and how much to indent it by processing the Python code that was typed in. As we've moved towards supporting multiple languages, it's not appropriate for the frontend to make that decision, so it has to ask the kernel about it. It does that by making is_complete_request to the kernel: http://jupyter-client.readthedocs.org/en/latest/messaging.html#code-completeness Assuming you're using the Qt console with an IPython kernel, it should still be straightforward to use that, but I guess it needs some changes in your integration code to make sure the message gets through. The widget object now has an is_complete method, which you can see here: https://github.com/jupyter/qtconsole/blob/f2c8a31c387ce1e020ccdbb020091de2ee98dbf9/qtconsole/frontend_widget.py#L260 Best wishes, Thomas _______________________________________________ IPython-dev mailing list [email protected]<mailto:[email protected]> https://mail.scipy.org/mailman/listinfo/ipython-dev -- Ray Osborn, Senior Scientist Materials Science Division Argonne National Laboratory Argonne, IL 60439, USA Phone: +1 (630) 252-9011 Email: [email protected]<mailto:[email protected]> -- Ray Osborn, Senior Scientist Materials Science Division Argonne National Laboratory Argonne, IL 60439, USA Phone: +1 (630) 252-9011 Email: [email protected]<mailto:[email protected]> _______________________________________________ IPython-dev mailing list [email protected] https://mail.scipy.org/mailman/listinfo/ipython-dev