add qt config option to clear_on_kernel_restart#1681
Conversation
|
I could use feedback if I should go ahead and remove the messagebox logic on after line 522 to also use this new option. |
|
No time to review right now (gotta catch a flight early tomorrow, will be offline for a bit), but I wanted to say thank you for this. I've been wanting this for a long time. |
Previously, restarting a kernel in the qtconsole always cleared the
entire session. Since qtconsole has a %clear command, it makes sense to
allow users to decouple the two activities - the restarting of kernels,
and clearing the console. This commit adds a configuration option which
allows for the restarting of kernels without losing console history. The
default value for clear_on_kernel_restart is set to True to stay
consistent with the way things worked before this functionality was
added.
To test, run:
ipython qtconsole --IPythonWidget.clear_on_kernel_restart=False
Here's what it looks like when the user restarts the kernel on In[3]:
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.dev -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
%guiref -> A brief reference about the graphical user interface.
In [1]: 0x42
Out[1]: 66
In [2]: 042
Out[2]: 34
In [3]: # restarting kernel...
#------------------------------------------
In [1]:
|
IIRC, we're using a rich text widget - is it easy to draw a proper horizontal line, rather than an ASCII art |
|
ok, now using html |
|
Thanks Paul, I've just tested, and I like the way it's looking now. |
|
Looks good to me. Any reason not to merge? |
|
@minrk, actually, yeah, hang on, found a minor problem with this |
I originally made a new method (reset_on_restart) to accommodate this new functionality, but it turns out I ended up needing to replicate almost everything that reset() already does inside this new method. In particular, reset_on_restart did not work properly when restarting a kernel that was in debug mode. Everything should now work, and we don't have another method to deal with.
|
ok @minrk and @takluyver - I think it's ready to merge again: I originally made a new method (reset_on_restart) to accommodate this Everything should now work, and we don't have another method to deal |
|
having second thoughts about calling the parameter |
|
clear seems most appropriate, since that's the switch you are flipping. |
|
I agree that Other than that, it looks good, and I think putting it inside the |
|
ok, thanks for being patient with me, guys. Renamed it to |
add qt config option to clear_on_kernel_restart. This allows for restarting kernels without clearing the qtconsole, while leaving a visible indication that the kernel has restarted.
|
Hi all, I am not sure if this is the best place for this comment, but I will try anyway: Are these 2 bugs (scrolling problem + no way to disable clear_on_kernel_restart) windows related and is there a way to solve them? I use the pythonxy distribution and these problems have been appearing on all the computers I have tried so far. Thanks for your help, |
|
Hi Samuel - it looks like the code to check that option was taken out somewhere along the line. If you can work out where it should be checked, please make a pull request to do so. |
|
Hi Thomas, Thanks for the quick reply, I have been looking around in the code, especially in |
|
It certainly looks like sticking |
add qt config option to clear_on_kernel_restart. This allows for restarting kernels without clearing the qtconsole, while leaving a visible indication that the kernel has restarted.
Previously, restarting a kernel in the qtconsole always cleared the
entire session. Since qtconsole has a %clear command, it makes sense to
allow users to decouple the two activities - the restarting of kernels,
and clearing the console. This PR adds a configuration option which allows for the restarting of kernels without losing console history. The default value for
clear_on_kernel_restartis set to True to stay consistent with the way things worked before this functionality was added.To test, run:
Here's what it looks like when the user restarts the kernel on
In[3]: