jupyter / qtconsole

Jupyter Qt Console
https://qtconsole.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
417 stars 200 forks source link

Custom banner #153

Open astrofrog opened 8 years ago

astrofrog commented 8 years ago

It used to be possible to customize the banner of RichIPythonWidget using something like:

class MyConsole(RichIPythonWidget):
    banner = 'Custom banner\n'

However, if I now do:

class MyConsole(RichJupyterWidget):
    banner = 'Custom banner\n'

control = MyConsole()
control.kernel_manager = kernel_manager
control.kernel_client = kernel_client
control.exit_requested.connect(stop)
control.show()

Then the output of the console is as follows:

screen shot 2016-10-15 at 18 29 20

If I add:

control._display_banner = False

Then no banner is shown at all. Is there a way to have a fully customized banner?

takluyver commented 8 years ago

The second part is coming from the kernel; I don't think there's a way to disable that.

You could override the reset() method, but that would involve a bit of copy-pasting. Maybe it makes sense to pull out a display_banner() method which you could more easily override.

astrofrog commented 8 years ago

@takluyver - thanks! Just to check, this has changed recently though, correct? (it used to be that what was assigned to the banner attribute was the last thing shown before the prompt).

takluyver commented 8 years ago

I'm not sure exactly when it changed, but probably at some point post big-split.