This documentation is for an old version of IPython. You can find docs for newer versions here.
The Qt MainWindow for the QtConsole
This is a tabbed pseudo-terminal of IPython sessions, with a menu bar for common actions.
MainWindow(QWidget parent=None, Qt.WindowFlags flags=0)¶
__init__(app, confirm_exit=True, new_frontend_factory=None, slave_frontend_factory=None)¶
Create a tabbed MainWindow for managing IPython FrontendWidgets
app : reference to QApplication parent
confirm_exit : bool, optional
Whether we should prompt on close of tabs
new_frontend_factory : callable
A callable that returns a new IPythonWidget instance, attached to its own running kernel.
slave_frontend_factory : callable
A callable that takes an existing IPythonWidget, and returns a new IPythonWidget instance, attached to the same kernel.
Add action to menu as well as self
So that when the menu bar is invisible, its actions are still available.
If defer_shortcut is True, set the shortcut context to widget-only, where it will avoid conflict with shortcuts already bound to the widgets themselves.
insert a tab with a given frontend in the tab bar, and give it a name
Forward the close event to every tabs contained by the windows
Called when you need to try to close a tab.
It takes the number of the tab to be closed as argument, or a reference to the widget inside this tab
create a new frontend attached to the same kernel as the current tab
create a new frontend and attach it to a new tab
Try to return the frontend that owns the kernel attached to the given widget/tab.
Only finds frontend owned by the current application. Selection based on port of the kernel might be inaccurate if several kernel on different ip use same port number.
This function does the conversion tabNumber/widget if needed. Might return None if no master widget (non local kernel) Will crash IPython if more than 1 masterWidget
When asList set to True, always return a list of widget(s) owning the kernel. The list might be empty or containing several Widget.
return all the frontends that do not own the kernel attached to the given widget/tab.
Only find frontends owned by the current application. Selection based on connection file of the kernel.
This function does the conversion tabNumber/widget if needed.
constantly increasing counter for kernel IDs
update visibility of the tabBar depending of the number of tab
0 or 1 tab, tabBar hidden 2+ tabs, tabBar visible
send a self.close if number of tab ==0
need to be called explicitly, or be connected to tabInserted/tabRemoved